@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
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import { Z as T2000Error, b4 as T2000Options, a4 as TransactionSigner, w as PayOptions, x as PayResult, b5 as
|
|
5
|
-
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig,
|
|
4
|
+
import { Z as T2000Error, b4 as T2000Options, a4 as TransactionSigner, w as PayOptions, x as PayResult, b5 as SerializedCetusRoute, b6 as SwapResult, b7 as SwapQuoteResult, X as SupportedAsset, Q as SendResult, B as BalanceResponse, a3 as TransactionRecord, i as DepositInfo, b8 as PaymentRequest, ae as ZkLoginProof, b9 as SuiCoreClient, u as OverlayFeeConfig, ba as SponsoredCoinMergeCache, Y as SwapRouteResult, bb as SendableAsset } from './commerce-B_eH6fvR.cjs';
|
|
5
|
+
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig, bc as CETUS_USDC_SUI_POOL, C as CLOCK_ID, c as COIN_REGISTRY, d as ClassifyBalanceChange, e as ClassifyResult, f as CoinMeta, bd as CoinPage, D as DEFAULT_ACTIVITY_REPORT_URL, g as DEFAULT_COMMERCE_API_BASE, be as DEFAULT_GRPC_URL, h as DEFAULT_NETWORK, E as ETH_TYPE, j as ExtractedTransfer, bf as GASLESS_MIN_STABLE_AMOUNT, bg as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, J as JOB_STATES, k as Job, l as JobState, m as JobTerms, n as JobVerification, K as KNOWN_TARGETS, o as KeypairSigner, L as LABEL_PATTERNS, p as LOFI_TYPE, M as MANIFEST_TYPE, q as MAX_DELIVER_HORIZON_MS, r as MAX_JOB_USDC, s as MAX_REVIEW_WINDOW_MS, t as MIST_PER_SUI, N as NAVX_TYPE, bh as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, bi as Operation, P as PREFLIGHT_MAX_AMOUNT, v as PREFLIGHT_OK, y as PreflightResult, bj as SENDABLE_ASSETS, S as STABLE_ASSETS, z as SUI_DECIMALS, F as SUI_TYPE, H as SUPPORTED_ASSETS, bk as SelectAndSplitResult, bl as SerializedCetusRoutePath, bm as SerializedRouterDataV3, R as ServiceListing, T as SimulationResult, U as StableAsset, V as SuiHolding, W as SuiRpcTxBlock, _ as T2000ErrorCode, $ as T2000ErrorData, a0 as T2000_OVERLAY_FEE_WALLET, a1 as TOKEN_MAP, a2 as TransactionLeg, a5 as TxDirection, a6 as USDC_DECIMALS, a7 as USDC_TYPE, a8 as USDE_TYPE, a9 as USDSUI_TYPE, aa as USDT_TYPE, ab as WAL_TYPE, ac as WBTC_TYPE, ad as X402ActivityPayload, af as ZkLoginSigner, bn as addSendToTx, bo as addSwapToTx, bp as assertAllowedAsset, bq as assertBuyerRequirements, ag as buildCreateJobTx, br as buildDeclineJobTx, ah as buildDeliverJobTx, ai as buildRefundJobTx, aj as buildRejectJobTx, ak as buildReleaseJobTx, al as buildSendTx, am as buildSwapTx, an as checkPositiveAmount, ao as checkSuiAddress, ap as classifyAction, aq as classifyLabel, ar as classifyTransaction, bs as deserializeCetusRoute, as as executeTx, at as extractAllUserLegs, au as extractTransferDetails, av as extractTxCommands, aw as extractTxSender, ax as fallbackLabel, bt as fetchAllCoins, ay as fetchService, az as findSwapRoute, aA as formatAssetAmount, aB as formatSui, aC as formatUsd, bu as getCoinMeta, aD as getDecimals, aE as getDecimalsForCoinType, aF as getJob, aG as getJobSpec, bv as getSuiClient, bw as getSuiGrpcClient, bx as isAllowedAsset, by as isCetusRouteFresh, bz as isInRegistry, aH as jobActionsFor, aI as listServices, aJ as mapMoveAbortCode, aK as mapWalletError, aL as mistToSui, bA as normalizeAsset, bB as normalizeCoinType, aM as parseSuiRpcTx, aN as payWithX402, aO as preflightCreateJob, aP as preflightFail, aQ as preflightPay, aR as preflightSend, aS as preflightSwap, aT as putJobSpec, bC as queryHistory, bD as queryTransaction, aU as rawToStable, aV as rawToUsdc, aW as refineLendingLabel, aX as reportX402Activity, aY as resolveSymbol, aZ as resolveTokenType, bE as selectAndSplitCoin, bF as selectSuiCoin, bG as serializeCetusRoute, bH as simulateTransaction, a_ as stableToRaw, a$ as suiToMist, bI as throwIfSimulationFailed, b0 as truncateAddress, b1 as usdcToRaw, b2 as validateAddress, bJ as verifyCetusRouteCoinMatch, b3 as verifyJobForSeller } from './commerce-B_eH6fvR.cjs';
|
|
6
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
@@ -298,6 +298,16 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
298
298
|
byAmountIn?: boolean;
|
|
299
299
|
slippage?: number;
|
|
300
300
|
force?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* A quote's `serializedRoute` (from `swapQuote`/`getSwapQuote`) — when
|
|
303
|
+
* provided, the quoted route is BINDING: it must be fresh
|
|
304
|
+
* (`isCetusRouteFresh`, one shared TTL) and match from/to/amount, or the
|
|
305
|
+
* swap throws (`SWAP_QUOTE_STALE` / `SWAP_ROUTE_MISMATCH`) with a
|
|
306
|
+
* re-quote instruction. Never silently re-routed — an agent that showed
|
|
307
|
+
* the user a rate executes that rate or fails loud. Omitted → discover
|
|
308
|
+
* a fresh route (existing behavior).
|
|
309
|
+
*/
|
|
310
|
+
serializedRoute?: SerializedCetusRoute;
|
|
301
311
|
}): Promise<SwapResult>;
|
|
302
312
|
/**
|
|
303
313
|
* [SPEC_AGENTIC_STACK P1 / SDK F2 — 2026-05-25]
|
|
@@ -1114,9 +1124,9 @@ declare const AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb70999
|
|
|
1114
1124
|
* A SuiNS parent under which leaf subnames are minted: the registered SLD name
|
|
1115
1125
|
* + the on-chain `SuinsRegistration` NFT id the minting service must own/sign.
|
|
1116
1126
|
*
|
|
1117
|
-
* Added 2026-06-29
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1127
|
+
* Added 2026-06-29 to keep the leaf machinery generic over the parent.
|
|
1128
|
+
* Audric is the default (and, since the agent-id leaf product was retired
|
|
1129
|
+
* 2026-08-04, the only product parent) — every existing caller is unchanged.
|
|
1120
1130
|
*/
|
|
1121
1131
|
interface SuinsParent {
|
|
1122
1132
|
name: string;
|
|
@@ -1124,16 +1134,6 @@ interface SuinsParent {
|
|
|
1124
1134
|
}
|
|
1125
1135
|
/** The Audric consumer-handle parent (`<label>.audric.sui` → `@audric`). */
|
|
1126
1136
|
declare const AUDRIC_PARENT: SuinsParent;
|
|
1127
|
-
/** The Agent ID parent (`<label>.agent-id.sui` → `@agent-id`). Distinct from
|
|
1128
|
-
* audric.sui on purpose (infra/agent registry vs consumer brand).
|
|
1129
|
-
*
|
|
1130
|
-
* Registered on SuiNS mainnet 2026-06-29; the `SuinsRegistration` NFT
|
|
1131
|
-
* (`0xc8c1…d5d1f`) is held by the custody address
|
|
1132
|
-
* `0x6988a92d…30e4532`, which signs leaf mints + pays their gas. Override via
|
|
1133
|
-
* `AGENT_ID_PARENT_NFT_ID` for testnet/dev. */
|
|
1134
|
-
declare const AGENT_ID_PARENT_NAME = "agent-id.sui";
|
|
1135
|
-
declare const AGENT_ID_PARENT_NFT_ID: string;
|
|
1136
|
-
declare const AGENT_ID_PARENT: SuinsParent;
|
|
1137
1137
|
interface BuildAddLeafParams {
|
|
1138
1138
|
/** Bare label, e.g. `'alice'` — NOT the full `'alice.audric.sui'` path. */
|
|
1139
1139
|
label: string;
|
|
@@ -1237,4 +1237,4 @@ declare function fullHandle(label: string, parentName?: string): string;
|
|
|
1237
1237
|
*/
|
|
1238
1238
|
declare function displayHandle(label: string, parentName?: string): string;
|
|
1239
1239
|
|
|
1240
|
-
export { A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID,
|
|
1240
|
+
export { A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MAX_OPEN_WINDOW_MS, type NormalizedAddress, OPENING_CLAIM_POLICY_ANY_ACTIVE, type OpenJobFilter, type OpenJobRow, type Opening, type OpeningTerms, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, SerializedCetusRoute, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, type TrustMode, type UpstreamClaim, type VerifyAnchor, type VerifyCheck, type VerifyOptions, type VerifyResult, type VerifyUpstream, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateOpeningTx, buildRefundUnclaimedTx, buildRevokeLeafTx, cancelOpenJob, chatCompletion, chatCompletionStream, claimOpenJob, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, listOpenJobs, loadKey, looksLikeSuiNs, normalizeAddressInput, postOpenJob, preflightCreateOpening, queryBalance, readLimitsFile, recordDailySpend, refundOpenJob, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import { Z as T2000Error, b4 as T2000Options, a4 as TransactionSigner, w as PayOptions, x as PayResult, b5 as
|
|
5
|
-
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig,
|
|
4
|
+
import { Z as T2000Error, b4 as T2000Options, a4 as TransactionSigner, w as PayOptions, x as PayResult, b5 as SerializedCetusRoute, b6 as SwapResult, b7 as SwapQuoteResult, X as SupportedAsset, Q as SendResult, B as BalanceResponse, a3 as TransactionRecord, i as DepositInfo, b8 as PaymentRequest, ae as ZkLoginProof, b9 as SuiCoreClient, u as OverlayFeeConfig, ba as SponsoredCoinMergeCache, Y as SwapRouteResult, bb as SendableAsset } from './commerce-B_eH6fvR.js';
|
|
5
|
+
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig, bc as CETUS_USDC_SUI_POOL, C as CLOCK_ID, c as COIN_REGISTRY, d as ClassifyBalanceChange, e as ClassifyResult, f as CoinMeta, bd as CoinPage, D as DEFAULT_ACTIVITY_REPORT_URL, g as DEFAULT_COMMERCE_API_BASE, be as DEFAULT_GRPC_URL, h as DEFAULT_NETWORK, E as ETH_TYPE, j as ExtractedTransfer, bf as GASLESS_MIN_STABLE_AMOUNT, bg as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, J as JOB_STATES, k as Job, l as JobState, m as JobTerms, n as JobVerification, K as KNOWN_TARGETS, o as KeypairSigner, L as LABEL_PATTERNS, p as LOFI_TYPE, M as MANIFEST_TYPE, q as MAX_DELIVER_HORIZON_MS, r as MAX_JOB_USDC, s as MAX_REVIEW_WINDOW_MS, t as MIST_PER_SUI, N as NAVX_TYPE, bh as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, bi as Operation, P as PREFLIGHT_MAX_AMOUNT, v as PREFLIGHT_OK, y as PreflightResult, bj as SENDABLE_ASSETS, S as STABLE_ASSETS, z as SUI_DECIMALS, F as SUI_TYPE, H as SUPPORTED_ASSETS, bk as SelectAndSplitResult, bl as SerializedCetusRoutePath, bm as SerializedRouterDataV3, R as ServiceListing, T as SimulationResult, U as StableAsset, V as SuiHolding, W as SuiRpcTxBlock, _ as T2000ErrorCode, $ as T2000ErrorData, a0 as T2000_OVERLAY_FEE_WALLET, a1 as TOKEN_MAP, a2 as TransactionLeg, a5 as TxDirection, a6 as USDC_DECIMALS, a7 as USDC_TYPE, a8 as USDE_TYPE, a9 as USDSUI_TYPE, aa as USDT_TYPE, ab as WAL_TYPE, ac as WBTC_TYPE, ad as X402ActivityPayload, af as ZkLoginSigner, bn as addSendToTx, bo as addSwapToTx, bp as assertAllowedAsset, bq as assertBuyerRequirements, ag as buildCreateJobTx, br as buildDeclineJobTx, ah as buildDeliverJobTx, ai as buildRefundJobTx, aj as buildRejectJobTx, ak as buildReleaseJobTx, al as buildSendTx, am as buildSwapTx, an as checkPositiveAmount, ao as checkSuiAddress, ap as classifyAction, aq as classifyLabel, ar as classifyTransaction, bs as deserializeCetusRoute, as as executeTx, at as extractAllUserLegs, au as extractTransferDetails, av as extractTxCommands, aw as extractTxSender, ax as fallbackLabel, bt as fetchAllCoins, ay as fetchService, az as findSwapRoute, aA as formatAssetAmount, aB as formatSui, aC as formatUsd, bu as getCoinMeta, aD as getDecimals, aE as getDecimalsForCoinType, aF as getJob, aG as getJobSpec, bv as getSuiClient, bw as getSuiGrpcClient, bx as isAllowedAsset, by as isCetusRouteFresh, bz as isInRegistry, aH as jobActionsFor, aI as listServices, aJ as mapMoveAbortCode, aK as mapWalletError, aL as mistToSui, bA as normalizeAsset, bB as normalizeCoinType, aM as parseSuiRpcTx, aN as payWithX402, aO as preflightCreateJob, aP as preflightFail, aQ as preflightPay, aR as preflightSend, aS as preflightSwap, aT as putJobSpec, bC as queryHistory, bD as queryTransaction, aU as rawToStable, aV as rawToUsdc, aW as refineLendingLabel, aX as reportX402Activity, aY as resolveSymbol, aZ as resolveTokenType, bE as selectAndSplitCoin, bF as selectSuiCoin, bG as serializeCetusRoute, bH as simulateTransaction, a_ as stableToRaw, a$ as suiToMist, bI as throwIfSimulationFailed, b0 as truncateAddress, b1 as usdcToRaw, b2 as validateAddress, bJ as verifyCetusRouteCoinMatch, b3 as verifyJobForSeller } from './commerce-B_eH6fvR.js';
|
|
6
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
@@ -298,6 +298,16 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
298
298
|
byAmountIn?: boolean;
|
|
299
299
|
slippage?: number;
|
|
300
300
|
force?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* A quote's `serializedRoute` (from `swapQuote`/`getSwapQuote`) — when
|
|
303
|
+
* provided, the quoted route is BINDING: it must be fresh
|
|
304
|
+
* (`isCetusRouteFresh`, one shared TTL) and match from/to/amount, or the
|
|
305
|
+
* swap throws (`SWAP_QUOTE_STALE` / `SWAP_ROUTE_MISMATCH`) with a
|
|
306
|
+
* re-quote instruction. Never silently re-routed — an agent that showed
|
|
307
|
+
* the user a rate executes that rate or fails loud. Omitted → discover
|
|
308
|
+
* a fresh route (existing behavior).
|
|
309
|
+
*/
|
|
310
|
+
serializedRoute?: SerializedCetusRoute;
|
|
301
311
|
}): Promise<SwapResult>;
|
|
302
312
|
/**
|
|
303
313
|
* [SPEC_AGENTIC_STACK P1 / SDK F2 — 2026-05-25]
|
|
@@ -1114,9 +1124,9 @@ declare const AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb70999
|
|
|
1114
1124
|
* A SuiNS parent under which leaf subnames are minted: the registered SLD name
|
|
1115
1125
|
* + the on-chain `SuinsRegistration` NFT id the minting service must own/sign.
|
|
1116
1126
|
*
|
|
1117
|
-
* Added 2026-06-29
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1127
|
+
* Added 2026-06-29 to keep the leaf machinery generic over the parent.
|
|
1128
|
+
* Audric is the default (and, since the agent-id leaf product was retired
|
|
1129
|
+
* 2026-08-04, the only product parent) — every existing caller is unchanged.
|
|
1120
1130
|
*/
|
|
1121
1131
|
interface SuinsParent {
|
|
1122
1132
|
name: string;
|
|
@@ -1124,16 +1134,6 @@ interface SuinsParent {
|
|
|
1124
1134
|
}
|
|
1125
1135
|
/** The Audric consumer-handle parent (`<label>.audric.sui` → `@audric`). */
|
|
1126
1136
|
declare const AUDRIC_PARENT: SuinsParent;
|
|
1127
|
-
/** The Agent ID parent (`<label>.agent-id.sui` → `@agent-id`). Distinct from
|
|
1128
|
-
* audric.sui on purpose (infra/agent registry vs consumer brand).
|
|
1129
|
-
*
|
|
1130
|
-
* Registered on SuiNS mainnet 2026-06-29; the `SuinsRegistration` NFT
|
|
1131
|
-
* (`0xc8c1…d5d1f`) is held by the custody address
|
|
1132
|
-
* `0x6988a92d…30e4532`, which signs leaf mints + pays their gas. Override via
|
|
1133
|
-
* `AGENT_ID_PARENT_NFT_ID` for testnet/dev. */
|
|
1134
|
-
declare const AGENT_ID_PARENT_NAME = "agent-id.sui";
|
|
1135
|
-
declare const AGENT_ID_PARENT_NFT_ID: string;
|
|
1136
|
-
declare const AGENT_ID_PARENT: SuinsParent;
|
|
1137
1137
|
interface BuildAddLeafParams {
|
|
1138
1138
|
/** Bare label, e.g. `'alice'` — NOT the full `'alice.audric.sui'` path. */
|
|
1139
1139
|
label: string;
|
|
@@ -1237,4 +1237,4 @@ declare function fullHandle(label: string, parentName?: string): string;
|
|
|
1237
1237
|
*/
|
|
1238
1238
|
declare function displayHandle(label: string, parentName?: string): string;
|
|
1239
1239
|
|
|
1240
|
-
export { A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID,
|
|
1240
|
+
export { A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MAX_OPEN_WINDOW_MS, type NormalizedAddress, OPENING_CLAIM_POLICY_ANY_ACTIVE, type OpenJobFilter, type OpenJobRow, type Opening, type OpeningTerms, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, SerializedCetusRoute, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, type TrustMode, type UpstreamClaim, type VerifyAnchor, type VerifyCheck, type VerifyOptions, type VerifyResult, type VerifyUpstream, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateOpeningTx, buildRefundUnclaimedTx, buildRevokeLeafTx, cancelOpenJob, chatCompletion, chatCompletionStream, claimOpenJob, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, listOpenJobs, loadKey, looksLikeSuiNs, normalizeAddressInput, postOpenJob, preflightCreateOpening, queryBalance, readLimitsFile, recordDailySpend, refundOpenJob, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
package/dist/index.js
CHANGED
|
@@ -2831,7 +2831,15 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
2831
2831
|
amountUsd: approxUsdValue(params.from, params.amount) ?? 0,
|
|
2832
2832
|
force: params.force
|
|
2833
2833
|
});
|
|
2834
|
-
const {
|
|
2834
|
+
const {
|
|
2835
|
+
findSwapRoute: findSwapRoute2,
|
|
2836
|
+
buildSwapTx: buildSwapTx2,
|
|
2837
|
+
resolveTokenType: resolveTokenType2,
|
|
2838
|
+
preflightSwap: preflightSwap2,
|
|
2839
|
+
deserializeCetusRoute: deserializeCetusRoute2,
|
|
2840
|
+
isCetusRouteFresh: isCetusRouteFresh2,
|
|
2841
|
+
verifyCetusRouteCoinMatch: verifyCetusRouteCoinMatch2
|
|
2842
|
+
} = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
2835
2843
|
const pf = preflightSwap2({ from: params.from, to: params.to, amount: params.amount });
|
|
2836
2844
|
if (!pf.valid) throw new T2000Error(pf.code, pf.error);
|
|
2837
2845
|
const fromType = resolveTokenType2(params.from);
|
|
@@ -2842,13 +2850,37 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
2842
2850
|
const slippage = Math.min(params.slippage ?? 0.01, 0.05);
|
|
2843
2851
|
const fromDecimals = await resolveCoinDecimals(this.client, fromType);
|
|
2844
2852
|
const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2853
|
+
let route;
|
|
2854
|
+
if (params.serializedRoute) {
|
|
2855
|
+
const s = params.serializedRoute;
|
|
2856
|
+
if (!verifyCetusRouteCoinMatch2(s, { fromCoinType: fromType, toCoinType: toType })) {
|
|
2857
|
+
throw new T2000Error(
|
|
2858
|
+
"SWAP_ROUTE_MISMATCH",
|
|
2859
|
+
`The quoted route is for ${s.fromCoinType} -> ${s.toCoinType}, not ${params.from} -> ${params.to}. Re-quote and pass the new serializedRoute.`
|
|
2860
|
+
);
|
|
2861
|
+
}
|
|
2862
|
+
if (s.byAmountIn !== byAmountIn || BigInt(s.amountIn) !== rawAmount) {
|
|
2863
|
+
throw new T2000Error(
|
|
2864
|
+
"SWAP_ROUTE_MISMATCH",
|
|
2865
|
+
"The quoted route was for a different amount. Re-quote with the amount you want to execute and pass the new serializedRoute."
|
|
2866
|
+
);
|
|
2867
|
+
}
|
|
2868
|
+
if (!isCetusRouteFresh2(s)) {
|
|
2869
|
+
throw new T2000Error(
|
|
2870
|
+
"SWAP_QUOTE_STALE",
|
|
2871
|
+
"The quote expired (routes are held for ~30s). Re-quote and pass the fresh serializedRoute."
|
|
2872
|
+
);
|
|
2873
|
+
}
|
|
2874
|
+
route = deserializeCetusRoute2(s);
|
|
2875
|
+
} else {
|
|
2876
|
+
route = await findSwapRoute2({
|
|
2877
|
+
walletAddress: this._address,
|
|
2878
|
+
from: fromType,
|
|
2879
|
+
to: toType,
|
|
2880
|
+
amount: rawAmount,
|
|
2881
|
+
byAmountIn
|
|
2882
|
+
});
|
|
2883
|
+
}
|
|
2852
2884
|
if (!route) throw new T2000Error("SWAP_NO_ROUTE", `No swap route found for ${params.from} -> ${params.to}.`);
|
|
2853
2885
|
if (route.insufficientLiquidity) throw new T2000Error("SWAP_NO_ROUTE", `Insufficient liquidity for ${params.from} -> ${params.to}.`);
|
|
2854
2886
|
if (route.priceImpact > 0.05) {
|
|
@@ -4082,12 +4114,6 @@ var AUDRIC_PARENT = {
|
|
|
4082
4114
|
name: AUDRIC_PARENT_NAME,
|
|
4083
4115
|
nftId: AUDRIC_PARENT_NFT_ID
|
|
4084
4116
|
};
|
|
4085
|
-
var AGENT_ID_PARENT_NAME = "agent-id.sui";
|
|
4086
|
-
var AGENT_ID_PARENT_NFT_ID = process.env.AGENT_ID_PARENT_NFT_ID ?? "0xc8c13f5b5a6d4c47c04877014794f65e67e2745d3bfa089b736eb54b0ebd5d1f";
|
|
4087
|
-
var AGENT_ID_PARENT = {
|
|
4088
|
-
name: AGENT_ID_PARENT_NAME,
|
|
4089
|
-
nftId: AGENT_ID_PARENT_NFT_ID
|
|
4090
|
-
};
|
|
4091
4117
|
var LABEL_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
|
|
4092
4118
|
function validateLabel(label) {
|
|
4093
4119
|
if (typeof label !== "string") {
|
|
@@ -4157,6 +4183,6 @@ function displayHandle(label, parentName = AUDRIC_PARENT_NAME) {
|
|
|
4157
4183
|
// src/index.ts
|
|
4158
4184
|
init_preflight();
|
|
4159
4185
|
|
|
4160
|
-
export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID,
|
|
4186
|
+
export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, DEFAULT_ACTIVITY_REPORT_URL, DEFAULT_API_BASE, DEFAULT_COMMERCE_API_BASE, DEFAULT_GRPC_URL, DEFAULT_NETWORK, ETH_TYPE, GASLESS_MIN_STABLE_AMOUNT, GASLESS_STABLE_TYPES, GAS_RESERVE_MIN, IKA_TYPE, InvalidAddressError, JOB_STATES, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, LimitEnforcer, LimitExceededError, MANIFEST_TYPE, MAX_DELIVER_HORIZON_MS, MAX_JOB_USDC, MAX_OPEN_WINDOW_MS, MAX_REVIEW_WINDOW_MS, MIST_PER_SUI, NAVX_TYPE, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPERATION_ASSETS, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, SENDABLE_ASSETS, SPONSORED_PYTH_DEPENDENT_PROVIDERS, STABLE_ASSETS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SuinsNotRegisteredError, SuinsRpcError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addSendToTx, addSwapToTx, approxUsdValue, assertAllowedAsset, assertBuyerRequirements, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateJobTx, buildCreateOpeningTx, buildDeclineJobTx, buildDeliverJobTx, buildRefundJobTx, buildRefundUnclaimedTx, buildRejectJobTx, buildReleaseJobTx, buildRevokeLeafTx, buildSendTx, buildSwapTx, cancelOpenJob, chatCompletion, chatCompletionStream, checkPositiveAmount, checkSuiAddress, claimOpenJob, classifyAction, classifyLabel, classifyTransaction, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, isAllowedAsset, isCetusRouteFresh, isInRegistry, jobActionsFor, keypairFromPrivateKey, listModels, listOpenJobs, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseSuiRpcTx, payWithX402, postOpenJob, preflightCreateJob, preflightCreateOpening, preflightFail, preflightPay, preflightSend, preflightSwap, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, refundOpenJob, reportX402Activity, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, verifyReceipt, walletExists, writeLimitsFile };
|
|
4161
4187
|
//# sourceMappingURL=index.js.map
|
|
4162
4188
|
//# sourceMappingURL=index.js.map
|