@t2000/sdk 4.2.1 → 4.2.2

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.d.cts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
3
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
4
- import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, v as SupportedAsset, _ as ZkLoginProof, ax as SendableAsset } from './types-8CNP74n6.cjs';
5
- export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, ay as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, az as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, f as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, F as FeeOperation, aA as GASLESS_MIN_STABLE_AMOUNT, aB as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, aC as OPERATION_ASSETS, O as OUTBOUND_OPS, aD as Operation, P as ProtocolFeeInfo, aE as SAVEABLE_ASSETS, S as SAVE_FEE_BPS, aF as SENDABLE_ASSETS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, aG as SaveableAsset, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, J as TxDirection, U as USDC_DECIMALS, R as USDC_TYPE, V as USDE_TYPE, W as USDSUI_TYPE, X as USDT_TYPE, Y as WAL_TYPE, Z as WBTC_TYPE, $ as ZkLoginSigner, a0 as addFeeTransfer, aH as assertAllowedAsset, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, aI as createSuiClient, a5 as extractAllUserLegs, a6 as extractTransferDetails, a7 as extractTxCommands, a8 as extractTxSender, a9 as fallbackLabel, aa as formatAssetAmount, ab as formatSui, ac as formatUsd, aJ as getCoinMeta, ad as getDecimals, ae as getDecimalsForCoinType, aK as getSuiClient, aL as getSuiGrpcClient, af as getTier, aM as isAllowedAsset, aN as isInRegistry, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, aO as normalizeAsset, aP as normalizeCoinType, am as parseSuiRpcTx, aQ as queryHistory, aR as queryTransaction, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, aS as simulateTransaction, as as stableToRaw, at as suiToMist, aT as throwIfSimulationFailed, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-8CNP74n6.cjs';
4
+ import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, v as SupportedAsset, _ as ZkLoginProof, ax as SendableAsset } from './types-BjvEpkwT.cjs';
5
+ export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, ay as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, az as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, f as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, F as FeeOperation, aA as GASLESS_MIN_STABLE_AMOUNT, aB as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, aC as OPERATION_ASSETS, O as OUTBOUND_OPS, aD as Operation, P as ProtocolFeeInfo, aE as SAVEABLE_ASSETS, S as SAVE_FEE_BPS, aF as SENDABLE_ASSETS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, aG as SaveableAsset, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, J as TxDirection, U as USDC_DECIMALS, R as USDC_TYPE, V as USDE_TYPE, W as USDSUI_TYPE, X as USDT_TYPE, Y as WAL_TYPE, Z as WBTC_TYPE, $ as ZkLoginSigner, a0 as addFeeTransfer, aH as assertAllowedAsset, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, aI as createSuiClient, a5 as extractAllUserLegs, a6 as extractTransferDetails, a7 as extractTxCommands, a8 as extractTxSender, a9 as fallbackLabel, aa as formatAssetAmount, ab as formatSui, ac as formatUsd, aJ as getCoinMeta, ad as getDecimals, ae as getDecimalsForCoinType, aK as getSuiClient, aL as getSuiGrpcClient, af as getTier, aM as isAllowedAsset, aN as isInRegistry, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, aO as normalizeAsset, aP as normalizeCoinType, am as parseSuiRpcTx, aQ as queryHistory, aR as queryTransaction, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, aS as simulateTransaction, as as stableToRaw, at as suiToMist, aT as throwIfSimulationFailed, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-BjvEpkwT.cjs';
6
6
  import { L as LendingAdapter, a as LendingRates, P as PendingReward$1 } from './descriptors-DqIb4AnV.cjs';
7
7
  export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from './descriptors-DqIb4AnV.cjs';
