@t2000/sdk 5.5.1 → 5.6.1

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.
@@ -1,4 +1,4 @@
1
- export { B as BalanceResponse, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, D as DEFAULT_NETWORK, e as DepositInfo, E as ETH_TYPE, f as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OVERLAY_FEE_RATE, j as OverlayFeeConfig, P as PayOptions, k as PayResult, S as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, o as SendResult, p as SimulationResult, q as StableAsset, r as SuiHolding, s as SuiRpcTxBlock, t as SupportedAsset, u as SwapRouteResult, T as T2000Error, v as T2000ErrorCode, w as T2000ErrorData, x as T2000_OVERLAY_FEE_WALLET, y as TOKEN_MAP, z as TransactionLeg, A as TransactionRecord, F as TransactionSigner, H as TxDirection, U as USDC_DECIMALS, J as USDC_TYPE, Q as USDE_TYPE, R as USDSUI_TYPE, V as USDT_TYPE, W as WAL_TYPE, X as WBTC_TYPE, Z as ZkLoginProof, Y as ZkLoginSigner, _ as buildSwapTx, $ as classifyAction, a0 as classifyLabel, a1 as classifyTransaction, a2 as executeTx, a3 as extractAllUserLegs, a4 as extractTransferDetails, a5 as extractTxCommands, a6 as extractTxSender, a7 as fallbackLabel, a8 as findSwapRoute, a9 as formatAssetAmount, aa as formatSui, ab as formatUsd, ac as getDecimals, ad as getDecimalsForCoinType, ae as mapMoveAbortCode, af as mapWalletError, ag as mistToSui, ah as parseSuiRpcTx, ai as payWithMpp, aj as rawToStable, ak as rawToUsdc, al as refineLendingLabel, am as resolveSymbol, an as resolveTokenType, ao as stableToRaw, ap as suiToMist, aq as truncateAddress, ar as usdcToRaw, as as validateAddress } from './simulate-KETPmlDo.cjs';
1
+ export { B as BalanceResponse, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, D as DEFAULT_NETWORK, e as DepositInfo, E as ETH_TYPE, f as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OVERLAY_FEE_RATE, j as OverlayFeeConfig, P as PREFLIGHT_MAX_AMOUNT, k as PREFLIGHT_OK, l as PayOptions, m as PayResult, n as PreflightResult, S as STABLE_ASSETS, o as SUI_DECIMALS, p as SUI_TYPE, q as SUPPORTED_ASSETS, r as SendResult, s as SimulationResult, t as StableAsset, u as SuiHolding, v as SuiRpcTxBlock, w as SupportedAsset, x as SwapRouteResult, T as T2000Error, y as T2000ErrorCode, z as T2000ErrorData, A as T2000_OVERLAY_FEE_WALLET, F as TOKEN_MAP, H as TransactionLeg, J as TransactionRecord, Q as TransactionSigner, R as TxDirection, U as USDC_DECIMALS, V as USDC_TYPE, W as USDE_TYPE, X as USDSUI_TYPE, Y as USDT_TYPE, Z as WAL_TYPE, _ as WBTC_TYPE, $ as ZkLoginProof, a0 as ZkLoginSigner, a1 as buildSendTx, a2 as buildSwapTx, a3 as checkPositiveAmount, a4 as checkSuiAddress, a5 as classifyAction, a6 as classifyLabel, a7 as classifyTransaction, a8 as executeTx, a9 as extractAllUserLegs, aa as extractTransferDetails, ab as extractTxCommands, ac as extractTxSender, ad as fallbackLabel, ae as findSwapRoute, af as formatAssetAmount, ag as formatSui, ah as formatUsd, ai as getDecimals, aj as getDecimalsForCoinType, ak as mapMoveAbortCode, al as mapWalletError, am as mistToSui, an as parseSuiRpcTx, ao as payWithMpp, ap as preflightFail, aq as preflightPay, ar as preflightSend, as as preflightSwap, at as rawToStable, au as rawToUsdc, av as refineLendingLabel, aw as resolveSymbol, ax as resolveTokenType, ay as stableToRaw, az as suiToMist, aA as truncateAddress, aB as usdcToRaw, aC as validateAddress } from './send-D2nKpwJN.cjs';
2
2
  import '@mysten/sui/keypairs/ed25519';
