@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.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -6
- package/dist/index.mjs.map +1 -1
- package/dist/utils/deposit.d.ts.map +1 -1
- package/dist/utils/withdraw.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/utils/deposit.ts +7 -3
- package/src/utils/withdraw.ts +7 -3
package/dist/index.js
CHANGED
|
@@ -39628,7 +39628,11 @@ const prepareDepositProof = async ({ tx, amount, accountSecret, unspentUtxos, vo
|
|
|
39628
39628
|
keypair: vortexKeypair,
|
|
39629
39629
|
vortexPool: vortexObjectId,
|
|
39630
39630
|
});
|
|
39631
|
-
const nextIndex = await
|
|
39631
|
+
const [nextIndex, merklePath0, merklePath1] = await Promise.all([
|
|
39632
|
+
vortexSdk.nextIndex(vortexPool),
|
|
39633
|
+
getMerklePathFn(inputUtxo0),
|
|
39634
|
+
getMerklePathFn(inputUtxo1),
|
|
39635
|
+
]);
|
|
39632
39636
|
// Calculate output UTXO0 amount: if using unspent UTXOs, include their amounts
|
|
39633
39637
|
const outputUtxo0 = new Utxo({
|
|
39634
39638
|
amount: amount + inputUtxo0.amount + inputUtxo1.amount - relayerFee,
|
|
@@ -39657,8 +39661,8 @@ const prepareDepositProof = async ({ tx, amount, accountSecret, unspentUtxos, vo
|
|
|
39657
39661
|
vortexObjectId,
|
|
39658
39662
|
accountSecret,
|
|
39659
39663
|
root,
|
|
39660
|
-
merklePath0
|
|
39661
|
-
merklePath1
|
|
39664
|
+
merklePath0,
|
|
39665
|
+
merklePath1,
|
|
39662
39666
|
publicAmount: amount - relayerFee,
|
|
39663
39667
|
nullifier0,
|
|
39664
39668
|
nullifier1,
|
|
@@ -39752,7 +39756,11 @@ const prepareWithdraw = async ({ tx = new Transaction(), amount, unspentUtxos =
|
|
|
39752
39756
|
});
|
|
39753
39757
|
const totalWithdrawAmount = inputUtxo0.amount + inputUtxo1.amount;
|
|
39754
39758
|
const changeAmount = totalWithdrawAmount - amount;
|
|
39755
|
-
const nextIndex = await
|
|
39759
|
+
const [nextIndex, merklePath0, merklePath1] = await Promise.all([
|
|
39760
|
+
vortexSdk.nextIndex(vortexPool),
|
|
39761
|
+
getMerklePathFn(inputUtxo0),
|
|
39762
|
+
getMerklePathFn(inputUtxo1),
|
|
39763
|
+
]);
|
|
39756
39764
|
const outputUtxo0 = new Utxo({
|
|
39757
39765
|
amount: changeAmount,
|
|
39758
39766
|
index: nextIndex,
|
|
@@ -39781,8 +39789,8 @@ const prepareWithdraw = async ({ tx = new Transaction(), amount, unspentUtxos =
|
|
|
39781
39789
|
vortexObjectId,
|
|
39782
39790
|
accountSecret,
|
|
39783
39791
|
root,
|
|
39784
|
-
merklePath0
|
|
39785
|
-
merklePath1
|
|
39792
|
+
merklePath0,
|
|
39793
|
+
merklePath1,
|
|
39786
39794
|
publicAmount: BN254_FIELD_MODULUS - amount,
|
|
39787
39795
|
nullifier0,
|
|
39788
39796
|
nullifier1,
|