8
- import { n as T2000Options, P as PayOptions, d as PayResult, o as SwapResult, p as SwapQuoteResult, i as SendResult, B as BalanceResponse, k as TransactionRecord, D as DepositInfo, q as PaymentRequest, S as SaveResult, W as WithdrawResult, b as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, r as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, c as OverlayFeeConfig, s as SponsoredCoinMergeCache, j as SwapRouteResult, t as FinancialSummary } from './types-DUmk5ivZ.cjs';
9
- export { A as AssetRates, u as CoinPage, G as GasReserve, v as HFAlertLevel, O as OVERLAY_FEE_RATE, f as PositionEntry, w as SelectAndSplitResult, x as SerializedCetusRoute, y as SerializedCetusRoutePath, z as SerializedRouterDataV3, T as TransactionLeg, I as addSwapToTx, l as buildSwapTx, J as deserializeCetusRoute, K as fetchAllCoins, m as findSwapRoute, L as isCetusRouteFresh, N as selectAndSplitCoin, Q as selectSuiCoin, U as serializeCetusRoute, V as verifyCetusRouteCoinMatch } from './types-DUmk5ivZ.cjs';
8
+ import { n as T2000Options, P as PayOptions, d as PayResult, o as SwapResult, p as SwapQuoteResult, i as SendResult, B as BalanceResponse, k as TransactionRecord, D as DepositInfo, q as PaymentRequest, S as SaveResult, W as WithdrawResult, b as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, r as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, c as OverlayFeeConfig, s as SponsoredCoinMergeCache, j as SwapRouteResult, t as FinancialSummary } from './types-Ch0zVUpC.cjs';
9
+ export { A as AssetRates, u as CoinPage, G as GasReserve, v as HFAlertLevel, O as OVERLAY_FEE_RATE, f as PositionEntry, w as SelectAndSplitResult, x as SerializedCetusRoute, y as SerializedCetusRoutePath, z as SerializedRouterDataV3, T as TransactionLeg, I as addSwapToTx, l as buildSwapTx, J as deserializeCetusRoute, K as fetchAllCoins, m as findSwapRoute, L as isCetusRouteFresh, N as selectAndSplitCoin, Q as selectSuiCoin, U as serializeCetusRoute, V as verifyCetusRouteCoinMatch } from './types-Ch0zVUpC.cjs';
10
10
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
11
11
  import { SuinsClient } from '@mysten/suins';
12
12
  export { NaviAdapter, ProtocolRegistry } from './adapters/index.cjs';
@@ -874,14 +874,15 @@ interface AppenderContext {
874
874
  */
875
875
  isOutputConsumed?: boolean;
876
876
  /**
877
- * Per-PTB merge cache for sponsored SUI sourcing, shared across every
878
- * appender in a single `composeTx` run. Lets multiple SUI-source swap
879
- * legs in one bundle reuse a single merged primary coin instead of each
880
- * re-fetching + re-merging the same coin objects (the second merge of
881
- * which references already-consumed coins Enoki dry-run
882
- * `ArgumentWithoutValue`). See `SponsoredCoinMergeCache` JSDoc.
877
+ * Per-PTB merge cache for sponsored coin-object sourcing, shared across
878
+ * every appender in a single `composeTx` run. Lets multiple legs that
879
+ * source the same coin type (two SUI swaps, swap USDC + save USDC, etc.)
880
+ * reuse a single merged primary coin instead of each re-fetching +
881
+ * re-merging the same coin objects (the second merge of which references
882
+ * already-consumed coins → Enoki dry-run `ArgumentWithoutValue`). Applies
883
+ * to ALL coin types, not just SUI. See `SponsoredCoinMergeCache` JSDoc.
883
884
  */
884
- suiMergeCache?: SponsoredCoinMergeCache;
885
+ coinMergeCache?: SponsoredCoinMergeCache;
885
886
  }