3
3
  import '@mysten/sui/grpc';
4
4
  import '@mysten/sui/client';
package/dist/browser.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BalanceResponse, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, D as DEFAULT_NETWORK, e as DepositInfo, E as ETH_TYPE, f as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OVERLAY_FEE_RATE, j as OverlayFeeConfig, P as PayOptions, k as PayResult, S as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, o as SendResult, p as SimulationResult, q as StableAsset, r as SuiHolding, s as SuiRpcTxBlock, t as SupportedAsset, u as SwapRouteResult, T as T2000Error, v as T2000ErrorCode, w as T2000ErrorData, x as T2000_OVERLAY_FEE_WALLET, y as TOKEN_MAP, z as TransactionLeg, A as TransactionRecord, F as TransactionSigner, H as TxDirection, U as USDC_DECIMALS, J as USDC_TYPE, Q as USDE_TYPE, R as USDSUI_TYPE, V as USDT_TYPE, W as WAL_TYPE, X as WBTC_TYPE, Z as ZkLoginProof, Y as ZkLoginSigner, _ as buildSwapTx, $ as classifyAction, a0 as classifyLabel, a1 as classifyTransaction, a2 as executeTx, a3 as extractAllUserLegs, a4 as extractTransferDetails, a5 as extractTxCommands, a6 as extractTxSender, a7 as fallbackLabel, a8 as findSwapRoute, a9 as formatAssetAmount, aa as formatSui, ab as formatUsd, ac as getDecimals, ad as getDecimalsForCoinType, ae as mapMoveAbortCode, af as mapWalletError, ag as mistToSui, ah as parseSuiRpcTx, ai as payWithMpp, aj as rawToStable, ak as rawToUsdc, al as refineLendingLabel, am as resolveSymbol, an as resolveTokenType, ao as stableToRaw, ap as suiToMist, aq as truncateAddress, ar as usdcToRaw, as as validateAddress } from './simulate-KETPmlDo.js';
1
+ export { B as BalanceResponse, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, D as DEFAULT_NETWORK, e as DepositInfo, E as ETH_TYPE, f as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OVERLAY_FEE_RATE, j as OverlayFeeConfig, P as PREFLIGHT_MAX_AMOUNT, k as PREFLIGHT_OK, l as PayOptions, m as PayResult, n as PreflightResult, S as STABLE_ASSETS, o as SUI_DECIMALS, p as SUI_TYPE, q as SUPPORTED_ASSETS, r as SendResult, s as SimulationResult, t as StableAsset, u as SuiHolding, v as SuiRpcTxBlock, w as SupportedAsset, x as SwapRouteResult, T as T2000Error, y as T2000ErrorCode, z as T2000ErrorData, A as T2000_OVERLAY_FEE_WALLET, F as TOKEN_MAP, H as TransactionLeg, J as TransactionRecord, Q as TransactionSigner, R as TxDirection, U as USDC_DECIMALS, V as USDC_TYPE, W as USDE_TYPE, X as USDSUI_TYPE, Y as USDT_TYPE, Z as WAL_TYPE, _ as WBTC_TYPE, $ as ZkLoginProof, a0 as ZkLoginSigner, a1 as buildSendTx, a2 as buildSwapTx, a3 as checkPositiveAmount, a4 as checkSuiAddress, a5 as classifyAction, a6 as classifyLabel, a7 as classifyTransaction, a8 as executeTx, a9 as extractAllUserLegs, aa as extractTransferDetails, ab as extractTxCommands, ac as extractTxSender, ad as fallbackLabel, ae as findSwapRoute, af as formatAssetAmount, ag as formatSui, ah as formatUsd, ai as getDecimals, aj as getDecimalsForCoinType, ak as mapMoveAbortCode, al as mapWalletError, am as mistToSui, an as parseSuiRpcTx, ao as payWithMpp, ap as preflightFail, aq as preflightPay, ar as preflightSend, as as preflightSwap, at as rawToStable, au as rawToUsdc, av as refineLendingLabel, aw as resolveSymbol, ax as resolveTokenType, ay as stableToRaw, az as suiToMist, aA as truncateAddress, aB as usdcToRaw, aC as validateAddress } from './send-D2nKpwJN.js';
2
2
  import '@mysten/sui/keypairs/ed25519';
