@interest-protocol/vortex-sdk 4.2.0 → 4.3.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.mjs CHANGED
@@ -39626,7 +39626,11 @@ const prepareDepositProof = async ({ tx, amount, accountSecret, unspentUtxos, vo
39626
39626
  keypair: vortexKeypair,
39627
39627
  vortexPool: vortexObjectId,
39628
39628
  });
39629
- const nextIndex = await vortexSdk.nextIndex(vortexPool);
39629
+ const [nextIndex, merklePath0, merklePath1] = await Promise.all([
39630
+ vortexSdk.nextIndex(vortexPool),
39631
+ getMerklePathFn(inputUtxo0),
39632
+ getMerklePathFn(inputUtxo1),
39633
+ ]);
39630
39634
  // Calculate output UTXO0 amount: if using unspent UTXOs, include their amounts
39631
39635
  const outputUtxo0 = new Utxo({
39632
39636
  amount: amount + inputUtxo0.amount + inputUtxo1.amount - relayerFee,
@@ -39655,8 +39659,8 @@ const prepareDepositProof = async ({ tx, amount, accountSecret, unspentUtxos, vo
39655
39659
  vortexObjectId,
39656
39660
  accountSecret,
39657
39661
  root,
39658
- merklePath0: await getMerklePathFn(inputUtxo0),
39659
- merklePath1: await getMerklePathFn(inputUtxo1),
39662
+ merklePath0,
39663
+ merklePath1,
39660
39664
  publicAmount: amount - relayerFee,
39661
39665
  nullifier0,
39662
39666
  nullifier1,
@@ -39750,7 +39754,11 @@ const prepareWithdraw = async ({ tx = new Transaction(), amount, unspentUtxos =
39750
39754
  });
39751
39755
  const totalWithdrawAmount = inputUtxo0.amount + inputUtxo1.amount;
39752
39756
  const changeAmount = totalWithdrawAmount - amount;
39753
- const nextIndex = await vortexSdk.nextIndex(vortexPool);
39757
+ const [nextIndex, merklePath0, merklePath1] = await Promise.all([
39758
+ vortexSdk.nextIndex(vortexPool),
39759
+ getMerklePathFn(inputUtxo0),
39760
+ getMerklePathFn(inputUtxo1),
39761
+ ]);
39754
39762
  const outputUtxo0 = new Utxo({
39755
39763
  amount: changeAmount,
39756
39764
  index: nextIndex,
@@ -39779,8 +39787,8 @@ const prepareWithdraw = async ({ tx = new Transaction(), amount, unspentUtxos =
39779
39787
  vortexObjectId,
39780
39788
  accountSecret,
39781
39789
  root,
39782
- merklePath0: await getMerklePathFn(inputUtxo0),
39783
- merklePath1: await getMerklePathFn(inputUtxo1),
39790
+ merklePath0,
39791
+ merklePath1,
39784
39792
  publicAmount: BN254_FIELD_MODULUS - amount,
39785
39793
  nullifier0,
39786
39794
  nullifier1,