@interest-protocol/vortex-sdk 7.1.0 → 7.2.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,167 @@ 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
+ elements: [{ Input: 16 }],
39303
+ },
39304
+ },
39305
+ {
39306
+ MoveCall: {
39307
+ package: VORTEX_PACKAGE_ID,
39308
+ module: 'vortex',
39309
+ function: 'transact_with_account',
39310
+ arguments: [
39311
+ { Input: 14 },
39312
+ { Input: 15 },
39313
+ { Result: 2 },
39314
+ { Result: 1 },
39315
+ { Result: 0 },
39316
+ ],
39317
+ },
39318
+ },
39319
+ {
39320
+ TransferObjects: {
39321
+ objects: [{ Result: 3 }],
39322
+ address: { Input: 17 },
39323
+ },
39324
+ },
39325
+ ];
39326
+ const EXPECTED_WITHDRAW_COMMANDS = [
39327
+ {
39328
+ MoveCall: {
39329
+ package: VORTEX_PACKAGE_ID,
39330
+ module: 'vortex_ext_data',
39331
+ function: 'new',
39332
+ arguments: [
39333
+ { Input: 0 },
39334
+ { Input: 1 },
39335
+ { Input: 2 },
39336
+ { Input: 3 },
39337
+ { Input: 4 },
39338
+ { Input: 5 },
39339
+ ],
39340
+ },
39341
+ },
39342
+ {
39343
+ MoveCall: {
39344
+ package: VORTEX_PACKAGE_ID,
39345
+ module: 'vortex_proof',
39346
+ function: 'new',
39347
+ arguments: [
39348
+ { Input: 6 },
39349
+ { Input: 7 },
39350
+ { Input: 8 },
39351
+ { Input: 9 },
39352
+ { Input: 10 },
39353
+ { Input: 11 },
39354
+ { Input: 12 },
39355
+ { Input: 13 },
39356
+ ],
39357
+ },
39358
+ },
39359
+ {
39360
+ MoveCall: {
39361
+ package: SUI_FRAMEWORK_ADDRESS,
39362
+ module: 'coin',
39363
+ function: 'zero',
39364
+ arguments: [],
39365
+ },
39366
+ },
39367
+ {
39368
+ MoveCall: {
39369
+ package: VORTEX_PACKAGE_ID,
39370
+ module: 'vortex',
39371
+ function: 'transact',
39372
+ arguments: [
39373
+ { Input: 14 },
39374
+ { Result: 2 },
39375
+ { Result: 1 },
39376
+ { Result: 0 },
39377
+ ],
39378
+ },
39379
+ },
39380
+ {
39381
+ TransferObjects: {
39382
+ objects: [{ Result: 3 }],
39383
+ address: { Input: 15 },
39384
+ },
39385
+ },
39386
+ ];
39387
+ function validateCommands(commands, expectedCommands) {
39388
+ invariant(commands.length === expectedCommands.length, `Expected ${expectedCommands.length} commands, got ${commands.length}`);
39389
+ for (let i = 0; i < commands.length; i++) {
39390
+ const actual = commands[i];
39391
+ const expected = expectedCommands[i];
39392
+ if ('MoveCall' in expected && expected.MoveCall) {
39393
+ invariant('MoveCall' in actual, `Command ${i}: Expected MoveCall`);
39394
+ const actualMoveCall = actual.MoveCall;
39395
+ const expectedMoveCall = expected.MoveCall;
39396
+ invariant(normalizeSuiAddress(actualMoveCall.package) ===
39397
+ normalizeSuiAddress(expectedMoveCall.package), `Command ${i}: Package mismatch. Expected ${expectedMoveCall.package}, got ${actualMoveCall.package}`);
39398
+ invariant(actualMoveCall.module === expectedMoveCall.module, `Command ${i}: Module mismatch. Expected ${expectedMoveCall.module}, got ${actualMoveCall.module}`);
39399
+ invariant(actualMoveCall.function === expectedMoveCall.function, `Command ${i}: Function mismatch. Expected ${expectedMoveCall.function}, got ${actualMoveCall.function}`);
39400
+ invariant(JSON.stringify(actualMoveCall.arguments) ===
39401
+ JSON.stringify(expectedMoveCall.arguments), `Command ${i}: Arguments mismatch`);
39402
+ }
39403
+ else if ('MakeMoveVec' in expected && expected.MakeMoveVec) {
39404
+ invariant('MakeMoveVec' in actual, `Command ${i}: Expected MakeMoveVec`);
39405
+ const actualMakeMoveVec = actual.MakeMoveVec;
39406
+ const expectedMakeMoveVec = expected.MakeMoveVec;
39407
+ invariant(JSON.stringify(actualMakeMoveVec.elements) ===
39408
+ JSON.stringify(expectedMakeMoveVec.elements), `Command ${i}: MakeMoveVec elements mismatch`);
39409
+ }
39410
+ else if ('TransferObjects' in expected && expected.TransferObjects) {
39411
+ invariant('TransferObjects' in actual, `Command ${i}: Expected TransferObjects`);
39412
+ const actualTransfer = actual.TransferObjects;
39413
+ const expectedTransfer = expected.TransferObjects;
39414
+ invariant(JSON.stringify(actualTransfer.objects) ===
39415
+ JSON.stringify(expectedTransfer.objects), `Command ${i}: TransferObjects objects mismatch`);
39416
+ invariant(JSON.stringify(actualTransfer.address) ===
39417
+ JSON.stringify(expectedTransfer.address), `Command ${i}: TransferObjects address mismatch`);
39418
+ }
39419
+ }
39420
+ }
39421
+ function validateDepositWithAccountCommands(commands) {
39422
+ validateCommands(commands, EXPECTED_DEPOSIT_WITH_ACCOUNT_COMMANDS);
39423
+ }
39424
+ function validateWithdrawCommands(commands) {
39425
+ validateCommands(commands, EXPECTED_WITHDRAW_COMMANDS);
39426
+ }
39427
+
39267
39428
  function getMerklePath(merkleTree, utxo) {
39268
39429
  // Handle zero-amount UTXOs
39269
39430
  if (!utxo || utxo.amount === 0n) {
@@ -40187,6 +40348,8 @@ exports.poseidon4 = poseidon4;
40187
40348
  exports.prove = prove;
40188
40349
  exports.startSwap = startSwap;
40189
40350
  exports.toProveInput = toProveInput;
40351
+ exports.validateDepositWithAccountCommands = validateDepositWithAccountCommands;
40352
+ exports.validateWithdrawCommands = validateWithdrawCommands;
40190
40353
  exports.verify = verify;
40191
40354
  exports.vortexAPI = vortexAPI;
40192
40355
  exports.vortexSDK = vortexSDK;