3
3
  import '@mysten/sui/grpc';
4
4
  import '@mysten/sui/client';
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
- import { coinWithBalance } from '@mysten/sui/transactions';
2
- import { fromBase64, normalizeSuiAddress, isValidSuiAddress } from '@mysten/sui/utils';
1
+ import { coinWithBalance, Transaction } from '@mysten/sui/transactions';
2
+ import { isValidSuiAddress, normalizeSuiAddress, fromBase64 } from '@mysten/sui/utils';
3
3
  import '@mysten/sui/grpc';
4
4
  import '@mysten/sui/graphql';
5
5
  import { AggregatorClient, Env } from '@cetusprotocol/aggregator-sdk';
@@ -229,6 +229,7 @@ var init_token_registry = __esm({
229
229
  // src/wallet/coinSelection.ts
230
230
  var coinSelection_exports = {};
231
231
  __export(coinSelection_exports, {
232
+ buildCoinToAddressBalanceMigration: () => buildCoinToAddressBalanceMigration,
232
233
  fetchAllCoins: () => fetchAllCoins,
233
234
  selectAndSplitCoin: () => selectAndSplitCoin,
234
235
  selectSuiCoin: () => selectSuiCoin
@@ -342,6 +343,32 @@ async function selectCoinObjectsOnly(tx, client, owner, coinType, amount, allowS
342
343
  });
343
344
  return { coin, effectiveAmount, swapAll };
344
345
  }
346
+ function buildCoinToAddressBalanceMigration(args) {
347
+ const { coins, coinType, owner, minAmount } = args;
348
+ const sorted = [...coins].filter((c) => c.balance > 0n).sort((a, b) => b.balance > a.balance ? 1 : b.balance < a.balance ? -1 : 0);
349
+ const selected = [];
350
+ let migratedRaw = 0n;
351
+ for (const c of sorted) {
352
+ if (migratedRaw >= minAmount) break;
353
+ selected.push(c);
354
+ migratedRaw += c.balance;
355
+ }
356
+ if (migratedRaw < minAmount) {
357
+ throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient ${coinType} coin objects to migrate`, {
358
+ available: migratedRaw.toString(),
359
+ required: minAmount.toString()
360
+ });
361
+ }
362
+ const tx = new Transaction();
363
+ for (const c of selected) {
364
+ tx.moveCall({
365
+ target: "0x2::coin::send_funds",
366
+ typeArguments: [coinType],
367
+ arguments: [tx.object(c.objectId), tx.pure.address(owner)]
368
+ });
369
+ }
370
+ return { tx, migratedRaw };
371
+ }
345
372
  async function selectSuiCoin(tx, client, owner, amountMist, sponsoredContext, mergeCache) {
346
373
  if (sponsoredContext) {
347
374
  const { SUI_TYPE: SUI_TYPE2 } = await Promise.resolve().then(() => (init_token_registry(), token_registry_exports));
@@ -440,10 +467,60 @@ async function executeTx(client, signer, buildTx, options = {}) {
440
467
  }
441
468
  return { digest: txn.digest, gasCostSui, effects };
442
469
  }
470
+ var PREFLIGHT_MAX_AMOUNT = 1e6;
471
+ var PREFLIGHT_OK = { valid: true };
472
+ function preflightFail(code, error) {
473
+ return { valid: false, code, error };
474
+ }
475
+ function checkPositiveAmount(amount, label = "Amount", max = PREFLIGHT_MAX_AMOUNT) {
476
+ if (typeof amount !== "number" || !Number.isFinite(amount)) {
477
+ return preflightFail("INVALID_AMOUNT", `${label} must be a finite number`);
478
+ }
479
+ if (amount <= 0) {
480
+ return preflightFail("INVALID_AMOUNT", `${label} must be greater than zero`);
481
+ }
482
+ if (amount > max) {
483
+ return preflightFail("INVALID_AMOUNT", `${label} ${amount} exceeds the sane maximum (${max})`);
484
+ }
485
+ return PREFLIGHT_OK;
486
+ }
487
+ function checkSuiAddress(address, label = "recipient") {
488
+ try {
489
+ if (typeof address === "string" && address.trim() !== "" && isValidSuiAddress(normalizeSuiAddress(address))) {
490
+ return PREFLIGHT_OK;
491
+ }
492
+ } catch {
493
+ }
494
+ return preflightFail("INVALID_ADDRESS", `Invalid ${label} address: ${address}`);
495
+ }
443
496
 
444
497
  // src/wallet/pay.ts
498
+ function preflightPay(input) {
499
+ if (typeof input.url !== "string" || input.url.trim() === "") {
500
+ return preflightFail("FACILITATOR_REJECTION", "A target URL is required to pay");
501
+ }
502
+ let parsed;
503
+ try {
504
+ parsed = new URL(input.url);
505
+ } catch {
506
+ return preflightFail("FACILITATOR_REJECTION", `Invalid URL: ${input.url}`);
507
+ }
508
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
509
+ return preflightFail(
510
+ "FACILITATOR_REJECTION",
511
+ `URL must be http(s): got ${parsed.protocol}//`
512
+ );
513
+ }
514
+ if (input.maxPrice !== void 0) {
515
+ const priceCheck = checkPositiveAmount(input.maxPrice, "maxPrice");
516
+ if (!priceCheck.valid) return priceCheck;
517
+ }
518
+ return PREFLIGHT_OK;
519
+ }
445
520
  async function payWithMpp(args) {
446
521
  const { signer, client, options } = args;
522
+ const pf = preflightPay({ url: options.url, maxPrice: options.maxPrice });
523
+ if (!pf.valid) throw new T2000Error(pf.code, pf.error);
447
524
  const method = (options.method ?? "GET").toUpperCase();
448
525
  const canHaveBody = method !== "GET" && method !== "HEAD";
449
526
  const reqInit = {
@@ -523,40 +600,26 @@ async function ensureAddressBalanceCovers(args) {
523
600
  required: amountRaw.toString()
524
601
  });
525
602
  }
603
+ const coins = [];
526
604
  let coinSum = 0n;
527
605
  let cursor;
528
606
  let hasNext = true;
529
607
  while (hasNext) {
530
608
  const page = await client.core.listCoins({ owner, coinType: asset, cursor: cursor ?? void 0 });
531
- for (const c of page.objects) coinSum += BigInt(c.balance);
609
+ for (const c of page.objects) {
610
+ coins.push({ objectId: c.objectId, balance: BigInt(c.balance) });
611
+ coinSum += BigInt(c.balance);
612
+ }
532
613
  cursor = page.cursor;
533
614
  hasNext = page.hasNextPage;
534
615
  }
535
616
  const addressBalance = total - coinSum;
536
617
  if (addressBalance >= amountRaw) return 0;
537
618
  const shortfall = amountRaw - addressBalance;
538
- const { Transaction: Transaction2 } = await import('@mysten/sui/transactions');
539
- const { selectAndSplitCoin: selectAndSplitCoin2 } = await Promise.resolve().then(() => (init_coinSelection(), coinSelection_exports));
619
+ const { buildCoinToAddressBalanceMigration: buildCoinToAddressBalanceMigration2 } = await Promise.resolve().then(() => (init_coinSelection(), coinSelection_exports));
540
620
  const grpcClient = await makeGrpcBuildClient(client);
541
- const migration = await executeTx(
542
- client,
543
- signer,
544
- async () => {
545
- const tx = new Transaction2();
546
- const { coin } = await selectAndSplitCoin2(tx, client, owner, asset, shortfall, {
547
- sponsoredContext: true,
548
- // coin-objects-only — never the address balance
549
- allowSwapAll: false
550
- });
551
- tx.moveCall({
552
- target: "0x2::coin::send_funds",
553
- typeArguments: [asset],
554
- arguments: [coin, tx.pure.address(owner)]
555
- });
556
- return tx;
557
- },
558
- { buildClient: grpcClient }
559
- );
621
+ const { tx } = buildCoinToAddressBalanceMigration2({ coins, coinType: asset, owner, minAmount: shortfall });
622
+ const migration = await executeTx(client, signer, () => tx, { buildClient: grpcClient });
560
623
  return migration.gasCostSui;
561
624
  }
