@t2000/sdk 10.37.2 → 10.38.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 +79 -15
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +70 -16
- package/dist/{commerce-gDWVYXP8.d.cts → commerce-D14qzqAV.d.cts} +91 -14
- package/dist/{commerce-gDWVYXP8.d.ts → commerce-D14qzqAV.d.ts} +91 -14
- package/dist/index.cjs +123 -24
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +113 -25
- package/package.json +2 -2
package/dist/browser.cjs
CHANGED
|
@@ -1332,10 +1332,11 @@ init_coinSelection();
|
|
|
1332
1332
|
init_errors();
|
|
1333
1333
|
init_token_registry();
|
|
1334
1334
|
init_coinSelection();
|
|
1335
|
-
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
1335
|
+
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0x5c90ec07da01bf885a4e65247ce98b75ab8a042cd965d30d7213856d579c4afa";
|
|
1336
1336
|
var A2A_ESCROW_LATEST_PACKAGE_ID = process.env.A2A_ESCROW_OPENING_PACKAGE_ID ?? process.env.A2A_ESCROW_PACKAGE_ID ?? MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID;
|
|
1337
1337
|
var A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe769bcedf11f3525e84682d59a3b23e";
|
|
1338
1338
|
var A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1339
|
+
var A2A_ESCROW_PACKAGE_V10_ID = process.env.A2A_ESCROW_PACKAGE_V10_ID ?? "0x5c90ec07da01bf885a4e65247ce98b75ab8a042cd965d30d7213856d579c4afa";
|
|
1339
1340
|
var OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1340
1341
|
var OPENING_CLAIM_POLICY_PROVEN = 1;
|
|
1341
1342
|
var OPENING_CLAIM_POLICY_PROVEN_4STAR = 2;
|
|
@@ -1461,15 +1462,6 @@ async function buildCreateJobTx({
|
|
|
1461
1462
|
});
|
|
1462
1463
|
return tx;
|
|
1463
1464
|
}
|
|
1464
|
-
function jobCall(jobId, fn) {
|
|
1465
|
-
const tx = new transactions.Transaction();
|
|
1466
|
-
tx.moveCall({
|
|
1467
|
-
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::${MODULE}::${fn}`,
|
|
1468
|
-
typeArguments: [exports.USDC_TYPE],
|
|
1469
|
-
arguments: [tx.object(jobId), feeConfigArg(tx), tx.object(CLOCK_ID2)]
|
|
1470
|
-
});
|
|
1471
|
-
return tx;
|
|
1472
|
-
}
|
|
1473
1465
|
function buildRejectJobTx(jobId, v2) {
|
|
1474
1466
|
const tx = new transactions.Transaction();
|
|
1475
1467
|
tx.moveCall({
|
|
@@ -1520,8 +1512,19 @@ function buildDeliverJobTx(jobId, deliveryHash) {
|
|
|
1520
1512
|
});
|
|
1521
1513
|
return tx;
|
|
1522
1514
|
}
|
|
1523
|
-
function buildReleaseJobTx(jobId) {
|
|
1524
|
-
|
|
1515
|
+
function buildReleaseJobTx(jobId, v2) {
|
|
1516
|
+
const tx = new transactions.Transaction();
|
|
1517
|
+
tx.moveCall({
|
|
1518
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::release_v2`,
|
|
1519
|
+
typeArguments: [exports.USDC_TYPE],
|
|
1520
|
+
arguments: [
|
|
1521
|
+
tx.object(jobId),
|
|
1522
|
+
tx.object(v2.sellerScoreId),
|
|
1523
|
+
feeConfigArg(tx),
|
|
1524
|
+
tx.object(CLOCK_ID2)
|
|
1525
|
+
]
|
|
1526
|
+
});
|
|
1527
|
+
return tx;
|
|
1525
1528
|
}
|
|
1526
1529
|
async function getJob(client, jobId) {
|
|
1527
1530
|
const resp = await client.core.getObject({ objectId: jobId, include: { json: true } }).catch((e) => {
|
|
@@ -1609,6 +1612,10 @@ var PROVEN_MIN_REVIEWS = 3;
|
|
|
1609
1612
|
var PROVEN_MIN_AVG_STARS_X10 = 40;
|
|
1610
1613
|
var REVIEW_MIN_STARS = 1;
|
|
1611
1614
|
var REVIEW_MAX_STARS = 5;
|
|
1615
|
+
var SELLER_LEVEL_ACTIVE_CAPS = [4, 10, 20, 30];
|
|
1616
|
+
var NO_DELIVERY_REGRESSION_FLOOR = 3;
|
|
1617
|
+
var LEVEL4_MIN_REVIEWS = 20;
|
|
1618
|
+
var LEVEL4_MAX_NO_DELIVERY = 2;
|
|
1612
1619
|
function boardIdOrThrow(boardId) {
|
|
1613
1620
|
const id = boardId ?? A2A_SCORE_BOARD_ID;
|
|
1614
1621
|
if (!id) {
|
|
@@ -1654,11 +1661,12 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
1654
1661
|
}
|
|
1655
1662
|
const reviewCount = Number(json.review_count ?? 0);
|
|
1656
1663
|
const starsSum = Number(json.stars_sum ?? 0);
|
|
1657
|
-
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected] = await Promise.all([
|
|
1664
|
+
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected, activeSellerJobs] = await Promise.all([
|
|
1658
1665
|
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V7_ID, "DistinctCountKey"),
|
|
1659
1666
|
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "RejectedAfterDeliveryKey"),
|
|
1660
1667
|
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "NoDeliveryKey"),
|
|
1661
|
-
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey")
|
|
1668
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey"),
|
|
1669
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V10_ID, "ActiveSellerJobsKey")
|
|
1662
1670
|
]);
|
|
1663
1671
|
return {
|
|
1664
1672
|
id: scoreId,
|
|
@@ -1669,7 +1677,8 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
1669
1677
|
distinctBuyers,
|
|
1670
1678
|
rejectedAfterDelivery,
|
|
1671
1679
|
noDelivery,
|
|
1672
|
-
asBuyerRejected
|
|
1680
|
+
asBuyerRejected,
|
|
1681
|
+
activeSellerJobs
|
|
1673
1682
|
};
|
|
1674
1683
|
}
|
|
1675
1684
|
function meetsClaimPolicy(score, claimPolicy) {
|
|
@@ -1697,6 +1706,51 @@ function claimPolicyRequirement(claimPolicy) {
|
|
|
1697
1706
|
}
|
|
1698
1707
|
return "Anyone can claim (active Agent ID required).";
|
|
1699
1708
|
}
|
|
1709
|
+
function sellerLevel(score) {
|
|
1710
|
+
if (!score) return 1;
|
|
1711
|
+
const provenAvg = score.distinctBuyers >= PROVEN_MIN_REVIEWS && score.starsSum * 10 >= score.reviewCount * PROVEN_MIN_AVG_STARS_X10;
|
|
1712
|
+
if (provenAvg) {
|
|
1713
|
+
return score.reviewCount >= LEVEL4_MIN_REVIEWS && score.noDelivery <= LEVEL4_MAX_NO_DELIVERY ? 4 : 3;
|
|
1714
|
+
}
|
|
1715
|
+
return score.distinctBuyers >= PROVEN_MIN_REVIEWS ? 2 : 1;
|
|
1716
|
+
}
|
|
1717
|
+
function effectiveSellerLevel(score) {
|
|
1718
|
+
if (!score) return 1;
|
|
1719
|
+
if (score.noDelivery >= NO_DELIVERY_REGRESSION_FLOOR) return 1;
|
|
1720
|
+
return sellerLevel(score);
|
|
1721
|
+
}
|
|
1722
|
+
function activeCapForLevel(level) {
|
|
1723
|
+
return SELLER_LEVEL_ACTIVE_CAPS[level - 1];
|
|
1724
|
+
}
|
|
1725
|
+
function meetsMinSellerLevel(score, minLevel) {
|
|
1726
|
+
if (minLevel <= 0) return true;
|
|
1727
|
+
return effectiveSellerLevel(score) >= minLevel;
|
|
1728
|
+
}
|
|
1729
|
+
function sellerLevelLabel(level) {
|
|
1730
|
+
return level >= 1 && level <= 4 ? `Level ${level}` : `Level ? (${level})`;
|
|
1731
|
+
}
|
|
1732
|
+
function preflightClaimOpening(score, opening) {
|
|
1733
|
+
if (!meetsClaimPolicy(score, opening.claimPolicy)) {
|
|
1734
|
+
return { valid: false, error: claimPolicyRequirement(opening.claimPolicy) };
|
|
1735
|
+
}
|
|
1736
|
+
const level = effectiveSellerLevel(score);
|
|
1737
|
+
const cap = activeCapForLevel(level);
|
|
1738
|
+
const active = score?.activeSellerJobs ?? 0;
|
|
1739
|
+
if (active >= cap) {
|
|
1740
|
+
return {
|
|
1741
|
+
valid: false,
|
|
1742
|
+
error: `Active: ${active}/${cap} \u2014 ${sellerLevelLabel(level)} caps in-flight claimed jobs at ${cap}. Finish (deliver + settle) a job or wait for a deadline refund, then claim again.`
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
const minLevel = opening.minSellerLevel ?? 0;
|
|
1746
|
+
if (!meetsMinSellerLevel(score, minLevel)) {
|
|
1747
|
+
return {
|
|
1748
|
+
valid: false,
|
|
1749
|
+
error: `This opening needs ${sellerLevelLabel(minLevel)}+ \u2014 this wallet is ${sellerLevelLabel(level)}. Level 2 = reviews from ${PROVEN_MIN_REVIEWS}+ distinct buyers; Level 3 adds a 4.0\u2605 average; reliability (no-shows) can regress a level. Earn it on openings without a floor first.`
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
return { valid: true };
|
|
1753
|
+
}
|
|
1700
1754
|
|
|
1701
1755
|
// src/commerce.ts
|
|
1702
1756
|
var DEFAULT_COMMERCE_API_BASE = "https://api.t2000.ai/v1";
|
|
@@ -1799,11 +1853,14 @@ exports.JOB_STATES = JOB_STATES;
|
|
|
1799
1853
|
exports.KNOWN_TARGETS = KNOWN_TARGETS;
|
|
1800
1854
|
exports.KeypairSigner = KeypairSigner;
|
|
1801
1855
|
exports.LABEL_PATTERNS = LABEL_PATTERNS;
|
|
1856
|
+
exports.LEVEL4_MAX_NO_DELIVERY = LEVEL4_MAX_NO_DELIVERY;
|
|
1857
|
+
exports.LEVEL4_MIN_REVIEWS = LEVEL4_MIN_REVIEWS;
|
|
1802
1858
|
exports.MAX_DELIVER_HORIZON_MS = MAX_DELIVER_HORIZON_MS;
|
|
1803
1859
|
exports.MAX_JOB_USDC = MAX_JOB_USDC;
|
|
1804
1860
|
exports.MAX_REVIEW_WINDOW_MS = MAX_REVIEW_WINDOW_MS;
|
|
1805
1861
|
exports.MIN_JOB_USDC = MIN_JOB_USDC;
|
|
1806
1862
|
exports.MIST_PER_SUI = MIST_PER_SUI;
|
|
1863
|
+
exports.NO_DELIVERY_REGRESSION_FLOOR = NO_DELIVERY_REGRESSION_FLOOR;
|
|
1807
1864
|
exports.OPENING_CLAIM_POLICIES = OPENING_CLAIM_POLICIES;
|
|
1808
1865
|
exports.OPENING_CLAIM_POLICY_ANY_ACTIVE = OPENING_CLAIM_POLICY_ANY_ACTIVE;
|
|
1809
1866
|
exports.OPENING_CLAIM_POLICY_PROVEN = OPENING_CLAIM_POLICY_PROVEN;
|
|
@@ -1815,12 +1872,14 @@ exports.PROVEN_MIN_AVG_STARS_X10 = PROVEN_MIN_AVG_STARS_X10;
|
|
|
1815
1872
|
exports.PROVEN_MIN_REVIEWS = PROVEN_MIN_REVIEWS;
|
|
1816
1873
|
exports.REVIEW_MAX_STARS = REVIEW_MAX_STARS;
|
|
1817
1874
|
exports.REVIEW_MIN_STARS = REVIEW_MIN_STARS;
|
|
1875
|
+
exports.SELLER_LEVEL_ACTIVE_CAPS = SELLER_LEVEL_ACTIVE_CAPS;
|
|
1818
1876
|
exports.STABLE_ASSETS = STABLE_ASSETS;
|
|
1819
1877
|
exports.SUI_DECIMALS = SUI_DECIMALS;
|
|
1820
1878
|
exports.SUPPORTED_ASSETS = SUPPORTED_ASSETS;
|
|
1821
1879
|
exports.T2000_OVERLAY_FEE_WALLET = T2000_OVERLAY_FEE_WALLET;
|
|
1822
1880
|
exports.USDC_DECIMALS = USDC_DECIMALS;
|
|
1823
1881
|
exports.ZkLoginSigner = ZkLoginSigner;
|
|
1882
|
+
exports.activeCapForLevel = activeCapForLevel;
|
|
1824
1883
|
exports.buildCreateJobTx = buildCreateJobTx;
|
|
1825
1884
|
exports.buildDeliverJobTx = buildDeliverJobTx;
|
|
1826
1885
|
exports.buildRefundJobTx = buildRefundJobTx;
|
|
@@ -1837,6 +1896,7 @@ exports.classifyLabel = classifyLabel;
|
|
|
1837
1896
|
exports.classifySendAsset = classifySendAsset;
|
|
1838
1897
|
exports.classifyTransaction = classifyTransaction;
|
|
1839
1898
|
exports.deriveAgentScoreId = deriveAgentScoreId;
|
|
1899
|
+
exports.effectiveSellerLevel = effectiveSellerLevel;
|
|
1840
1900
|
exports.executeTx = executeTx;
|
|
1841
1901
|
exports.extractAllUserLegs = extractAllUserLegs;
|
|
1842
1902
|
exports.extractTransferDetails = extractTransferDetails;
|
|
@@ -1860,9 +1920,11 @@ exports.listServices = listServices;
|
|
|
1860
1920
|
exports.mapMoveAbortCode = mapMoveAbortCode;
|
|
1861
1921
|
exports.mapWalletError = mapWalletError;
|
|
1862
1922
|
exports.meetsClaimPolicy = meetsClaimPolicy;
|
|
1923
|
+
exports.meetsMinSellerLevel = meetsMinSellerLevel;
|
|
1863
1924
|
exports.mistToSui = mistToSui;
|
|
1864
1925
|
exports.parseSuiRpcTx = parseSuiRpcTx;
|
|
1865
1926
|
exports.payWithX402 = payWithX402;
|
|
1927
|
+
exports.preflightClaimOpening = preflightClaimOpening;
|
|
1866
1928
|
exports.preflightCreateJob = preflightCreateJob;
|
|
1867
1929
|
exports.preflightFail = preflightFail;
|
|
1868
1930
|
exports.preflightPay = preflightPay;
|
|
@@ -1875,6 +1937,8 @@ exports.refineLendingLabel = refineLendingLabel;
|
|
|
1875
1937
|
exports.reportX402Activity = reportX402Activity;
|
|
1876
1938
|
exports.resolveSymbol = resolveSymbol;
|
|
1877
1939
|
exports.resolveTokenType = resolveTokenType;
|
|
1940
|
+
exports.sellerLevel = sellerLevel;
|
|
1941
|
+
exports.sellerLevelLabel = sellerLevelLabel;
|
|
1878
1942
|
exports.stableToRaw = stableToRaw;
|
|
1879
1943
|
exports.suiToMist = suiToMist;
|
|
1880
1944
|
exports.toBase64 = toBase64;
|
package/dist/browser.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig, c as AgentScore, B as BalanceResponse, C as CLOCK_ID, d as COIN_REGISTRY, e as ClassifyBalanceChange, f as ClassifyResult, g as CoinMeta, D as DEFAULT_ACTIVITY_REPORT_URL, h as DEFAULT_COMMERCE_API_BASE, i as DEFAULT_NETWORK, j as DepositInfo, E as ETH_TYPE, k as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, J as JOB_STATES, l as Job, m as JobState, n as JobTerms, o as JobVerification, K as KNOWN_TARGETS, p as KeypairSigner, L as LABEL_PATTERNS, q as LOFI_TYPE, M as MANIFEST_TYPE,
|
|
1
|
+
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig, c as AgentScore, B as BalanceResponse, C as CLOCK_ID, d as COIN_REGISTRY, e as ClassifyBalanceChange, f as ClassifyResult, g as CoinMeta, D as DEFAULT_ACTIVITY_REPORT_URL, h as DEFAULT_COMMERCE_API_BASE, i as DEFAULT_NETWORK, j as DepositInfo, E as ETH_TYPE, k as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, J as JOB_STATES, l as Job, m as JobState, n as JobTerms, o as JobVerification, K as KNOWN_TARGETS, p as KeypairSigner, L as LABEL_PATTERNS, q as LEVEL4_MAX_NO_DELIVERY, r as LEVEL4_MIN_REVIEWS, s as LOFI_TYPE, M as MANIFEST_TYPE, t as MAX_DELIVER_HORIZON_MS, u as MAX_JOB_USDC, v as MAX_REVIEW_WINDOW_MS, w as MIN_JOB_USDC, x as MIST_PER_SUI, N as NAVX_TYPE, y as NO_DELIVERY_REGRESSION_FLOOR, O as OPENING_CLAIM_POLICIES, z as OPENING_CLAIM_POLICY_ANY_ACTIVE, F as OPENING_CLAIM_POLICY_PROVEN, H as OPENING_CLAIM_POLICY_PROVEN_4STAR, P as OVERLAY_FEE_RATE, Q as OverlayFeeConfig, R as PREFLIGHT_MAX_AMOUNT, S as PREFLIGHT_OK, T as PROVEN_MIN_AVG_STARS_X10, U as PROVEN_MIN_REVIEWS, V as PayOptions, W as PayResult, X as PreflightResult, Y as REVIEW_MAX_STARS, Z as REVIEW_MIN_STARS, _ as SELLER_LEVEL_ACTIVE_CAPS, $ as STABLE_ASSETS, a0 as SUI_DECIMALS, a1 as SUI_TYPE, a2 as SUPPORTED_ASSETS, a3 as SellerLevel, a4 as SendAssetClass, a5 as SendResult, a6 as ServiceListing, a7 as SimulationResult, a8 as StableAsset, a9 as SuiHolding, aa as SuiRpcTxBlock, ab as SupportedAsset, ac as SwapRouteResult, ad as T2000Error, ae as T2000ErrorCode, af as T2000ErrorData, ag as T2000_OVERLAY_FEE_WALLET, ah as TOKEN_MAP, ai as TransactionLeg, aj as TransactionRecord, ak as TransactionSigner, al as TxDirection, am as USDC_DECIMALS, an as USDC_TYPE, ao as USDE_TYPE, ap as USDSUI_TYPE, aq as USDT_TYPE, ar as WAL_TYPE, as as WBTC_TYPE, at as X402ActivityPayload, au as ZkLoginProof, av as ZkLoginSigner, aw as activeCapForLevel, ax as buildCreateJobTx, ay as buildDeliverJobTx, az as buildRefundJobTx, aA as buildRejectJobTx, aB as buildReleaseJobTx, aC as buildSendTx, aD as buildSwapTx, aE as checkPositiveAmount, aF as checkSuiAddress, aG as claimPolicyLabel, aH as claimPolicyRequirement, aI as classifyAction, aJ as classifyLabel, aK as classifySendAsset, aL as classifyTransaction, aM as deriveAgentScoreId, aN as effectiveSellerLevel, aO as executeTx, aP as extractAllUserLegs, aQ as extractTransferDetails, aR as extractTxCommands, aS as extractTxSender, aT as fallbackLabel, aU as fetchService, aV as findSwapRoute, aW as formatAssetAmount, aX as formatSui, aY as formatUsd, aZ as getAgentScore, a_ as getDecimals, a$ as getDecimalsForCoinType, b0 as getJob, b1 as getJobSpec, b2 as invalidSendAssetMessage, b3 as jobActionsFor, b4 as listServices, b5 as mapMoveAbortCode, b6 as mapWalletError, b7 as meetsClaimPolicy, b8 as meetsMinSellerLevel, b9 as mistToSui, ba as parseSuiRpcTx, bb as payWithX402, bc as preflightClaimOpening, bd as preflightCreateJob, be as preflightFail, bf as preflightPay, bg as preflightSend, bh as preflightSwap, bi as putJobSpec, bj as rawToStable, bk as rawToUsdc, bl as refineLendingLabel, bm as reportX402Activity, bn as resolveSymbol, bo as resolveTokenType, bp as sellerLevel, bq as sellerLevelLabel, br as stableToRaw, bs as suiToMist, bt as truncateAddress, bu as usdcToRaw, bv as validateAddress, bw as verifyJobForSeller } from './commerce-D14qzqAV.cjs';
|
|
2
2
|
import '@mysten/sui/keypairs/ed25519';
|
|
3
3
|
import '@mysten/sui/grpc';
|
|
4
4
|
import '@mysten/sui/client';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig, c as AgentScore, B as BalanceResponse, C as CLOCK_ID, d as COIN_REGISTRY, e as ClassifyBalanceChange, f as ClassifyResult, g as CoinMeta, D as DEFAULT_ACTIVITY_REPORT_URL, h as DEFAULT_COMMERCE_API_BASE, i as DEFAULT_NETWORK, j as DepositInfo, E as ETH_TYPE, k as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, J as JOB_STATES, l as Job, m as JobState, n as JobTerms, o as JobVerification, K as KNOWN_TARGETS, p as KeypairSigner, L as LABEL_PATTERNS, q as LOFI_TYPE, M as MANIFEST_TYPE,
|
|
1
|
+
export { A as A2A_ESCROW_FEE_CONFIG_ID, a as A2A_ESCROW_PACKAGE_ID, b as ActivityReportConfig, c as AgentScore, B as BalanceResponse, C as CLOCK_ID, d as COIN_REGISTRY, e as ClassifyBalanceChange, f as ClassifyResult, g as CoinMeta, D as DEFAULT_ACTIVITY_REPORT_URL, h as DEFAULT_COMMERCE_API_BASE, i as DEFAULT_NETWORK, j as DepositInfo, E as ETH_TYPE, k as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, J as JOB_STATES, l as Job, m as JobState, n as JobTerms, o as JobVerification, K as KNOWN_TARGETS, p as KeypairSigner, L as LABEL_PATTERNS, q as LEVEL4_MAX_NO_DELIVERY, r as LEVEL4_MIN_REVIEWS, s as LOFI_TYPE, M as MANIFEST_TYPE, t as MAX_DELIVER_HORIZON_MS, u as MAX_JOB_USDC, v as MAX_REVIEW_WINDOW_MS, w as MIN_JOB_USDC, x as MIST_PER_SUI, N as NAVX_TYPE, y as NO_DELIVERY_REGRESSION_FLOOR, O as OPENING_CLAIM_POLICIES, z as OPENING_CLAIM_POLICY_ANY_ACTIVE, F as OPENING_CLAIM_POLICY_PROVEN, H as OPENING_CLAIM_POLICY_PROVEN_4STAR, P as OVERLAY_FEE_RATE, Q as OverlayFeeConfig, R as PREFLIGHT_MAX_AMOUNT, S as PREFLIGHT_OK, T as PROVEN_MIN_AVG_STARS_X10, U as PROVEN_MIN_REVIEWS, V as PayOptions, W as PayResult, X as PreflightResult, Y as REVIEW_MAX_STARS, Z as REVIEW_MIN_STARS, _ as SELLER_LEVEL_ACTIVE_CAPS, $ as STABLE_ASSETS, a0 as SUI_DECIMALS, a1 as SUI_TYPE, a2 as SUPPORTED_ASSETS, a3 as SellerLevel, a4 as SendAssetClass, a5 as SendResult, a6 as ServiceListing, a7 as SimulationResult, a8 as StableAsset, a9 as SuiHolding, aa as SuiRpcTxBlock, ab as SupportedAsset, ac as SwapRouteResult, ad as T2000Error, ae as T2000ErrorCode, af as T2000ErrorData, ag as T2000_OVERLAY_FEE_WALLET, ah as TOKEN_MAP, ai as TransactionLeg, aj as TransactionRecord, ak as TransactionSigner, al as TxDirection, am as USDC_DECIMALS, an as USDC_TYPE, ao as USDE_TYPE, ap as USDSUI_TYPE, aq as USDT_TYPE, ar as WAL_TYPE, as as WBTC_TYPE, at as X402ActivityPayload, au as ZkLoginProof, av as ZkLoginSigner, aw as activeCapForLevel, ax as buildCreateJobTx, ay as buildDeliverJobTx, az as buildRefundJobTx, aA as buildRejectJobTx, aB as buildReleaseJobTx, aC as buildSendTx, aD as buildSwapTx, aE as checkPositiveAmount, aF as checkSuiAddress, aG as claimPolicyLabel, aH as claimPolicyRequirement, aI as classifyAction, aJ as classifyLabel, aK as classifySendAsset, aL as classifyTransaction, aM as deriveAgentScoreId, aN as effectiveSellerLevel, aO as executeTx, aP as extractAllUserLegs, aQ as extractTransferDetails, aR as extractTxCommands, aS as extractTxSender, aT as fallbackLabel, aU as fetchService, aV as findSwapRoute, aW as formatAssetAmount, aX as formatSui, aY as formatUsd, aZ as getAgentScore, a_ as getDecimals, a$ as getDecimalsForCoinType, b0 as getJob, b1 as getJobSpec, b2 as invalidSendAssetMessage, b3 as jobActionsFor, b4 as listServices, b5 as mapMoveAbortCode, b6 as mapWalletError, b7 as meetsClaimPolicy, b8 as meetsMinSellerLevel, b9 as mistToSui, ba as parseSuiRpcTx, bb as payWithX402, bc as preflightClaimOpening, bd as preflightCreateJob, be as preflightFail, bf as preflightPay, bg as preflightSend, bh as preflightSwap, bi as putJobSpec, bj as rawToStable, bk as rawToUsdc, bl as refineLendingLabel, bm as reportX402Activity, bn as resolveSymbol, bo as resolveTokenType, bp as sellerLevel, bq as sellerLevelLabel, br as stableToRaw, bs as suiToMist, bt as truncateAddress, bu as usdcToRaw, bv as validateAddress, bw as verifyJobForSeller } from './commerce-D14qzqAV.js';
|
|
2
2
|
import '@mysten/sui/keypairs/ed25519';
|
|
3
3
|
import '@mysten/sui/grpc';
|
|
4
4
|
import '@mysten/sui/client';
|
package/dist/browser.js
CHANGED
|
@@ -1330,10 +1330,11 @@ init_coinSelection();
|
|
|
1330
1330
|
init_errors();
|
|
1331
1331
|
init_token_registry();
|
|
1332
1332
|
init_coinSelection();
|
|
1333
|
-
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
1333
|
+
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0x5c90ec07da01bf885a4e65247ce98b75ab8a042cd965d30d7213856d579c4afa";
|
|
1334
1334
|
var A2A_ESCROW_LATEST_PACKAGE_ID = process.env.A2A_ESCROW_OPENING_PACKAGE_ID ?? process.env.A2A_ESCROW_PACKAGE_ID ?? MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID;
|
|
1335
1335
|
var A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe769bcedf11f3525e84682d59a3b23e";
|
|
1336
1336
|
var A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1337
|
+
var A2A_ESCROW_PACKAGE_V10_ID = process.env.A2A_ESCROW_PACKAGE_V10_ID ?? "0x5c90ec07da01bf885a4e65247ce98b75ab8a042cd965d30d7213856d579c4afa";
|
|
1337
1338
|
var OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1338
1339
|
var OPENING_CLAIM_POLICY_PROVEN = 1;
|
|
1339
1340
|
var OPENING_CLAIM_POLICY_PROVEN_4STAR = 2;
|
|
@@ -1459,15 +1460,6 @@ async function buildCreateJobTx({
|
|
|
1459
1460
|
});
|
|
1460
1461
|
return tx;
|
|
1461
1462
|
}
|
|
1462
|
-
function jobCall(jobId, fn) {
|
|
1463
|
-
const tx = new Transaction();
|
|
1464
|
-
tx.moveCall({
|
|
1465
|
-
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::${MODULE}::${fn}`,
|
|
1466
|
-
typeArguments: [USDC_TYPE],
|
|
1467
|
-
arguments: [tx.object(jobId), feeConfigArg(tx), tx.object(CLOCK_ID2)]
|
|
1468
|
-
});
|
|
1469
|
-
return tx;
|
|
1470
|
-
}
|
|
1471
1463
|
function buildRejectJobTx(jobId, v2) {
|
|
1472
1464
|
const tx = new Transaction();
|
|
1473
1465
|
tx.moveCall({
|
|
@@ -1518,8 +1510,19 @@ function buildDeliverJobTx(jobId, deliveryHash) {
|
|
|
1518
1510
|
});
|
|
1519
1511
|
return tx;
|
|
1520
1512
|
}
|
|
1521
|
-
function buildReleaseJobTx(jobId) {
|
|
1522
|
-
|
|
1513
|
+
function buildReleaseJobTx(jobId, v2) {
|
|
1514
|
+
const tx = new Transaction();
|
|
1515
|
+
tx.moveCall({
|
|
1516
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::release_v2`,
|
|
1517
|
+
typeArguments: [USDC_TYPE],
|
|
1518
|
+
arguments: [
|
|
1519
|
+
tx.object(jobId),
|
|
1520
|
+
tx.object(v2.sellerScoreId),
|
|
1521
|
+
feeConfigArg(tx),
|
|
1522
|
+
tx.object(CLOCK_ID2)
|
|
1523
|
+
]
|
|
1524
|
+
});
|
|
1525
|
+
return tx;
|
|
1523
1526
|
}
|
|
1524
1527
|
async function getJob(client, jobId) {
|
|
1525
1528
|
const resp = await client.core.getObject({ objectId: jobId, include: { json: true } }).catch((e) => {
|
|
@@ -1607,6 +1610,10 @@ var PROVEN_MIN_REVIEWS = 3;
|
|
|
1607
1610
|
var PROVEN_MIN_AVG_STARS_X10 = 40;
|
|
1608
1611
|
var REVIEW_MIN_STARS = 1;
|
|
1609
1612
|
var REVIEW_MAX_STARS = 5;
|
|
1613
|
+
var SELLER_LEVEL_ACTIVE_CAPS = [4, 10, 20, 30];
|
|
1614
|
+
var NO_DELIVERY_REGRESSION_FLOOR = 3;
|
|
1615
|
+
var LEVEL4_MIN_REVIEWS = 20;
|
|
1616
|
+
var LEVEL4_MAX_NO_DELIVERY = 2;
|
|
1610
1617
|
function boardIdOrThrow(boardId) {
|
|
1611
1618
|
const id = boardId ?? A2A_SCORE_BOARD_ID;
|
|
1612
1619
|
if (!id) {
|
|
@@ -1652,11 +1659,12 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
1652
1659
|
}
|
|
1653
1660
|
const reviewCount = Number(json.review_count ?? 0);
|
|
1654
1661
|
const starsSum = Number(json.stars_sum ?? 0);
|
|
1655
|
-
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected] = await Promise.all([
|
|
1662
|
+
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected, activeSellerJobs] = await Promise.all([
|
|
1656
1663
|
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V7_ID, "DistinctCountKey"),
|
|
1657
1664
|
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "RejectedAfterDeliveryKey"),
|
|
1658
1665
|
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "NoDeliveryKey"),
|
|
1659
|
-
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey")
|
|
1666
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey"),
|
|
1667
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V10_ID, "ActiveSellerJobsKey")
|
|
1660
1668
|
]);
|
|
1661
1669
|
return {
|
|
1662
1670
|
id: scoreId,
|
|
@@ -1667,7 +1675,8 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
1667
1675
|
distinctBuyers,
|
|
1668
1676
|
rejectedAfterDelivery,
|
|
1669
1677
|
noDelivery,
|
|
1670
|
-
asBuyerRejected
|
|
1678
|
+
asBuyerRejected,
|
|
1679
|
+
activeSellerJobs
|
|
1671
1680
|
};
|
|
1672
1681
|
}
|
|
1673
1682
|
function meetsClaimPolicy(score, claimPolicy) {
|
|
@@ -1695,6 +1704,51 @@ function claimPolicyRequirement(claimPolicy) {
|
|
|
1695
1704
|
}
|
|
1696
1705
|
return "Anyone can claim (active Agent ID required).";
|
|
1697
1706
|
}
|
|
1707
|
+
function sellerLevel(score) {
|
|
1708
|
+
if (!score) return 1;
|
|
1709
|
+
const provenAvg = score.distinctBuyers >= PROVEN_MIN_REVIEWS && score.starsSum * 10 >= score.reviewCount * PROVEN_MIN_AVG_STARS_X10;
|
|
1710
|
+
if (provenAvg) {
|
|
1711
|
+
return score.reviewCount >= LEVEL4_MIN_REVIEWS && score.noDelivery <= LEVEL4_MAX_NO_DELIVERY ? 4 : 3;
|
|
1712
|
+
}
|
|
1713
|
+
return score.distinctBuyers >= PROVEN_MIN_REVIEWS ? 2 : 1;
|
|
1714
|
+
}
|
|
1715
|
+
function effectiveSellerLevel(score) {
|
|
1716
|
+
if (!score) return 1;
|
|
1717
|
+
if (score.noDelivery >= NO_DELIVERY_REGRESSION_FLOOR) return 1;
|
|
1718
|
+
return sellerLevel(score);
|
|
1719
|
+
}
|
|
1720
|
+
function activeCapForLevel(level) {
|
|
1721
|
+
return SELLER_LEVEL_ACTIVE_CAPS[level - 1];
|
|
1722
|
+
}
|
|
1723
|
+
function meetsMinSellerLevel(score, minLevel) {
|
|
1724
|
+
if (minLevel <= 0) return true;
|
|
1725
|
+
return effectiveSellerLevel(score) >= minLevel;
|
|
1726
|
+
}
|
|
1727
|
+
function sellerLevelLabel(level) {
|
|
1728
|
+
return level >= 1 && level <= 4 ? `Level ${level}` : `Level ? (${level})`;
|
|
1729
|
+
}
|
|
1730
|
+
function preflightClaimOpening(score, opening) {
|
|
1731
|
+
if (!meetsClaimPolicy(score, opening.claimPolicy)) {
|
|
1732
|
+
return { valid: false, error: claimPolicyRequirement(opening.claimPolicy) };
|
|
1733
|
+
}
|
|
1734
|
+
const level = effectiveSellerLevel(score);
|
|
1735
|
+
const cap = activeCapForLevel(level);
|
|
1736
|
+
const active = score?.activeSellerJobs ?? 0;
|
|
1737
|
+
if (active >= cap) {
|
|
1738
|
+
return {
|
|
1739
|
+
valid: false,
|
|
1740
|
+
error: `Active: ${active}/${cap} \u2014 ${sellerLevelLabel(level)} caps in-flight claimed jobs at ${cap}. Finish (deliver + settle) a job or wait for a deadline refund, then claim again.`
|
|
1741
|
+
};
|
|
1742
|
+
}
|
|
1743
|
+
const minLevel = opening.minSellerLevel ?? 0;
|
|
1744
|
+
if (!meetsMinSellerLevel(score, minLevel)) {
|
|
1745
|
+
return {
|
|
1746
|
+
valid: false,
|
|
1747
|
+
error: `This opening needs ${sellerLevelLabel(minLevel)}+ \u2014 this wallet is ${sellerLevelLabel(level)}. Level 2 = reviews from ${PROVEN_MIN_REVIEWS}+ distinct buyers; Level 3 adds a 4.0\u2605 average; reliability (no-shows) can regress a level. Earn it on openings without a floor first.`
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
return { valid: true };
|
|
1751
|
+
}
|
|
1698
1752
|
|
|
1699
1753
|
// src/commerce.ts
|
|
1700
1754
|
var DEFAULT_COMMERCE_API_BASE = "https://api.t2000.ai/v1";
|
|
@@ -1786,4 +1840,4 @@ async function getJobSpec(base, hash) {
|
|
|
1786
1840
|
// src/browser.ts
|
|
1787
1841
|
init_token_registry();
|
|
1788
1842
|
|
|
1789
|
-
export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_PACKAGE_ID, CLOCK_ID, COIN_REGISTRY, DEFAULT_ACTIVITY_REPORT_URL, DEFAULT_COMMERCE_API_BASE, DEFAULT_NETWORK, ETH_TYPE, GAS_RESERVE_MIN, IKA_TYPE, JOB_STATES, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, MANIFEST_TYPE, MAX_DELIVER_HORIZON_MS, MAX_JOB_USDC, MAX_REVIEW_WINDOW_MS, MIN_JOB_USDC, MIST_PER_SUI, NAVX_TYPE, OPENING_CLAIM_POLICIES, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPENING_CLAIM_POLICY_PROVEN, OPENING_CLAIM_POLICY_PROVEN_4STAR, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, PROVEN_MIN_AVG_STARS_X10, PROVEN_MIN_REVIEWS, REVIEW_MAX_STARS, REVIEW_MIN_STARS, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, buildCreateJobTx, buildDeliverJobTx, buildRefundJobTx, buildRejectJobTx, buildReleaseJobTx, buildSendTx, buildSwapTx, checkPositiveAmount, checkSuiAddress, claimPolicyLabel, claimPolicyRequirement, classifyAction, classifyLabel, classifySendAsset, classifyTransaction, deriveAgentScoreId, executeTx, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fromBase642 as fromBase64, getAgentScore, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, invalidSendAssetMessage, jobActionsFor, listServices, mapMoveAbortCode, mapWalletError, meetsClaimPolicy, mistToSui, parseSuiRpcTx, payWithX402, preflightCreateJob, preflightFail, preflightPay, preflightSend, preflightSwap, putJobSpec, rawToStable, rawToUsdc, refineLendingLabel, reportX402Activity, resolveSymbol, resolveTokenType, stableToRaw, suiToMist, toBase64, truncateAddress, usdcToRaw, validateAddress, verifyJobForSeller };
|
|
1843
|
+
export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_PACKAGE_ID, CLOCK_ID, COIN_REGISTRY, DEFAULT_ACTIVITY_REPORT_URL, DEFAULT_COMMERCE_API_BASE, DEFAULT_NETWORK, ETH_TYPE, GAS_RESERVE_MIN, IKA_TYPE, JOB_STATES, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LEVEL4_MAX_NO_DELIVERY, LEVEL4_MIN_REVIEWS, LOFI_TYPE, MANIFEST_TYPE, MAX_DELIVER_HORIZON_MS, MAX_JOB_USDC, MAX_REVIEW_WINDOW_MS, MIN_JOB_USDC, MIST_PER_SUI, NAVX_TYPE, NO_DELIVERY_REGRESSION_FLOOR, OPENING_CLAIM_POLICIES, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPENING_CLAIM_POLICY_PROVEN, OPENING_CLAIM_POLICY_PROVEN_4STAR, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, PROVEN_MIN_AVG_STARS_X10, PROVEN_MIN_REVIEWS, REVIEW_MAX_STARS, REVIEW_MIN_STARS, SELLER_LEVEL_ACTIVE_CAPS, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, activeCapForLevel, buildCreateJobTx, buildDeliverJobTx, buildRefundJobTx, buildRejectJobTx, buildReleaseJobTx, buildSendTx, buildSwapTx, checkPositiveAmount, checkSuiAddress, claimPolicyLabel, claimPolicyRequirement, classifyAction, classifyLabel, classifySendAsset, classifyTransaction, deriveAgentScoreId, effectiveSellerLevel, executeTx, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fromBase642 as fromBase64, getAgentScore, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, invalidSendAssetMessage, jobActionsFor, listServices, mapMoveAbortCode, mapWalletError, meetsClaimPolicy, meetsMinSellerLevel, mistToSui, parseSuiRpcTx, payWithX402, preflightClaimOpening, preflightCreateJob, preflightFail, preflightPay, preflightSend, preflightSwap, putJobSpec, rawToStable, rawToUsdc, refineLendingLabel, reportX402Activity, resolveSymbol, resolveTokenType, sellerLevel, sellerLevelLabel, stableToRaw, suiToMist, toBase64, truncateAddress, usdcToRaw, validateAddress, verifyJobForSeller };
|
|
@@ -1591,8 +1591,16 @@ declare function buildRefundJobTx(jobId: string, v2: {
|
|
|
1591
1591
|
}): Transaction;
|
|
1592
1592
|
/** Seller posts the delivery commitment (hex hash) before the deadline. */
|
|
1593
1593
|
declare function buildDeliverJobTx(jobId: string, deliveryHash: string): Transaction;
|
|
1594
|
-
/** Buyer accepts (or anyone, once the review window lapsed) → funds to
|
|
1595
|
-
|
|
1594
|
+
/** Buyer accepts (or anyone, once the review window lapsed) → funds to
|
|
1595
|
+
* seller. S.1192: settles through `reputation::release_v2` — the
|
|
1596
|
+
* SELLER's score (derive with `deriveAgentScoreId`) rides along so a
|
|
1597
|
+
* board-claimed job frees its active seat with the money. Hire jobs pass
|
|
1598
|
+
* the same score; the contract's `ClaimedJobKey` marker decides whether
|
|
1599
|
+
* a decrement lands. A scoreless seller needs the `create_empty_score`
|
|
1600
|
+
* precursor first (same hop as reject/refund since S.1063). */
|
|
1601
|
+
declare function buildReleaseJobTx(jobId: string, v2: {
|
|
1602
|
+
sellerScoreId: string;
|
|
1603
|
+
}): Transaction;
|
|
1596
1604
|
/** Fetch + parse a `Job` shared object. Throws `RPC_ERROR` when the id
|
|
1597
1605
|
* doesn't resolve to an a2a_escrow Job. */
|
|
1598
1606
|
declare function getJob(client: SuiCoreClient, jobId: string): Promise<Job>;
|
|
@@ -1633,8 +1641,10 @@ declare function verifyJobForSeller({ client, jobId, seller, minAmountUsdc, minR
|
|
|
1633
1641
|
* target the LATEST published id — the original id (types, Job verbs) is
|
|
1634
1642
|
* unchanged.
|
|
1635
1643
|
*/
|
|
1636
|
-
/** The LATEST published `a2a_escrow` package id on MAINNET (
|
|
1637
|
-
* 2026-08-
|
|
1644
|
+
/** The LATEST published `a2a_escrow` package id on MAINNET (v10 upgrade
|
|
1645
|
+
* 2026-08-24, S.1192 — seller levels + active caps, VERSION 6 cutover:
|
|
1646
|
+
* claim_v2/claim_proven_v2/create_open_v2/release_v2;
|
|
1647
|
+
* v9 = S.1064 review on REJECTED, additive; v8 = outcome
|
|
1638
1648
|
* counters (S.1063); v7 = distinct buyers (S.1062);
|
|
1639
1649
|
* v6 = S.1054 — `reputation` module + `opening::claim_proven`;
|
|
1640
1650
|
* v5 locked open reject at 10000 (S.1019); v4 added amount bounds
|
|
@@ -1647,9 +1657,9 @@ declare function verifyJobForSeller({ client, jobId, seller, minAmountUsdc, minR
|
|
|
1647
1657
|
* upgrade + `migrate` cutover is a ONE-VALUE change here. The original id
|
|
1648
1658
|
* (`MAINNET_A2A_ESCROW_PACKAGE_ID` in job.ts) remains the anchor for type
|
|
1649
1659
|
* strings, event filters, and object-type queries — those never move. */
|
|
1650
|
-
declare const MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
1660
|
+
declare const MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0x5c90ec07da01bf885a4e65247ce98b75ab8a042cd965d30d7213856d579c4afa";
|
|
1651
1661
|
/** Back-compat name for the latest id (pre-S.981 consumers import this). */
|
|
1652
|
-
declare const MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = "
|
|
1662
|
+
declare const MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = "0x5c90ec07da01bf885a4e65247ce98b75ab8a042cd965d30d7213856d579c4afa";
|
|
1653
1663
|
/** Env-overridable latest id for testnet/dev (NOT a trust anchor). A fresh
|
|
1654
1664
|
* dev publish has original == latest, so `A2A_ESCROW_PACKAGE_ID` alone is
|
|
1655
1665
|
* honored as the fallback override. */
|
|
@@ -1686,6 +1696,12 @@ declare const A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe76
|
|
|
1686
1696
|
* RejectedAfterDeliveryKey/NoDeliveryKey/AsBuyerRejectedKey DF key types.
|
|
1687
1697
|
* A DEFINING-id anchor like V2/V3/V6/V7 — never moves again. */
|
|
1688
1698
|
declare const A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1699
|
+
/** v10 (S.1192, upgrade 1Am9J7H5… 2026-08-24) — defining id for the
|
|
1700
|
+
* seller-level surface: the ActiveSellerJobsChanged/OpeningCreatedV2
|
|
1701
|
+
* events and the ActiveSellerJobsKey/MinSellerLevelKey/TierActiveCapKey/
|
|
1702
|
+
* ClaimedJobKey DF key types. A DEFINING-id anchor like V2/V3/V6/V7/V8 —
|
|
1703
|
+
* never moves again, even when LATEST does. */
|
|
1704
|
+
declare const A2A_ESCROW_PACKAGE_V10_ID: string;
|
|
1689
1705
|
/** Default claim policy: any ACTIVE registered Agent ID ($0 claim, FCFS). */
|
|
1690
1706
|
declare const OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1691
1707
|
/** S.1054 — Proven: claimer needs ≥ PROVEN_MIN_REVIEWS on-chain reviews
|
|
@@ -1714,6 +1730,11 @@ interface OpeningTerms {
|
|
|
1714
1730
|
* 2 Proven · 4★+. Never changes HOW a claim works: still FCFS, still
|
|
1715
1731
|
* $0. 3+ aborts on-chain until defined. */
|
|
1716
1732
|
claimPolicy?: number;
|
|
1733
|
+
/** S.1192 — minimum EFFECTIVE seller level to claim: 0 none (default),
|
|
1734
|
+
* 1..4 (Level floor, independent of claimPolicy — a post can require
|
|
1735
|
+
* Proven · 4★+ AND Level 2+, or either alone). Stored as a DF on the
|
|
1736
|
+
* Opening, enforced on-chain at claim. */
|
|
1737
|
+
minSellerLevel?: number;
|
|
1717
1738
|
}
|
|
1718
1739
|
/** Every claim policy `create_open` accepts (S.1054). */
|
|
1719
1740
|
declare const OPENING_CLAIM_POLICIES: readonly [0, 1, 2];
|
|
@@ -1735,15 +1756,21 @@ declare function buildCreateOpeningTx({ client, buyer, terms, }: {
|
|
|
1735
1756
|
* `registryId` = the shared `agent_id::registry::Registry` object
|
|
1736
1757
|
* (callers pass `AGENT_ID_REGISTRY_ID` from `@t2000/id` — single source).
|
|
1737
1758
|
*
|
|
1738
|
-
* S.
|
|
1739
|
-
* claimer's own `AgentScore` (compute with `deriveAgentScoreId`)
|
|
1740
|
-
*
|
|
1741
|
-
*
|
|
1742
|
-
*
|
|
1743
|
-
|
|
1759
|
+
* S.1192: EVERY claim — policy 0 included — passes `scoreId`, the
|
|
1760
|
+
* claimer's own `AgentScore` (compute with `deriveAgentScoreId`): the
|
|
1761
|
+
* active-cap + level-floor gates read it and the in-flight counter
|
|
1762
|
+
* writes to it. A claimer with no score yet runs the permissionless
|
|
1763
|
+
* `buildCreateEmptyScoreTx` as its own PRECURSOR tx first (a shared
|
|
1764
|
+
* object cannot be created and used in one tx — the S.1063 sponsored
|
|
1765
|
+
* precursor hop; an empty score grants nothing and reads as Level 1).
|
|
1766
|
+
* `claimPolicy` (the OPENING's policy, from the board row or
|
|
1767
|
+
* `getOpening`) routes 0 → `claim_v2`, 1/2 → `claim_proven_v2`.
|
|
1768
|
+
* Preflight with `preflightClaimOpening` first for English refusals. */
|
|
1769
|
+
declare function buildClaimOpeningTx({ openingId, registryId, scoreId, claimPolicy, }: {
|
|
1744
1770
|
openingId: string;
|
|
1745
1771
|
registryId: string;
|
|
1746
|
-
scoreId
|
|
1772
|
+
scoreId: string;
|
|
1773
|
+
claimPolicy?: number;
|
|
1747
1774
|
}): Transaction;
|
|
1748
1775
|
/** Buyer withdraws an unclaimed opening — fee-free, any time. */
|
|
1749
1776
|
declare function buildCancelOpeningTx(openingId: string): Transaction;
|
|
@@ -1761,6 +1788,10 @@ interface Opening {
|
|
|
1761
1788
|
reviewWindowMs: number;
|
|
1762
1789
|
rejectSplitBps: number;
|
|
1763
1790
|
claimPolicy: number;
|
|
1791
|
+
/** S.1192 — minimum EFFECTIVE seller level to claim (0 = none; DF read,
|
|
1792
|
+
* best-effort: 0 for every pre-S.1192 opening, when the V10 pin isn't
|
|
1793
|
+
* set yet, or on a read hiccup — Move is the enforcement). */
|
|
1794
|
+
minSellerLevel: number;
|
|
1764
1795
|
createdAtMs: number;
|
|
1765
1796
|
}
|
|
1766
1797
|
/** Read one Opening by object id (null = gone: claimed/cancelled/refunded). */
|
|
@@ -1801,6 +1832,20 @@ declare const PROVEN_MIN_AVG_STARS_X10 = 40;
|
|
|
1801
1832
|
/** Star bounds on a review. */
|
|
1802
1833
|
declare const REVIEW_MIN_STARS = 1;
|
|
1803
1834
|
declare const REVIEW_MAX_STARS = 5;
|
|
1835
|
+
/** A seller's capacity label, 1-indexed (buyer copy: "Level 1"…"Level 4").
|
|
1836
|
+
* Separate from claim policy — an opening can require both. */
|
|
1837
|
+
type SellerLevel = 1 | 2 | 3 | 4;
|
|
1838
|
+
/** Default in-flight claimed-job caps per level (index = level − 1).
|
|
1839
|
+
* Package defaults — the LIVE values are AdminCap-tunable FeeConfig DFs;
|
|
1840
|
+
* the chain is the enforcement, these feed display + preflight. */
|
|
1841
|
+
declare const SELLER_LEVEL_ACTIVE_CAPS: readonly number[];
|
|
1842
|
+
/** `noDelivery >= floor` regresses the EFFECTIVE level to 1 (default;
|
|
1843
|
+
* AdminCap-tunable on-chain). */
|
|
1844
|
+
declare const NO_DELIVERY_REGRESSION_FLOOR = 3;
|
|
1845
|
+
/** Level 4 additionally needs ≥ this many reviews… */
|
|
1846
|
+
declare const LEVEL4_MIN_REVIEWS = 20;
|
|
1847
|
+
/** …and ≤ this many no-delivery outcomes. */
|
|
1848
|
+
declare const LEVEL4_MAX_NO_DELIVERY = 2;
|
|
1804
1849
|
/** Compute the deterministic `AgentScore` object id for an agent — pure
|
|
1805
1850
|
* local math (`sui::derived_object`), no RPC. The object may not exist
|
|
1806
1851
|
* yet: no score object ⇔ zero on-chain reviews. */
|
|
@@ -1822,6 +1867,9 @@ interface AgentScore {
|
|
|
1822
1867
|
rejectedAfterDelivery: number;
|
|
1823
1868
|
noDelivery: number;
|
|
1824
1869
|
asBuyerRejected: number;
|
|
1870
|
+
/** S.1192 — live board-claimed jobs in flight (funded + delivered).
|
|
1871
|
+
* 0 when the DF is absent (soft start) or pre-V10-pin. */
|
|
1872
|
+
activeSellerJobs: number;
|
|
1825
1873
|
}
|
|
1826
1874
|
/** Read an agent's score (null = no reviews yet — the lazy-create means the
|
|
1827
1875
|
* object simply doesn't exist). */
|
|
@@ -1846,6 +1894,35 @@ declare function claimPolicyLabel(claimPolicy: number): string;
|
|
|
1846
1894
|
/** One English sentence for a Proven refusal — CLI/MCP/prepare all reuse
|
|
1847
1895
|
* this instead of surfacing a raw Move abort. */
|
|
1848
1896
|
declare function claimPolicyRequirement(claimPolicy: number): string;
|
|
1897
|
+
/** Computed Level 1..4 from on-chain aggregates (`null` score = Level 1,
|
|
1898
|
+
* the empty-score default). Reuses the SAME predicates the claim
|
|
1899
|
+
* policies read — one SSOT for every threshold. */
|
|
1900
|
+
declare function sellerLevel(score: AgentScore | null): SellerLevel;
|
|
1901
|
+
/** The level capacity actually gates on: `noDelivery >= floor` regresses
|
|
1902
|
+
* to Level 1 regardless of stars (reliability caps capacity without
|
|
1903
|
+
* touching star math). Uses the package-default floor — the live value
|
|
1904
|
+
* is an AdminCap DF; the chain is the enforcement. */
|
|
1905
|
+
declare function effectiveSellerLevel(score: AgentScore | null): SellerLevel;
|
|
1906
|
+
/** Default active-job cap for a level (the live cap is AdminCap-tunable
|
|
1907
|
+
* on-chain; this feeds display + preflight). */
|
|
1908
|
+
declare function activeCapForLevel(level: SellerLevel): number;
|
|
1909
|
+
/** Whether this seller clears an opening's `minSellerLevel` floor — on
|
|
1910
|
+
* the EFFECTIVE level, matching the Move gate. */
|
|
1911
|
+
declare function meetsMinSellerLevel(score: AgentScore | null, minLevel: number): boolean;
|
|
1912
|
+
/** Human label — every surface uses this, never the raw number. */
|
|
1913
|
+
declare function sellerLevelLabel(level: number): string;
|
|
1914
|
+
/** English preflight for a claim (S.1192) — refuse BEFORE the sponsored
|
|
1915
|
+
* rail instead of surfacing a raw Move abort. Checks, in gate order:
|
|
1916
|
+
* claim policy (S.1054), the active-job cap on the claimer's effective
|
|
1917
|
+
* level, then the opening's level floor. Capacity language, not ban
|
|
1918
|
+
* language — a capped seller finishes work and claims again. */
|
|
1919
|
+
declare function preflightClaimOpening(score: AgentScore | null, opening: {
|
|
1920
|
+
claimPolicy: number;
|
|
1921
|
+
minSellerLevel?: number;
|
|
1922
|
+
}): {
|
|
1923
|
+
valid: boolean;
|
|
1924
|
+
error?: string;
|
|
1925
|
+
};
|
|
1849
1926
|
/** Review a released job when the seller ALREADY has a score object —
|
|
1850
1927
|
* also the star-EDIT path (same buyer re-rating the same job). */
|
|
1851
1928
|
declare function buildSubmitReviewTx({ scoreId, jobId, stars, }: {
|
|
@@ -1960,4 +2037,4 @@ declare function putJobSpec(base: string, content: string): Promise<string>;
|
|
|
1960
2037
|
* the store is untrusted; the chain hash is the authority). */
|
|
1961
2038
|
declare function getJobSpec(base: string, hash: string): Promise<string>;
|
|
1962
2039
|
|
|
1963
|
-
export {
|
|
2040
|
+
export { STABLE_ASSETS as $, A2A_ESCROW_FEE_CONFIG_ID as A, type BalanceResponse as B, CLOCK_ID as C, DEFAULT_ACTIVITY_REPORT_URL as D, ETH_TYPE as E, OPENING_CLAIM_POLICY_PROVEN as F, GAS_RESERVE_MIN as G, OPENING_CLAIM_POLICY_PROVEN_4STAR as H, IKA_TYPE as I, JOB_STATES as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OPENING_CLAIM_POLICIES as O, OVERLAY_FEE_RATE as P, type OverlayFeeConfig as Q, PREFLIGHT_MAX_AMOUNT as R, PREFLIGHT_OK as S, PROVEN_MIN_AVG_STARS_X10 as T, PROVEN_MIN_REVIEWS as U, type PayOptions as V, type PayResult as W, type PreflightResult as X, REVIEW_MAX_STARS as Y, REVIEW_MIN_STARS as Z, SELLER_LEVEL_ACTIVE_CAPS as _, A2A_ESCROW_PACKAGE_ID as a, getDecimalsForCoinType as a$, SUI_DECIMALS as a0, SUI_TYPE as a1, SUPPORTED_ASSETS as a2, type SellerLevel as a3, type SendAssetClass as a4, type SendResult as a5, type ServiceListing as a6, type SimulationResult as a7, type StableAsset as a8, type SuiHolding as a9, buildRejectJobTx as aA, buildReleaseJobTx as aB, buildSendTx as aC, buildSwapTx as aD, checkPositiveAmount as aE, checkSuiAddress as aF, claimPolicyLabel as aG, claimPolicyRequirement as aH, classifyAction as aI, classifyLabel as aJ, classifySendAsset as aK, classifyTransaction as aL, deriveAgentScoreId as aM, effectiveSellerLevel as aN, executeTx as aO, extractAllUserLegs as aP, extractTransferDetails as aQ, extractTxCommands as aR, extractTxSender as aS, fallbackLabel as aT, fetchService as aU, findSwapRoute as aV, formatAssetAmount as aW, formatSui as aX, formatUsd as aY, getAgentScore as aZ, getDecimals as a_, type SuiRpcTxBlock as aa, type SupportedAsset as ab, type SwapRouteResult as ac, T2000Error as ad, type T2000ErrorCode as ae, type T2000ErrorData as af, T2000_OVERLAY_FEE_WALLET as ag, TOKEN_MAP as ah, type TransactionLeg as ai, type TransactionRecord as aj, type TransactionSigner as ak, type TxDirection as al, USDC_DECIMALS as am, USDC_TYPE as an, USDE_TYPE as ao, USDSUI_TYPE as ap, USDT_TYPE as aq, WAL_TYPE as ar, WBTC_TYPE as as, type X402ActivityPayload as at, type ZkLoginProof as au, ZkLoginSigner as av, activeCapForLevel as aw, buildCreateJobTx as ax, buildDeliverJobTx as ay, buildRefundJobTx as az, type ActivityReportConfig as b, type Opening as b$, getJob as b0, getJobSpec as b1, invalidSendAssetMessage as b2, jobActionsFor as b3, listServices as b4, mapMoveAbortCode as b5, mapWalletError as b6, meetsClaimPolicy as b7, meetsMinSellerLevel as b8, mistToSui as b9, type SwapResult as bA, type SwapQuoteResult as bB, type PaymentRequest as bC, type SuiCoreClient as bD, type SponsoredCoinMergeCache as bE, type SendableAsset as bF, A2A_ESCROW_LATEST_PACKAGE_ID as bG, A2A_ESCROW_OPENING_PACKAGE_ID as bH, A2A_ESCROW_PACKAGE_V10_ID as bI, A2A_ESCROW_PACKAGE_V2_ID as bJ, A2A_ESCROW_PACKAGE_V3_ID as bK, A2A_ESCROW_PACKAGE_V6_ID as bL, A2A_ESCROW_PACKAGE_V7_ID as bM, A2A_ESCROW_PACKAGE_V8_ID as bN, A2A_SCORE_BOARD_ID as bO, type ApiRouteListing as bP, CETUS_USDC_SUI_POOL as bQ, type CoinPage as bR, DEFAULT_GRPC_URL as bS, GASLESS_MIN_STABLE_AMOUNT as bT, GASLESS_STABLE_TYPES as bU, MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID as bV, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID as bW, MAINNET_A2A_ESCROW_PACKAGE_ID as bX, MAINNET_A2A_SCORE_BOARD_ID as bY, MAX_OPEN_WINDOW_MS as bZ, OPERATION_ASSETS as b_, parseSuiRpcTx as ba, payWithX402 as bb, preflightClaimOpening as bc, preflightCreateJob as bd, preflightFail as be, preflightPay as bf, preflightSend as bg, preflightSwap as bh, putJobSpec as bi, rawToStable as bj, rawToUsdc as bk, refineLendingLabel as bl, reportX402Activity as bm, resolveSymbol as bn, resolveTokenType as bo, sellerLevel as bp, sellerLevelLabel as bq, stableToRaw as br, suiToMist as bs, truncateAddress as bt, usdcToRaw as bu, validateAddress as bv, verifyJobForSeller as bw, type T2000Options as bx, type X402Probe as by, type SerializedCetusRoute as bz, type AgentScore as c, type OpeningTerms as c0, type Operation as c1, SENDABLE_ASSETS as c2, type SelectAndSplitResult as c3, type SerializedCetusRoutePath as c4, type SerializedRouterDataV3 as c5, type ServicesRail as c6, type ServicesRow as c7, addSendToTx as c8, addSwapToTx as c9, selectSuiCoin as cA, serializeCetusRoute as cB, simulateTransaction as cC, throwIfSimulationFailed as cD, verifyCetusRouteCoinMatch as cE, assertAllowedAsset as ca, assertBuyerRequirements as cb, buildCancelOpeningTx as cc, buildClaimOpeningTx as cd, buildCreateEmptyScoreTx as ce, buildCreateOpeningTx as cf, buildDeclineJobTx as cg, buildRefundUnclaimedTx as ch, buildSubmitFirstReviewTx as ci, buildSubmitReviewTx as cj, deserializeCetusRoute as ck, fetchAllCoins as cl, getCoinMeta as cm, getOpening as cn, getSuiClient as co, getSuiGrpcClient as cp, isAllowedAsset as cq, isCetusRouteFresh as cr, isInRegistry as cs, normalizeAsset as ct, normalizeCoinType as cu, preflightCreateOpening as cv, probeX402 as cw, queryHistory as cx, queryTransaction as cy, selectAndSplitCoin as cz, COIN_REGISTRY as d, type ClassifyBalanceChange as e, type ClassifyResult as f, type CoinMeta as g, DEFAULT_COMMERCE_API_BASE as h, DEFAULT_NETWORK as i, type DepositInfo as j, type ExtractedTransfer as k, type Job as l, type JobState as m, type JobTerms as n, type JobVerification as o, KeypairSigner as p, LEVEL4_MAX_NO_DELIVERY as q, LEVEL4_MIN_REVIEWS as r, LOFI_TYPE as s, MAX_DELIVER_HORIZON_MS as t, MAX_JOB_USDC as u, MAX_REVIEW_WINDOW_MS as v, MIN_JOB_USDC as w, MIST_PER_SUI as x, NO_DELIVERY_REGRESSION_FLOOR as y, OPENING_CLAIM_POLICY_ANY_ACTIVE as z };
|