You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
698 B

  1. const wc = require("./witness_calculator.js");
  2. const { readFileSync, writeFile } = require("fs");
  3. if (process.argv.length != 5) {
  4. console.log("Usage: node generate_witness.js <file.wasm> <input.json> <output.wtns>");
  5. } else {
  6. const input = JSON.parse(readFileSync(process.argv[3], "utf8"));
  7. const buffer = readFileSync(process.argv[2]);
  8. wc(buffer).then(async witnessCalculator => {
  9. // const w= await witnessCalculator.calculateWitness(input,0);
  10. // for (let i=0; i< w.length; i++){
  11. // console.log(w[i]);
  12. // }
  13. const buff= await witnessCalculator.calculateWTNSBin(input,0);
  14. writeFile(process.argv[4], buff, function(err) {
  15. if (err) throw err;
  16. });
  17. });
  18. }