@interest-protocol/vortex-sdk 9.0.1 → 11.0.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/__tests__/test-utils.d.ts +1 -0
- package/dist/__tests__/test-utils.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.js +68 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -4
- package/dist/index.mjs.map +1 -1
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/vortex-api.d.ts +3 -2
- package/dist/vortex-api.d.ts.map +1 -1
- package/dist/vortex-api.types.d.ts +16 -0
- package/dist/vortex-api.types.d.ts.map +1 -1
- package/dist/vortex.d.ts +17 -2
- package/dist/vortex.d.ts.map +1 -1
- package/dist/vortex.types.d.ts +7 -0
- package/dist/vortex.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/test-utils.ts +4 -0
- package/src/constants.ts +3 -0
- package/src/utils/index.ts +17 -0
- package/src/vortex-api.ts +31 -2
- package/src/vortex-api.types.ts +19 -0
- package/src/vortex.ts +57 -1
- package/src/vortex.types.ts +9 -0
package/dist/index.mjs
CHANGED
|
@@ -3374,6 +3374,7 @@ const VORTEX_UPGRADE_CAP = '0xc2d1925fd45559e09c51f5491ec96d61f9e9108c967d34fe22
|
|
|
3374
3374
|
const REGISTRY_OBJECT_ID = '0xf2c11c297e0581e0279714f6ba47e26d03d9a70756036fab5882ebc0f1d2b3b1';
|
|
3375
3375
|
const VORTEX_SWAP_PACKAGE_ID = '0x2ddd33debbac3e0461b3551bb00bd40d3055ea5cd441b4fad8624dcbb095e8fb';
|
|
3376
3376
|
const VORTEX_SWAP_UPGRADE_CAP = '0xec0beaf1453b0e09d92f8addf25abcfb4bc6ce43ead828914836cadc8df249a0';
|
|
3377
|
+
const SECRET_PACKAGE_ID = '0x2d57ed0dd0d5f44d91f865fee3bc33d13ef3ce97c7daf88ad5f5fbb32468ccd6';
|
|
3377
3378
|
const INITIAL_SHARED_VERSION = '692442863';
|
|
3378
3379
|
const LSK_FETCH_OFFSET = 'fetch_offset';
|
|
3379
3380
|
const LSK_ENCRYPTED_OUTPUTS = 'encrypted_outputs';
|
|
@@ -39214,10 +39215,21 @@ const parseVortexPool = (data) => {
|
|
|
39214
39215
|
coinType: normalizeStructTag(extractCoinType(data.content.type)),
|
|
39215
39216
|
};
|
|
39216
39217
|
};
|
|
39218
|
+
const parseSecretAccount = (data) => {
|
|
39219
|
+
invariant(data.content?.dataType === 'moveObject', 'Secret account content type not found');
|
|
39220
|
+
invariant(data.content?.type, 'Secret account content not found');
|
|
39221
|
+
return {
|
|
39222
|
+
objectId: data.objectId,
|
|
39223
|
+
version: data.version,
|
|
39224
|
+
digest: data.digest,
|
|
39225
|
+
type: data.content.type,
|
|
39226
|
+
encryptedSecret: pathOr('', ['fields', 'encrypted_secret'], data.content),
|
|
39227
|
+
};
|
|
39228
|
+
};
|
|
39217
39229
|
|
|
39218
39230
|
var _Vortex_suiClient, _Vortex_newPoolEventType, _Vortex_newAccountEventType, _Vortex_newCommitmentEventType, _Vortex_nullifierSpentEventType, _Vortex_newEncryptionKeyEventType;
|
|
39219
39231
|
class Vortex {
|
|
39220
|
-
constructor({ registry, packageId, swapPackageId, prove, verify, fullNodeUrl = getFullnodeUrl('testnet'), }) {
|
|
39232
|
+
constructor({ registry, packageId, swapPackageId, secretPackageId, prove, verify, fullNodeUrl = getFullnodeUrl('testnet'), }) {
|
|
39221
39233
|
_Vortex_suiClient.set(this, void 0);
|
|
39222
39234
|
_Vortex_newPoolEventType.set(this, void 0);
|
|
39223
39235
|
_Vortex_newAccountEventType.set(this, void 0);
|
|
@@ -39232,8 +39244,10 @@ class Vortex {
|
|
|
39232
39244
|
__classPrivateFieldSet(this, _Vortex_newCommitmentEventType, `${packageId}::vortex_events::NewCommitment`, "f");
|
|
39233
39245
|
__classPrivateFieldSet(this, _Vortex_nullifierSpentEventType, `${packageId}::vortex_events::NullifierSpent`, "f");
|
|
39234
39246
|
__classPrivateFieldSet(this, _Vortex_newEncryptionKeyEventType, `${packageId}::vortex_events::NewEncryptionKey`, "f");
|
|
39247
|
+
this.secretAccountType = `${secretPackageId}::secret::Secret`;
|
|
39235
39248
|
this.swapPackageId = swapPackageId;
|
|
39236
39249
|
this.packageId = packageId;
|
|
39250
|
+
this.secretPackageId = secretPackageId;
|
|
39237
39251
|
this.registry = registry;
|
|
39238
39252
|
this.prove = prove;
|
|
39239
39253
|
this.verify = verify;
|
|
@@ -39290,6 +39304,40 @@ class Vortex {
|
|
|
39290
39304
|
});
|
|
39291
39305
|
return { tx };
|
|
39292
39306
|
}
|
|
39307
|
+
newSecretAccount({ tx = new Transaction(), encryptedSecret, }) {
|
|
39308
|
+
const secretAccount = tx.moveCall({
|
|
39309
|
+
target: `${this.secretPackageId}::secret::new`,
|
|
39310
|
+
arguments: [tx.pure.string(encryptedSecret)],
|
|
39311
|
+
});
|
|
39312
|
+
tx.moveCall({
|
|
39313
|
+
target: `${this.secretPackageId}::secret::keep`,
|
|
39314
|
+
arguments: [secretAccount],
|
|
39315
|
+
});
|
|
39316
|
+
return { tx };
|
|
39317
|
+
}
|
|
39318
|
+
deleteSecretAccount({ tx = new Transaction(), secretAccountObjectId, }) {
|
|
39319
|
+
tx.moveCall({
|
|
39320
|
+
target: `${this.secretPackageId}::secret::delete`,
|
|
39321
|
+
arguments: [tx.object(secretAccountObjectId)],
|
|
39322
|
+
});
|
|
39323
|
+
return { tx };
|
|
39324
|
+
}
|
|
39325
|
+
async getAllSecretAccounts(account) {
|
|
39326
|
+
const secretAccounts = await __classPrivateFieldGet(this, _Vortex_suiClient, "f").getOwnedObjects({
|
|
39327
|
+
owner: account,
|
|
39328
|
+
options: {
|
|
39329
|
+
showContent: true,
|
|
39330
|
+
showType: true,
|
|
39331
|
+
},
|
|
39332
|
+
filter: {
|
|
39333
|
+
StructType: this.secretAccountType,
|
|
39334
|
+
},
|
|
39335
|
+
});
|
|
39336
|
+
return secretAccounts.data.map((data) => {
|
|
39337
|
+
invariant(data.data, 'Secret account data not found');
|
|
39338
|
+
return parseSecretAccount(data.data);
|
|
39339
|
+
});
|
|
39340
|
+
}
|
|
39293
39341
|
async vortexAddress(coinType) {
|
|
39294
39342
|
const tx = new Transaction();
|
|
39295
39343
|
tx.moveCall({
|
|
@@ -39538,8 +39586,11 @@ class VortexAPI {
|
|
|
39538
39586
|
__classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
|
|
39539
39587
|
return response;
|
|
39540
39588
|
}
|
|
39541
|
-
async getAccounts(
|
|
39542
|
-
const params = new URLSearchParams({ hashed_secret: hashedSecret });
|
|
39589
|
+
async getAccounts(args) {
|
|
39590
|
+
const params = new URLSearchParams({ hashed_secret: args.hashedSecret });
|
|
39591
|
+
if (args.excludeHidden !== undefined) {
|
|
39592
|
+
params.set('exclude_hidden', args.excludeHidden.toString());
|
|
39593
|
+
}
|
|
39543
39594
|
const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_get).call(this, `/api/v1/accounts?${params.toString()}`);
|
|
39544
39595
|
__classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
|
|
39545
39596
|
return response;
|
|
@@ -39552,6 +39603,18 @@ class VortexAPI {
|
|
|
39552
39603
|
__classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
|
|
39553
39604
|
return response;
|
|
39554
39605
|
}
|
|
39606
|
+
async hideAccounts(args) {
|
|
39607
|
+
const body = {};
|
|
39608
|
+
if (args.accountObjectIds) {
|
|
39609
|
+
body.accountObjectIds = args.accountObjectIds;
|
|
39610
|
+
}
|
|
39611
|
+
if (args.hashedSecret) {
|
|
39612
|
+
body.hashedSecret = args.hashedSecret;
|
|
39613
|
+
}
|
|
39614
|
+
const response = await __classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_post).call(this, '/api/v1/accounts/hide', body, args.apiKey);
|
|
39615
|
+
__classPrivateFieldGet(this, _VortexAPI_instances, "m", _VortexAPI_assertSuccess).call(this, response);
|
|
39616
|
+
return response;
|
|
39617
|
+
}
|
|
39555
39618
|
async getPools(args = {}) {
|
|
39556
39619
|
const params = new URLSearchParams();
|
|
39557
39620
|
if (args.page) {
|
|
@@ -40016,5 +40079,5 @@ const finishSwap = async ({ tx = new Transaction(), amount, vortexSdk, vortexPoo
|
|
|
40016
40079
|
});
|
|
40017
40080
|
};
|
|
40018
40081
|
|
|
40019
|
-
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_API_URL, VORTEX_PACKAGE_ID, VORTEX_POOL_IDS, VORTEX_SIGNATURE_DOMAIN, VORTEX_SWAP_PACKAGE_ID, VORTEX_SWAP_UPGRADE_CAP, VORTEX_UPGRADE_CAP, Vortex, VortexAPI, VortexKeypair, ZERO_VALUE, buildMerkleTree, deposit, depositWithAccount, deserializeMerkleTree, finishSwap, getMerklePath, getUnspentUtxos, getUnspentUtxosWithApi, getUnspentUtxosWithApiAndCommitments, merkleTreeHashFunction, parseNewCommitmentEvent, parseVortexPool, poseidon1, poseidon2, poseidon3, poseidon4, startSwap, toProveInput, validateDepositWithAccountCommands, validateWithdrawCommands, vortexAPI, withdraw, withdrawWithAccount };
|
|
40082
|
+
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, SECRET_PACKAGE_ID, TREASURY_ADDRESS, Utxo, VORTEX_API_URL, VORTEX_PACKAGE_ID, VORTEX_POOL_IDS, VORTEX_SIGNATURE_DOMAIN, VORTEX_SWAP_PACKAGE_ID, VORTEX_SWAP_UPGRADE_CAP, VORTEX_UPGRADE_CAP, Vortex, VortexAPI, VortexKeypair, ZERO_VALUE, buildMerkleTree, deposit, depositWithAccount, deserializeMerkleTree, finishSwap, getMerklePath, getUnspentUtxos, getUnspentUtxosWithApi, getUnspentUtxosWithApiAndCommitments, merkleTreeHashFunction, parseNewCommitmentEvent, parseSecretAccount, parseVortexPool, poseidon1, poseidon2, poseidon3, poseidon4, startSwap, toProveInput, validateDepositWithAccountCommands, validateWithdrawCommands, vortexAPI, withdraw, withdrawWithAccount };
|
|
40020
40083
|
//# sourceMappingURL=index.mjs.map
|