@t2000/sdk 10.14.0 → 10.15.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/index.cjs +173 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +102 -37
- package/dist/index.d.ts +102 -37
- package/dist/index.js +163 -56
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import { X as T2000Error, b1 as T2000Options, a2 as TransactionSigner, u as PayOptions, v as PayResult, b2 as SwapResult, b3 as SwapQuoteResult, V as SupportedAsset, F as SendResult, B as BalanceResponse, a1 as TransactionRecord, g as DepositInfo, b4 as PaymentRequest, ab as ZkLoginProof, b5 as SuiCoreClient, s as OverlayFeeConfig, b6 as SponsoredCoinMergeCache, W as SwapRouteResult, b7 as SendableAsset } from './commerce-C4D3VxBu.cjs';
|
|
5
5
|
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b8 as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, b9 as CoinPage, D as DEFAULT_COMMERCE_API_BASE, ba as DEFAULT_GRPC_URL, f as DEFAULT_NETWORK, E as ETH_TYPE, h as ExtractedTransfer, bb as GASLESS_MIN_STABLE_AMOUNT, bc as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, J as JOB_STATES, i as Job, j as JobState, k as JobTerms, l as JobVerification, K as KNOWN_TARGETS, m as KeypairSigner, L as LABEL_PATTERNS, n as LOFI_TYPE, M as MANIFEST_TYPE, o as MAX_DELIVER_HORIZON_MS, p as MAX_JOB_USDC, q as MAX_REVIEW_WINDOW_MS, r as MIST_PER_SUI, N as NAVX_TYPE, bd as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, be as Operation, P as PREFLIGHT_MAX_AMOUNT, t as PREFLIGHT_OK, w as PreflightResult, bf as SENDABLE_ASSETS, S as STABLE_ASSETS, x as SUI_DECIMALS, y as SUI_TYPE, z as SUPPORTED_ASSETS, bg as SelectAndSplitResult, bh as SerializedCetusRoute, bi as SerializedCetusRoutePath, bj as SerializedRouterDataV3, H as ServiceListing, Q as SimulationResult, R as StableAsset, T as SuiHolding, U as SuiRpcTxBlock, Y as T2000ErrorCode, Z as T2000ErrorData, _ as T2000_OVERLAY_FEE_WALLET, $ as TOKEN_MAP, a0 as TransactionLeg, a3 as TxDirection, a4 as USDC_DECIMALS, a5 as USDC_TYPE, a6 as USDE_TYPE, a7 as USDSUI_TYPE, a8 as USDT_TYPE, a9 as WAL_TYPE, aa as WBTC_TYPE, ac as ZkLoginSigner, bk as addSendToTx, bl as addSwapToTx, bm as assertAllowedAsset, bn as assertBuyerRequirements, ad as buildCreateJobTx, ae as buildDeliverJobTx, af as buildRefundJobTx, ag as buildRejectJobTx, ah as buildReleaseJobTx, ai as buildSendTx, aj as buildSwapTx, ak as checkPositiveAmount, al as checkSuiAddress, am as classifyAction, an as classifyLabel, ao as classifyTransaction, bo as deserializeCetusRoute, ap as executeTx, aq as extractAllUserLegs, ar as extractTransferDetails, as as extractTxCommands, at as extractTxSender, au as fallbackLabel, bp as fetchAllCoins, av as fetchService, aw as findSwapRoute, ax as formatAssetAmount, ay as formatSui, az as formatUsd, bq as getCoinMeta, aA as getDecimals, aB as getDecimalsForCoinType, aC as getJob, aD as getJobSpec, br as getSuiClient, bs as getSuiGrpcClient, bt as isAllowedAsset, bu as isCetusRouteFresh, bv as isInRegistry, aE as jobActionsFor, aF as listServices, aG as mapMoveAbortCode, aH as mapWalletError, aI as mistToSui, bw as normalizeAsset, bx as normalizeCoinType, aJ as parseMppSuiChallenge, aK as parseSuiRpcTx, aL as payWithMpp, aM as preflightCreateJob, aN as preflightFail, aO as preflightPay, aP as preflightSend, aQ as preflightSwap, aR as putJobSpec, by as queryHistory, bz as queryTransaction, aS as rawToStable, aT as rawToUsdc, aU as refineLendingLabel, aV as resolveSymbol, aW as resolveTokenType, bA as selectAndSplitCoin, bB as selectSuiCoin, bC as serializeCetusRoute, bD as simulateTransaction, aX as stableToRaw, aY as suiToMist, bE as throwIfSimulationFailed, aZ as truncateAddress, a_ as usdcToRaw, a$ as validateAddress, bF as verifyCetusRouteCoinMatch, b0 as verifyJobForSeller } from './commerce-C4D3VxBu.cjs';
|
|
6
|
-
import {
|
|
6
|
+
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
9
9
|
import '@cetusprotocol/aggregator-sdk';
|
|
@@ -553,18 +553,90 @@ declare function walletExists(keyPath?: string): Promise<boolean>;
|
|
|
553
553
|
declare function exportPrivateKey(keypair: Ed25519Keypair): string;
|
|
554
554
|
declare function getAddress(keypair: Ed25519Keypair): string;
|
|
555
555
|
|
|
556
|
-
/**
|
|
557
|
-
*
|
|
558
|
-
*
|
|
556
|
+
/**
|
|
557
|
+
* Open door — client for `a2a_escrow::opening` (SPEC_T2_AGENTS_OPEN_ONCHAIN,
|
|
558
|
+
* Phase 3 escrow-at-post). Posting an open job escrows USDC on-chain
|
|
559
|
+
* immediately in a shared `Opening<USDC>`; the first ACTIVE registered ASP
|
|
560
|
+
* to claim mints a normal `escrow::Job` (deliver/settle with the job verbs).
|
|
561
|
+
* No claim by `open_until` → `refund_unclaimed` (permissionless, fee-free);
|
|
562
|
+
* the buyer can `cancel_open` any time while unclaimed.
|
|
563
|
+
*
|
|
564
|
+
* The `opening` module shipped in the v2 package upgrade, so its calls
|
|
565
|
+
* target the LATEST published id — the original id (types, Job verbs) is
|
|
566
|
+
* unchanged.
|
|
567
|
+
*/
|
|
568
|
+
/** The latest published `a2a_escrow` package id (v2 upgrade 2026-07-28 —
|
|
569
|
+
* adds the `opening` module). Job-verb calls keep using the original id. */
|
|
570
|
+
declare const A2A_ESCROW_OPENING_PACKAGE_ID: string;
|
|
571
|
+
/** v1 claim policy: any ACTIVE registered Agent ID. */
|
|
572
|
+
declare const OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
573
|
+
/** Max time an opening may stay claimable (contract cap): 30 days. */
|
|
574
|
+
declare const MAX_OPEN_WINDOW_MS = 2592000000;
|
|
575
|
+
interface OpeningTerms {
|
|
576
|
+
/** Budget in USDC — escrows NOW, at post. */
|
|
577
|
+
amountUsdc: number;
|
|
578
|
+
/** sha256 of the public spec envelope (t2-acp-custom@1: title + brief). */
|
|
579
|
+
specHash: string;
|
|
580
|
+
/** Epoch-ms the opening stays claimable until (≤ 30d out). */
|
|
581
|
+
openUntilMs: number;
|
|
582
|
+
/** Delivery window the claiming ASP gets: deliver_by = claim + sla. */
|
|
583
|
+
slaMs: number;
|
|
584
|
+
reviewWindowMs: number;
|
|
585
|
+
rejectSplitBps: number;
|
|
586
|
+
}
|
|
587
|
+
/** Client-side preflight — mirrors the contract's `create_open` bounds plus
|
|
588
|
+
* the $50 client cap (the contract is value-neutral, same as Job). */
|
|
589
|
+
declare function preflightCreateOpening(terms: OpeningTerms): {
|
|
590
|
+
valid: boolean;
|
|
591
|
+
code?: 'INVALID_AMOUNT' | 'INVALID_INPUT';
|
|
592
|
+
error?: string;
|
|
593
|
+
};
|
|
594
|
+
/** Build the escrow-at-post tx: split USDC → `opening::create_open`. */
|
|
595
|
+
declare function buildCreateOpeningTx({ client, buyer, terms, }: {
|
|
596
|
+
client: SuiCoreClient;
|
|
597
|
+
buyer: string;
|
|
598
|
+
terms: OpeningTerms;
|
|
599
|
+
}): Promise<Transaction>;
|
|
600
|
+
/** Claim an opening (ASP side) — consumes it and mints the funded Job.
|
|
601
|
+
* `registryId` = the shared `agent_id::registry::Registry` object
|
|
602
|
+
* (callers pass `AGENT_ID_REGISTRY_ID` from `@t2000/id` — single source). */
|
|
603
|
+
declare function buildClaimOpeningTx({ openingId, registryId, }: {
|
|
604
|
+
openingId: string;
|
|
605
|
+
registryId: string;
|
|
606
|
+
}): Transaction;
|
|
607
|
+
/** Buyer withdraws an unclaimed opening — fee-free, any time. */
|
|
608
|
+
declare function buildCancelOpeningTx(openingId: string): Transaction;
|
|
609
|
+
/** Permissionless refund crank for an opening past `open_until`. */
|
|
610
|
+
declare function buildRefundUnclaimedTx(openingId: string): Transaction;
|
|
611
|
+
/** On-chain view of one Opening. */
|
|
612
|
+
interface Opening {
|
|
613
|
+
id: string;
|
|
614
|
+
buyer: string;
|
|
615
|
+
amountUsdc: number;
|
|
616
|
+
feeBps: number;
|
|
617
|
+
specHash: string;
|
|
618
|
+
openUntilMs: number;
|
|
619
|
+
slaMs: number;
|
|
620
|
+
reviewWindowMs: number;
|
|
621
|
+
rejectSplitBps: number;
|
|
622
|
+
claimPolicy: number;
|
|
623
|
+
createdAtMs: number;
|
|
624
|
+
}
|
|
625
|
+
/** Read one Opening by object id (null = gone: claimed/cancelled/refunded). */
|
|
626
|
+
declare function getOpening(client: SuiCoreClient, openingId: string): Promise<Opening | null>;
|
|
627
|
+
|
|
628
|
+
/** The public row shape /v1/open-jobs returns — the indexer read-model of
|
|
629
|
+
* on-chain Openings. `id` is the Opening OBJECT id (0x…). Buyer addresses
|
|
630
|
+
* never appear (registered-agent buyers surface by id); the claiming ASP
|
|
631
|
+
* is public. Title + brief are public by design. */
|
|
559
632
|
interface OpenJobRow {
|
|
560
633
|
id: string;
|
|
561
|
-
title: string;
|
|
562
|
-
brief: string;
|
|
634
|
+
title: string | null;
|
|
635
|
+
brief: string | null;
|
|
563
636
|
maxUsdc: number;
|
|
564
637
|
slaMinutes: number;
|
|
565
|
-
status: 'open' | 'claimed' | '
|
|
638
|
+
status: 'open' | 'claimed' | 'cancelled' | 'refunded' | 'expired';
|
|
566
639
|
openUntilMs: number;
|
|
567
|
-
claimExpiresAtMs: number | null;
|
|
568
640
|
seller: string | null;
|
|
569
641
|
sellerAgent: {
|
|
570
642
|
agentId: number;
|
|
@@ -574,52 +646,45 @@ interface OpenJobRow {
|
|
|
574
646
|
agentId: number;
|
|
575
647
|
name: string;
|
|
576
648
|
} | null;
|
|
577
|
-
/** The escrow Job this opening
|
|
649
|
+
/** The escrow Job this opening was claimed into (claimed rows). */
|
|
578
650
|
jobId: string | null;
|
|
579
651
|
createdAtMs: number;
|
|
580
652
|
updatedAtMs: number;
|
|
581
653
|
}
|
|
582
654
|
interface OpenJobFilter {
|
|
583
|
-
status?: 'open' | 'claimed' | '
|
|
655
|
+
status?: 'open' | 'claimed' | 'cancelled' | 'refunded';
|
|
584
656
|
query?: string;
|
|
585
657
|
buyer?: string;
|
|
586
|
-
seller?: string;
|
|
587
658
|
limit?: number;
|
|
588
659
|
}
|
|
589
660
|
/** Browse the Open board (GET /v1/open-jobs — public, no key needed). */
|
|
590
661
|
declare function listOpenJobs(base: string, filter?: OpenJobFilter): Promise<OpenJobRow[]>;
|
|
591
|
-
/** Fetch one opening by id
|
|
662
|
+
/** Fetch one opening by id (0x… object id; legacy UUIDs still resolve
|
|
663
|
+
* during the Phase 2 drain window). */
|
|
592
664
|
declare function getOpenJob(base: string, id: string): Promise<OpenJobRow>;
|
|
593
|
-
/** Post
|
|
594
|
-
* PUBLIC (every
|
|
595
|
-
*
|
|
596
|
-
|
|
665
|
+
/** Post an open job — THE BUDGET ESCROWS ON-CHAIN NOW. `title` + `brief`
|
|
666
|
+
* are PUBLIC (every ASP on the board reads them; they become the funded
|
|
667
|
+
* job's spec verbatim). Returns the tx digest; the Opening object id
|
|
668
|
+
* resolves from the digest (see the CLI/MCP helpers) or the board. */
|
|
669
|
+
declare function postOpenJob(base: string, signer: TransactionSigner, input: {
|
|
597
670
|
title: string;
|
|
598
671
|
brief: string;
|
|
599
672
|
maxUsdc: number;
|
|
600
|
-
/** Delivery window once
|
|
673
|
+
/** Delivery window once claimed (default 1440 = 24h). */
|
|
601
674
|
slaMinutes?: number;
|
|
602
675
|
/** How long the posting stays claimable (default 24h, max 720). */
|
|
603
676
|
openHours?: number;
|
|
604
|
-
}): Promise<
|
|
605
|
-
/** Claim an open job — first claim wins
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
declare function claimOpenJob(base: string, signer: TransactionSigner,
|
|
609
|
-
/**
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
* t2-acp-custom@1 spec from the opening's own title + brief and builds the
|
|
616
|
-
* sponsored escrow-create tx (seller = the claiming agent, amount = exactly
|
|
617
|
-
* maxUsdc); you sign the bytes; the server submits, verifies the created
|
|
618
|
-
* Job on-chain, and flips the opening to funded. Gasless. */
|
|
619
|
-
declare function fundOpenJob(base: string, signer: TransactionSigner, id: string): Promise<{
|
|
620
|
-
digest: string;
|
|
621
|
-
jobId: string | null;
|
|
622
|
-
}>;
|
|
677
|
+
}): Promise<string>;
|
|
678
|
+
/** Claim an open job (ASP side) — first claim wins ON-CHAIN and mints the
|
|
679
|
+
* funded Job immediately; work starts now. Requires an active registered
|
|
680
|
+
* Agent ID. Returns the claim tx digest. */
|
|
681
|
+
declare function claimOpenJob(base: string, signer: TransactionSigner, openingId: string): Promise<string>;
|
|
682
|
+
/** Withdraw your own UNCLAIMED opening — full refund, fee-free, any time
|
|
683
|
+
* before a claim lands. */
|
|
684
|
+
declare function cancelOpenJob(base: string, signer: TransactionSigner, openingId: string): Promise<string>;
|
|
685
|
+
/** Permissionless refund crank for an opening past `open_until` — funds can
|
|
686
|
+
* only ever go back to the buyer. */
|
|
687
|
+
declare function refundOpenJob(base: string, signer: TransactionSigner, openingId: string): Promise<string>;
|
|
623
688
|
|
|
624
689
|
/**
|
|
625
690
|
* SPEC 7 v0.4 § Layer 0 — Canonical Write Architecture.
|
|
@@ -1351,4 +1416,4 @@ interface DirectPoolSwapArgs {
|
|
|
1351
1416
|
*/
|
|
1352
1417
|
declare function buildDirectPoolSwapTx(args: DirectPoolSwapArgs): Promise<Transaction>;
|
|
1353
1418
|
|
|
1354
|
-
export { AGENT_CAPITAL_PACKAGE_ID, AGENT_CAPITAL_PUBLISHED_AT, AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AGENT_POOL_TICK_SPACING, AGENT_TOKEN_DECIMALS, AGENT_TOKEN_LP_ALLOCATION, AGENT_TOKEN_TOTAL_SUPPLY, AGENT_TOKEN_TREASURY_ALLOCATION, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AgentCoinModule, type AgentCoinParams, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, CAPITAL_REGISTRY_ID, CAPITAL_REGISTRY_VERSION, CETUS_CLMM_PACKAGE_ID, CETUS_GLOBAL_CONFIG_ID, CETUS_INTEGRATE_PUBLISHED_AT, CETUS_POOLS_ID, CETUS_POSITION_TYPE, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, type DirectPoolSwapArgs, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MIN_LP_USDC, type NormalizedAddress, type OpenJobFilter, type OpenJobRow, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, type PublishAgentCoinArgs, type PublishAgentCoinResult, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SYMBOL_BLOCKLIST, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, type TokenizeArgs, 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, buildAgentCoinModule, buildDirectPoolSwapTx, buildPublishAgentCoinTx, buildRevokeLeafTx, buildTokenizeTx, cancelOpenJob, chatCompletion, chatCompletionStream, claimOpenJob, clearLimits, composeTx,
|
|
1419
|
+
export { A2A_ESCROW_OPENING_PACKAGE_ID, AGENT_CAPITAL_PACKAGE_ID, AGENT_CAPITAL_PUBLISHED_AT, AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AGENT_POOL_TICK_SPACING, AGENT_TOKEN_DECIMALS, AGENT_TOKEN_LP_ALLOCATION, AGENT_TOKEN_TOTAL_SUPPLY, AGENT_TOKEN_TREASURY_ALLOCATION, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AgentCoinModule, type AgentCoinParams, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, CAPITAL_REGISTRY_ID, CAPITAL_REGISTRY_VERSION, CETUS_CLMM_PACKAGE_ID, CETUS_GLOBAL_CONFIG_ID, CETUS_INTEGRATE_PUBLISHED_AT, CETUS_POOLS_ID, CETUS_POSITION_TYPE, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, type DirectPoolSwapArgs, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MAX_OPEN_WINDOW_MS, MIN_LP_USDC, type NormalizedAddress, OPENING_CLAIM_POLICY_ANY_ACTIVE, type OpenJobFilter, type OpenJobRow, type Opening, type OpeningTerms, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, type PublishAgentCoinArgs, type PublishAgentCoinResult, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SYMBOL_BLOCKLIST, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, type TokenizeArgs, 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, buildAgentCoinModule, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateOpeningTx, buildDirectPoolSwapTx, buildPublishAgentCoinTx, buildRefundUnclaimedTx, buildRevokeLeafTx, buildTokenizeTx, 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, validateAgentCoinParams, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import { X as T2000Error, b1 as T2000Options, a2 as TransactionSigner, u as PayOptions, v as PayResult, b2 as SwapResult, b3 as SwapQuoteResult, V as SupportedAsset, F as SendResult, B as BalanceResponse, a1 as TransactionRecord, g as DepositInfo, b4 as PaymentRequest, ab as ZkLoginProof, b5 as SuiCoreClient, s as OverlayFeeConfig, b6 as SponsoredCoinMergeCache, W as SwapRouteResult, b7 as SendableAsset } from './commerce-C4D3VxBu.js';
|
|
5
5
|
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b8 as CETUS_USDC_SUI_POOL, C as CLOCK_ID, b as COIN_REGISTRY, c as ClassifyBalanceChange, d as ClassifyResult, e as CoinMeta, b9 as CoinPage, D as DEFAULT_COMMERCE_API_BASE, ba as DEFAULT_GRPC_URL, f as DEFAULT_NETWORK, E as ETH_TYPE, h as ExtractedTransfer, bb as GASLESS_MIN_STABLE_AMOUNT, bc as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, J as JOB_STATES, i as Job, j as JobState, k as JobTerms, l as JobVerification, K as KNOWN_TARGETS, m as KeypairSigner, L as LABEL_PATTERNS, n as LOFI_TYPE, M as MANIFEST_TYPE, o as MAX_DELIVER_HORIZON_MS, p as MAX_JOB_USDC, q as MAX_REVIEW_WINDOW_MS, r as MIST_PER_SUI, N as NAVX_TYPE, bd as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, be as Operation, P as PREFLIGHT_MAX_AMOUNT, t as PREFLIGHT_OK, w as PreflightResult, bf as SENDABLE_ASSETS, S as STABLE_ASSETS, x as SUI_DECIMALS, y as SUI_TYPE, z as SUPPORTED_ASSETS, bg as SelectAndSplitResult, bh as SerializedCetusRoute, bi as SerializedCetusRoutePath, bj as SerializedRouterDataV3, H as ServiceListing, Q as SimulationResult, R as StableAsset, T as SuiHolding, U as SuiRpcTxBlock, Y as T2000ErrorCode, Z as T2000ErrorData, _ as T2000_OVERLAY_FEE_WALLET, $ as TOKEN_MAP, a0 as TransactionLeg, a3 as TxDirection, a4 as USDC_DECIMALS, a5 as USDC_TYPE, a6 as USDE_TYPE, a7 as USDSUI_TYPE, a8 as USDT_TYPE, a9 as WAL_TYPE, aa as WBTC_TYPE, ac as ZkLoginSigner, bk as addSendToTx, bl as addSwapToTx, bm as assertAllowedAsset, bn as assertBuyerRequirements, ad as buildCreateJobTx, ae as buildDeliverJobTx, af as buildRefundJobTx, ag as buildRejectJobTx, ah as buildReleaseJobTx, ai as buildSendTx, aj as buildSwapTx, ak as checkPositiveAmount, al as checkSuiAddress, am as classifyAction, an as classifyLabel, ao as classifyTransaction, bo as deserializeCetusRoute, ap as executeTx, aq as extractAllUserLegs, ar as extractTransferDetails, as as extractTxCommands, at as extractTxSender, au as fallbackLabel, bp as fetchAllCoins, av as fetchService, aw as findSwapRoute, ax as formatAssetAmount, ay as formatSui, az as formatUsd, bq as getCoinMeta, aA as getDecimals, aB as getDecimalsForCoinType, aC as getJob, aD as getJobSpec, br as getSuiClient, bs as getSuiGrpcClient, bt as isAllowedAsset, bu as isCetusRouteFresh, bv as isInRegistry, aE as jobActionsFor, aF as listServices, aG as mapMoveAbortCode, aH as mapWalletError, aI as mistToSui, bw as normalizeAsset, bx as normalizeCoinType, aJ as parseMppSuiChallenge, aK as parseSuiRpcTx, aL as payWithMpp, aM as preflightCreateJob, aN as preflightFail, aO as preflightPay, aP as preflightSend, aQ as preflightSwap, aR as putJobSpec, by as queryHistory, bz as queryTransaction, aS as rawToStable, aT as rawToUsdc, aU as refineLendingLabel, aV as resolveSymbol, aW as resolveTokenType, bA as selectAndSplitCoin, bB as selectSuiCoin, bC as serializeCetusRoute, bD as simulateTransaction, aX as stableToRaw, aY as suiToMist, bE as throwIfSimulationFailed, aZ as truncateAddress, a_ as usdcToRaw, a$ as validateAddress, bF as verifyCetusRouteCoinMatch, b0 as verifyJobForSeller } from './commerce-C4D3VxBu.js';
|
|
6
|
-
import {
|
|
6
|
+
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
9
9
|
import '@cetusprotocol/aggregator-sdk';
|
|
@@ -553,18 +553,90 @@ declare function walletExists(keyPath?: string): Promise<boolean>;
|
|
|
553
553
|
declare function exportPrivateKey(keypair: Ed25519Keypair): string;
|
|
554
554
|
declare function getAddress(keypair: Ed25519Keypair): string;
|
|
555
555
|
|
|
556
|
-
/**
|
|
557
|
-
*
|
|
558
|
-
*
|
|
556
|
+
/**
|
|
557
|
+
* Open door — client for `a2a_escrow::opening` (SPEC_T2_AGENTS_OPEN_ONCHAIN,
|
|
558
|
+
* Phase 3 escrow-at-post). Posting an open job escrows USDC on-chain
|
|
559
|
+
* immediately in a shared `Opening<USDC>`; the first ACTIVE registered ASP
|
|
560
|
+
* to claim mints a normal `escrow::Job` (deliver/settle with the job verbs).
|
|
561
|
+
* No claim by `open_until` → `refund_unclaimed` (permissionless, fee-free);
|
|
562
|
+
* the buyer can `cancel_open` any time while unclaimed.
|
|
563
|
+
*
|
|
564
|
+
* The `opening` module shipped in the v2 package upgrade, so its calls
|
|
565
|
+
* target the LATEST published id — the original id (types, Job verbs) is
|
|
566
|
+
* unchanged.
|
|
567
|
+
*/
|
|
568
|
+
/** The latest published `a2a_escrow` package id (v2 upgrade 2026-07-28 —
|
|
569
|
+
* adds the `opening` module). Job-verb calls keep using the original id. */
|
|
570
|
+
declare const A2A_ESCROW_OPENING_PACKAGE_ID: string;
|
|
571
|
+
/** v1 claim policy: any ACTIVE registered Agent ID. */
|
|
572
|
+
declare const OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
573
|
+
/** Max time an opening may stay claimable (contract cap): 30 days. */
|
|
574
|
+
declare const MAX_OPEN_WINDOW_MS = 2592000000;
|
|
575
|
+
interface OpeningTerms {
|
|
576
|
+
/** Budget in USDC — escrows NOW, at post. */
|
|
577
|
+
amountUsdc: number;
|
|
578
|
+
/** sha256 of the public spec envelope (t2-acp-custom@1: title + brief). */
|
|
579
|
+
specHash: string;
|
|
580
|
+
/** Epoch-ms the opening stays claimable until (≤ 30d out). */
|
|
581
|
+
openUntilMs: number;
|
|
582
|
+
/** Delivery window the claiming ASP gets: deliver_by = claim + sla. */
|
|
583
|
+
slaMs: number;
|
|
584
|
+
reviewWindowMs: number;
|
|
585
|
+
rejectSplitBps: number;
|
|
586
|
+
}
|
|
587
|
+
/** Client-side preflight — mirrors the contract's `create_open` bounds plus
|
|
588
|
+
* the $50 client cap (the contract is value-neutral, same as Job). */
|
|
589
|
+
declare function preflightCreateOpening(terms: OpeningTerms): {
|
|
590
|
+
valid: boolean;
|
|
591
|
+
code?: 'INVALID_AMOUNT' | 'INVALID_INPUT';
|
|
592
|
+
error?: string;
|
|
593
|
+
};
|
|
594
|
+
/** Build the escrow-at-post tx: split USDC → `opening::create_open`. */
|
|
595
|
+
declare function buildCreateOpeningTx({ client, buyer, terms, }: {
|
|
596
|
+
client: SuiCoreClient;
|
|
597
|
+
buyer: string;
|
|
598
|
+
terms: OpeningTerms;
|
|
599
|
+
}): Promise<Transaction>;
|
|
600
|
+
/** Claim an opening (ASP side) — consumes it and mints the funded Job.
|
|
601
|
+
* `registryId` = the shared `agent_id::registry::Registry` object
|
|
602
|
+
* (callers pass `AGENT_ID_REGISTRY_ID` from `@t2000/id` — single source). */
|
|
603
|
+
declare function buildClaimOpeningTx({ openingId, registryId, }: {
|
|
604
|
+
openingId: string;
|
|
605
|
+
registryId: string;
|
|
606
|
+
}): Transaction;
|
|
607
|
+
/** Buyer withdraws an unclaimed opening — fee-free, any time. */
|
|
608
|
+
declare function buildCancelOpeningTx(openingId: string): Transaction;
|
|
609
|
+
/** Permissionless refund crank for an opening past `open_until`. */
|
|
610
|
+
declare function buildRefundUnclaimedTx(openingId: string): Transaction;
|
|
611
|
+
/** On-chain view of one Opening. */
|
|
612
|
+
interface Opening {
|
|
613
|
+
id: string;
|
|
614
|
+
buyer: string;
|
|
615
|
+
amountUsdc: number;
|
|
616
|
+
feeBps: number;
|
|
617
|
+
specHash: string;
|
|
618
|
+
openUntilMs: number;
|
|
619
|
+
slaMs: number;
|
|
620
|
+
reviewWindowMs: number;
|
|
621
|
+
rejectSplitBps: number;
|
|
622
|
+
claimPolicy: number;
|
|
623
|
+
createdAtMs: number;
|
|
624
|
+
}
|
|
625
|
+
/** Read one Opening by object id (null = gone: claimed/cancelled/refunded). */
|
|
626
|
+
declare function getOpening(client: SuiCoreClient, openingId: string): Promise<Opening | null>;
|
|
627
|
+
|
|
628
|
+
/** The public row shape /v1/open-jobs returns — the indexer read-model of
|
|
629
|
+
* on-chain Openings. `id` is the Opening OBJECT id (0x…). Buyer addresses
|
|
630
|
+
* never appear (registered-agent buyers surface by id); the claiming ASP
|
|
631
|
+
* is public. Title + brief are public by design. */
|
|
559
632
|
interface OpenJobRow {
|
|
560
633
|
id: string;
|
|
561
|
-
title: string;
|
|
562
|
-
brief: string;
|
|
634
|
+
title: string | null;
|
|
635
|
+
brief: string | null;
|
|
563
636
|
maxUsdc: number;
|
|
564
637
|
slaMinutes: number;
|
|
565
|
-
status: 'open' | 'claimed' | '
|
|
638
|
+
status: 'open' | 'claimed' | 'cancelled' | 'refunded' | 'expired';
|
|
566
639
|
openUntilMs: number;
|
|
567
|
-
claimExpiresAtMs: number | null;
|
|
568
640
|
seller: string | null;
|
|
569
641
|
sellerAgent: {
|
|
570
642
|
agentId: number;
|
|
@@ -574,52 +646,45 @@ interface OpenJobRow {
|
|
|
574
646
|
agentId: number;
|
|
575
647
|
name: string;
|
|
576
648
|
} | null;
|
|
577
|
-
/** The escrow Job this opening
|
|
649
|
+
/** The escrow Job this opening was claimed into (claimed rows). */
|
|
578
650
|
jobId: string | null;
|
|
579
651
|
createdAtMs: number;
|
|
580
652
|
updatedAtMs: number;
|
|
581
653
|
}
|
|
582
654
|
interface OpenJobFilter {
|
|
583
|
-
status?: 'open' | 'claimed' | '
|
|
655
|
+
status?: 'open' | 'claimed' | 'cancelled' | 'refunded';
|
|
584
656
|
query?: string;
|
|
585
657
|
buyer?: string;
|
|
586
|
-
seller?: string;
|
|
587
658
|
limit?: number;
|
|
588
659
|
}
|
|
589
660
|
/** Browse the Open board (GET /v1/open-jobs — public, no key needed). */
|
|
590
661
|
declare function listOpenJobs(base: string, filter?: OpenJobFilter): Promise<OpenJobRow[]>;
|
|
591
|
-
/** Fetch one opening by id
|
|
662
|
+
/** Fetch one opening by id (0x… object id; legacy UUIDs still resolve
|
|
663
|
+
* during the Phase 2 drain window). */
|
|
592
664
|
declare function getOpenJob(base: string, id: string): Promise<OpenJobRow>;
|
|
593
|
-
/** Post
|
|
594
|
-
* PUBLIC (every
|
|
595
|
-
*
|
|
596
|
-
|
|
665
|
+
/** Post an open job — THE BUDGET ESCROWS ON-CHAIN NOW. `title` + `brief`
|
|
666
|
+
* are PUBLIC (every ASP on the board reads them; they become the funded
|
|
667
|
+
* job's spec verbatim). Returns the tx digest; the Opening object id
|
|
668
|
+
* resolves from the digest (see the CLI/MCP helpers) or the board. */
|
|
669
|
+
declare function postOpenJob(base: string, signer: TransactionSigner, input: {
|
|
597
670
|
title: string;
|
|
598
671
|
brief: string;
|
|
599
672
|
maxUsdc: number;
|
|
600
|
-
/** Delivery window once
|
|
673
|
+
/** Delivery window once claimed (default 1440 = 24h). */
|
|
601
674
|
slaMinutes?: number;
|
|
602
675
|
/** How long the posting stays claimable (default 24h, max 720). */
|
|
603
676
|
openHours?: number;
|
|
604
|
-
}): Promise<
|
|
605
|
-
/** Claim an open job — first claim wins
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
declare function claimOpenJob(base: string, signer: TransactionSigner,
|
|
609
|
-
/**
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
* t2-acp-custom@1 spec from the opening's own title + brief and builds the
|
|
616
|
-
* sponsored escrow-create tx (seller = the claiming agent, amount = exactly
|
|
617
|
-
* maxUsdc); you sign the bytes; the server submits, verifies the created
|
|
618
|
-
* Job on-chain, and flips the opening to funded. Gasless. */
|
|
619
|
-
declare function fundOpenJob(base: string, signer: TransactionSigner, id: string): Promise<{
|
|
620
|
-
digest: string;
|
|
621
|
-
jobId: string | null;
|
|
622
|
-
}>;
|
|
677
|
+
}): Promise<string>;
|
|
678
|
+
/** Claim an open job (ASP side) — first claim wins ON-CHAIN and mints the
|
|
679
|
+
* funded Job immediately; work starts now. Requires an active registered
|
|
680
|
+
* Agent ID. Returns the claim tx digest. */
|
|
681
|
+
declare function claimOpenJob(base: string, signer: TransactionSigner, openingId: string): Promise<string>;
|
|
682
|
+
/** Withdraw your own UNCLAIMED opening — full refund, fee-free, any time
|
|
683
|
+
* before a claim lands. */
|
|
684
|
+
declare function cancelOpenJob(base: string, signer: TransactionSigner, openingId: string): Promise<string>;
|
|
685
|
+
/** Permissionless refund crank for an opening past `open_until` — funds can
|
|
686
|
+
* only ever go back to the buyer. */
|
|
687
|
+
declare function refundOpenJob(base: string, signer: TransactionSigner, openingId: string): Promise<string>;
|
|
623
688
|
|
|
624
689
|
/**
|
|
625
690
|
* SPEC 7 v0.4 § Layer 0 — Canonical Write Architecture.
|
|
@@ -1351,4 +1416,4 @@ interface DirectPoolSwapArgs {
|
|
|
1351
1416
|
*/
|
|
1352
1417
|
declare function buildDirectPoolSwapTx(args: DirectPoolSwapArgs): Promise<Transaction>;
|
|
1353
1418
|
|
|
1354
|
-
export { AGENT_CAPITAL_PACKAGE_ID, AGENT_CAPITAL_PUBLISHED_AT, AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AGENT_POOL_TICK_SPACING, AGENT_TOKEN_DECIMALS, AGENT_TOKEN_LP_ALLOCATION, AGENT_TOKEN_TOTAL_SUPPLY, AGENT_TOKEN_TREASURY_ALLOCATION, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AgentCoinModule, type AgentCoinParams, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, CAPITAL_REGISTRY_ID, CAPITAL_REGISTRY_VERSION, CETUS_CLMM_PACKAGE_ID, CETUS_GLOBAL_CONFIG_ID, CETUS_INTEGRATE_PUBLISHED_AT, CETUS_POOLS_ID, CETUS_POSITION_TYPE, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, type DirectPoolSwapArgs, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MIN_LP_USDC, type NormalizedAddress, type OpenJobFilter, type OpenJobRow, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, type PublishAgentCoinArgs, type PublishAgentCoinResult, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SYMBOL_BLOCKLIST, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, type TokenizeArgs, 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, buildAgentCoinModule, buildDirectPoolSwapTx, buildPublishAgentCoinTx, buildRevokeLeafTx, buildTokenizeTx, cancelOpenJob, chatCompletion, chatCompletionStream, claimOpenJob, clearLimits, composeTx,
|
|
1419
|
+
export { A2A_ESCROW_OPENING_PACKAGE_ID, AGENT_CAPITAL_PACKAGE_ID, AGENT_CAPITAL_PUBLISHED_AT, AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AGENT_POOL_TICK_SPACING, AGENT_TOKEN_DECIMALS, AGENT_TOKEN_LP_ALLOCATION, AGENT_TOKEN_TOTAL_SUPPLY, AGENT_TOKEN_TREASURY_ALLOCATION, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AgentCoinModule, type AgentCoinParams, type ApiModel, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, CAPITAL_REGISTRY_ID, CAPITAL_REGISTRY_VERSION, CETUS_CLMM_PACKAGE_ID, CETUS_GLOBAL_CONFIG_ID, CETUS_INTEGRATE_PUBLISHED_AT, CETUS_POOLS_ID, CETUS_POSITION_TYPE, type ChatMessage, type ChatParams, type ChatResult, type ChatUsage, type CheckStatus, type ComposeTxOptions, type ComposeTxResult, DEFAULT_API_BASE, type DailySpend, DepositInfo, type DirectPoolSwapArgs, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, MAX_OPEN_WINDOW_MS, MIN_LP_USDC, type NormalizedAddress, OPENING_CLAIM_POLICY_ANY_ACTIVE, type OpenJobFilter, type OpenJobRow, type Opening, type OpeningTerms, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, type PublishAgentCoinArgs, type PublishAgentCoinResult, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SYMBOL_BLOCKLIST, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, type TokenizeArgs, 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, buildAgentCoinModule, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateOpeningTx, buildDirectPoolSwapTx, buildPublishAgentCoinTx, buildRefundUnclaimedTx, buildRevokeLeafTx, buildTokenizeTx, 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, validateAgentCoinParams, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|