562
625
  async function finalize(response, opts) {
@@ -654,12 +717,35 @@ var SUPPORTED_ASSETS = {
654
717
  }
655
718
  };
656
719
  var STABLE_ASSETS = ["USDC", "USDsui"];
657
- ({
720
+ var OPERATION_ASSETS = {
721
+ send: ["USDC", "USDsui", "SUI"],
722
+ swap: "*"
723
+ };
724
+ function isAllowedAsset(op, asset) {
725
+ const allowed = OPERATION_ASSETS[op];
726
+ if (allowed === "*") return true;
727
+ const target = asset.toLowerCase();
728
+ return allowed.some((a) => a.toLowerCase() === target);
729
+ }
730
+ function assertAllowedAsset(op, asset) {
731
+ if (!asset) return;
732
+ if (!isAllowedAsset(op, asset)) {
733
+ const allowed = OPERATION_ASSETS[op];
734
+ const list = Array.isArray(allowed) ? allowed.join(", ") : "any";
735
+ const swapHint = " Swap to USDC or USDsui first, or send SUI." ;
736
+ throw new T2000Error(
737
+ "INVALID_ASSET",
738
+ `${op} only supports ${list}. Cannot use ${asset}.${swapHint}`
739
+ );
740
+ }
741
+ }
742
+ var GASLESS_STABLE_TYPES = {
658
743
  USDC: SUPPORTED_ASSETS.USDC.type,
659
744
  USDsui: SUPPORTED_ASSETS.USDsui.type
660
- });
745
+ };
661
746
  var T2000_OVERLAY_FEE_WALLET = process.env.T2000_OVERLAY_FEE_WALLET ?? "0x5366efbf2b4fe5767fe2e78eb197aa5f5d138d88ac3333fbf3f80a1927da473a";
