@t2000/sdk 5.3.0 → 5.5.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.
@@ -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-BTIIpnXc.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 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';
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-BTIIpnXc.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 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';
2
2
  import '@mysten/sui/keypairs/ed25519';
3
3
  import '@mysten/sui/grpc';
4
4
  import '@mysten/sui/client';
package/dist/browser.js CHANGED
@@ -124,6 +124,7 @@ __export(token_registry_exports, {
124
124
  getCoinMeta: () => getCoinMeta,
125
125
  getDecimalsForCoinType: () => getDecimalsForCoinType,
126
126
  isInRegistry: () => isInRegistry,
127
+ resolveCoinDecimals: () => resolveCoinDecimals,
127
128
  resolveSymbol: () => resolveSymbol,
128
129
  resolveTokenType: () => resolveTokenType
129
130
  });
@@ -145,6 +146,16 @@ function getDecimalsForCoinType(coinType) {
145
146
  }
146
147
  return 9;
147
148
  }
149
+ async function resolveCoinDecimals(client, coinType) {
150
+ if (isInRegistry(coinType)) return getDecimalsForCoinType(coinType);
151
+ try {
152
+ const res = await client.core.getCoinMetadata({ coinType });
153
+ const d = res?.metadata?.decimals ?? res?.decimals;
154
+ if (typeof d === "number" && Number.isFinite(d)) return d;
155
+ } catch {
156
+ }
157
+ return getDecimalsForCoinType(coinType);
158
+ }
148
159
  function resolveSymbol(coinType) {
149
160
  const direct = BY_TYPE.get(coinType);
150
161
  if (direct) return direct.symbol;