886
887
  /**
887
888
  * [SPEC 13 Phase 1] Appender return shape. Producers populate
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
2
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
3
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
4
- import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, v as SupportedAsset, _ as ZkLoginProof, ax as SendableAsset } from './types-BTbqE8AE.js';
5
- export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, ay as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, az as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, f as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, F as FeeOperation, aA as GASLESS_MIN_STABLE_AMOUNT, aB as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, aC as OPERATION_ASSETS, O as OUTBOUND_OPS, aD as Operation, P as ProtocolFeeInfo, aE as SAVEABLE_ASSETS, S as SAVE_FEE_BPS, aF as SENDABLE_ASSETS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, aG as SaveableAsset, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, J as TxDirection, U as USDC_DECIMALS, R as USDC_TYPE, V as USDE_TYPE, W as USDSUI_TYPE, X as USDT_TYPE, Y as WAL_TYPE, Z as WBTC_TYPE, $ as ZkLoginSigner, a0 as addFeeTransfer, aH as assertAllowedAsset, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, aI as createSuiClient, a5 as extractAllUserLegs, a6 as extractTransferDetails, a7 as extractTxCommands, a8 as extractTxSender, a9 as fallbackLabel, aa as formatAssetAmount, ab as formatSui, ac as formatUsd, aJ as getCoinMeta, ad as getDecimals, ae as getDecimalsForCoinType, aK as getSuiClient, aL as getSuiGrpcClient, af as getTier, aM as isAllowedAsset, aN as isInRegistry, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, aO as normalizeAsset, aP as normalizeCoinType, am as parseSuiRpcTx, aQ as queryHistory, aR as queryTransaction, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, aS as simulateTransaction, as as stableToRaw, at as suiToMist, aT as throwIfSimulationFailed, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-BTbqE8AE.js';
4
+ import { Q as TxMetadata, o as SafeguardConfig, T as T2000Error, H as TransactionSigner, v as SupportedAsset, _ as ZkLoginProof, ax as SendableAsset } from './types-CElCPOFA.js';
5
+ export { A as ALL_NAVI_ASSETS, B as BORROW_FEE_BPS, a as BPS_DENOMINATOR, ay as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, az as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, f as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, F as FeeOperation, aA as GASLESS_MIN_STABLE_AMOUNT, aB as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, aC as OPERATION_ASSETS, O as OUTBOUND_OPS, aD as Operation, P as ProtocolFeeInfo, aE as SAVEABLE_ASSETS, S as SAVE_FEE_BPS, aF as SENDABLE_ASSETS, k as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, p as SafeguardError, q as SafeguardErrorDetails, r as SafeguardRule, aG as SaveableAsset, s as SimulationResult, t as StableAsset, u as SuiRpcTxBlock, w as T2000ErrorCode, x as T2000ErrorData, y as T2000_OVERLAY_FEE_WALLET, z as TOKEN_MAP, J as TxDirection, U as USDC_DECIMALS, R as USDC_TYPE, V as USDE_TYPE, W as USDSUI_TYPE, X as USDT_TYPE, Y as WAL_TYPE, Z as WBTC_TYPE, $ as ZkLoginSigner, a0 as addFeeTransfer, aH as assertAllowedAsset, a1 as calculateFee, a2 as classifyAction, a3 as classifyLabel, a4 as classifyTransaction, aI as createSuiClient, a5 as extractAllUserLegs, a6 as extractTransferDetails, a7 as extractTxCommands, a8 as extractTxSender, a9 as fallbackLabel, aa as formatAssetAmount, ab as formatSui, ac as formatUsd, aJ as getCoinMeta, ad as getDecimals, ae as getDecimalsForCoinType, aK as getSuiClient, aL as getSuiGrpcClient, af as getTier, aM as isAllowedAsset, aN as isInRegistry, ag as isSupported, ah as isTier1, ai as isTier2, aj as mapMoveAbortCode, ak as mapWalletError, al as mistToSui, aO as normalizeAsset, aP as normalizeCoinType, am as parseSuiRpcTx, aQ as queryHistory, aR as queryTransaction, an as rawToStable, ao as rawToUsdc, ap as refineLendingLabel, aq as resolveSymbol, ar as resolveTokenType, aS as simulateTransaction, as as stableToRaw, at as suiToMist, aT as throwIfSimulationFailed, au as truncateAddress, av as usdcToRaw, aw as validateAddress } from './types-CElCPOFA.js';
6
6
  import { L as LendingAdapter, a as LendingRates, P as PendingReward$1 } from './descriptors-DqIb4AnV.js';
7
7
  export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from './descriptors-DqIb4AnV.js';
8
- import { n as T2000Options, P as PayOptions, d as PayResult, o as SwapResult, p as SwapQuoteResult, i as SendResult, B as BalanceResponse, k as TransactionRecord, D as DepositInfo, q as PaymentRequest, S as SaveResult, W as WithdrawResult, b as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, r as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, c as OverlayFeeConfig, s as SponsoredCoinMergeCache, j as SwapRouteResult, t as FinancialSummary } from './types-DUmk5ivZ.js';
9
- export { A as AssetRates, u as CoinPage, G as GasReserve, v as HFAlertLevel, O as OVERLAY_FEE_RATE, f as PositionEntry, w as SelectAndSplitResult, x as SerializedCetusRoute, y as SerializedCetusRoutePath, z as SerializedRouterDataV3, T as TransactionLeg, I as addSwapToTx, l as buildSwapTx, J as deserializeCetusRoute, K as fetchAllCoins, m as findSwapRoute, L as isCetusRouteFresh, N as selectAndSplitCoin, Q as selectSuiCoin, U as serializeCetusRoute, V as verifyCetusRouteCoinMatch } from './types-DUmk5ivZ.js';
8
+ import { n as T2000Options, P as PayOptions, d as PayResult, o as SwapResult, p as SwapQuoteResult, i as SendResult, B as BalanceResponse, k as TransactionRecord, D as DepositInfo, q as PaymentRequest, S as SaveResult, W as WithdrawResult, b as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, r as CompoundRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, c as OverlayFeeConfig, s as SponsoredCoinMergeCache, j as SwapRouteResult, t as FinancialSummary } from './types-Ch0zVUpC.js';
9
+ export { A as AssetRates, u as CoinPage, G as GasReserve, v as HFAlertLevel, O as OVERLAY_FEE_RATE, f as PositionEntry, w as SelectAndSplitResult, x as SerializedCetusRoute, y as SerializedCetusRoutePath, z as SerializedRouterDataV3, T as TransactionLeg, I as addSwapToTx, l as buildSwapTx, J as deserializeCetusRoute, K as fetchAllCoins, m as findSwapRoute, L as isCetusRouteFresh, N as selectAndSplitCoin, Q as selectSuiCoin, U as serializeCetusRoute, V as verifyCetusRouteCoinMatch } from './types-Ch0zVUpC.js';
10
10
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
11
11
  import { SuinsClient } from '@mysten/suins';
12
12
  export { NaviAdapter, ProtocolRegistry } from './adapters/index.js';
@@ -874,14 +874,15 @@ interface AppenderContext {
874
874
  */