662
747
  var DEFAULT_NETWORK = "mainnet";
748
+ var GASLESS_MIN_STABLE_AMOUNT = 0.01;
663
749
  var GAS_RESERVE_MIN = 0.05;
664
750
  init_errors();
665
751
  function validateAddress(address) {
@@ -900,6 +986,9 @@ function rawToStable(raw, decimals) {
900
986
  function getDecimals(asset) {
901
987
  return SUPPORTED_ASSETS[asset].decimals;
902
988
  }
989
+ function displayToRaw(amount, decimals) {
990
+ return BigInt(Math.round(amount * 10 ** decimals));
991
+ }
903
992
  function formatUsd(amount) {
904
993
  return `$${amount.toFixed(2)}`;
905
994
  }
@@ -937,6 +1026,23 @@ function fromBase642(b64) {
937
1026
  // src/protocols/cetus-swap.ts
938
1027
  init_token_registry();
939
1028
  init_token_registry();
1029
+ function preflightSwap(input) {
1030
+ if (typeof input.from !== "string" || input.from.trim() === "") {
1031
+ return preflightFail("INVALID_ASSET", "A `from` token is required to swap");
1032
+ }
1033
+ if (typeof input.to !== "string" || input.to.trim() === "") {
1034
+ return preflightFail("INVALID_ASSET", "A `to` token is required to swap");
1035
+ }
1036
+ const amountCheck = checkPositiveAmount(input.amount, "Amount", Number.POSITIVE_INFINITY);
1037
+ if (!amountCheck.valid) return amountCheck;
1038
+ const resolvedFrom = resolveTokenType(input.from);
1039
+ const resolvedTo = resolveTokenType(input.to);
1040
+ const sameToken = input.from.trim() === input.to.trim() || resolvedFrom !== null && resolvedFrom === resolvedTo;
1041
+ if (sameToken) {
1042
+ return preflightFail("INVALID_ASSET", `Cannot swap ${input.from} to itself`);
1043
+ }
1044
+ return PREFLIGHT_OK;
1045
+ }
940
1046
  var OVERLAY_FEE_RATE = 1e-3;
941
1047
  var clientCache = /* @__PURE__ */ new Map();
942
1048
  function getClient(walletAddress, overlayFee) {
@@ -1002,10 +1108,68 @@ async function buildSwapTx(params) {
1002
1108
  });
1003
1109
  return outputCoin;
1004
1110
  }
1111
+ init_errors();
1112
+ function preflightSend(input) {
1113
+ try {
1114
+ assertAllowedAsset("send", input.asset);
1115
+ } catch (e) {
1116
+ return preflightFail("INVALID_ASSET", e.message);
1117
+ }
1118
+ const amountCheck = checkPositiveAmount(input.amount);
1119
+ if (!amountCheck.valid) return amountCheck;
1120
+ if ((input.asset === "USDC" || input.asset === "USDsui") && input.amount < GASLESS_MIN_STABLE_AMOUNT) {
1121
+ return preflightFail(
1122
+ "INVALID_AMOUNT",
1123
+ `Minimum gasless transfer is ${GASLESS_MIN_STABLE_AMOUNT} ${input.asset}. Got ${input.amount}.`
1124
+ );
1125
+ }
1126
+ const addressCheck = checkSuiAddress(input.to);
1127
+ if (!addressCheck.valid) return addressCheck;
1128
+ return PREFLIGHT_OK;
1129
+ }
1130
+ async function buildSendTx({
1131
+ client,
1132
+ address,
1133
+ to,
1134
+ amount,
1135
+ asset
1136
+ }) {
1137
+ const pf = preflightSend({ to, amount, asset });
1138
+ if (!pf.valid) throw new T2000Error(pf.code, pf.error);
1139
+ const recipient = validateAddress(to);
1140
+ const assetInfo = SUPPORTED_ASSETS[asset];
1141
+ if (!assetInfo) throw new T2000Error("ASSET_NOT_SUPPORTED", `Asset ${asset} is not supported`);
1142
+ const rawAmount = displayToRaw(amount, assetInfo.decimals);
1143
+ const tx = new Transaction();
1144
+ tx.setSender(address);
1145
+ const balanceResp = await client.core.getBalance({ owner: address, coinType: assetInfo.type });
1146
+ const totalBalance = BigInt(balanceResp.balance.balance);
1147
+ if (totalBalance < rawAmount) {
1148
+ throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient ${asset} balance`, {
1149
+ available: Number(totalBalance) / 10 ** assetInfo.decimals,
1150
+ required: amount
1151
+ });
1152
+ }
1153
+ if (asset === "SUI") {
1154
+ const [sendCoin] = tx.splitCoins(tx.gas, [rawAmount]);
1155
+ tx.transferObjects([sendCoin], recipient);
1156
+ return tx;
1157
+ }
1158
+ const coinType = GASLESS_STABLE_TYPES[asset];
1159
+ tx.moveCall({
1160
+ target: "0x2::balance::send_funds",
1161
+ typeArguments: [coinType],
1162
+ arguments: [
1163
+ tx.balance({ type: coinType, balance: rawAmount }),
1164
+ tx.pure.address(recipient)
1165
+ ]
1166
+ });
1167
+ return tx;
1168
+ }
1005
1169
 
1006
1170
  // src/browser.ts
1007
1171
  init_token_registry();
1008
1172
 
1009
- export { CLOCK_ID, COIN_REGISTRY, DEFAULT_NETWORK, ETH_TYPE, GAS_RESERVE_MIN, IKA_TYPE, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, OVERLAY_FEE_RATE, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, buildSwapTx, classifyAction, classifyLabel, classifyTransaction, executeTx, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fromBase642 as fromBase64, getDecimals, getDecimalsForCoinType, mapMoveAbortCode, mapWalletError, mistToSui, parseSuiRpcTx, payWithMpp, rawToStable, rawToUsdc, refineLendingLabel, resolveSymbol, resolveTokenType, stableToRaw, suiToMist, toBase64, truncateAddress, usdcToRaw, validateAddress };
1173
+ export { CLOCK_ID, COIN_REGISTRY, DEFAULT_NETWORK, ETH_TYPE, GAS_RESERVE_MIN, IKA_TYPE, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, buildSendTx, buildSwapTx, checkPositiveAmount, checkSuiAddress, classifyAction, classifyLabel, classifyTransaction, executeTx, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fromBase642 as fromBase64, getDecimals, getDecimalsForCoinType, mapMoveAbortCode, mapWalletError, mistToSui, parseSuiRpcTx, payWithMpp, preflightFail, preflightPay, preflightSend, preflightSwap, rawToStable, rawToUsdc, refineLendingLabel, resolveSymbol, resolveTokenType, stableToRaw, suiToMist, toBase64, truncateAddress, usdcToRaw, validateAddress };
1010
1174
  //# sourceMappingURL=browser.js.map
1011
1175
  //# sourceMappingURL=browser.js.map