@t2000/sdk 10.27.2 → 10.29.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 +55 -50
- 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 +55 -52
- package/dist/browser.js.map +1 -1
- package/dist/{commerce-DR_F-Eg6.d.cts → commerce-B6_F6JYi.d.cts} +56 -23
- package/dist/{commerce-DR_F-Eg6.d.ts → commerce-B6_F6JYi.d.ts} +56 -23
- package/dist/index.cjs +112 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -15
- package/dist/index.d.ts +23 -15
- package/dist/index.js +109 -49
- 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 {
|
|
5
|
-
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig,
|
|
4
|
+
import { _ as T2000Error, b7 as T2000Options, a5 as TransactionSigner, w as PayOptions, b8 as X402Probe, x as PayResult, b9 as SerializedCetusRoute, ba as SwapResult, bb as SwapQuoteResult, R as SendResult, B as BalanceResponse, a4 as TransactionRecord, i as DepositInfo, bc as PaymentRequest, af as ZkLoginProof, bd as SuiCoreClient, u as OverlayFeeConfig, be as SponsoredCoinMergeCache, Y as SupportedAsset, Z as SwapRouteResult, bf as SendableAsset } from './commerce-B6_F6JYi.cjs';
|
|
5
|
+
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig, bg as CETUS_USDC_SUI_POOL, C as CLOCK_ID, c as COIN_REGISTRY, d as ClassifyBalanceChange, e as ClassifyResult, f as CoinMeta, bh as CoinPage, D as DEFAULT_ACTIVITY_REPORT_URL, g as DEFAULT_COMMERCE_API_BASE, bi as DEFAULT_GRPC_URL, h as DEFAULT_NETWORK, E as ETH_TYPE, j as ExtractedTransfer, bj as GASLESS_MIN_STABLE_AMOUNT, bk 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, bl as MAINNET_A2A_ESCROW_PACKAGE_ID, 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, bm as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, bn as Operation, P as PREFLIGHT_MAX_AMOUNT, v as PREFLIGHT_OK, y as PreflightResult, bo as SENDABLE_ASSETS, S as STABLE_ASSETS, z as SUI_DECIMALS, F as SUI_TYPE, H as SUPPORTED_ASSETS, bp as SelectAndSplitResult, Q as SendAssetClass, bq as SerializedCetusRoutePath, br as SerializedRouterDataV3, T as ServiceListing, U as SimulationResult, V as StableAsset, W as SuiHolding, X as SuiRpcTxBlock, $ as T2000ErrorCode, a0 as T2000ErrorData, a1 as T2000_OVERLAY_FEE_WALLET, a2 as TOKEN_MAP, a3 as TransactionLeg, a6 as TxDirection, a7 as USDC_DECIMALS, a8 as USDC_TYPE, a9 as USDE_TYPE, aa as USDSUI_TYPE, ab as USDT_TYPE, ac as WAL_TYPE, ad as WBTC_TYPE, ae as X402ActivityPayload, ag as ZkLoginSigner, bs as addSendToTx, bt as addSwapToTx, bu as assertAllowedAsset, bv as assertBuyerRequirements, ah as buildCreateJobTx, bw as buildDeclineJobTx, ai as buildDeliverJobTx, aj as buildRefundJobTx, ak as buildRejectJobTx, al as buildReleaseJobTx, am as buildSendTx, an as buildSwapTx, ao as checkPositiveAmount, ap as checkSuiAddress, aq as classifyAction, ar as classifyLabel, as as classifySendAsset, at as classifyTransaction, bx as deserializeCetusRoute, au as executeTx, av as extractAllUserLegs, aw as extractTransferDetails, ax as extractTxCommands, ay as extractTxSender, az as fallbackLabel, by as fetchAllCoins, aA as fetchService, aB as findSwapRoute, aC as formatAssetAmount, aD as formatSui, aE as formatUsd, bz as getCoinMeta, aF as getDecimals, aG as getDecimalsForCoinType, aH as getJob, aI as getJobSpec, bA as getSuiClient, bB as getSuiGrpcClient, aJ as invalidSendAssetMessage, bC as isAllowedAsset, bD as isCetusRouteFresh, bE as isInRegistry, aK as jobActionsFor, aL as listServices, aM as mapMoveAbortCode, aN as mapWalletError, aO as mistToSui, bF as normalizeAsset, bG as normalizeCoinType, aP as parseSuiRpcTx, aQ as payWithX402, aR as preflightCreateJob, aS as preflightFail, aT as preflightPay, aU as preflightSend, aV as preflightSwap, bH as probeX402, aW as putJobSpec, bI as queryHistory, bJ as queryTransaction, aX as rawToStable, aY as rawToUsdc, aZ as refineLendingLabel, a_ as reportX402Activity, a$ as resolveSymbol, b0 as resolveTokenType, bK as selectAndSplitCoin, bL as selectSuiCoin, bM as serializeCetusRoute, bN as simulateTransaction, b1 as stableToRaw, b2 as suiToMist, bO as throwIfSimulationFailed, b3 as truncateAddress, b4 as usdcToRaw, b5 as validateAddress, bP as verifyCetusRouteCoinMatch, b6 as verifyJobForSeller } from './commerce-B6_F6JYi.cjs';
|
|
6
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
@@ -335,18 +335,17 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
335
335
|
/**
|
|
336
336
|
* Send `amount` of `asset` to `to` (hex address or SuiNS name).
|
|
337
337
|
*
|
|
338
|
-
* [
|
|
338
|
+
* [S.957 — 2026-08-08] `asset` accepts **any held coin type** — a
|
|
339
|
+
* registry symbol (`USDC`, `MANIFEST`) or a full `0x…::module::TYPE`.
|
|
340
|
+
* Unresolvable strings throw `INVALID_ASSET`; empty balances throw
|
|
341
|
+
* `INSUFFICIENT_BALANCE`.
|
|
339
342
|
*
|
|
340
|
-
* **Breaking changes from v3.x:**
|
|
341
|
-
* - `asset` is now REQUIRED (no implicit `?? 'USDC'` default). Callers
|
|
342
|
-
* must specify `'USDC' | 'USDsui' | 'SUI'`. Sending `'USDT'` /
|
|
343
|
-
* `'USDe'` / `'WAL'` / `'ETH'` / `'NAVX'` / `'GOLD'` now errors
|
|
344
|
-
* with `INVALID_ASSET` — swap to a stable first.
|
|
345
343
|
* - USDC + USDsui builds go through `SuiGrpcClient` so the gRPC build
|
|
346
344
|
* resolver auto-detects `0x2::balance::send_funds` eligibility and
|
|
347
|
-
* zeros gas at simulate time
|
|
348
|
-
*
|
|
349
|
-
*
|
|
345
|
+
* zeros gas at simulate time — **gasless sends from a zero-SUI
|
|
346
|
+
* wallet.** They remain the ONLY gasless assets.
|
|
347
|
+
* - SUI and every other coin type are gas-paid (the sender needs SUI).
|
|
348
|
+
* - `asset` stays REQUIRED (no implicit `?? 'USDC'` default — v4 rule).
|
|
350
349
|
*
|
|
351
350
|
* Submission stays on the JSON-RPC client (the rest of the SDK
|
|
352
351
|
* expects JSON-RPC for read paths, and Sui's docs explicitly support
|
|
@@ -355,7 +354,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
355
354
|
send(params: {
|
|
356
355
|
to: string;
|
|
357
356
|
amount: number;
|
|
358
|
-
asset:
|
|
357
|
+
asset: string;
|
|
359
358
|
force?: boolean;
|
|
360
359
|
}): Promise<SendResult>;
|
|
361
360
|
/**
|
|
@@ -672,6 +671,15 @@ interface Opening {
|
|
|
672
671
|
/** Read one Opening by object id (null = gone: claimed/cancelled/refunded). */
|
|
673
672
|
declare function getOpening(client: SuiCoreClient, openingId: string): Promise<Opening | null>;
|
|
674
673
|
|
|
674
|
+
/** Title rules: an explicit title wins; otherwise the brief's first
|
|
675
|
+
* non-empty line (a leading "Title: …" prefix is stripped for the title
|
|
676
|
+
* field — the FULL text always stays in the brief, lossless), hard-capped
|
|
677
|
+
* at 80 chars. Empty derive → "Custom job". */
|
|
678
|
+
declare function customHireEnvelope(brief: string, title: string | undefined, now: number): string;
|
|
679
|
+
/** Idempotency guard: text that already IS a custom envelope (current or
|
|
680
|
+
* legacy name) with a usable brief must upload as-is, never double-wrap. */
|
|
681
|
+
declare function isCustomHireEnvelope(text: string): boolean;
|
|
682
|
+
|
|
675
683
|
/** The public row shape /v1/open-jobs returns — the indexer read-model of
|
|
676
684
|
* on-chain Openings. `id` is the Opening OBJECT id (0x…). Buyer addresses
|
|
677
685
|
* never appear (registered-agent buyers surface by id); the claiming ASP
|
|
@@ -846,8 +854,8 @@ type WriteToolName = 'send_transfer' | 'swap_execute';
|
|
|
846
854
|
* type is the wider `SupportedAsset` rather than the narrower
|
|
847
855
|
* `SendableAsset` so callers that thread a wide-typed asset through
|
|
848
856
|
* (primarily the engine LLM tool surface) compile without modification.
|
|
849
|
-
* Runtime narrowing happens via
|
|
850
|
-
* which throws `INVALID_ASSET` for anything outside the
|
|
857
|
+
* Runtime narrowing happens via the appender's local `SENDABLE_ASSETS`
|
|
858
|
+
* check, which throws `INVALID_ASSET` for anything outside the
|
|
851
859
|
* `['USDC', 'USDsui', 'SUI']` whitelist. USDC + USDsui route through
|
|
852
860
|
* the gasless `0x2::balance::send_funds` Move call; SUI uses the
|
|
853
861
|
* standard `transferObjects` path.
|
|
@@ -1288,4 +1296,4 @@ declare function fullHandle(label: string, parentName?: string): string;
|
|
|
1288
1296
|
*/
|
|
1289
1297
|
declare function displayHandle(label: string, parentName?: string): string;
|
|
1290
1298
|
|
|
1291
|
-
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, ESCROW_JOB_TYPE_MARKER, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAX_OPEN_WINDOW_MS, type NormalizedAddress, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPENING_TYPE_MARKER, 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 SponsoredTxGuard, 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, X402Probe, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateOpeningTx, buildRefundUnclaimedTx, buildRevokeLeafTx, cancelOpenJob, canonicalizeRecipientInput, 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, resolveCreatedObjectId, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, setSponsoredTxGuard, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
|
1299
|
+
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, ESCROW_JOB_TYPE_MARKER, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAX_OPEN_WINDOW_MS, type NormalizedAddress, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPENING_TYPE_MARKER, 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 SponsoredTxGuard, 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, X402Probe, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateOpeningTx, buildRefundUnclaimedTx, buildRevokeLeafTx, cancelOpenJob, canonicalizeRecipientInput, chatCompletion, chatCompletionStream, claimOpenJob, clearLimits, composeTx, customHireEnvelope, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSwapQuote, hasLimits, isCustomHireEnvelope, keypairFromPrivateKey, listModels, listOpenJobs, loadKey, looksLikeSuiNs, normalizeAddressInput, postOpenJob, preflightCreateOpening, queryBalance, readLimitsFile, recordDailySpend, refundOpenJob, resolveAddressToSuinsViaRpc, resolveCreatedObjectId, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, setSponsoredTxGuard, 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 {
|
|
5
|
-
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig,
|
|
4
|
+
import { _ as T2000Error, b7 as T2000Options, a5 as TransactionSigner, w as PayOptions, b8 as X402Probe, x as PayResult, b9 as SerializedCetusRoute, ba as SwapResult, bb as SwapQuoteResult, R as SendResult, B as BalanceResponse, a4 as TransactionRecord, i as DepositInfo, bc as PaymentRequest, af as ZkLoginProof, bd as SuiCoreClient, u as OverlayFeeConfig, be as SponsoredCoinMergeCache, Y as SupportedAsset, Z as SwapRouteResult, bf as SendableAsset } from './commerce-B6_F6JYi.js';
|
|
5
|
+
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig, bg as CETUS_USDC_SUI_POOL, C as CLOCK_ID, c as COIN_REGISTRY, d as ClassifyBalanceChange, e as ClassifyResult, f as CoinMeta, bh as CoinPage, D as DEFAULT_ACTIVITY_REPORT_URL, g as DEFAULT_COMMERCE_API_BASE, bi as DEFAULT_GRPC_URL, h as DEFAULT_NETWORK, E as ETH_TYPE, j as ExtractedTransfer, bj as GASLESS_MIN_STABLE_AMOUNT, bk 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, bl as MAINNET_A2A_ESCROW_PACKAGE_ID, 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, bm as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, bn as Operation, P as PREFLIGHT_MAX_AMOUNT, v as PREFLIGHT_OK, y as PreflightResult, bo as SENDABLE_ASSETS, S as STABLE_ASSETS, z as SUI_DECIMALS, F as SUI_TYPE, H as SUPPORTED_ASSETS, bp as SelectAndSplitResult, Q as SendAssetClass, bq as SerializedCetusRoutePath, br as SerializedRouterDataV3, T as ServiceListing, U as SimulationResult, V as StableAsset, W as SuiHolding, X as SuiRpcTxBlock, $ as T2000ErrorCode, a0 as T2000ErrorData, a1 as T2000_OVERLAY_FEE_WALLET, a2 as TOKEN_MAP, a3 as TransactionLeg, a6 as TxDirection, a7 as USDC_DECIMALS, a8 as USDC_TYPE, a9 as USDE_TYPE, aa as USDSUI_TYPE, ab as USDT_TYPE, ac as WAL_TYPE, ad as WBTC_TYPE, ae as X402ActivityPayload, ag as ZkLoginSigner, bs as addSendToTx, bt as addSwapToTx, bu as assertAllowedAsset, bv as assertBuyerRequirements, ah as buildCreateJobTx, bw as buildDeclineJobTx, ai as buildDeliverJobTx, aj as buildRefundJobTx, ak as buildRejectJobTx, al as buildReleaseJobTx, am as buildSendTx, an as buildSwapTx, ao as checkPositiveAmount, ap as checkSuiAddress, aq as classifyAction, ar as classifyLabel, as as classifySendAsset, at as classifyTransaction, bx as deserializeCetusRoute, au as executeTx, av as extractAllUserLegs, aw as extractTransferDetails, ax as extractTxCommands, ay as extractTxSender, az as fallbackLabel, by as fetchAllCoins, aA as fetchService, aB as findSwapRoute, aC as formatAssetAmount, aD as formatSui, aE as formatUsd, bz as getCoinMeta, aF as getDecimals, aG as getDecimalsForCoinType, aH as getJob, aI as getJobSpec, bA as getSuiClient, bB as getSuiGrpcClient, aJ as invalidSendAssetMessage, bC as isAllowedAsset, bD as isCetusRouteFresh, bE as isInRegistry, aK as jobActionsFor, aL as listServices, aM as mapMoveAbortCode, aN as mapWalletError, aO as mistToSui, bF as normalizeAsset, bG as normalizeCoinType, aP as parseSuiRpcTx, aQ as payWithX402, aR as preflightCreateJob, aS as preflightFail, aT as preflightPay, aU as preflightSend, aV as preflightSwap, bH as probeX402, aW as putJobSpec, bI as queryHistory, bJ as queryTransaction, aX as rawToStable, aY as rawToUsdc, aZ as refineLendingLabel, a_ as reportX402Activity, a$ as resolveSymbol, b0 as resolveTokenType, bK as selectAndSplitCoin, bL as selectSuiCoin, bM as serializeCetusRoute, bN as simulateTransaction, b1 as stableToRaw, b2 as suiToMist, bO as throwIfSimulationFailed, b3 as truncateAddress, b4 as usdcToRaw, b5 as validateAddress, bP as verifyCetusRouteCoinMatch, b6 as verifyJobForSeller } from './commerce-B6_F6JYi.js';
|
|
6
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
@@ -335,18 +335,17 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
335
335
|
/**
|
|
336
336
|
* Send `amount` of `asset` to `to` (hex address or SuiNS name).
|
|
337
337
|
*
|
|
338
|
-
* [
|
|
338
|
+
* [S.957 — 2026-08-08] `asset` accepts **any held coin type** — a
|
|
339
|
+
* registry symbol (`USDC`, `MANIFEST`) or a full `0x…::module::TYPE`.
|
|
340
|
+
* Unresolvable strings throw `INVALID_ASSET`; empty balances throw
|
|
341
|
+
* `INSUFFICIENT_BALANCE`.
|
|
339
342
|
*
|
|
340
|
-
* **Breaking changes from v3.x:**
|
|
341
|
-
* - `asset` is now REQUIRED (no implicit `?? 'USDC'` default). Callers
|
|
342
|
-
* must specify `'USDC' | 'USDsui' | 'SUI'`. Sending `'USDT'` /
|
|
343
|
-
* `'USDe'` / `'WAL'` / `'ETH'` / `'NAVX'` / `'GOLD'` now errors
|
|
344
|
-
* with `INVALID_ASSET` — swap to a stable first.
|
|
345
343
|
* - USDC + USDsui builds go through `SuiGrpcClient` so the gRPC build
|
|
346
344
|
* resolver auto-detects `0x2::balance::send_funds` eligibility and
|
|
347
|
-
* zeros gas at simulate time
|
|
348
|
-
*
|
|
349
|
-
*
|
|
345
|
+
* zeros gas at simulate time — **gasless sends from a zero-SUI
|
|
346
|
+
* wallet.** They remain the ONLY gasless assets.
|
|
347
|
+
* - SUI and every other coin type are gas-paid (the sender needs SUI).
|
|
348
|
+
* - `asset` stays REQUIRED (no implicit `?? 'USDC'` default — v4 rule).
|
|
350
349
|
*
|
|
351
350
|
* Submission stays on the JSON-RPC client (the rest of the SDK
|
|
352
351
|
* expects JSON-RPC for read paths, and Sui's docs explicitly support
|
|
@@ -355,7 +354,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
355
354
|
send(params: {
|
|
356
355
|
to: string;
|
|
357
356
|
amount: number;
|
|
358
|
-
asset:
|
|
357
|
+
asset: string;
|
|
359
358
|
force?: boolean;
|
|
360
359
|
}): Promise<SendResult>;
|
|
361
360
|
/**
|
|
@@ -672,6 +671,15 @@ interface Opening {
|
|
|
672
671
|
/** Read one Opening by object id (null = gone: claimed/cancelled/refunded). */
|
|
673
672
|
declare function getOpening(client: SuiCoreClient, openingId: string): Promise<Opening | null>;
|
|
674
673
|
|
|
674
|
+
/** Title rules: an explicit title wins; otherwise the brief's first
|
|
675
|
+
* non-empty line (a leading "Title: …" prefix is stripped for the title
|
|
676
|
+
* field — the FULL text always stays in the brief, lossless), hard-capped
|
|
677
|
+
* at 80 chars. Empty derive → "Custom job". */
|
|
678
|
+
declare function customHireEnvelope(brief: string, title: string | undefined, now: number): string;
|
|
679
|
+
/** Idempotency guard: text that already IS a custom envelope (current or
|
|
680
|
+
* legacy name) with a usable brief must upload as-is, never double-wrap. */
|
|
681
|
+
declare function isCustomHireEnvelope(text: string): boolean;
|
|
682
|
+
|
|
675
683
|
/** The public row shape /v1/open-jobs returns — the indexer read-model of
|
|
676
684
|
* on-chain Openings. `id` is the Opening OBJECT id (0x…). Buyer addresses
|
|
677
685
|
* never appear (registered-agent buyers surface by id); the claiming ASP
|
|
@@ -846,8 +854,8 @@ type WriteToolName = 'send_transfer' | 'swap_execute';
|
|
|
846
854
|
* type is the wider `SupportedAsset` rather than the narrower
|
|
847
855
|
* `SendableAsset` so callers that thread a wide-typed asset through
|
|
848
856
|
* (primarily the engine LLM tool surface) compile without modification.
|
|
849
|
-
* Runtime narrowing happens via
|
|
850
|
-
* which throws `INVALID_ASSET` for anything outside the
|
|
857
|
+
* Runtime narrowing happens via the appender's local `SENDABLE_ASSETS`
|
|
858
|
+
* check, which throws `INVALID_ASSET` for anything outside the
|
|
851
859
|
* `['USDC', 'USDsui', 'SUI']` whitelist. USDC + USDsui route through
|
|
852
860
|
* the gasless `0x2::balance::send_funds` Move call; SUI uses the
|
|
853
861
|
* standard `transferObjects` path.
|
|
@@ -1288,4 +1296,4 @@ declare function fullHandle(label: string, parentName?: string): string;
|
|
|
1288
1296
|
*/
|
|
1289
1297
|
declare function displayHandle(label: string, parentName?: string): string;
|
|
1290
1298
|
|
|
1291
|
-
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, ESCROW_JOB_TYPE_MARKER, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAX_OPEN_WINDOW_MS, type NormalizedAddress, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPENING_TYPE_MARKER, 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 SponsoredTxGuard, 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, X402Probe, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateOpeningTx, buildRefundUnclaimedTx, buildRevokeLeafTx, cancelOpenJob, canonicalizeRecipientInput, 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, resolveCreatedObjectId, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, setSponsoredTxGuard, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
|
1299
|
+
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, ESCROW_JOB_TYPE_MARKER, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAX_OPEN_WINDOW_MS, type NormalizedAddress, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPENING_TYPE_MARKER, 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 SponsoredTxGuard, 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, X402Probe, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateOpeningTx, buildRefundUnclaimedTx, buildRevokeLeafTx, cancelOpenJob, canonicalizeRecipientInput, chatCompletion, chatCompletionStream, claimOpenJob, clearLimits, composeTx, customHireEnvelope, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSwapQuote, hasLimits, isCustomHireEnvelope, keypairFromPrivateKey, listModels, listOpenJobs, loadKey, looksLikeSuiNs, normalizeAddressInput, postOpenJob, preflightCreateOpening, queryBalance, readLimitsFile, recordDailySpend, refundOpenJob, resolveAddressToSuinsViaRpc, resolveCreatedObjectId, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, setSponsoredTxGuard, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
package/dist/index.js
CHANGED
|
@@ -841,7 +841,7 @@ var SUPPORTED_ASSETS = {
|
|
|
841
841
|
};
|
|
842
842
|
var STABLE_ASSETS = ["USDC", "USDsui"];
|
|
843
843
|
var OPERATION_ASSETS = {
|
|
844
|
-
send:
|
|
844
|
+
send: "*",
|
|
845
845
|
swap: "*"
|
|
846
846
|
};
|
|
847
847
|
function isAllowedAsset(op, asset) {
|
|
@@ -1529,19 +1529,42 @@ function normalizeAsset(input) {
|
|
|
1529
1529
|
}
|
|
1530
1530
|
|
|
1531
1531
|
// src/wallet/send.ts
|
|
1532
|
+
init_token_registry();
|
|
1532
1533
|
init_preflight();
|
|
1533
|
-
function
|
|
1534
|
+
function classifySendAsset(asset) {
|
|
1535
|
+
const coinType = resolveTokenType(asset.trim());
|
|
1536
|
+
if (!coinType) return null;
|
|
1537
|
+
let normalized;
|
|
1534
1538
|
try {
|
|
1535
|
-
|
|
1536
|
-
} catch
|
|
1537
|
-
return
|
|
1539
|
+
normalized = normalizeStructTag(coinType);
|
|
1540
|
+
} catch {
|
|
1541
|
+
return null;
|
|
1542
|
+
}
|
|
1543
|
+
if (normalized === normalizeStructTag(GASLESS_STABLE_TYPES.USDC)) {
|
|
1544
|
+
return { kind: "gasless-stable", symbol: "USDC", coinType: GASLESS_STABLE_TYPES.USDC };
|
|
1545
|
+
}
|
|
1546
|
+
if (normalized === normalizeStructTag(GASLESS_STABLE_TYPES.USDsui)) {
|
|
1547
|
+
return { kind: "gasless-stable", symbol: "USDsui", coinType: GASLESS_STABLE_TYPES.USDsui };
|
|
1548
|
+
}
|
|
1549
|
+
if (normalized === normalizeStructTag(SUI_TYPE)) {
|
|
1550
|
+
return { kind: "sui", symbol: "SUI", coinType: SUI_TYPE };
|
|
1551
|
+
}
|
|
1552
|
+
return { kind: "coin", symbol: resolveSymbol(coinType), coinType };
|
|
1553
|
+
}
|
|
1554
|
+
function invalidSendAssetMessage(asset) {
|
|
1555
|
+
return `Unknown asset "${asset}". Use a registry symbol (USDC, USDsui, SUI, MANIFEST, \u2026) or a full coin type (0x\u2026::module::TYPE).`;
|
|
1556
|
+
}
|
|
1557
|
+
function preflightSend(input) {
|
|
1558
|
+
const cls = classifySendAsset(input.asset);
|
|
1559
|
+
if (!cls) {
|
|
1560
|
+
return preflightFail("INVALID_ASSET", invalidSendAssetMessage(input.asset));
|
|
1538
1561
|
}
|
|
1539
1562
|
const amountCheck = checkPositiveAmount(input.amount);
|
|
1540
1563
|
if (!amountCheck.valid) return amountCheck;
|
|
1541
|
-
if (
|
|
1564
|
+
if (cls.kind === "gasless-stable" && input.amount < GASLESS_MIN_STABLE_AMOUNT) {
|
|
1542
1565
|
return preflightFail(
|
|
1543
1566
|
"INVALID_AMOUNT",
|
|
1544
|
-
`Minimum gasless transfer is ${GASLESS_MIN_STABLE_AMOUNT} ${
|
|
1567
|
+
`Minimum gasless transfer is ${GASLESS_MIN_STABLE_AMOUNT} ${cls.symbol}. Got ${input.amount}.`
|
|
1545
1568
|
);
|
|
1546
1569
|
}
|
|
1547
1570
|
const addressCheck = checkSuiAddress(input.to);
|
|
@@ -1558,42 +1581,44 @@ async function buildSendTx({
|
|
|
1558
1581
|
const pf = preflightSend({ to, amount, asset });
|
|
1559
1582
|
if (!pf.valid) throw new T2000Error(pf.code, pf.error);
|
|
1560
1583
|
const recipient = validateAddress(to);
|
|
1561
|
-
const
|
|
1562
|
-
|
|
1563
|
-
const rawAmount = displayToRaw(amount,
|
|
1584
|
+
const cls = classifySendAsset(asset);
|
|
1585
|
+
const decimals = cls.kind === "gasless-stable" || cls.kind === "sui" ? SUPPORTED_ASSETS[cls.symbol].decimals : await resolveCoinDecimals(client, cls.coinType);
|
|
1586
|
+
const rawAmount = displayToRaw(amount, decimals);
|
|
1564
1587
|
const tx = new Transaction();
|
|
1565
1588
|
tx.setSender(address);
|
|
1566
|
-
const balanceResp = await client.core.getBalance({ owner: address, coinType:
|
|
1589
|
+
const balanceResp = await client.core.getBalance({ owner: address, coinType: cls.coinType });
|
|
1567
1590
|
const totalBalance = BigInt(balanceResp.balance.balance);
|
|
1568
1591
|
if (totalBalance < rawAmount) {
|
|
1569
|
-
throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient ${
|
|
1570
|
-
available: Number(totalBalance) / 10 **
|
|
1592
|
+
throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient ${cls.symbol} balance`, {
|
|
1593
|
+
available: Number(totalBalance) / 10 ** decimals,
|
|
1571
1594
|
required: amount
|
|
1572
1595
|
});
|
|
1573
1596
|
}
|
|
1574
|
-
if (
|
|
1575
|
-
const rawFloor = displayToRaw(GASLESS_MIN_STABLE_AMOUNT, assetInfo.decimals);
|
|
1576
|
-
const remainder = totalBalance - rawAmount;
|
|
1577
|
-
if (remainder > 0n && remainder < rawFloor) {
|
|
1578
|
-
const total = Number(totalBalance) / 10 ** assetInfo.decimals;
|
|
1579
|
-
throw new T2000Error(
|
|
1580
|
-
"INVALID_AMOUNT",
|
|
1581
|
-
`Gasless ${asset} transfers must send the entire balance or leave at least ${GASLESS_MIN_STABLE_AMOUNT} ${asset}. Sending ${amount} of ${total} leaves ${(total - amount).toFixed(assetInfo.decimals)}. Send ${total} (everything) or at most ${(total - GASLESS_MIN_STABLE_AMOUNT).toFixed(assetInfo.decimals)}.`,
|
|
1582
|
-
{ available: total, required: amount }
|
|
1583
|
-
);
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
if (asset === "SUI") {
|
|
1597
|
+
if (cls.kind === "sui") {
|
|
1587
1598
|
const [sendCoin] = tx.splitCoins(tx.gas, [rawAmount]);
|
|
1588
1599
|
tx.transferObjects([sendCoin], recipient);
|
|
1589
1600
|
return tx;
|
|
1590
1601
|
}
|
|
1591
|
-
|
|
1602
|
+
if (cls.kind === "coin") {
|
|
1603
|
+
const sendCoin = coinWithBalance({ type: cls.coinType, balance: rawAmount })(tx);
|
|
1604
|
+
tx.transferObjects([sendCoin], recipient);
|
|
1605
|
+
return tx;
|
|
1606
|
+
}
|
|
1607
|
+
const rawFloor = displayToRaw(GASLESS_MIN_STABLE_AMOUNT, decimals);
|
|
1608
|
+
const remainder = totalBalance - rawAmount;
|
|
1609
|
+
if (remainder > 0n && remainder < rawFloor) {
|
|
1610
|
+
const total = Number(totalBalance) / 10 ** decimals;
|
|
1611
|
+
throw new T2000Error(
|
|
1612
|
+
"INVALID_AMOUNT",
|
|
1613
|
+
`Gasless ${cls.symbol} transfers must send the entire balance or leave at least ${GASLESS_MIN_STABLE_AMOUNT} ${cls.symbol}. Sending ${amount} of ${total} leaves ${(total - amount).toFixed(decimals)}. Send ${total} (everything) or at most ${(total - GASLESS_MIN_STABLE_AMOUNT).toFixed(decimals)}.`,
|
|
1614
|
+
{ available: total, required: amount }
|
|
1615
|
+
);
|
|
1616
|
+
}
|
|
1592
1617
|
tx.moveCall({
|
|
1593
1618
|
target: "0x2::balance::send_funds",
|
|
1594
|
-
typeArguments: [coinType],
|
|
1619
|
+
typeArguments: [cls.coinType],
|
|
1595
1620
|
arguments: [
|
|
1596
|
-
tx.balance({ type: coinType, balance: rawAmount }),
|
|
1621
|
+
tx.balance({ type: cls.coinType, balance: rawAmount }),
|
|
1597
1622
|
tx.pure.address(recipient)
|
|
1598
1623
|
]
|
|
1599
1624
|
});
|
|
@@ -3094,18 +3119,17 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
3094
3119
|
/**
|
|
3095
3120
|
* Send `amount` of `asset` to `to` (hex address or SuiNS name).
|
|
3096
3121
|
*
|
|
3097
|
-
* [
|
|
3122
|
+
* [S.957 — 2026-08-08] `asset` accepts **any held coin type** — a
|
|
3123
|
+
* registry symbol (`USDC`, `MANIFEST`) or a full `0x…::module::TYPE`.
|
|
3124
|
+
* Unresolvable strings throw `INVALID_ASSET`; empty balances throw
|
|
3125
|
+
* `INSUFFICIENT_BALANCE`.
|
|
3098
3126
|
*
|
|
3099
|
-
* **Breaking changes from v3.x:**
|
|
3100
|
-
* - `asset` is now REQUIRED (no implicit `?? 'USDC'` default). Callers
|
|
3101
|
-
* must specify `'USDC' | 'USDsui' | 'SUI'`. Sending `'USDT'` /
|
|
3102
|
-
* `'USDe'` / `'WAL'` / `'ETH'` / `'NAVX'` / `'GOLD'` now errors
|
|
3103
|
-
* with `INVALID_ASSET` — swap to a stable first.
|
|
3104
3127
|
* - USDC + USDsui builds go through `SuiGrpcClient` so the gRPC build
|
|
3105
3128
|
* resolver auto-detects `0x2::balance::send_funds` eligibility and
|
|
3106
|
-
* zeros gas at simulate time
|
|
3107
|
-
*
|
|
3108
|
-
*
|
|
3129
|
+
* zeros gas at simulate time — **gasless sends from a zero-SUI
|
|
3130
|
+
* wallet.** They remain the ONLY gasless assets.
|
|
3131
|
+
* - SUI and every other coin type are gas-paid (the sender needs SUI).
|
|
3132
|
+
* - `asset` stays REQUIRED (no implicit `?? 'USDC'` default — v4 rule).
|
|
3109
3133
|
*
|
|
3110
3134
|
* Submission stays on the JSON-RPC client (the rest of the SDK
|
|
3111
3135
|
* expects JSON-RPC for read paths, and Sui's docs explicitly support
|
|
@@ -3116,30 +3140,31 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
3116
3140
|
if (!asset) {
|
|
3117
3141
|
throw new T2000Error(
|
|
3118
3142
|
"INVALID_ASSET",
|
|
3119
|
-
"send() requires an explicit asset. Use
|
|
3143
|
+
"send() requires an explicit asset. Use a registry symbol (USDC, USDsui, SUI, MANIFEST, \u2026) or a full coin type (0x\u2026::module::TYPE)."
|
|
3120
3144
|
);
|
|
3121
3145
|
}
|
|
3122
|
-
|
|
3123
|
-
|
|
3146
|
+
const cls = classifySendAsset(asset);
|
|
3147
|
+
if (!cls) {
|
|
3148
|
+
throw new T2000Error("INVALID_ASSET", invalidSendAssetMessage(asset));
|
|
3149
|
+
}
|
|
3124
3150
|
this.limits.assert({
|
|
3125
3151
|
operation: "send",
|
|
3126
|
-
amountUsd: approxUsdValue(
|
|
3152
|
+
amountUsd: approxUsdValue(cls.symbol, params.amount) ?? 0,
|
|
3127
3153
|
force: params.force
|
|
3128
3154
|
});
|
|
3129
3155
|
const resolved = await this.resolveRecipient(params.to);
|
|
3130
3156
|
const sendAmount = params.amount;
|
|
3131
3157
|
const sendTo = resolved.address;
|
|
3132
|
-
const
|
|
3133
|
-
const buildClient = useGrpc ? getSuiGrpcClient() : void 0;
|
|
3158
|
+
const buildClient = cls.kind === "gasless-stable" ? getSuiGrpcClient() : void 0;
|
|
3134
3159
|
const gasResult = await executeTx(
|
|
3135
3160
|
this.client,
|
|
3136
3161
|
this._signer,
|
|
3137
|
-
() => buildSendTx({ client: this.client, address: this._address, to: sendTo, amount: sendAmount, asset
|
|
3162
|
+
() => buildSendTx({ client: this.client, address: this._address, to: sendTo, amount: sendAmount, asset }),
|
|
3138
3163
|
{ buildClient }
|
|
3139
3164
|
);
|
|
3140
|
-
this.limits.record(approxUsdValue(
|
|
3165
|
+
this.limits.record(approxUsdValue(cls.symbol, sendAmount) ?? 0);
|
|
3141
3166
|
const balance = await this.balance();
|
|
3142
|
-
this.emitBalanceChange(
|
|
3167
|
+
this.emitBalanceChange(cls.symbol, sendAmount, "send", gasResult.digest);
|
|
3143
3168
|
return {
|
|
3144
3169
|
success: true,
|
|
3145
3170
|
tx: gasResult.digest,
|
|
@@ -3790,6 +3815,36 @@ async function getJobSpec(base, hash) {
|
|
|
3790
3815
|
}
|
|
3791
3816
|
return content;
|
|
3792
3817
|
}
|
|
3818
|
+
|
|
3819
|
+
// src/job-spec-envelope.ts
|
|
3820
|
+
var TITLE_PREFIX_RE = /^title\s*:\s*(.+)$/i;
|
|
3821
|
+
var ENVELOPE_TITLE_MAX = 80;
|
|
3822
|
+
function customHireEnvelope(brief, title, now) {
|
|
3823
|
+
const body2 = brief.trim();
|
|
3824
|
+
let t = title?.trim() ?? "";
|
|
3825
|
+
if (!t) {
|
|
3826
|
+
const first = body2.split("\n").find((l) => l.trim())?.trim() ?? "";
|
|
3827
|
+
const prefixed = TITLE_PREFIX_RE.exec(first);
|
|
3828
|
+
t = (prefixed ? prefixed[1] : first).trim();
|
|
3829
|
+
}
|
|
3830
|
+
if (t.length > ENVELOPE_TITLE_MAX) {
|
|
3831
|
+
t = `${t.slice(0, ENVELOPE_TITLE_MAX - 1).trimEnd()}\u2026`;
|
|
3832
|
+
}
|
|
3833
|
+
return JSON.stringify({
|
|
3834
|
+
type: "t2-acp-custom@1",
|
|
3835
|
+
title: t || "Custom job",
|
|
3836
|
+
brief: body2,
|
|
3837
|
+
createdAtMs: now
|
|
3838
|
+
});
|
|
3839
|
+
}
|
|
3840
|
+
function isCustomHireEnvelope(text) {
|
|
3841
|
+
try {
|
|
3842
|
+
const parsed = JSON.parse(text);
|
|
3843
|
+
return (parsed.type === "t2-acp-custom@1" || parsed.type === "t2-acp-invite@1") && typeof parsed.brief === "string" && parsed.brief.trim().length > 0;
|
|
3844
|
+
} catch {
|
|
3845
|
+
return false;
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3793
3848
|
async function fetchJson(url, init) {
|
|
3794
3849
|
const res = await fetch(url, {
|
|
3795
3850
|
method: init?.method ?? "GET",
|
|
@@ -3915,7 +3970,12 @@ var WRITE_APPENDER_REGISTRY = {
|
|
|
3915
3970
|
"send_transfer requires an explicit asset. Use one of: USDC, USDsui, SUI."
|
|
3916
3971
|
);
|
|
3917
3972
|
}
|
|
3918
|
-
|
|
3973
|
+
if (!SENDABLE_ASSETS.some((a) => a.toLowerCase() === input.asset.toLowerCase())) {
|
|
3974
|
+
throw new T2000Error(
|
|
3975
|
+
"INVALID_ASSET",
|
|
3976
|
+
`send_transfer only supports ${SENDABLE_ASSETS.join(", ")}. Cannot use ${input.asset}. Swap to USDC or USDsui first, or send SUI.`
|
|
3977
|
+
);
|
|
3978
|
+
}
|
|
3919
3979
|
const asset = input.asset;
|
|
3920
3980
|
const assetInfo = SUPPORTED_ASSETS[asset];
|
|
3921
3981
|
if (input.amount <= 0) {
|
|
@@ -4303,6 +4363,6 @@ function displayHandle(label, parentName = AUDRIC_PARENT_NAME) {
|
|
|
4303
4363
|
// src/index.ts
|
|
4304
4364
|
init_preflight();
|
|
4305
4365
|
|
|
4306
|
-
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, ESCROW_JOB_TYPE_MARKER, 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, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAINNET_A2A_ESCROW_PACKAGE_ID, 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, OPENING_TYPE_MARKER, 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, canonicalizeRecipientInput, 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, probeX402, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, refundOpenJob, reportX402Activity, resolveAddressToSuinsViaRpc, resolveCreatedObjectId, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, setSponsoredTxGuard, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, verifyReceipt, walletExists, writeLimitsFile };
|
|
4366
|
+
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, ESCROW_JOB_TYPE_MARKER, 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, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAINNET_A2A_ESCROW_PACKAGE_ID, 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, OPENING_TYPE_MARKER, 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, canonicalizeRecipientInput, chatCompletion, chatCompletionStream, checkPositiveAmount, checkSuiAddress, claimOpenJob, classifyAction, classifyLabel, classifySendAsset, classifyTransaction, clearLimits, composeTx, customHireEnvelope, 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, invalidSendAssetMessage, isAllowedAsset, isCetusRouteFresh, isCustomHireEnvelope, isInRegistry, jobActionsFor, keypairFromPrivateKey, listModels, listOpenJobs, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseSuiRpcTx, payWithX402, postOpenJob, preflightCreateJob, preflightCreateOpening, preflightFail, preflightPay, preflightSend, preflightSwap, probeX402, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, refundOpenJob, reportX402Activity, resolveAddressToSuinsViaRpc, resolveCreatedObjectId, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, setSponsoredTxGuard, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, verifyReceipt, walletExists, writeLimitsFile };
|
|
4307
4367
|
//# sourceMappingURL=index.js.map
|
|
4308
4368
|
//# sourceMappingURL=index.js.map
|