875
875
  isOutputConsumed?: boolean;
876
876
  /**
877
- * Per-PTB merge cache for sponsored SUI sourcing, shared across every
878
- * appender in a single `composeTx` run. Lets multiple SUI-source swap
879
- * legs in one bundle reuse a single merged primary coin instead of each
880
- * re-fetching + re-merging the same coin objects (the second merge of
881
- * which references already-consumed coins Enoki dry-run
882
- * `ArgumentWithoutValue`). See `SponsoredCoinMergeCache` JSDoc.
877
+ * Per-PTB merge cache for sponsored coin-object sourcing, shared across
878
+ * every appender in a single `composeTx` run. Lets multiple legs that
879
+ * source the same coin type (two SUI swaps, swap USDC + save USDC, etc.)
880
+ * reuse a single merged primary coin instead of each re-fetching +
881
+ * re-merging the same coin objects (the second merge of which references
882
+ * already-consumed coins → Enoki dry-run `ArgumentWithoutValue`). Applies
883
+ * to ALL coin types, not just SUI. See `SponsoredCoinMergeCache` JSDoc.
883
884
  */
884
- suiMergeCache?: SponsoredCoinMergeCache;
885
+ coinMergeCache?: SponsoredCoinMergeCache;
885
886
  }
886
887
  /**
887
888
  * [SPEC 13 Phase 1] Appender return shape. Producers populate
package/dist/index.js CHANGED
@@ -672,7 +672,15 @@ async function fetchAllCoins(client, owner, coinType) {
672
672
  }
673
673
  async function selectAndSplitCoin(tx, client, owner, coinType, amount, options = {}) {
674
674
  if (options.sponsoredContext) {
675
- return selectCoinObjectsOnly(tx, client, owner, coinType, amount, options.allowSwapAll ?? true);
675
+ return selectCoinObjectsOnly(
676
+ tx,
677
+ client,
678
+ owner,
679
+ coinType,
680
+ amount,
681
+ options.allowSwapAll ?? true,
682
+ options.mergeCache
683
+ );
676
684
  }
677
685
  const balanceResp = await client.getBalance({ owner, coinType });
678
686
  const totalBalance = BigInt(balanceResp.totalBalance);
@@ -979,14 +987,15 @@ async function addSwapToTx(tx, client, address, input) {
979
987
  address,
980
988
  requestedRaw,
981
989
  input.sponsoredContext ?? false,
982
- input.suiMergeCache
990
+ input.coinMergeCache
983
991
  );
984
992
  inputCoin = result.coin;
985
993
  effectiveRaw = result.effectiveAmount;
986
994
  } else {
987
995
  const { selectAndSplitCoin: selectAndSplitCoin2 } = await Promise.resolve().then(() => (init_coinSelection(), coinSelection_exports));
988
996
  const result = await selectAndSplitCoin2(tx, client, address, fromType, requestedRaw, {
989
- sponsoredContext: input.sponsoredContext ?? false
997
+ sponsoredContext: input.sponsoredContext ?? false,
998
+ mergeCache: input.coinMergeCache
990
999
  });
991
1000
  inputCoin = result.coin;
992
1001
  effectiveRaw = result.effectiveAmount;
@@ -7967,7 +7976,8 @@ var WRITE_APPENDER_REGISTRY = {
7967
7976
  effectiveAmount = rawAmount;
7968
7977
  } else {
7969
7978
  const r = await selectAndSplitCoin(tx, ctx.client, ctx.sender, assetInfo.type, rawAmount, {
7970
- sponsoredContext: ctx.sponsoredContext
7979
+ sponsoredContext: ctx.sponsoredContext,
7980
+ mergeCache: ctx.coinMergeCache
7971
7981
  });
7972
7982
  coin = r.coin;
7973
7983
  effectiveAmount = r.effectiveAmount;
@@ -8041,7 +8051,8 @@ var WRITE_APPENDER_REGISTRY = {
8041
8051
  effectiveAmount = rawAmount;
8042
8052
  } else {
8043
8053
  const r = await selectAndSplitCoin(tx, ctx.client, ctx.sender, assetInfo.type, rawAmount, {
8044
- sponsoredContext: ctx.sponsoredContext
8054
+ sponsoredContext: ctx.sponsoredContext,
8055
+ mergeCache: ctx.coinMergeCache
8045
8056
  });
8046
8057
  coin = r.coin;
8047
8058
  effectiveAmount = r.effectiveAmount;
@@ -8085,7 +8096,14 @@ var WRITE_APPENDER_REGISTRY = {
8085
8096
  };
8086
8097
  }
8087
8098
  if (asset === "SUI") {
8088
- const result = await selectSuiCoin(tx, ctx.client, ctx.sender, rawAmount, ctx.sponsoredContext);
8099
+ const result = await selectSuiCoin(
8100
+ tx,
8101
+ ctx.client,
8102
+ ctx.sender,
8103
+ rawAmount,
8104
+ ctx.sponsoredContext,
8105
+ ctx.coinMergeCache
8106
+ );
8089
8107
  addSendToTx(tx, result.coin, recipient);
8090
8108
  return {
8091
8109
  preview: {
@@ -8148,7 +8166,7 @@ var WRITE_APPENDER_REGISTRY = {
8148
8166
  inputCoin: ctx.chainedCoin,
8149
8167
  precomputedRoute: input.precomputedRoute,
8150
8168
  sponsoredContext: ctx.sponsoredContext,
8151
- suiMergeCache: ctx.suiMergeCache
8169
+ coinMergeCache: ctx.coinMergeCache
8152
8170
  });
8153
8171
  if (!ctx.isOutputConsumed) {
8154
8172
  tx.transferObjects([result.coin], ctx.sender);
@@ -8252,10 +8270,10 @@ async function composeTx(opts) {
8252
8270
  sponsoredContext: opts.sponsoredContext ?? false,
8253
8271
  overlayFee: opts.overlayFee,
8254
8272
  feeHooks: opts.feeHooks,
8255
- // One cache per compose run — shared across all legs so multi-leg
8256
- // sponsored bundles that source the same coin (e.g. two SUI swaps)
8257
- // merge that coin's objects exactly once.
8258
- suiMergeCache: /* @__PURE__ */ new Map()
8273
+ // One cache per compose run — shared across all legs (any coin type)
8274
+ // so multi-leg sponsored bundles that source the same coin (two SUI
8275
+ // swaps, swap USDC + save USDC, ...) merge that coin's objects once.
8276
+ coinMergeCache: /* @__PURE__ */ new Map()
8259
8277
  };
8260
8278
  const consumedSteps = /* @__PURE__ */ new Set();
8261
8279
  for (let i = 0; i < opts.steps.length; i++) {