@interest-protocol/vortex-sdk 8.2.0 → 8.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.
@@ -22,31 +22,31 @@ interface ToProveInputArgs {
22
22
  accountSecret: bigint;
23
23
  }
24
24
  export declare const toProveInput: ({ root, merklePath0, merklePath1, publicAmount, nullifier0, nullifier1, commitment0, commitment1, vortexKeypair, inputUtxo0, inputUtxo1, outputUtxo0, outputUtxo1, vortexObjectId, accountSecret, }: ToProveInputArgs) => {
25
- vortex: bigint;
26
- root: bigint;
27
- publicAmount: bigint;
28
- inputNullifier0: bigint;
29
- inputNullifier1: bigint;
30
- outputCommitment0: bigint;
31
- outputCommitment1: bigint;
32
- hashedAccountSecret: bigint;
33
- accountSecret: bigint;
25
+ vortex: string;
26
+ root: string;
27
+ publicAmount: string;
28
+ inputNullifier0: string;
29
+ inputNullifier1: string;
30
+ outputCommitment0: string;
31
+ outputCommitment1: string;
32
+ hashedAccountSecret: string;
33
+ accountSecret: string;
34
34
  inPrivateKey0: bigint;
35
35
  inPrivateKey1: bigint;
36
- inAmount0: bigint;
37
- inAmount1: bigint;
38
- inBlinding0: bigint;
39
- inBlinding1: bigint;
40
- inPathIndex0: bigint;
41
- inPathIndex1: bigint;
36
+ inAmount0: string;
37
+ inAmount1: string;
38
+ inBlinding0: string;
39
+ inBlinding1: string;
40
+ inPathIndex0: string;
41
+ inPathIndex1: string;
42
42
  merklePath0: MerklePath;
43
43
  merklePath1: MerklePath;
44
44
  outPublicKey0: string;
45
45
  outPublicKey1: string;
46
- outAmount0: bigint;
47
- outAmount1: bigint;
48
- outBlinding0: bigint;
49
- outBlinding1: bigint;
46
+ outAmount0: string;
47
+ outAmount1: string;
48
+ outBlinding0: string;
49
+ outBlinding1: string;
50
50
  };
51
51
  export declare const parseVortexPool: (data: SuiObjectData) => {
52
52
  objectId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../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M,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,GAAU,0HAWnC,mBAAmB;;;;;EAqIrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interest-protocol/vortex-sdk",
3
- "version": "8.2.0",
3
+ "version": "8.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",
@@ -119,36 +119,38 @@ export const toProveInput = ({
119
119
  accountSecret,
120
120
  }: ToProveInputArgs) => {
121
121
  return {
122
- vortex:
122
+ vortex: (
123
123
  BigInt(
124
124
  normalizeSuiAddress(vortexObjectId, !vortexObjectId.startsWith('0x'))
125
- ) % BN254_FIELD_MODULUS,
126
- root,
127
- publicAmount,
128
- inputNullifier0: nullifier0,
129
- inputNullifier1: nullifier1,
130
- outputCommitment0: commitment0,
131
- outputCommitment1: commitment1,
132
- hashedAccountSecret: accountSecret === 0n ? 0n : poseidon1(accountSecret),
133
-
134
- accountSecret: accountSecret === 0n ? 12345n : accountSecret,
125
+ ) % BN254_FIELD_MODULUS
126
+ ).toString(),
127
+ root: root.toString(),
128
+ publicAmount: publicAmount.toString(),
129
+ inputNullifier0: nullifier0.toString(),
130
+ inputNullifier1: nullifier1.toString(),
131
+ outputCommitment0: commitment0.toString(),
132
+ outputCommitment1: commitment1.toString(),
133
+ hashedAccountSecret:
134
+ accountSecret === 0n ? '0' : poseidon1(accountSecret).toString(),
135
+
136
+ accountSecret: accountSecret === 0n ? '12345' : accountSecret.toString(),
135
137
  inPrivateKey0: vortexKeypair.privateKey,
136
138
  inPrivateKey1: vortexKeypair.privateKey,
137
- inAmount0: inputUtxo0.amount,
138
- inAmount1: inputUtxo1.amount,
139
- inBlinding0: inputUtxo0.blinding,
140
- inBlinding1: inputUtxo1.blinding,
141
- inPathIndex0: inputUtxo0.index,
142
- inPathIndex1: inputUtxo1.index,
139
+ inAmount0: inputUtxo0.amount.toString(),
140
+ inAmount1: inputUtxo1.amount.toString(),
141
+ inBlinding0: inputUtxo0.blinding.toString(),
142
+ inBlinding1: inputUtxo1.blinding.toString(),
143
+ inPathIndex0: inputUtxo0.index.toString(),
144
+ inPathIndex1: inputUtxo1.index.toString(),
143
145
  merklePath0,
144
146
  merklePath1,
145
147
 
146
148
  outPublicKey0: vortexKeypair.publicKey,
147
149
  outPublicKey1: vortexKeypair.publicKey,
148
- outAmount0: outputUtxo0.amount,
149
- outAmount1: outputUtxo1.amount,
150
- outBlinding0: outputUtxo0.blinding,
151
- outBlinding1: outputUtxo1.blinding,
150
+ outAmount0: outputUtxo0.amount.toString(),
151
+ outAmount1: outputUtxo1.amount.toString(),
152
+ outBlinding0: outputUtxo0.blinding.toString(),
153
+ outBlinding1: outputUtxo1.blinding.toString(),
152
154
  };
153
155
  };
154
156
 
@@ -133,7 +133,10 @@ export const prepareWithdraw = async ({
133
133
 
134
134
  const proof: Proof = JSON.parse(proofJson);
135
135
 
136
- invariant(vortexSdk.verify(proofJson, VERIFYING_KEY), 'Proof verification failed');
136
+ invariant(
137
+ vortexSdk.verify(proofJson, VERIFYING_KEY),
138
+ 'Proof verification failed'
139
+ );
137
140
 
138
141
  const { extData, tx: tx2 } = vortexSdk.newExtData({
139
142
  tx,