@interest-protocol/vortex-sdk 6.1.0 → 6.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/entities/merkle-tree.d.ts +3 -1
- package/dist/entities/merkle-tree.d.ts.map +1 -1
- package/dist/entities/utxo.d.ts +7 -0
- package/dist/entities/utxo.d.ts.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/entities/merkle-tree.ts +12 -3
- package/src/entities/utxo.ts +28 -8
package/dist/index.mjs
CHANGED
|
@@ -39184,11 +39184,19 @@ class Utxo {
|
|
|
39184
39184
|
this.index = index ?? 0n;
|
|
39185
39185
|
this.vortexPool = vortexPool;
|
|
39186
39186
|
}
|
|
39187
|
+
static makeCommitment({ amount, publicKey, blinding, vortexPool, }) {
|
|
39188
|
+
return poseidon4(amount, BigInt(publicKey), blinding, BigInt(normalizeSuiAddress(vortexPool, !vortexPool.startsWith('0x'))));
|
|
39189
|
+
}
|
|
39187
39190
|
static blinding() {
|
|
39188
39191
|
return BigInt(Math.floor(Math.random() * 1000000000));
|
|
39189
39192
|
}
|
|
39190
39193
|
commitment() {
|
|
39191
|
-
return
|
|
39194
|
+
return Utxo.makeCommitment({
|
|
39195
|
+
amount: this.amount,
|
|
39196
|
+
publicKey: this.keypair.publicKey,
|
|
39197
|
+
blinding: this.blinding,
|
|
39198
|
+
vortexPool: this.vortexPool,
|
|
39199
|
+
});
|
|
39192
39200
|
}
|
|
39193
39201
|
nullifier() {
|
|
39194
39202
|
const commitment = this.commitment();
|
|
@@ -39634,10 +39642,12 @@ const vortexSDK = new Vortex({
|
|
|
39634
39642
|
});
|
|
39635
39643
|
|
|
39636
39644
|
// packages/vortex/src/entities/merkle-tree.ts
|
|
39645
|
+
const merkleTreeHashFunction = (left, right) => poseidon2(BigInt(left), BigInt(right)).toString();
|
|
39637
39646
|
const buildMerkleTree = (elements = []) => new MerkleTree(MERKLE_TREE_HEIGHT, elements, {
|
|
39638
|
-
hashFunction:
|
|
39647
|
+
hashFunction: merkleTreeHashFunction,
|
|
39639
39648
|
zeroElement: ZERO_VALUE.toString(),
|
|
39640
39649
|
});
|
|
39650
|
+
const deserializeMerkleTree = (data) => MerkleTree.deserialize(data, merkleTreeHashFunction);
|
|
39641
39651
|
|
|
39642
39652
|
const prepareDepositProof = async ({ tx, amount, accountSecret, unspentUtxos, vortexSdk, vortexKeypair, vortexPool, root, getMerklePathFn, relayer, relayerFee, }) => {
|
|
39643
39653
|
const vortexObjectId = typeof vortexPool === 'string' ? vortexPool : vortexPool.objectId;
|
|
@@ -39993,5 +40003,5 @@ const finishSwap = async ({ tx = new Transaction(), amount, vortexSdk, vortexPoo
|
|
|
39993
40003
|
});
|
|
39994
40004
|
};
|
|
39995
40005
|
|
|
39996
|
-
export { Action, BASIS_POINTS, BN254_FIELD_MODULUS, DEPOSIT_FEE_IN_BASIS_POINTS, EMPTY_COMMITMENT, EMPTY_SUBTREE_HASHES, ERROR_CODES, INITIAL_SHARED_VERSION, LSK_ENCRYPTED_OUTPUTS, LSK_FETCH_OFFSET, MERKLE_TREE_HEIGHT, Modules, OPT, REGISTRY_OBJECT_ID, ROOT_HISTORY_SIZE, TREASURY_ADDRESS, Utxo, VORTEX_PACKAGE_ID, VORTEX_POOL_IDS, VORTEX_SIGNATURE_DOMAIN, VORTEX_SWAP_PACKAGE_ID, VORTEX_SWAP_UPGRADE_CAP, VORTEX_UPGRADE_CAP, Vortex, VortexKeypair, ZERO_VALUE, buildMerkleTree, deposit, depositWithAccount, finishSwap, getMerklePath, getUnspentUtxos, parseNewCommitmentEvent, parseVortexPool, poseidon1, poseidon2, poseidon3, poseidon4, prove, startSwap, toProveInput, verify, vortexSDK, withdraw, withdrawWithAccount };
|
|
40006
|
+
export { Action, BASIS_POINTS, BN254_FIELD_MODULUS, DEPOSIT_FEE_IN_BASIS_POINTS, EMPTY_COMMITMENT, EMPTY_SUBTREE_HASHES, ERROR_CODES, INITIAL_SHARED_VERSION, LSK_ENCRYPTED_OUTPUTS, LSK_FETCH_OFFSET, MERKLE_TREE_HEIGHT, Modules, OPT, REGISTRY_OBJECT_ID, ROOT_HISTORY_SIZE, TREASURY_ADDRESS, Utxo, VORTEX_PACKAGE_ID, VORTEX_POOL_IDS, VORTEX_SIGNATURE_DOMAIN, VORTEX_SWAP_PACKAGE_ID, VORTEX_SWAP_UPGRADE_CAP, VORTEX_UPGRADE_CAP, Vortex, VortexKeypair, ZERO_VALUE, buildMerkleTree, deposit, depositWithAccount, deserializeMerkleTree, finishSwap, getMerklePath, getUnspentUtxos, merkleTreeHashFunction, parseNewCommitmentEvent, parseVortexPool, poseidon1, poseidon2, poseidon3, poseidon4, prove, startSwap, toProveInput, verify, vortexSDK, withdraw, withdrawWithAccount };
|
|
39997
40007
|
//# sourceMappingURL=index.mjs.map
|