snarkjs-algorand 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4639,7 +4639,7 @@ async function getLagrangeWitness(proof, signals, algorand, vkBytes, rootOfUnity
4639
4639
  return LagrangeWitnessFromTuple(retVal);
4640
4640
  }
4641
4641
  var LsigVerifier = class {
4642
- constructor(algorand, zKey2, wasmProver, totalLsigs) {
4642
+ constructor(algorand, zKey2, wasmProver, totalLsigs = 6) {
4643
4643
  this.algorand = algorand;
4644
4644
  this.zKey = zKey2;
4645
4645
  this.wasmProver = wasmProver;
@@ -4690,7 +4690,12 @@ var LsigVerifier = class {
4690
4690
  );
4691
4691
  return this.algorand.account.logicsig(compilation.compiledBase64ToBytes);
4692
4692
  }
4693
- async verificationParams(inputs) {
4693
+ async verificationParams({
4694
+ inputs,
4695
+ composer,
4696
+ paramsCallback,
4697
+ addExtraLsigs = true
4698
+ }) {
4694
4699
  const { proof, signals, lw } = await this.proofAndSignals(inputs);
4695
4700
  const params = {
4696
4701
  appParams: {
@@ -4698,7 +4703,7 @@ var LsigVerifier = class {
4698
4703
  staticFee: (0, import_algokit_utils.microAlgos)(0),
4699
4704
  args: { signals, proof, lw }
4700
4705
  },
4701
- lsigFees: (0, import_algokit_utils.microAlgos)(1e3 * this.totalLsigs),
4706
+ lsigsFee: (0, import_algokit_utils.microAlgos)(1e3 * this.totalLsigs),
4702
4707
  extraLsigsTxns: []
4703
4708
  };
4704
4709
  const compilation = await this.algorand.app.compileTeal(
@@ -4707,6 +4712,7 @@ var LsigVerifier = class {
4707
4712
  const extraLsig = this.algorand.account.logicsig(
4708
4713
  compilation.compiledBase64ToBytes
4709
4714
  );
4715
+ await paramsCallback(params);
4710
4716
  for (let i = 0; i < this.totalLsigs - 1; i++) {
4711
4717
  const lsigPay = await this.algorand.createTransaction.payment({
4712
4718
  sender: extraLsig,
@@ -4716,8 +4722,10 @@ var LsigVerifier = class {
4716
4722
  note: `Extra lsig ${i + 1} of ${this.totalLsigs - 1}`
4717
4723
  });
4718
4724
  params.extraLsigsTxns.push(lsigPay);
4725
+ if (addExtraLsigs) {
4726
+ composer.addTransaction(lsigPay);
4727
+ }
4719
4728
  }
4720
- return params;
4721
4729
  }
4722
4730
  };
4723
4731
  var AppVerifier = class {
package/dist/index.d.cts CHANGED
@@ -1380,25 +1380,32 @@ declare class LsigVerifier {
1380
1380
  wasmProver: snarkjs.ZKArtifact;
1381
1381
  totalLsigs: number;
1382
1382
  curve?: any;
1383
- constructor(algorand: AlgorandClient$1, zKey: snarkjs.ZKArtifact, wasmProver: snarkjs.ZKArtifact, totalLsigs: number);
1383
+ constructor(algorand: AlgorandClient$1, zKey: snarkjs.ZKArtifact, wasmProver: snarkjs.ZKArtifact, totalLsigs?: number);
1384
1384
  private ensureCurveInstanttiation;
1385
1385
  proofAndSignals(inputs: snarkjs.CircuitSignals): Promise<Witness>;
1386
1386
  lsigAccount(): Promise<algosdk__default.Address & _algorandfoundation_algokit_utils_types_account.TransactionSignerAccount & {
1387
1387
  account: algosdk__default.LogicSigAccount;
1388
1388
  }>;
1389
- verificationParams(inputs: snarkjs.CircuitSignals): Promise<{
1390
- appParams: {
1391
- sender: Address;
1392
- staticFee: AlgoAmount;
1393
- args: {
1394
- signals: bigint[];
1395
- proof: Proof$3;
1396
- lw: LagrangeWitness$1;
1397
- };
1389
+ verificationParams({ inputs, composer, paramsCallback, addExtraLsigs, }: {
1390
+ inputs: snarkjs.CircuitSignals;
1391
+ composer: {
1392
+ addTransaction: (txn: Transaction) => unknown;
1398
1393
  };
1399
- lsigFees: AlgoAmount;
1400
- extraLsigsTxns: Transaction[];
1401
- }>;
1394
+ addExtraLsigs?: boolean;
1395
+ paramsCallback: (params: {
1396
+ appParams: {
1397
+ sender: Address;
1398
+ staticFee: AlgoAmount;
1399
+ args: {
1400
+ signals: bigint[];
1401
+ proof: Proof$3;
1402
+ lw: LagrangeWitness$1;
1403
+ };
1404
+ };
1405
+ lsigsFee: AlgoAmount;
1406
+ extraLsigsTxns: Transaction[];
1407
+ }) => Promise<void>;
1408
+ }): Promise<void>;
1402
1409
  }
1403
1410
  declare class AppVerifier {
1404
1411
  algorand: AlgorandClient$1;
package/dist/index.d.ts CHANGED
@@ -1380,25 +1380,32 @@ declare class LsigVerifier {
1380
1380
  wasmProver: snarkjs.ZKArtifact;
1381
1381
  totalLsigs: number;
1382
1382
  curve?: any;
1383
- constructor(algorand: AlgorandClient$1, zKey: snarkjs.ZKArtifact, wasmProver: snarkjs.ZKArtifact, totalLsigs: number);
1383
+ constructor(algorand: AlgorandClient$1, zKey: snarkjs.ZKArtifact, wasmProver: snarkjs.ZKArtifact, totalLsigs?: number);
1384
1384
  private ensureCurveInstanttiation;
1385
1385
  proofAndSignals(inputs: snarkjs.CircuitSignals): Promise<Witness>;
1386
1386
  lsigAccount(): Promise<algosdk__default.Address & _algorandfoundation_algokit_utils_types_account.TransactionSignerAccount & {
1387
1387
  account: algosdk__default.LogicSigAccount;
1388
1388
  }>;
1389
- verificationParams(inputs: snarkjs.CircuitSignals): Promise<{
1390
- appParams: {
1391
- sender: Address;
1392
- staticFee: AlgoAmount;
1393
- args: {
1394
- signals: bigint[];
1395
- proof: Proof$3;
1396
- lw: LagrangeWitness$1;
1397
- };
1389
+ verificationParams({ inputs, composer, paramsCallback, addExtraLsigs, }: {
1390
+ inputs: snarkjs.CircuitSignals;
1391
+ composer: {
1392
+ addTransaction: (txn: Transaction) => unknown;
1398
1393
  };
1399
- lsigFees: AlgoAmount;
1400
- extraLsigsTxns: Transaction[];
1401
- }>;
1394
+ addExtraLsigs?: boolean;
1395
+ paramsCallback: (params: {
1396
+ appParams: {
1397
+ sender: Address;
1398
+ staticFee: AlgoAmount;
1399
+ args: {
1400
+ signals: bigint[];
1401
+ proof: Proof$3;
1402
+ lw: LagrangeWitness$1;
1403
+ };
1404
+ };
1405
+ lsigsFee: AlgoAmount;
1406
+ extraLsigsTxns: Transaction[];
1407
+ }) => Promise<void>;
1408
+ }): Promise<void>;
1402
1409
  }
1403
1410
  declare class AppVerifier {
1404
1411
  algorand: AlgorandClient$1;
package/dist/index.js CHANGED
@@ -4605,7 +4605,7 @@ async function getLagrangeWitness(proof, signals, algorand, vkBytes, rootOfUnity
4605
4605
  return LagrangeWitnessFromTuple(retVal);
4606
4606
  }
4607
4607
  var LsigVerifier = class {
4608
- constructor(algorand, zKey2, wasmProver, totalLsigs) {
4608
+ constructor(algorand, zKey2, wasmProver, totalLsigs = 6) {
4609
4609
  this.algorand = algorand;
4610
4610
  this.zKey = zKey2;
4611
4611
  this.wasmProver = wasmProver;
@@ -4656,7 +4656,12 @@ var LsigVerifier = class {
4656
4656
  );
4657
4657
  return this.algorand.account.logicsig(compilation.compiledBase64ToBytes);
4658
4658
  }
4659
- async verificationParams(inputs) {
4659
+ async verificationParams({
4660
+ inputs,
4661
+ composer,
4662
+ paramsCallback,
4663
+ addExtraLsigs = true
4664
+ }) {
4660
4665
  const { proof, signals, lw } = await this.proofAndSignals(inputs);
4661
4666
  const params = {
4662
4667
  appParams: {
@@ -4664,7 +4669,7 @@ var LsigVerifier = class {
4664
4669
  staticFee: microAlgos(0),
4665
4670
  args: { signals, proof, lw }
4666
4671
  },
4667
- lsigFees: microAlgos(1e3 * this.totalLsigs),
4672
+ lsigsFee: microAlgos(1e3 * this.totalLsigs),
4668
4673
  extraLsigsTxns: []
4669
4674
  };
4670
4675
  const compilation = await this.algorand.app.compileTeal(
@@ -4673,6 +4678,7 @@ var LsigVerifier = class {
4673
4678
  const extraLsig = this.algorand.account.logicsig(
4674
4679
  compilation.compiledBase64ToBytes
4675
4680
  );
4681
+ await paramsCallback(params);
4676
4682
  for (let i = 0; i < this.totalLsigs - 1; i++) {
4677
4683
  const lsigPay = await this.algorand.createTransaction.payment({
4678
4684
  sender: extraLsig,
@@ -4682,8 +4688,10 @@ var LsigVerifier = class {
4682
4688
  note: `Extra lsig ${i + 1} of ${this.totalLsigs - 1}`
4683
4689
  });
4684
4690
  params.extraLsigsTxns.push(lsigPay);
4691
+ if (addExtraLsigs) {
4692
+ composer.addTransaction(lsigPay);
4693
+ }
4685
4694
  }
4686
- return params;
4687
4695
  }
4688
4696
  };
4689
4697
  var AppVerifier = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snarkjs-algorand",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",