@t2000/sdk 10.22.0 → 10.24.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/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/{commerce-D79xwwJ8.d.cts → commerce-B_eH6fvR.d.cts} +2 -2
- package/dist/{commerce-D79xwwJ8.d.ts → commerce-B_eH6fvR.d.ts} +2 -2
- package/dist/index.cjs +40 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +41 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -295,7 +295,7 @@ type SponsoredCoinMergeCache = Map<string, {
|
|
|
295
295
|
*/
|
|
296
296
|
declare function selectSuiCoin(tx: Transaction, client: SuiCoreClient, owner: string, amountMist: bigint, sponsoredContext: boolean, mergeCache?: SponsoredCoinMergeCache): Promise<SelectAndSplitResult>;
|
|
297
297
|
|
|
298
|
-
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'ADDRESS_BALANCE_UNSPONSORABLE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'INVALID_INPUT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'WALLET_CORRUPT' | 'INVALID_KEY' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'INVALID_ASSET' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'SUINS_NOT_REGISTERED' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'DIALECT_UNSUPPORTED' | 'ESCROW_REQUIRED' | 'CHAIN_MODE_INVALID' | 'INFERENCE_FAILED' | 'UNKNOWN';
|
|
298
|
+
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'ADDRESS_BALANCE_UNSPONSORABLE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'INVALID_INPUT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'WALLET_CORRUPT' | 'INVALID_KEY' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'INVALID_ASSET' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'SUINS_NOT_REGISTERED' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'SWAP_QUOTE_STALE' | 'SWAP_ROUTE_MISMATCH' | 'DIALECT_UNSUPPORTED' | 'ESCROW_REQUIRED' | 'CHAIN_MODE_INVALID' | 'INFERENCE_FAILED' | 'UNKNOWN';
|
|
299
299
|
interface T2000ErrorData {
|
|
300
300
|
reason?: string;
|
|
301
301
|
[key: string]: unknown;
|
|
@@ -1556,4 +1556,4 @@ declare function putJobSpec(base: string, content: string): Promise<string>;
|
|
|
1556
1556
|
* the store is untrusted; the chain hash is the authority). */
|
|
1557
1557
|
declare function getJobSpec(base: string, hash: string): Promise<string>;
|
|
1558
1558
|
|
|
1559
|
-
export { type T2000ErrorData as $, A2A_ESCROW_FEE_CONFIG_ID as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_ACTIVITY_REPORT_URL as D, ETH_TYPE as E, SUI_TYPE as F, GAS_RESERVE_MIN as G, SUPPORTED_ASSETS as H, IKA_TYPE as I, JOB_STATES as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OVERLAY_FEE_RATE as O, PREFLIGHT_MAX_AMOUNT as P, type SendResult as Q, type ServiceListing as R, STABLE_ASSETS as S, type SimulationResult as T, type StableAsset as U, type SuiHolding as V, type SuiRpcTxBlock as W, type SupportedAsset as X, type SwapRouteResult as Y, T2000Error as Z, type T2000ErrorCode as _, A2A_ESCROW_PACKAGE_ID as a, suiToMist as a$, T2000_OVERLAY_FEE_WALLET as a0, TOKEN_MAP as a1, type TransactionLeg as a2, type TransactionRecord as a3, type TransactionSigner as a4, type TxDirection as a5, USDC_DECIMALS as a6, USDC_TYPE as a7, USDE_TYPE as a8, USDSUI_TYPE as a9, formatAssetAmount as aA, formatSui as aB, formatUsd as aC, getDecimals as aD, getDecimalsForCoinType as aE, getJob as aF, getJobSpec as aG, jobActionsFor as aH, listServices as aI, mapMoveAbortCode as aJ, mapWalletError as aK, mistToSui as aL, parseSuiRpcTx as aM, payWithX402 as aN, preflightCreateJob as aO, preflightFail as aP, preflightPay as aQ, preflightSend as aR, preflightSwap as aS, putJobSpec as aT, rawToStable as aU, rawToUsdc as aV, refineLendingLabel as aW, reportX402Activity as aX, resolveSymbol as aY, resolveTokenType as aZ, stableToRaw as a_, USDT_TYPE as aa, WAL_TYPE as ab, WBTC_TYPE as ac, type X402ActivityPayload as ad, type ZkLoginProof as ae, ZkLoginSigner as af, buildCreateJobTx as ag, buildDeliverJobTx as ah, buildRefundJobTx as ai, buildRejectJobTx as aj, buildReleaseJobTx as ak, buildSendTx as al, buildSwapTx as am, checkPositiveAmount as an, checkSuiAddress as ao, classifyAction as ap, classifyLabel as aq, classifyTransaction as ar, executeTx as as, extractAllUserLegs as at, extractTransferDetails as au, extractTxCommands as av, extractTxSender as aw, fallbackLabel as ax, fetchService as ay, findSwapRoute as az, type ActivityReportConfig as b, truncateAddress as b0, usdcToRaw as b1, validateAddress as b2, verifyJobForSeller as b3, type T2000Options as b4, type
|
|
1559
|
+
export { type T2000ErrorData as $, A2A_ESCROW_FEE_CONFIG_ID as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_ACTIVITY_REPORT_URL as D, ETH_TYPE as E, SUI_TYPE as F, GAS_RESERVE_MIN as G, SUPPORTED_ASSETS as H, IKA_TYPE as I, JOB_STATES as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OVERLAY_FEE_RATE as O, PREFLIGHT_MAX_AMOUNT as P, type SendResult as Q, type ServiceListing as R, STABLE_ASSETS as S, type SimulationResult as T, type StableAsset as U, type SuiHolding as V, type SuiRpcTxBlock as W, type SupportedAsset as X, type SwapRouteResult as Y, T2000Error as Z, type T2000ErrorCode as _, A2A_ESCROW_PACKAGE_ID as a, suiToMist as a$, T2000_OVERLAY_FEE_WALLET as a0, TOKEN_MAP as a1, type TransactionLeg as a2, type TransactionRecord as a3, type TransactionSigner as a4, type TxDirection as a5, USDC_DECIMALS as a6, USDC_TYPE as a7, USDE_TYPE as a8, USDSUI_TYPE as a9, formatAssetAmount as aA, formatSui as aB, formatUsd as aC, getDecimals as aD, getDecimalsForCoinType as aE, getJob as aF, getJobSpec as aG, jobActionsFor as aH, listServices as aI, mapMoveAbortCode as aJ, mapWalletError as aK, mistToSui as aL, parseSuiRpcTx as aM, payWithX402 as aN, preflightCreateJob as aO, preflightFail as aP, preflightPay as aQ, preflightSend as aR, preflightSwap as aS, putJobSpec as aT, rawToStable as aU, rawToUsdc as aV, refineLendingLabel as aW, reportX402Activity as aX, resolveSymbol as aY, resolveTokenType as aZ, stableToRaw as a_, USDT_TYPE as aa, WAL_TYPE as ab, WBTC_TYPE as ac, type X402ActivityPayload as ad, type ZkLoginProof as ae, ZkLoginSigner as af, buildCreateJobTx as ag, buildDeliverJobTx as ah, buildRefundJobTx as ai, buildRejectJobTx as aj, buildReleaseJobTx as ak, buildSendTx as al, buildSwapTx as am, checkPositiveAmount as an, checkSuiAddress as ao, classifyAction as ap, classifyLabel as aq, classifyTransaction as ar, executeTx as as, extractAllUserLegs as at, extractTransferDetails as au, extractTxCommands as av, extractTxSender as aw, fallbackLabel as ax, fetchService as ay, findSwapRoute as az, type ActivityReportConfig as b, truncateAddress as b0, usdcToRaw as b1, validateAddress as b2, verifyJobForSeller as b3, type T2000Options as b4, type SerializedCetusRoute as b5, type SwapResult as b6, type SwapQuoteResult as b7, type PaymentRequest as b8, type SuiCoreClient as b9, normalizeAsset as bA, normalizeCoinType as bB, queryHistory as bC, queryTransaction as bD, selectAndSplitCoin as bE, selectSuiCoin as bF, serializeCetusRoute as bG, simulateTransaction as bH, throwIfSimulationFailed as bI, verifyCetusRouteCoinMatch as bJ, type SponsoredCoinMergeCache as ba, type SendableAsset as bb, CETUS_USDC_SUI_POOL as bc, type CoinPage as bd, DEFAULT_GRPC_URL as be, GASLESS_MIN_STABLE_AMOUNT as bf, GASLESS_STABLE_TYPES as bg, OPERATION_ASSETS as bh, type Operation as bi, SENDABLE_ASSETS as bj, type SelectAndSplitResult as bk, type SerializedCetusRoutePath as bl, type SerializedRouterDataV3 as bm, addSendToTx as bn, addSwapToTx as bo, assertAllowedAsset as bp, assertBuyerRequirements as bq, buildDeclineJobTx as br, deserializeCetusRoute as bs, fetchAllCoins as bt, getCoinMeta as bu, getSuiClient as bv, getSuiGrpcClient as bw, isAllowedAsset as bx, isCetusRouteFresh as by, isInRegistry as bz, COIN_REGISTRY as c, type ClassifyBalanceChange as d, type ClassifyResult as e, type CoinMeta as f, DEFAULT_COMMERCE_API_BASE as g, DEFAULT_NETWORK as h, type DepositInfo as i, type ExtractedTransfer as j, type Job as k, type JobState as l, type JobTerms as m, type JobVerification as n, KeypairSigner as o, LOFI_TYPE as p, MAX_DELIVER_HORIZON_MS as q, MAX_JOB_USDC as r, MAX_REVIEW_WINDOW_MS as s, MIST_PER_SUI as t, type OverlayFeeConfig as u, PREFLIGHT_OK as v, type PayOptions as w, type PayResult as x, type PreflightResult as y, SUI_DECIMALS as z };
|
|
@@ -295,7 +295,7 @@ type SponsoredCoinMergeCache = Map<string, {
|
|
|
295
295
|
*/
|
|
296
296
|
declare function selectSuiCoin(tx: Transaction, client: SuiCoreClient, owner: string, amountMist: bigint, sponsoredContext: boolean, mergeCache?: SponsoredCoinMergeCache): Promise<SelectAndSplitResult>;
|
|
297
297
|
|
|
298
|
-
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'ADDRESS_BALANCE_UNSPONSORABLE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'INVALID_INPUT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'WALLET_CORRUPT' | 'INVALID_KEY' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'INVALID_ASSET' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'SUINS_NOT_REGISTERED' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'DIALECT_UNSUPPORTED' | 'ESCROW_REQUIRED' | 'CHAIN_MODE_INVALID' | 'INFERENCE_FAILED' | 'UNKNOWN';
|
|
298
|
+
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'ADDRESS_BALANCE_UNSPONSORABLE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'INVALID_INPUT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'WALLET_CORRUPT' | 'INVALID_KEY' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'INVALID_ASSET' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'SUINS_NOT_REGISTERED' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'SWAP_QUOTE_STALE' | 'SWAP_ROUTE_MISMATCH' | 'DIALECT_UNSUPPORTED' | 'ESCROW_REQUIRED' | 'CHAIN_MODE_INVALID' | 'INFERENCE_FAILED' | 'UNKNOWN';
|
|
299
299
|
interface T2000ErrorData {
|
|
300
300
|
reason?: string;
|
|
301
301
|
[key: string]: unknown;
|
|
@@ -1556,4 +1556,4 @@ declare function putJobSpec(base: string, content: string): Promise<string>;
|
|
|
1556
1556
|
* the store is untrusted; the chain hash is the authority). */
|
|
1557
1557
|
declare function getJobSpec(base: string, hash: string): Promise<string>;
|
|
1558
1558
|
|
|
1559
|
-
export { type T2000ErrorData as $, A2A_ESCROW_FEE_CONFIG_ID as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_ACTIVITY_REPORT_URL as D, ETH_TYPE as E, SUI_TYPE as F, GAS_RESERVE_MIN as G, SUPPORTED_ASSETS as H, IKA_TYPE as I, JOB_STATES as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OVERLAY_FEE_RATE as O, PREFLIGHT_MAX_AMOUNT as P, type SendResult as Q, type ServiceListing as R, STABLE_ASSETS as S, type SimulationResult as T, type StableAsset as U, type SuiHolding as V, type SuiRpcTxBlock as W, type SupportedAsset as X, type SwapRouteResult as Y, T2000Error as Z, type T2000ErrorCode as _, A2A_ESCROW_PACKAGE_ID as a, suiToMist as a$, T2000_OVERLAY_FEE_WALLET as a0, TOKEN_MAP as a1, type TransactionLeg as a2, type TransactionRecord as a3, type TransactionSigner as a4, type TxDirection as a5, USDC_DECIMALS as a6, USDC_TYPE as a7, USDE_TYPE as a8, USDSUI_TYPE as a9, formatAssetAmount as aA, formatSui as aB, formatUsd as aC, getDecimals as aD, getDecimalsForCoinType as aE, getJob as aF, getJobSpec as aG, jobActionsFor as aH, listServices as aI, mapMoveAbortCode as aJ, mapWalletError as aK, mistToSui as aL, parseSuiRpcTx as aM, payWithX402 as aN, preflightCreateJob as aO, preflightFail as aP, preflightPay as aQ, preflightSend as aR, preflightSwap as aS, putJobSpec as aT, rawToStable as aU, rawToUsdc as aV, refineLendingLabel as aW, reportX402Activity as aX, resolveSymbol as aY, resolveTokenType as aZ, stableToRaw as a_, USDT_TYPE as aa, WAL_TYPE as ab, WBTC_TYPE as ac, type X402ActivityPayload as ad, type ZkLoginProof as ae, ZkLoginSigner as af, buildCreateJobTx as ag, buildDeliverJobTx as ah, buildRefundJobTx as ai, buildRejectJobTx as aj, buildReleaseJobTx as ak, buildSendTx as al, buildSwapTx as am, checkPositiveAmount as an, checkSuiAddress as ao, classifyAction as ap, classifyLabel as aq, classifyTransaction as ar, executeTx as as, extractAllUserLegs as at, extractTransferDetails as au, extractTxCommands as av, extractTxSender as aw, fallbackLabel as ax, fetchService as ay, findSwapRoute as az, type ActivityReportConfig as b, truncateAddress as b0, usdcToRaw as b1, validateAddress as b2, verifyJobForSeller as b3, type T2000Options as b4, type
|
|
1559
|
+
export { type T2000ErrorData as $, A2A_ESCROW_FEE_CONFIG_ID as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_ACTIVITY_REPORT_URL as D, ETH_TYPE as E, SUI_TYPE as F, GAS_RESERVE_MIN as G, SUPPORTED_ASSETS as H, IKA_TYPE as I, JOB_STATES as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OVERLAY_FEE_RATE as O, PREFLIGHT_MAX_AMOUNT as P, type SendResult as Q, type ServiceListing as R, STABLE_ASSETS as S, type SimulationResult as T, type StableAsset as U, type SuiHolding as V, type SuiRpcTxBlock as W, type SupportedAsset as X, type SwapRouteResult as Y, T2000Error as Z, type T2000ErrorCode as _, A2A_ESCROW_PACKAGE_ID as a, suiToMist as a$, T2000_OVERLAY_FEE_WALLET as a0, TOKEN_MAP as a1, type TransactionLeg as a2, type TransactionRecord as a3, type TransactionSigner as a4, type TxDirection as a5, USDC_DECIMALS as a6, USDC_TYPE as a7, USDE_TYPE as a8, USDSUI_TYPE as a9, formatAssetAmount as aA, formatSui as aB, formatUsd as aC, getDecimals as aD, getDecimalsForCoinType as aE, getJob as aF, getJobSpec as aG, jobActionsFor as aH, listServices as aI, mapMoveAbortCode as aJ, mapWalletError as aK, mistToSui as aL, parseSuiRpcTx as aM, payWithX402 as aN, preflightCreateJob as aO, preflightFail as aP, preflightPay as aQ, preflightSend as aR, preflightSwap as aS, putJobSpec as aT, rawToStable as aU, rawToUsdc as aV, refineLendingLabel as aW, reportX402Activity as aX, resolveSymbol as aY, resolveTokenType as aZ, stableToRaw as a_, USDT_TYPE as aa, WAL_TYPE as ab, WBTC_TYPE as ac, type X402ActivityPayload as ad, type ZkLoginProof as ae, ZkLoginSigner as af, buildCreateJobTx as ag, buildDeliverJobTx as ah, buildRefundJobTx as ai, buildRejectJobTx as aj, buildReleaseJobTx as ak, buildSendTx as al, buildSwapTx as am, checkPositiveAmount as an, checkSuiAddress as ao, classifyAction as ap, classifyLabel as aq, classifyTransaction as ar, executeTx as as, extractAllUserLegs as at, extractTransferDetails as au, extractTxCommands as av, extractTxSender as aw, fallbackLabel as ax, fetchService as ay, findSwapRoute as az, type ActivityReportConfig as b, truncateAddress as b0, usdcToRaw as b1, validateAddress as b2, verifyJobForSeller as b3, type T2000Options as b4, type SerializedCetusRoute as b5, type SwapResult as b6, type SwapQuoteResult as b7, type PaymentRequest as b8, type SuiCoreClient as b9, normalizeAsset as bA, normalizeCoinType as bB, queryHistory as bC, queryTransaction as bD, selectAndSplitCoin as bE, selectSuiCoin as bF, serializeCetusRoute as bG, simulateTransaction as bH, throwIfSimulationFailed as bI, verifyCetusRouteCoinMatch as bJ, type SponsoredCoinMergeCache as ba, type SendableAsset as bb, CETUS_USDC_SUI_POOL as bc, type CoinPage as bd, DEFAULT_GRPC_URL as be, GASLESS_MIN_STABLE_AMOUNT as bf, GASLESS_STABLE_TYPES as bg, OPERATION_ASSETS as bh, type Operation as bi, SENDABLE_ASSETS as bj, type SelectAndSplitResult as bk, type SerializedCetusRoutePath as bl, type SerializedRouterDataV3 as bm, addSendToTx as bn, addSwapToTx as bo, assertAllowedAsset as bp, assertBuyerRequirements as bq, buildDeclineJobTx as br, deserializeCetusRoute as bs, fetchAllCoins as bt, getCoinMeta as bu, getSuiClient as bv, getSuiGrpcClient as bw, isAllowedAsset as bx, isCetusRouteFresh as by, isInRegistry as bz, COIN_REGISTRY as c, type ClassifyBalanceChange as d, type ClassifyResult as e, type CoinMeta as f, DEFAULT_COMMERCE_API_BASE as g, DEFAULT_NETWORK as h, type DepositInfo as i, type ExtractedTransfer as j, type Job as k, type JobState as l, type JobTerms as m, type JobVerification as n, KeypairSigner as o, LOFI_TYPE as p, MAX_DELIVER_HORIZON_MS as q, MAX_JOB_USDC as r, MAX_REVIEW_WINDOW_MS as s, MIST_PER_SUI as t, type OverlayFeeConfig as u, PREFLIGHT_OK as v, type PayOptions as w, type PayResult as x, type PreflightResult as y, SUI_DECIMALS as z };
|
package/dist/index.cjs
CHANGED
|
@@ -2837,7 +2837,15 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
|
|
|
2837
2837
|
amountUsd: approxUsdValue(params.from, params.amount) ?? 0,
|
|
2838
2838
|
force: params.force
|
|
2839
2839
|
});
|
|
2840
|
-
const {
|
|
2840
|
+
const {
|
|
2841
|
+
findSwapRoute: findSwapRoute2,
|
|
2842
|
+
buildSwapTx: buildSwapTx2,
|
|
2843
|
+
resolveTokenType: resolveTokenType2,
|
|
2844
|
+
preflightSwap: preflightSwap2,
|
|
2845
|
+
deserializeCetusRoute: deserializeCetusRoute2,
|
|
2846
|
+
isCetusRouteFresh: isCetusRouteFresh2,
|
|
2847
|
+
verifyCetusRouteCoinMatch: verifyCetusRouteCoinMatch2
|
|
2848
|
+
} = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
2841
2849
|
const pf = preflightSwap2({ from: params.from, to: params.to, amount: params.amount });
|
|
2842
2850
|
if (!pf.valid) throw new exports.T2000Error(pf.code, pf.error);
|
|
2843
2851
|
const fromType = resolveTokenType2(params.from);
|
|
@@ -2848,13 +2856,37 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
|
|
|
2848
2856
|
const slippage = Math.min(params.slippage ?? 0.01, 0.05);
|
|
2849
2857
|
const fromDecimals = await resolveCoinDecimals(this.client, fromType);
|
|
2850
2858
|
const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2859
|
+
let route;
|
|
2860
|
+
if (params.serializedRoute) {
|
|
2861
|
+
const s = params.serializedRoute;
|
|
2862
|
+
if (!verifyCetusRouteCoinMatch2(s, { fromCoinType: fromType, toCoinType: toType })) {
|
|
2863
|
+
throw new exports.T2000Error(
|
|
2864
|
+
"SWAP_ROUTE_MISMATCH",
|
|
2865
|
+
`The quoted route is for ${s.fromCoinType} -> ${s.toCoinType}, not ${params.from} -> ${params.to}. Re-quote and pass the new serializedRoute.`
|
|
2866
|
+
);
|
|
2867
|
+
}
|
|
2868
|
+
if (s.byAmountIn !== byAmountIn || BigInt(s.amountIn) !== rawAmount) {
|
|
2869
|
+
throw new exports.T2000Error(
|
|
2870
|
+
"SWAP_ROUTE_MISMATCH",
|
|
2871
|
+
"The quoted route was for a different amount. Re-quote with the amount you want to execute and pass the new serializedRoute."
|
|
2872
|
+
);
|
|
2873
|
+
}
|
|
2874
|
+
if (!isCetusRouteFresh2(s)) {
|
|
2875
|
+
throw new exports.T2000Error(
|
|
2876
|
+
"SWAP_QUOTE_STALE",
|
|
2877
|
+
"The quote expired (routes are held for ~30s). Re-quote and pass the fresh serializedRoute."
|
|
2878
|
+
);
|
|
2879
|
+
}
|
|
2880
|
+
route = deserializeCetusRoute2(s);
|
|
2881
|
+
} else {
|
|
2882
|
+
route = await findSwapRoute2({
|
|
2883
|
+
walletAddress: this._address,
|
|
2884
|
+
from: fromType,
|
|
2885
|
+
to: toType,
|
|
2886
|
+
amount: rawAmount,
|
|
2887
|
+
byAmountIn
|
|
2888
|
+
});
|
|
2889
|
+
}
|
|
2858
2890
|
if (!route) throw new exports.T2000Error("SWAP_NO_ROUTE", `No swap route found for ${params.from} -> ${params.to}.`);
|
|
2859
2891
|
if (route.insufficientLiquidity) throw new exports.T2000Error("SWAP_NO_ROUTE", `Insufficient liquidity for ${params.from} -> ${params.to}.`);
|
|
2860
2892
|
if (route.priceImpact > 0.05) {
|
|
@@ -4088,12 +4120,6 @@ var AUDRIC_PARENT = {
|
|
|
4088
4120
|
name: AUDRIC_PARENT_NAME,
|
|
4089
4121
|
nftId: AUDRIC_PARENT_NFT_ID
|
|
4090
4122
|
};
|
|
4091
|
-
var AGENT_ID_PARENT_NAME = "agent-id.sui";
|
|
4092
|
-
var AGENT_ID_PARENT_NFT_ID = process.env.AGENT_ID_PARENT_NFT_ID ?? "0xc8c13f5b5a6d4c47c04877014794f65e67e2745d3bfa089b736eb54b0ebd5d1f";
|
|
4093
|
-
var AGENT_ID_PARENT = {
|
|
4094
|
-
name: AGENT_ID_PARENT_NAME,
|
|
4095
|
-
nftId: AGENT_ID_PARENT_NFT_ID
|
|
4096
|
-
};
|
|
4097
4123
|
var LABEL_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
|
|
4098
4124
|
function validateLabel(label) {
|
|
4099
4125
|
if (typeof label !== "string") {
|
|
@@ -4168,9 +4194,6 @@ exports.A2A_ESCROW_OPENING_PACKAGE_ID = A2A_ESCROW_OPENING_PACKAGE_ID;
|
|
|
4168
4194
|
exports.A2A_ESCROW_PACKAGE_ID = A2A_ESCROW_PACKAGE_ID;
|
|
4169
4195
|
exports.A2A_ESCROW_PACKAGE_V2_ID = A2A_ESCROW_PACKAGE_V2_ID;
|
|
4170
4196
|
exports.A2A_ESCROW_PACKAGE_V3_ID = A2A_ESCROW_PACKAGE_V3_ID;
|
|
4171
|
-
exports.AGENT_ID_PARENT = AGENT_ID_PARENT;
|
|
4172
|
-
exports.AGENT_ID_PARENT_NAME = AGENT_ID_PARENT_NAME;
|
|
4173
|
-
exports.AGENT_ID_PARENT_NFT_ID = AGENT_ID_PARENT_NFT_ID;
|
|
4174
4197
|
exports.AUDRIC_PARENT = AUDRIC_PARENT;
|
|
4175
4198
|
exports.AUDRIC_PARENT_NAME = AUDRIC_PARENT_NAME;
|
|
4176
4199
|
exports.AUDRIC_PARENT_NFT_ID = AUDRIC_PARENT_NFT_ID;
|