@interest-protocol/vortex-sdk 7.1.0 → 7.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 CHANGED
@@ -39264,6 +39264,159 @@ const getUnspentUtxosWithApi = async ({ commitments, vortexKeypair, vortexSdk, v
39264
39264
  return unspentUtxos;
39265
39265
  };
39266
39266
 
39267
+ const EXPECTED_DEPOSIT_WITH_ACCOUNT_COMMANDS = [
39268
+ {
39269
+ MoveCall: {
39270
+ package: VORTEX_PACKAGE_ID,
39271
+ module: 'vortex_ext_data',
39272
+ function: 'new',
39273
+ arguments: [
39274
+ { Input: 0 },
39275
+ { Input: 1 },
39276
+ { Input: 2 },
39277
+ { Input: 3 },
39278
+ { Input: 4 },
39279
+ { Input: 5 },
39280
+ ],
39281
+ },
39282
+ },
39283
+ {
39284
+ MoveCall: {
39285
+ package: VORTEX_PACKAGE_ID,
39286
+ module: 'vortex_proof',
39287
+ function: 'new',
39288
+ arguments: [
39289
+ { Input: 6 },
39290
+ { Input: 7 },
39291
+ { Input: 8 },
39292
+ { Input: 9 },
39293
+ { Input: 10 },
39294
+ { Input: 11 },
39295
+ { Input: 12 },
39296
+ { Input: 13 },
39297
+ ],
39298
+ },
39299
+ },
39300
+ {
39301
+ MakeMoveVec: {},
39302
+ },
39303
+ {
39304
+ MoveCall: {
39305
+ package: VORTEX_PACKAGE_ID,
39306
+ module: 'vortex',
39307
+ function: 'transact_with_account',
39308
+ arguments: [
39309
+ { Input: 14 },
39310
+ { Input: 15 },
39311
+ { Result: 2 },
39312
+ { Result: 1 },
39313
+ { Result: 0 },
39314
+ ],
39315
+ },
39316
+ },
39317
+ {
39318
+ TransferObjects: {
39319
+ objects: [{ Result: 3 }],
39320
+ },
39321
+ },
39322
+ ];
39323
+ const EXPECTED_WITHDRAW_COMMANDS = [
39324
+ {
39325
+ MoveCall: {
39326
+ package: VORTEX_PACKAGE_ID,
39327
+ module: 'vortex_ext_data',
39328
+ function: 'new',
39329
+ arguments: [
39330
+ { Input: 0 },
39331
+ { Input: 1 },
39332
+ { Input: 2 },
39333
+ { Input: 3 },
39334
+ { Input: 4 },
39335
+ { Input: 5 },
39336
+ ],
39337
+ },
39338
+ },
39339
+ {
39340
+ MoveCall: {
39341
+ package: VORTEX_PACKAGE_ID,
39342
+ module: 'vortex_proof',
39343
+ function: 'new',
39344
+ arguments: [
39345
+ { Input: 6 },
39346
+ { Input: 7 },
39347
+ { Input: 8 },
39348
+ { Input: 9 },
39349
+ { Input: 10 },
39350
+ { Input: 11 },
39351
+ { Input: 12 },
39352
+ { Input: 13 },
39353
+ ],
39354
+ },
39355
+ },
39356
+ {
39357
+ MoveCall: {
39358
+ package: SUI_FRAMEWORK_ADDRESS,
39359
+ module: 'coin',
39360
+ function: 'zero',
39361
+ arguments: [],
39362
+ },
39363
+ },
39364
+ {
39365
+ MoveCall: {
39366
+ package: VORTEX_PACKAGE_ID,
39367
+ module: 'vortex',
39368
+ function: 'transact',
39369
+ arguments: [
39370
+ { Input: 14 },
39371
+ { Result: 2 },
39372
+ { Result: 1 },
39373
+ { Result: 0 },
39374
+ ],
39375
+ },
39376
+ },
39377
+ {
39378
+ TransferObjects: {
39379
+ objects: [{ Result: 3 }],
39380
+ },
39381
+ },
39382
+ ];
39383
+ function validateCommands(commands, expectedCommands) {
39384
+ invariant(commands.length === expectedCommands.length, `Expected ${expectedCommands.length} commands, got ${commands.length}`);
39385
+ for (let i = 0; i < commands.length; i++) {
39386
+ const actual = commands[i];
39387
+ const expected = expectedCommands[i];
39388
+ if ('MoveCall' in expected && expected.MoveCall) {
39389
+ invariant('MoveCall' in actual, `Command ${i}: Expected MoveCall`);
39390
+ const actualMoveCall = actual.MoveCall;
39391
+ const expectedMoveCall = expected.MoveCall;
39392
+ invariant(normalizeSuiAddress(actualMoveCall.package) ===
39393
+ normalizeSuiAddress(expectedMoveCall.package), `Command ${i}: Package mismatch. Expected ${expectedMoveCall.package}, got ${actualMoveCall.package}`);
39394
+ invariant(actualMoveCall.module === expectedMoveCall.module, `Command ${i}: Module mismatch. Expected ${expectedMoveCall.module}, got ${actualMoveCall.module}`);
39395
+ invariant(actualMoveCall.function === expectedMoveCall.function, `Command ${i}: Function mismatch. Expected ${expectedMoveCall.function}, got ${actualMoveCall.function}`);
39396
+ invariant(JSON.stringify(actualMoveCall.arguments) ===
39397
+ JSON.stringify(expectedMoveCall.arguments), `Command ${i}: Arguments mismatch`);
39398
+ }
39399
+ else if ('MakeMoveVec' in expected && expected.MakeMoveVec) {
39400
+ invariant('MakeMoveVec' in actual, `Command ${i}: Expected MakeMoveVec`);
39401
+ // Skip detailed validation of MakeMoveVec elements as they vary based on coin count
39402
+ }
39403
+ else if ('TransferObjects' in expected && expected.TransferObjects) {
39404
+ invariant('TransferObjects' in actual, `Command ${i}: Expected TransferObjects`);
39405
+ const actualTransfer = actual.TransferObjects;
39406
+ const expectedTransfer = expected.TransferObjects;
39407
+ invariant(JSON.stringify(actualTransfer.objects) ===
39408
+ JSON.stringify(expectedTransfer.objects), `Command ${i}: TransferObjects objects mismatch`);
39409
+ // Skip address validation as input index varies based on coin count
39410
+ }
39411
+ }
39412
+ }
39413
+ function validateDepositWithAccountCommands(commands) {
39414
+ validateCommands(commands, EXPECTED_DEPOSIT_WITH_ACCOUNT_COMMANDS);
39415
+ }
39416
+ function validateWithdrawCommands(commands) {
39417
+ validateCommands(commands, EXPECTED_WITHDRAW_COMMANDS);
39418
+ }
39419
+
39267
39420
  function getMerklePath(merkleTree, utxo) {
39268
39421
  // Handle zero-amount UTXOs
39269
39422
  if (!utxo || utxo.amount === 0n) {
@@ -40187,6 +40340,8 @@ exports.poseidon4 = poseidon4;
40187
40340
  exports.prove = prove;
40188
40341
  exports.startSwap = startSwap;
40189
40342
  exports.toProveInput = toProveInput;
40343
+ exports.validateDepositWithAccountCommands = validateDepositWithAccountCommands;
40344
+ exports.validateWithdrawCommands = validateWithdrawCommands;
40190
40345
  exports.verify = verify;
40191
40346
  exports.vortexAPI = vortexAPI;
40192
40347
  exports.vortexSDK = vortexSDK;