@t2000/sdk 10.13.4 → 10.14.1
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-Cj8Zh9Tm.d.cts → commerce-C4D3VxBu.d.cts} +1 -1
- package/dist/{commerce-Cj8Zh9Tm.d.ts → commerce-C4D3VxBu.d.ts} +1 -1
- package/dist/index.cjs +107 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -3
- package/dist/index.d.ts +71 -3
- package/dist/index.js +101 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 { 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-
|
|
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-
|
|
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
|
+
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
6
|
import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
@@ -553,6 +553,74 @@ 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
|
+
/** The public row shape /v1/open-jobs returns. Buyer addresses never appear
|
|
557
|
+
* (registered-agent buyers surface by id); the claiming seller is public.
|
|
558
|
+
* Title + brief are public by design — sellers read exactly this. */
|
|
559
|
+
interface OpenJobRow {
|
|
560
|
+
id: string;
|
|
561
|
+
title: string;
|
|
562
|
+
brief: string;
|
|
563
|
+
maxUsdc: number;
|
|
564
|
+
slaMinutes: number;
|
|
565
|
+
status: 'open' | 'claimed' | 'funded' | 'expired' | 'cancelled';
|
|
566
|
+
openUntilMs: number;
|
|
567
|
+
claimExpiresAtMs: number | null;
|
|
568
|
+
seller: string | null;
|
|
569
|
+
sellerAgent: {
|
|
570
|
+
agentId: number;
|
|
571
|
+
name: string;
|
|
572
|
+
} | null;
|
|
573
|
+
buyerAgent: {
|
|
574
|
+
agentId: number;
|
|
575
|
+
name: string;
|
|
576
|
+
} | null;
|
|
577
|
+
/** The escrow Job this opening funded into (funded rows only). */
|
|
578
|
+
jobId: string | null;
|
|
579
|
+
createdAtMs: number;
|
|
580
|
+
updatedAtMs: number;
|
|
581
|
+
}
|
|
582
|
+
interface OpenJobFilter {
|
|
583
|
+
status?: 'open' | 'claimed' | 'funded' | 'expired' | 'cancelled';
|
|
584
|
+
query?: string;
|
|
585
|
+
buyer?: string;
|
|
586
|
+
seller?: string;
|
|
587
|
+
limit?: number;
|
|
588
|
+
}
|
|
589
|
+
/** Browse the Open board (GET /v1/open-jobs — public, no key needed). */
|
|
590
|
+
declare function listOpenJobs(base: string, filter?: OpenJobFilter): Promise<OpenJobRow[]>;
|
|
591
|
+
/** Fetch one opening by id. */
|
|
592
|
+
declare function getOpenJob(base: string, id: string): Promise<OpenJobRow>;
|
|
593
|
+
/** Post a job OPENING to the board — holds NO USDC. `title` + `brief` are
|
|
594
|
+
* PUBLIC (every seller on the board reads them; keep private details out —
|
|
595
|
+
* escrow terms are fixed at fund time from exactly these values). */
|
|
596
|
+
declare function createOpenJob(base: string, signer: TransactionSigner, input: {
|
|
597
|
+
title: string;
|
|
598
|
+
brief: string;
|
|
599
|
+
maxUsdc: number;
|
|
600
|
+
/** Delivery window once funded (default 1440 = 24h). */
|
|
601
|
+
slaMinutes?: number;
|
|
602
|
+
/** How long the posting stays claimable (default 24h, max 720). */
|
|
603
|
+
openHours?: number;
|
|
604
|
+
}): Promise<OpenJobRow>;
|
|
605
|
+
/** Claim an open job — first claim wins (atomic server-side). Holds no
|
|
606
|
+
* USDC; unfunded claims lapse after 2h; one live claim per seller. Only
|
|
607
|
+
* active registered Agent IDs may claim. */
|
|
608
|
+
declare function claimOpenJob(base: string, signer: TransactionSigner, id: string): Promise<OpenJobRow | null>;
|
|
609
|
+
/** Release your claim early — the opening goes straight back on the board. */
|
|
610
|
+
declare function unclaimOpenJob(base: string, signer: TransactionSigner, id: string): Promise<void>;
|
|
611
|
+
/** Withdraw your own UNCLAIMED opening (claimed rows resolve via fund,
|
|
612
|
+
* unclaim, or the claim TTL). */
|
|
613
|
+
declare function cancelOpenJob(base: string, signer: TransactionSigner, id: string): Promise<void>;
|
|
614
|
+
/** Fund a CLAIMED opening you posted: the server composes the public
|
|
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
|
+
}>;
|
|
623
|
+
|
|
556
624
|
/**
|
|
557
625
|
* SPEC 7 v0.4 § Layer 0 — Canonical Write Architecture.
|
|
558
626
|
*
|
|
@@ -1283,4 +1351,4 @@ interface DirectPoolSwapArgs {
|
|
|
1283
1351
|
*/
|
|
1284
1352
|
declare function buildDirectPoolSwapTx(args: DirectPoolSwapArgs): Promise<Transaction>;
|
|
1285
1353
|
|
|
1286
|
-
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, 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, chatCompletion, chatCompletionStream, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateAgentCoinParams, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
|
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, createOpenJob, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, fundOpenJob, generateKeypair, getAddress, getLimits, getOpenJob, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, listOpenJobs, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, unclaimOpenJob, validateAgentCoinParams, 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 { 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-
|
|
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-
|
|
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
|
+
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
6
|
import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
@@ -553,6 +553,74 @@ 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
|
+
/** The public row shape /v1/open-jobs returns. Buyer addresses never appear
|
|
557
|
+
* (registered-agent buyers surface by id); the claiming seller is public.
|
|
558
|
+
* Title + brief are public by design — sellers read exactly this. */
|
|
559
|
+
interface OpenJobRow {
|
|
560
|
+
id: string;
|
|
561
|
+
title: string;
|
|
562
|
+
brief: string;
|
|
563
|
+
maxUsdc: number;
|
|
564
|
+
slaMinutes: number;
|
|
565
|
+
status: 'open' | 'claimed' | 'funded' | 'expired' | 'cancelled';
|
|
566
|
+
openUntilMs: number;
|
|
567
|
+
claimExpiresAtMs: number | null;
|
|
568
|
+
seller: string | null;
|
|
569
|
+
sellerAgent: {
|
|
570
|
+
agentId: number;
|
|
571
|
+
name: string;
|
|
572
|
+
} | null;
|
|
573
|
+
buyerAgent: {
|
|
574
|
+
agentId: number;
|
|
575
|
+
name: string;
|
|
576
|
+
} | null;
|
|
577
|
+
/** The escrow Job this opening funded into (funded rows only). */
|
|
578
|
+
jobId: string | null;
|
|
579
|
+
createdAtMs: number;
|
|
580
|
+
updatedAtMs: number;
|
|
581
|
+
}
|
|
582
|
+
interface OpenJobFilter {
|
|
583
|
+
status?: 'open' | 'claimed' | 'funded' | 'expired' | 'cancelled';
|
|
584
|
+
query?: string;
|
|
585
|
+
buyer?: string;
|
|
586
|
+
seller?: string;
|
|
587
|
+
limit?: number;
|
|
588
|
+
}
|
|
589
|
+
/** Browse the Open board (GET /v1/open-jobs — public, no key needed). */
|
|
590
|
+
declare function listOpenJobs(base: string, filter?: OpenJobFilter): Promise<OpenJobRow[]>;
|
|
591
|
+
/** Fetch one opening by id. */
|
|
592
|
+
declare function getOpenJob(base: string, id: string): Promise<OpenJobRow>;
|
|
593
|
+
/** Post a job OPENING to the board — holds NO USDC. `title` + `brief` are
|
|
594
|
+
* PUBLIC (every seller on the board reads them; keep private details out —
|
|
595
|
+
* escrow terms are fixed at fund time from exactly these values). */
|
|
596
|
+
declare function createOpenJob(base: string, signer: TransactionSigner, input: {
|
|
597
|
+
title: string;
|
|
598
|
+
brief: string;
|
|
599
|
+
maxUsdc: number;
|
|
600
|
+
/** Delivery window once funded (default 1440 = 24h). */
|
|
601
|
+
slaMinutes?: number;
|
|
602
|
+
/** How long the posting stays claimable (default 24h, max 720). */
|
|
603
|
+
openHours?: number;
|
|
604
|
+
}): Promise<OpenJobRow>;
|
|
605
|
+
/** Claim an open job — first claim wins (atomic server-side). Holds no
|
|
606
|
+
* USDC; unfunded claims lapse after 2h; one live claim per seller. Only
|
|
607
|
+
* active registered Agent IDs may claim. */
|
|
608
|
+
declare function claimOpenJob(base: string, signer: TransactionSigner, id: string): Promise<OpenJobRow | null>;
|
|
609
|
+
/** Release your claim early — the opening goes straight back on the board. */
|
|
610
|
+
declare function unclaimOpenJob(base: string, signer: TransactionSigner, id: string): Promise<void>;
|
|
611
|
+
/** Withdraw your own UNCLAIMED opening (claimed rows resolve via fund,
|
|
612
|
+
* unclaim, or the claim TTL). */
|
|
613
|
+
declare function cancelOpenJob(base: string, signer: TransactionSigner, id: string): Promise<void>;
|
|
614
|
+
/** Fund a CLAIMED opening you posted: the server composes the public
|
|
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
|
+
}>;
|
|
623
|
+
|
|
556
624
|
/**
|
|
557
625
|
* SPEC 7 v0.4 § Layer 0 — Canonical Write Architecture.
|
|
558
626
|
*
|
|
@@ -1283,4 +1351,4 @@ interface DirectPoolSwapArgs {
|
|
|
1283
1351
|
*/
|
|
1284
1352
|
declare function buildDirectPoolSwapTx(args: DirectPoolSwapArgs): Promise<Transaction>;
|
|
1285
1353
|
|
|
1286
|
-
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, 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, chatCompletion, chatCompletionStream, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateAgentCoinParams, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
|
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, createOpenJob, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, fundOpenJob, generateKeypair, getAddress, getLimits, getOpenJob, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, listModels, listOpenJobs, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, unclaimOpenJob, validateAgentCoinParams, validateLabel, verifyReceipt, walletExists, writeLimitsFile };
|
package/dist/index.js
CHANGED
|
@@ -3540,6 +3540,106 @@ async function getJobSpec(base, hash) {
|
|
|
3540
3540
|
}
|
|
3541
3541
|
return content;
|
|
3542
3542
|
}
|
|
3543
|
+
async function fetchJson(url, init) {
|
|
3544
|
+
const res = await fetch(url, {
|
|
3545
|
+
method: init?.method ?? "GET",
|
|
3546
|
+
headers: init?.body ? { "Content-Type": "application/json" } : void 0,
|
|
3547
|
+
body: init?.body ? JSON.stringify(init.body) : void 0
|
|
3548
|
+
});
|
|
3549
|
+
const json = await res.json().catch(() => ({}));
|
|
3550
|
+
if (!res.ok) {
|
|
3551
|
+
const err = json.error;
|
|
3552
|
+
const msg = typeof err === "string" ? err : err?.message ?? `HTTP ${res.status}`;
|
|
3553
|
+
throw new Error(msg);
|
|
3554
|
+
}
|
|
3555
|
+
return json;
|
|
3556
|
+
}
|
|
3557
|
+
async function listOpenJobs(base, filter = {}) {
|
|
3558
|
+
const params = new URLSearchParams();
|
|
3559
|
+
if (filter.status) params.set("status", filter.status);
|
|
3560
|
+
if (filter.query) params.set("q", filter.query);
|
|
3561
|
+
if (filter.buyer) params.set("buyer", filter.buyer);
|
|
3562
|
+
if (filter.seller) params.set("seller", filter.seller);
|
|
3563
|
+
if (filter.limit) params.set("limit", String(filter.limit));
|
|
3564
|
+
const qs = params.size > 0 ? `?${params.toString()}` : "";
|
|
3565
|
+
const json = await fetchJson(`${base}/open-jobs${qs}`);
|
|
3566
|
+
return json.openJobs ?? [];
|
|
3567
|
+
}
|
|
3568
|
+
async function getOpenJob(base, id) {
|
|
3569
|
+
const json = await fetchJson(
|
|
3570
|
+
`${base}/open-jobs/${encodeURIComponent(id.trim())}`
|
|
3571
|
+
);
|
|
3572
|
+
return json.openJob;
|
|
3573
|
+
}
|
|
3574
|
+
async function signedChallenge(base, signer, action, id) {
|
|
3575
|
+
const address = signer.getAddress();
|
|
3576
|
+
const challenge = await fetchJson(`${base}/agent/challenge`, {
|
|
3577
|
+
method: "POST",
|
|
3578
|
+
body: { address }
|
|
3579
|
+
});
|
|
3580
|
+
const nonce = challenge.nonce;
|
|
3581
|
+
if (!nonce) {
|
|
3582
|
+
throw new Error("Failed to get a challenge nonce.");
|
|
3583
|
+
}
|
|
3584
|
+
const message = new TextEncoder().encode(
|
|
3585
|
+
id ? `t2000-open-${action}:${nonce}:${id}` : `t2000-open-${action}:${nonce}`
|
|
3586
|
+
);
|
|
3587
|
+
const { signature } = await signer.signPersonalMessage(message);
|
|
3588
|
+
return { address, nonce, signature };
|
|
3589
|
+
}
|
|
3590
|
+
async function createOpenJob(base, signer, input) {
|
|
3591
|
+
const auth = await signedChallenge(base, signer, "create");
|
|
3592
|
+
const json = await fetchJson(`${base}/open-jobs`, {
|
|
3593
|
+
method: "POST",
|
|
3594
|
+
body: { ...auth, ...input }
|
|
3595
|
+
});
|
|
3596
|
+
return json.openJob;
|
|
3597
|
+
}
|
|
3598
|
+
async function claimOpenJob(base, signer, id) {
|
|
3599
|
+
const auth = await signedChallenge(base, signer, "claim", id);
|
|
3600
|
+
const json = await fetchJson(
|
|
3601
|
+
`${base}/open-jobs/${encodeURIComponent(id)}/claim`,
|
|
3602
|
+
{ method: "POST", body: auth }
|
|
3603
|
+
);
|
|
3604
|
+
return json.openJob ?? null;
|
|
3605
|
+
}
|
|
3606
|
+
async function unclaimOpenJob(base, signer, id) {
|
|
3607
|
+
const auth = await signedChallenge(base, signer, "unclaim", id);
|
|
3608
|
+
await fetchJson(`${base}/open-jobs/${encodeURIComponent(id)}/unclaim`, {
|
|
3609
|
+
method: "POST",
|
|
3610
|
+
body: auth
|
|
3611
|
+
});
|
|
3612
|
+
}
|
|
3613
|
+
async function cancelOpenJob(base, signer, id) {
|
|
3614
|
+
const auth = await signedChallenge(base, signer, "cancel", id);
|
|
3615
|
+
await fetchJson(`${base}/open-jobs/${encodeURIComponent(id)}/cancel`, {
|
|
3616
|
+
method: "POST",
|
|
3617
|
+
body: auth
|
|
3618
|
+
});
|
|
3619
|
+
}
|
|
3620
|
+
async function fundOpenJob(base, signer, id) {
|
|
3621
|
+
const address = signer.getAddress();
|
|
3622
|
+
const encoded = encodeURIComponent(id.trim());
|
|
3623
|
+
const prep = await fetchJson(`${base}/open-jobs/${encoded}/fund-prepare`, {
|
|
3624
|
+
method: "POST",
|
|
3625
|
+
body: { address }
|
|
3626
|
+
});
|
|
3627
|
+
const nonce = prep.nonce;
|
|
3628
|
+
const txBytes = prep.txBytes;
|
|
3629
|
+
if (!(nonce && txBytes)) {
|
|
3630
|
+
throw new Error("Failed to prepare the funding transaction.");
|
|
3631
|
+
}
|
|
3632
|
+
const { signature } = await signer.signTransaction(fromBase64(txBytes));
|
|
3633
|
+
const json = await fetchJson(`${base}/open-jobs/${encoded}/fund-submit`, {
|
|
3634
|
+
method: "POST",
|
|
3635
|
+
body: { nonce, address, signature }
|
|
3636
|
+
});
|
|
3637
|
+
const digest = json.digest;
|
|
3638
|
+
if (!digest) {
|
|
3639
|
+
throw new Error("The funding transaction did not go through.");
|
|
3640
|
+
}
|
|
3641
|
+
return { digest, jobId: json.jobId ?? null };
|
|
3642
|
+
}
|
|
3543
3643
|
|
|
3544
3644
|
// src/index.ts
|
|
3545
3645
|
init_coinSelection();
|
|
@@ -4345,6 +4445,6 @@ async function buildDirectPoolSwapTx(args) {
|
|
|
4345
4445
|
return tx;
|
|
4346
4446
|
}
|
|
4347
4447
|
|
|
4348
|
-
export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_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, CAPITAL_REGISTRY_ID, CAPITAL_REGISTRY_VERSION, CETUS_CLMM_PACKAGE_ID, CETUS_GLOBAL_CONFIG_ID, CETUS_INTEGRATE_PUBLISHED_AT, CETUS_POOLS_ID, CETUS_POSITION_TYPE, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, 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_REVIEW_WINDOW_MS, MIN_LP_USDC, MIST_PER_SUI, NAVX_TYPE, 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, SYMBOL_BLOCKLIST, 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, buildAgentCoinModule, buildCreateJobTx, buildDeliverJobTx, buildDirectPoolSwapTx, buildPublishAgentCoinTx, buildRefundJobTx, buildRejectJobTx, buildReleaseJobTx, buildRevokeLeafTx, buildSendTx, buildSwapTx, buildTokenizeTx, chatCompletion, chatCompletionStream, checkPositiveAmount, checkSuiAddress, 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, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, isAllowedAsset, isCetusRouteFresh, isInRegistry, jobActionsFor, keypairFromPrivateKey, listModels, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseMppSuiChallenge, parseSuiRpcTx, payWithMpp, preflightCreateJob, preflightFail, preflightPay, preflightSend, preflightSwap, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateAgentCoinParams, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, verifyReceipt, walletExists, writeLimitsFile };
|
|
4448
|
+
export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_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, CAPITAL_REGISTRY_ID, CAPITAL_REGISTRY_VERSION, CETUS_CLMM_PACKAGE_ID, CETUS_GLOBAL_CONFIG_ID, CETUS_INTEGRATE_PUBLISHED_AT, CETUS_POOLS_ID, CETUS_POSITION_TYPE, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, 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_REVIEW_WINDOW_MS, MIN_LP_USDC, MIST_PER_SUI, NAVX_TYPE, 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, SYMBOL_BLOCKLIST, 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, buildAgentCoinModule, buildCreateJobTx, buildDeliverJobTx, buildDirectPoolSwapTx, buildPublishAgentCoinTx, buildRefundJobTx, buildRejectJobTx, buildReleaseJobTx, buildRevokeLeafTx, buildSendTx, buildSwapTx, buildTokenizeTx, cancelOpenJob, chatCompletion, chatCompletionStream, checkPositiveAmount, checkSuiAddress, claimOpenJob, classifyAction, classifyLabel, classifyTransaction, clearLimits, composeTx, createOpenJob, dailySpentToday, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, fundOpenJob, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, getLimits, getOpenJob, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, isAllowedAsset, isCetusRouteFresh, isInRegistry, jobActionsFor, keypairFromPrivateKey, listModels, listOpenJobs, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseMppSuiChallenge, parseSuiRpcTx, payWithMpp, preflightCreateJob, preflightFail, preflightPay, preflightSend, preflightSwap, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, unclaimOpenJob, usdcToRaw, validateAddress, validateAgentCoinParams, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, verifyReceipt, walletExists, writeLimitsFile };
|
|
4349
4449
|
//# sourceMappingURL=index.js.map
|
|
4350
4450
|
//# sourceMappingURL=index.js.map
|