@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.
@@ -1 +1 @@
1
- {"version":3,"file":"deposit.d.ts","sourceRoot":"","sources":["../../src/utils/deposit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,EAAiB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,UAAU,uBAAuB;IAC/B,EAAE,EAAE,WAAW,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,IAAI,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,iBAAiB,CAAC;IACjC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,eAAe,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,mBAAmB,GAAU,gIAYvC,uBAAuB;;;;;;;;EA2HzB,CAAC"}
1
+ {"version":3,"file":"deposit.d.ts","sourceRoot":"","sources":["../../src/utils/deposit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,EAAiB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,MAA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O,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,GAAU,2IAanC,mBAAmB;;;;;EA6HrB,CAAC"}
1
+ {"version":3,"file":"withdraw.d.ts","sourceRoot":"","sources":["../../src/utils/withdraw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASpD,OAAO,EAAiB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,UAAU,mBAAmB;IAC3B,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,IAAI,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,GAAG,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,GAAU,2IAanC,mBAAmB;;;;;EAiIrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interest-protocol/vortex-sdk",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "./dist/index.mjs",
@@ -37,8 +37,8 @@
37
37
  "rimraf": "^6.0.1",
38
38
  "ts-jest": "^29.1.1",
39
39
  "tsup": "^8.3.5",
40
- "@interest-protocol/typescript-config": "1.0.0",
41
- "@interest-protocol/prettier-config": "1.0.0"
40
+ "@interest-protocol/prettier-config": "1.0.0",
41
+ "@interest-protocol/typescript-config": "1.0.0"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public",
@@ -67,7 +67,11 @@ export const prepareDepositProof = async ({
67
67
  vortexPool: vortexObjectId,
68
68
  });
69
69
 
70
- const nextIndex = await vortexSdk.nextIndex(vortexPool);
70
+ const [nextIndex, merklePath0, merklePath1] = await Promise.all([
71
+ vortexSdk.nextIndex(vortexPool),
72
+ getMerklePathFn(inputUtxo0),
73
+ getMerklePathFn(inputUtxo1),
74
+ ]);
71
75
 
72
76
  // Calculate output UTXO0 amount: if using unspent UTXOs, include their amounts
73
77
  const outputUtxo0 = new Utxo({
@@ -108,8 +112,8 @@ export const prepareDepositProof = async ({
108
112
  vortexObjectId,
109
113
  accountSecret,
110
114
  root,
111
- merklePath0: await getMerklePathFn(inputUtxo0),
112
- merklePath1: await getMerklePathFn(inputUtxo1),
115
+ merklePath0,
116
+ merklePath1,
113
117
  publicAmount: amount - relayerFee,
114
118
  nullifier0,
115
119
  nullifier1,
@@ -74,7 +74,11 @@ export const prepareWithdraw = async ({
74
74
 
75
75
  const changeAmount = totalWithdrawAmount - amount;
76
76
 
77
- const nextIndex = await vortexSdk.nextIndex(vortexPool);
77
+ const [nextIndex, merklePath0, merklePath1] = await Promise.all([
78
+ vortexSdk.nextIndex(vortexPool),
79
+ getMerklePathFn(inputUtxo0),
80
+ getMerklePathFn(inputUtxo1),
81
+ ]);
78
82
 
79
83
  const outputUtxo0 = new Utxo({
80
84
  amount: changeAmount,
@@ -115,8 +119,8 @@ export const prepareWithdraw = async ({
115
119
  vortexObjectId,
116
120
  accountSecret,
117
121
  root,
118
- merklePath0: await getMerklePathFn(inputUtxo0),
119
- merklePath1: await getMerklePathFn(inputUtxo1),
122
+ merklePath0,
123
+ merklePath1,
120
124
  publicAmount: BN254_FIELD_MODULUS - amount,
121
125
  nullifier0,
122
126
  nullifier1,