@t2000/sdk 10.32.2 → 10.33.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 +94 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +83 -3
- package/dist/{commerce-CiewZ7vq.d.cts → commerce-CptpOlnv.d.cts} +207 -1
- package/dist/{commerce-CiewZ7vq.d.ts → commerce-CptpOlnv.d.ts} +207 -1
- package/dist/index.cjs +170 -5
- package/dist/index.d.cts +23 -112
- package/dist/index.d.ts +23 -112
- package/dist/index.js +154 -7
- package/package.json +2 -2
package/dist/browser.cjs
CHANGED
|
@@ -6,6 +6,7 @@ require('@mysten/sui/grpc');
|
|
|
6
6
|
require('@mysten/sui/graphql');
|
|
7
7
|
var aggregatorSdk = require('@cetusprotocol/aggregator-sdk');
|
|
8
8
|
require('bn.js');
|
|
9
|
+
var bcs = require('@mysten/sui/bcs');
|
|
9
10
|
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1331,8 +1332,16 @@ init_coinSelection();
|
|
|
1331
1332
|
init_errors();
|
|
1332
1333
|
init_token_registry();
|
|
1333
1334
|
init_coinSelection();
|
|
1334
|
-
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
1335
|
+
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
1335
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
|
+
var OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1338
|
+
var OPENING_CLAIM_POLICY_PROVEN = 1;
|
|
1339
|
+
var OPENING_CLAIM_POLICY_PROVEN_4STAR = 2;
|
|
1340
|
+
var OPENING_CLAIM_POLICIES = [
|
|
1341
|
+
OPENING_CLAIM_POLICY_ANY_ACTIVE,
|
|
1342
|
+
OPENING_CLAIM_POLICY_PROVEN,
|
|
1343
|
+
OPENING_CLAIM_POLICY_PROVEN_4STAR
|
|
1344
|
+
];
|
|
1336
1345
|
|
|
1337
1346
|
// src/wallet/job.ts
|
|
1338
1347
|
var MAINNET_A2A_ESCROW_PACKAGE_ID = "0x358a819c1c016e2cc84ef5fbea81cba90c31f7f8a62bf45cb5e5276acf198bdd";
|
|
@@ -1558,6 +1567,77 @@ async function verifyJobForSeller({
|
|
|
1558
1567
|
return { ok: problems.length === 0, job, problems };
|
|
1559
1568
|
}
|
|
1560
1569
|
|
|
1570
|
+
// src/wallet/reputation.ts
|
|
1571
|
+
init_errors();
|
|
1572
|
+
init_token_registry();
|
|
1573
|
+
var MAINNET_A2A_SCORE_BOARD_ID = "0x7506f01e01b1c48d73832949a2808929b80dec2f7104889e012f8a4f09719f6e";
|
|
1574
|
+
var A2A_SCORE_BOARD_ID = process.env.A2A_SCORE_BOARD_ID ?? MAINNET_A2A_SCORE_BOARD_ID;
|
|
1575
|
+
var MODULE2 = "reputation";
|
|
1576
|
+
var PROVEN_MIN_REVIEWS = 3;
|
|
1577
|
+
var PROVEN_MIN_AVG_STARS_X10 = 40;
|
|
1578
|
+
var REVIEW_MIN_STARS = 1;
|
|
1579
|
+
var REVIEW_MAX_STARS = 5;
|
|
1580
|
+
function boardIdOrThrow(boardId) {
|
|
1581
|
+
const id = boardId ?? A2A_SCORE_BOARD_ID;
|
|
1582
|
+
if (!id) {
|
|
1583
|
+
throw new exports.T2000Error(
|
|
1584
|
+
"INVALID_INPUT",
|
|
1585
|
+
"The reputation ScoreBoard id is not configured (pre-S.1054-cutover build?)."
|
|
1586
|
+
);
|
|
1587
|
+
}
|
|
1588
|
+
return id;
|
|
1589
|
+
}
|
|
1590
|
+
function deriveAgentScoreId(agent, boardId) {
|
|
1591
|
+
return utils.deriveObjectID(
|
|
1592
|
+
boardIdOrThrow(boardId),
|
|
1593
|
+
"address",
|
|
1594
|
+
bcs.bcs.Address.serialize(validateAddress(agent)).toBytes()
|
|
1595
|
+
);
|
|
1596
|
+
}
|
|
1597
|
+
async function getAgentScore(client, agent, boardId) {
|
|
1598
|
+
const scoreId = deriveAgentScoreId(agent, boardId);
|
|
1599
|
+
const resp = await client.core.getObject({ objectId: scoreId, include: { json: true } }).catch(() => null);
|
|
1600
|
+
const objType = resp?.object?.type ?? "";
|
|
1601
|
+
const json = resp?.object?.json;
|
|
1602
|
+
if (!json || !objType.includes(`::${MODULE2}::AgentScore`)) {
|
|
1603
|
+
return null;
|
|
1604
|
+
}
|
|
1605
|
+
const reviewCount = Number(json.review_count ?? 0);
|
|
1606
|
+
const starsSum = Number(json.stars_sum ?? 0);
|
|
1607
|
+
return {
|
|
1608
|
+
id: scoreId,
|
|
1609
|
+
agent: String(json.agent),
|
|
1610
|
+
reviewCount,
|
|
1611
|
+
starsSum,
|
|
1612
|
+
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
function meetsClaimPolicy(score, claimPolicy) {
|
|
1616
|
+
if (claimPolicy === 0) return true;
|
|
1617
|
+
if (!score) return false;
|
|
1618
|
+
const proven = score.reviewCount >= PROVEN_MIN_REVIEWS;
|
|
1619
|
+
if (claimPolicy === 1) return proven;
|
|
1620
|
+
if (claimPolicy === 2) {
|
|
1621
|
+
return proven && score.starsSum * 10 >= score.reviewCount * PROVEN_MIN_AVG_STARS_X10;
|
|
1622
|
+
}
|
|
1623
|
+
return false;
|
|
1624
|
+
}
|
|
1625
|
+
function claimPolicyLabel(claimPolicy) {
|
|
1626
|
+
if (claimPolicy === 0) return "Anyone";
|
|
1627
|
+
if (claimPolicy === 1) return "Proven";
|
|
1628
|
+
if (claimPolicy === 2) return "Proven \xB7 4\u2605+";
|
|
1629
|
+
return `Unknown policy ${claimPolicy}`;
|
|
1630
|
+
}
|
|
1631
|
+
function claimPolicyRequirement(claimPolicy) {
|
|
1632
|
+
if (claimPolicy === 1) {
|
|
1633
|
+
return `Proven opening \u2014 claiming needs at least ${PROVEN_MIN_REVIEWS} on-chain reviews.`;
|
|
1634
|
+
}
|
|
1635
|
+
if (claimPolicy === 2) {
|
|
1636
|
+
return `Proven \xB7 4\u2605+ opening \u2014 claiming needs at least ${PROVEN_MIN_REVIEWS} on-chain reviews AND a 4.0\u2605 average.`;
|
|
1637
|
+
}
|
|
1638
|
+
return "Anyone can claim (active Agent ID required).";
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1561
1641
|
// src/commerce.ts
|
|
1562
1642
|
var DEFAULT_COMMERCE_API_BASE = "https://api.t2000.ai/v1";
|
|
1563
1643
|
async function commerceFetchJson(url, init) {
|
|
@@ -1655,9 +1735,17 @@ exports.MAX_JOB_USDC = MAX_JOB_USDC;
|
|
|
1655
1735
|
exports.MAX_REVIEW_WINDOW_MS = MAX_REVIEW_WINDOW_MS;
|
|
1656
1736
|
exports.MIN_JOB_USDC = MIN_JOB_USDC;
|
|
1657
1737
|
exports.MIST_PER_SUI = MIST_PER_SUI;
|
|
1738
|
+
exports.OPENING_CLAIM_POLICIES = OPENING_CLAIM_POLICIES;
|
|
1739
|
+
exports.OPENING_CLAIM_POLICY_ANY_ACTIVE = OPENING_CLAIM_POLICY_ANY_ACTIVE;
|
|
1740
|
+
exports.OPENING_CLAIM_POLICY_PROVEN = OPENING_CLAIM_POLICY_PROVEN;
|
|
1741
|
+
exports.OPENING_CLAIM_POLICY_PROVEN_4STAR = OPENING_CLAIM_POLICY_PROVEN_4STAR;
|
|
1658
1742
|
exports.OVERLAY_FEE_RATE = OVERLAY_FEE_RATE;
|
|
1659
1743
|
exports.PREFLIGHT_MAX_AMOUNT = PREFLIGHT_MAX_AMOUNT;
|
|
1660
1744
|
exports.PREFLIGHT_OK = PREFLIGHT_OK;
|
|
1745
|
+
exports.PROVEN_MIN_AVG_STARS_X10 = PROVEN_MIN_AVG_STARS_X10;
|
|
1746
|
+
exports.PROVEN_MIN_REVIEWS = PROVEN_MIN_REVIEWS;
|
|
1747
|
+
exports.REVIEW_MAX_STARS = REVIEW_MAX_STARS;
|
|
1748
|
+
exports.REVIEW_MIN_STARS = REVIEW_MIN_STARS;
|
|
1661
1749
|
exports.STABLE_ASSETS = STABLE_ASSETS;
|
|
1662
1750
|
exports.SUI_DECIMALS = SUI_DECIMALS;
|
|
1663
1751
|
exports.SUPPORTED_ASSETS = SUPPORTED_ASSETS;
|
|
@@ -1673,10 +1761,13 @@ exports.buildSendTx = buildSendTx;
|
|
|
1673
1761
|
exports.buildSwapTx = buildSwapTx;
|
|
1674
1762
|
exports.checkPositiveAmount = checkPositiveAmount;
|
|
1675
1763
|
exports.checkSuiAddress = checkSuiAddress;
|
|
1764
|
+
exports.claimPolicyLabel = claimPolicyLabel;
|
|
1765
|
+
exports.claimPolicyRequirement = claimPolicyRequirement;
|
|
1676
1766
|
exports.classifyAction = classifyAction;
|
|
1677
1767
|
exports.classifyLabel = classifyLabel;
|
|
1678
1768
|
exports.classifySendAsset = classifySendAsset;
|
|
1679
1769
|
exports.classifyTransaction = classifyTransaction;
|
|
1770
|
+
exports.deriveAgentScoreId = deriveAgentScoreId;
|
|
1680
1771
|
exports.executeTx = executeTx;
|
|
1681
1772
|
exports.extractAllUserLegs = extractAllUserLegs;
|
|
1682
1773
|
exports.extractTransferDetails = extractTransferDetails;
|
|
@@ -1689,6 +1780,7 @@ exports.formatAssetAmount = formatAssetAmount;
|
|
|
1689
1780
|
exports.formatSui = formatSui;
|
|
1690
1781
|
exports.formatUsd = formatUsd;
|
|
1691
1782
|
exports.fromBase64 = fromBase642;
|
|
1783
|
+
exports.getAgentScore = getAgentScore;
|
|
1692
1784
|
exports.getDecimals = getDecimals;
|
|
1693
1785
|
exports.getDecimalsForCoinType = getDecimalsForCoinType;
|
|
1694
1786
|
exports.getJob = getJob;
|
|
@@ -1698,6 +1790,7 @@ exports.jobActionsFor = jobActionsFor;
|
|
|
1698
1790
|
exports.listServices = listServices;
|
|
1699
1791
|
exports.mapMoveAbortCode = mapMoveAbortCode;
|
|
1700
1792
|
exports.mapWalletError = mapWalletError;
|
|
1793
|
+
exports.meetsClaimPolicy = meetsClaimPolicy;
|
|
1701
1794
|
exports.mistToSui = mistToSui;
|
|
1702
1795
|
exports.parseSuiRpcTx = parseSuiRpcTx;
|
|
1703
1796
|
exports.payWithX402 = payWithX402;
|
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, B as BalanceResponse, C as CLOCK_ID,
|
|
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, r as MAX_DELIVER_HORIZON_MS, s as MAX_JOB_USDC, t as MAX_REVIEW_WINDOW_MS, u as MIN_JOB_USDC, v as MIST_PER_SUI, N as NAVX_TYPE, O as OPENING_CLAIM_POLICIES, w as OPENING_CLAIM_POLICY_ANY_ACTIVE, x as OPENING_CLAIM_POLICY_PROVEN, y as OPENING_CLAIM_POLICY_PROVEN_4STAR, z as OVERLAY_FEE_RATE, F as OverlayFeeConfig, P as PREFLIGHT_MAX_AMOUNT, H as PREFLIGHT_OK, Q as PROVEN_MIN_AVG_STARS_X10, R as PROVEN_MIN_REVIEWS, S as PayOptions, T as PayResult, U as PreflightResult, V as REVIEW_MAX_STARS, W as REVIEW_MIN_STARS, X as STABLE_ASSETS, Y as SUI_DECIMALS, Z as SUI_TYPE, _ as SUPPORTED_ASSETS, $ as SendAssetClass, a0 as SendResult, a1 as ServiceListing, a2 as SimulationResult, a3 as StableAsset, a4 as SuiHolding, a5 as SuiRpcTxBlock, a6 as SupportedAsset, a7 as SwapRouteResult, a8 as T2000Error, a9 as T2000ErrorCode, aa as T2000ErrorData, ab as T2000_OVERLAY_FEE_WALLET, ac as TOKEN_MAP, ad as TransactionLeg, ae as TransactionRecord, af as TransactionSigner, ag as TxDirection, ah as USDC_DECIMALS, ai as USDC_TYPE, aj as USDE_TYPE, ak as USDSUI_TYPE, al as USDT_TYPE, am as WAL_TYPE, an as WBTC_TYPE, ao as X402ActivityPayload, ap as ZkLoginProof, aq as ZkLoginSigner, ar as buildCreateJobTx, as as buildDeliverJobTx, at as buildRefundJobTx, au as buildRejectJobTx, av as buildReleaseJobTx, aw as buildSendTx, ax as buildSwapTx, ay as checkPositiveAmount, az as checkSuiAddress, aA as claimPolicyLabel, aB as claimPolicyRequirement, aC as classifyAction, aD as classifyLabel, aE as classifySendAsset, aF as classifyTransaction, aG as deriveAgentScoreId, aH as executeTx, aI as extractAllUserLegs, aJ as extractTransferDetails, aK as extractTxCommands, aL as extractTxSender, aM as fallbackLabel, aN as fetchService, aO as findSwapRoute, aP as formatAssetAmount, aQ as formatSui, aR as formatUsd, aS as getAgentScore, aT as getDecimals, aU as getDecimalsForCoinType, aV as getJob, aW as getJobSpec, aX as invalidSendAssetMessage, aY as jobActionsFor, aZ as listServices, a_ as mapMoveAbortCode, a$ as mapWalletError, b0 as meetsClaimPolicy, b1 as mistToSui, b2 as parseSuiRpcTx, b3 as payWithX402, b4 as preflightCreateJob, b5 as preflightFail, b6 as preflightPay, b7 as preflightSend, b8 as preflightSwap, b9 as putJobSpec, ba as rawToStable, bb as rawToUsdc, bc as refineLendingLabel, bd as reportX402Activity, be as resolveSymbol, bf as resolveTokenType, bg as stableToRaw, bh as suiToMist, bi as truncateAddress, bj as usdcToRaw, bk as validateAddress, bl as verifyJobForSeller } from './commerce-CptpOlnv.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, B as BalanceResponse, C as CLOCK_ID,
|
|
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, r as MAX_DELIVER_HORIZON_MS, s as MAX_JOB_USDC, t as MAX_REVIEW_WINDOW_MS, u as MIN_JOB_USDC, v as MIST_PER_SUI, N as NAVX_TYPE, O as OPENING_CLAIM_POLICIES, w as OPENING_CLAIM_POLICY_ANY_ACTIVE, x as OPENING_CLAIM_POLICY_PROVEN, y as OPENING_CLAIM_POLICY_PROVEN_4STAR, z as OVERLAY_FEE_RATE, F as OverlayFeeConfig, P as PREFLIGHT_MAX_AMOUNT, H as PREFLIGHT_OK, Q as PROVEN_MIN_AVG_STARS_X10, R as PROVEN_MIN_REVIEWS, S as PayOptions, T as PayResult, U as PreflightResult, V as REVIEW_MAX_STARS, W as REVIEW_MIN_STARS, X as STABLE_ASSETS, Y as SUI_DECIMALS, Z as SUI_TYPE, _ as SUPPORTED_ASSETS, $ as SendAssetClass, a0 as SendResult, a1 as ServiceListing, a2 as SimulationResult, a3 as StableAsset, a4 as SuiHolding, a5 as SuiRpcTxBlock, a6 as SupportedAsset, a7 as SwapRouteResult, a8 as T2000Error, a9 as T2000ErrorCode, aa as T2000ErrorData, ab as T2000_OVERLAY_FEE_WALLET, ac as TOKEN_MAP, ad as TransactionLeg, ae as TransactionRecord, af as TransactionSigner, ag as TxDirection, ah as USDC_DECIMALS, ai as USDC_TYPE, aj as USDE_TYPE, ak as USDSUI_TYPE, al as USDT_TYPE, am as WAL_TYPE, an as WBTC_TYPE, ao as X402ActivityPayload, ap as ZkLoginProof, aq as ZkLoginSigner, ar as buildCreateJobTx, as as buildDeliverJobTx, at as buildRefundJobTx, au as buildRejectJobTx, av as buildReleaseJobTx, aw as buildSendTx, ax as buildSwapTx, ay as checkPositiveAmount, az as checkSuiAddress, aA as claimPolicyLabel, aB as claimPolicyRequirement, aC as classifyAction, aD as classifyLabel, aE as classifySendAsset, aF as classifyTransaction, aG as deriveAgentScoreId, aH as executeTx, aI as extractAllUserLegs, aJ as extractTransferDetails, aK as extractTxCommands, aL as extractTxSender, aM as fallbackLabel, aN as fetchService, aO as findSwapRoute, aP as formatAssetAmount, aQ as formatSui, aR as formatUsd, aS as getAgentScore, aT as getDecimals, aU as getDecimalsForCoinType, aV as getJob, aW as getJobSpec, aX as invalidSendAssetMessage, aY as jobActionsFor, aZ as listServices, a_ as mapMoveAbortCode, a$ as mapWalletError, b0 as meetsClaimPolicy, b1 as mistToSui, b2 as parseSuiRpcTx, b3 as payWithX402, b4 as preflightCreateJob, b5 as preflightFail, b6 as preflightPay, b7 as preflightSend, b8 as preflightSwap, b9 as putJobSpec, ba as rawToStable, bb as rawToUsdc, bc as refineLendingLabel, bd as reportX402Activity, be as resolveSymbol, bf as resolveTokenType, bg as stableToRaw, bh as suiToMist, bi as truncateAddress, bj as usdcToRaw, bk as validateAddress, bl as verifyJobForSeller } from './commerce-CptpOlnv.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
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { coinWithBalance, Transaction } from '@mysten/sui/transactions';
|
|
2
|
-
import { isValidSuiAddress, normalizeSuiAddress, fromBase64, normalizeStructTag } from '@mysten/sui/utils';
|
|
2
|
+
import { isValidSuiAddress, normalizeSuiAddress, fromBase64, normalizeStructTag, deriveObjectID } from '@mysten/sui/utils';
|
|
3
3
|
import '@mysten/sui/grpc';
|
|
4
4
|
import '@mysten/sui/graphql';
|
|
5
5
|
import { AggregatorClient, Env } from '@cetusprotocol/aggregator-sdk';
|
|
6
6
|
import 'bn.js';
|
|
7
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
7
8
|
|
|
8
9
|
var __defProp = Object.defineProperty;
|
|
9
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1329,8 +1330,16 @@ init_coinSelection();
|
|
|
1329
1330
|
init_errors();
|
|
1330
1331
|
init_token_registry();
|
|
1331
1332
|
init_coinSelection();
|
|
1332
|
-
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
1333
|
+
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
1333
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
|
+
var OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1336
|
+
var OPENING_CLAIM_POLICY_PROVEN = 1;
|
|
1337
|
+
var OPENING_CLAIM_POLICY_PROVEN_4STAR = 2;
|
|
1338
|
+
var OPENING_CLAIM_POLICIES = [
|
|
1339
|
+
OPENING_CLAIM_POLICY_ANY_ACTIVE,
|
|
1340
|
+
OPENING_CLAIM_POLICY_PROVEN,
|
|
1341
|
+
OPENING_CLAIM_POLICY_PROVEN_4STAR
|
|
1342
|
+
];
|
|
1334
1343
|
|
|
1335
1344
|
// src/wallet/job.ts
|
|
1336
1345
|
var MAINNET_A2A_ESCROW_PACKAGE_ID = "0x358a819c1c016e2cc84ef5fbea81cba90c31f7f8a62bf45cb5e5276acf198bdd";
|
|
@@ -1556,6 +1565,77 @@ async function verifyJobForSeller({
|
|
|
1556
1565
|
return { ok: problems.length === 0, job, problems };
|
|
1557
1566
|
}
|
|
1558
1567
|
|
|
1568
|
+
// src/wallet/reputation.ts
|
|
1569
|
+
init_errors();
|
|
1570
|
+
init_token_registry();
|
|
1571
|
+
var MAINNET_A2A_SCORE_BOARD_ID = "0x7506f01e01b1c48d73832949a2808929b80dec2f7104889e012f8a4f09719f6e";
|
|
1572
|
+
var A2A_SCORE_BOARD_ID = process.env.A2A_SCORE_BOARD_ID ?? MAINNET_A2A_SCORE_BOARD_ID;
|
|
1573
|
+
var MODULE2 = "reputation";
|
|
1574
|
+
var PROVEN_MIN_REVIEWS = 3;
|
|
1575
|
+
var PROVEN_MIN_AVG_STARS_X10 = 40;
|
|
1576
|
+
var REVIEW_MIN_STARS = 1;
|
|
1577
|
+
var REVIEW_MAX_STARS = 5;
|
|
1578
|
+
function boardIdOrThrow(boardId) {
|
|
1579
|
+
const id = boardId ?? A2A_SCORE_BOARD_ID;
|
|
1580
|
+
if (!id) {
|
|
1581
|
+
throw new T2000Error(
|
|
1582
|
+
"INVALID_INPUT",
|
|
1583
|
+
"The reputation ScoreBoard id is not configured (pre-S.1054-cutover build?)."
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1586
|
+
return id;
|
|
1587
|
+
}
|
|
1588
|
+
function deriveAgentScoreId(agent, boardId) {
|
|
1589
|
+
return deriveObjectID(
|
|
1590
|
+
boardIdOrThrow(boardId),
|
|
1591
|
+
"address",
|
|
1592
|
+
bcs.Address.serialize(validateAddress(agent)).toBytes()
|
|
1593
|
+
);
|
|
1594
|
+
}
|
|
1595
|
+
async function getAgentScore(client, agent, boardId) {
|
|
1596
|
+
const scoreId = deriveAgentScoreId(agent, boardId);
|
|
1597
|
+
const resp = await client.core.getObject({ objectId: scoreId, include: { json: true } }).catch(() => null);
|
|
1598
|
+
const objType = resp?.object?.type ?? "";
|
|
1599
|
+
const json = resp?.object?.json;
|
|
1600
|
+
if (!json || !objType.includes(`::${MODULE2}::AgentScore`)) {
|
|
1601
|
+
return null;
|
|
1602
|
+
}
|
|
1603
|
+
const reviewCount = Number(json.review_count ?? 0);
|
|
1604
|
+
const starsSum = Number(json.stars_sum ?? 0);
|
|
1605
|
+
return {
|
|
1606
|
+
id: scoreId,
|
|
1607
|
+
agent: String(json.agent),
|
|
1608
|
+
reviewCount,
|
|
1609
|
+
starsSum,
|
|
1610
|
+
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
function meetsClaimPolicy(score, claimPolicy) {
|
|
1614
|
+
if (claimPolicy === 0) return true;
|
|
1615
|
+
if (!score) return false;
|
|
1616
|
+
const proven = score.reviewCount >= PROVEN_MIN_REVIEWS;
|
|
1617
|
+
if (claimPolicy === 1) return proven;
|
|
1618
|
+
if (claimPolicy === 2) {
|
|
1619
|
+
return proven && score.starsSum * 10 >= score.reviewCount * PROVEN_MIN_AVG_STARS_X10;
|
|
1620
|
+
}
|
|
1621
|
+
return false;
|
|
1622
|
+
}
|
|
1623
|
+
function claimPolicyLabel(claimPolicy) {
|
|
1624
|
+
if (claimPolicy === 0) return "Anyone";
|
|
1625
|
+
if (claimPolicy === 1) return "Proven";
|
|
1626
|
+
if (claimPolicy === 2) return "Proven \xB7 4\u2605+";
|
|
1627
|
+
return `Unknown policy ${claimPolicy}`;
|
|
1628
|
+
}
|
|
1629
|
+
function claimPolicyRequirement(claimPolicy) {
|
|
1630
|
+
if (claimPolicy === 1) {
|
|
1631
|
+
return `Proven opening \u2014 claiming needs at least ${PROVEN_MIN_REVIEWS} on-chain reviews.`;
|
|
1632
|
+
}
|
|
1633
|
+
if (claimPolicy === 2) {
|
|
1634
|
+
return `Proven \xB7 4\u2605+ opening \u2014 claiming needs at least ${PROVEN_MIN_REVIEWS} on-chain reviews AND a 4.0\u2605 average.`;
|
|
1635
|
+
}
|
|
1636
|
+
return "Anyone can claim (active Agent ID required).";
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1559
1639
|
// src/commerce.ts
|
|
1560
1640
|
var DEFAULT_COMMERCE_API_BASE = "https://api.t2000.ai/v1";
|
|
1561
1641
|
async function commerceFetchJson(url, init) {
|
|
@@ -1637,4 +1717,4 @@ async function getJobSpec(base, hash) {
|
|
|
1637
1717
|
// src/browser.ts
|
|
1638
1718
|
init_token_registry();
|
|
1639
1719
|
|
|
1640
|
-
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, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, 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, classifyAction, classifyLabel, classifySendAsset, classifyTransaction, executeTx, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fromBase642 as fromBase64, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, invalidSendAssetMessage, jobActionsFor, listServices, mapMoveAbortCode, mapWalletError, mistToSui, parseSuiRpcTx, payWithX402, preflightCreateJob, preflightFail, preflightPay, preflightSend, preflightSwap, putJobSpec, rawToStable, rawToUsdc, refineLendingLabel, reportX402Activity, resolveSymbol, resolveTokenType, stableToRaw, suiToMist, toBase64, truncateAddress, usdcToRaw, validateAddress, verifyJobForSeller };
|
|
1720
|
+
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 };
|
|
@@ -1601,6 +1601,212 @@ declare function verifyJobForSeller({ client, jobId, seller, minAmountUsdc, minR
|
|
|
1601
1601
|
minRunwayMs?: number;
|
|
1602
1602
|
}): Promise<JobVerification>;
|
|
1603
1603
|
|
|
1604
|
+
/**
|
|
1605
|
+
* Open door — client for `a2a_escrow::opening` (SPEC_T2_AGENTS_OPEN_ONCHAIN,
|
|
1606
|
+
* Phase 3 escrow-at-post). Posting an open job escrows USDC on-chain
|
|
1607
|
+
* immediately in a shared `Opening<USDC>`; the first ACTIVE registered ASP
|
|
1608
|
+
* to claim mints a normal `escrow::Job` (deliver/settle with the job verbs).
|
|
1609
|
+
* No claim by `open_until` → `refund_unclaimed` (permissionless, fee-free);
|
|
1610
|
+
* the buyer can `cancel_open` any time while unclaimed.
|
|
1611
|
+
*
|
|
1612
|
+
* The `opening` module shipped in the v2 package upgrade, so its calls
|
|
1613
|
+
* target the LATEST published id — the original id (types, Job verbs) is
|
|
1614
|
+
* unchanged.
|
|
1615
|
+
*/
|
|
1616
|
+
/** The LATEST published `a2a_escrow` package id on MAINNET (v6 upgrade
|
|
1617
|
+
* 2026-08-15, S.1054 — `reputation` module + `opening::claim_proven`;
|
|
1618
|
+
* v5 locked open reject at 10000 (S.1019); v4 added amount bounds
|
|
1619
|
+
* (S.981); v3 added `escrow::decline`; v2 the `opening` module).
|
|
1620
|
+
* A literal, never an env read, so it can serve as a signature-time trust
|
|
1621
|
+
* anchor (S.930). Must match the Move upgrade publish notes.
|
|
1622
|
+
*
|
|
1623
|
+
* S.981: EVERY version-gated verb (escrow create/deliver/release/reject/
|
|
1624
|
+
* refund + decline + all opening verbs) targets this id, so a package
|
|
1625
|
+
* upgrade + `migrate` cutover is a ONE-VALUE change here. The original id
|
|
1626
|
+
* (`MAINNET_A2A_ESCROW_PACKAGE_ID` in job.ts) remains the anchor for type
|
|
1627
|
+
* strings, event filters, and object-type queries — those never move. */
|
|
1628
|
+
declare const MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
1629
|
+
/** Back-compat name for the latest id (pre-S.981 consumers import this). */
|
|
1630
|
+
declare const MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
1631
|
+
/** Env-overridable latest id for testnet/dev (NOT a trust anchor). A fresh
|
|
1632
|
+
* dev publish has original == latest, so `A2A_ESCROW_PACKAGE_ID` alone is
|
|
1633
|
+
* honored as the fallback override. */
|
|
1634
|
+
declare const A2A_ESCROW_LATEST_PACKAGE_ID: string;
|
|
1635
|
+
/** Back-compat name (pre-S.981). */
|
|
1636
|
+
declare const A2A_ESCROW_OPENING_PACKAGE_ID: string;
|
|
1637
|
+
/**
|
|
1638
|
+
* PINNED per-upgrade package ids — event-filter anchors, NEVER bump these.
|
|
1639
|
+
*
|
|
1640
|
+
* A Sui event's type carries the package id that FIRST DEFINED the struct,
|
|
1641
|
+
* not the id of the version that executed. Indexers filtering
|
|
1642
|
+
* `<pkg>::module` must therefore pin the DEFINING id per event family:
|
|
1643
|
+
* v1 (A2A_ESCROW_PACKAGE_ID) — JobCreated/Delivered/Released/Rejected/Refunded
|
|
1644
|
+
* v2 (…_V2_ID) — OpeningCreated/Claimed/Cancelled/Refunded
|
|
1645
|
+
* v3 (…_V3_ID) — JobDeclined
|
|
1646
|
+
* Filtering the floating LATEST id matches nothing once the next upgrade
|
|
1647
|
+
* lands (live finding, 2026-07-28: the openings indexer went dark when
|
|
1648
|
+
* A2A_ESCROW_OPENING_PACKAGE_ID moved v2 → v3).
|
|
1649
|
+
*/
|
|
1650
|
+
declare const A2A_ESCROW_PACKAGE_V2_ID = "0x860288d789dc617f6474a0a6801d6011e53bf30d5fb801cdad47b9bc6adb098b";
|
|
1651
|
+
declare const A2A_ESCROW_PACKAGE_V3_ID = "0x69ad93c555519de520a5c7f7f2963ad6f8b91cefc098fc2eed75942dcb5bcbe7";
|
|
1652
|
+
/** v6 (S.1054, upgrade FHcn7KCB… 2026-08-15) — defining id for the
|
|
1653
|
+
* `reputation` module: the ScoreBoardCreated/ScoreCreated/ReviewSubmitted
|
|
1654
|
+
* events and the ScoreBoard/AgentScore object types. A DEFINING-id anchor
|
|
1655
|
+
* like V2/V3 — never moves again, even when LATEST does. */
|
|
1656
|
+
declare const A2A_ESCROW_PACKAGE_V6_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
1657
|
+
/** Default claim policy: any ACTIVE registered Agent ID ($0 claim, FCFS). */
|
|
1658
|
+
declare const OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1659
|
+
/** S.1054 — Proven: claimer needs ≥ PROVEN_MIN_REVIEWS on-chain reviews
|
|
1660
|
+
* (see `wallet/reputation.ts`). Claims route through `claim_proven`. */
|
|
1661
|
+
declare const OPENING_CLAIM_POLICY_PROVEN = 1;
|
|
1662
|
+
/** S.1054 — Proven · 4★+: Proven AND average stars ≥ 4.0 (strictly
|
|
1663
|
+
* stronger than policy 1). */
|
|
1664
|
+
declare const OPENING_CLAIM_POLICY_PROVEN_4STAR = 2;
|
|
1665
|
+
/** Max time an opening may stay claimable (contract cap): 30 days. */
|
|
1666
|
+
declare const MAX_OPEN_WINDOW_MS = 2592000000;
|
|
1667
|
+
interface OpeningTerms {
|
|
1668
|
+
/** Budget in USDC — escrows NOW, at post. */
|
|
1669
|
+
amountUsdc: number;
|
|
1670
|
+
/** sha256 of the public spec envelope (t2-acp-custom@1: title + brief). */
|
|
1671
|
+
specHash: string;
|
|
1672
|
+
/** Epoch-ms the opening stays claimable until (≤ 30d out). */
|
|
1673
|
+
openUntilMs: number;
|
|
1674
|
+
/** Delivery window the claiming ASP gets: deliver_by = claim + sla. */
|
|
1675
|
+
slaMs: number;
|
|
1676
|
+
reviewWindowMs: number;
|
|
1677
|
+
/** v5 (S.1019): MUST be 10000 — open-board reject pays the buyer in
|
|
1678
|
+
* full (contract-asserted; a partial split made junk delivery +EV over
|
|
1679
|
+
* an honest decline). Hire/`escrow::create` keeps the 0–10000 range. */
|
|
1680
|
+
rejectSplitBps: number;
|
|
1681
|
+
/** S.1054 — who may race to claim: 0 Anyone (default), 1 Proven,
|
|
1682
|
+
* 2 Proven · 4★+. Never changes HOW a claim works: still FCFS, still
|
|
1683
|
+
* $0. 3+ aborts on-chain until defined. */
|
|
1684
|
+
claimPolicy?: number;
|
|
1685
|
+
}
|
|
1686
|
+
/** Every claim policy `create_open` accepts (S.1054). */
|
|
1687
|
+
declare const OPENING_CLAIM_POLICIES: readonly [0, 1, 2];
|
|
1688
|
+
/** Client-side preflight — mirrors the contract's `create_open` bounds plus
|
|
1689
|
+
* the $50 client cap (the contract is value-neutral, same as Job). */
|
|
1690
|
+
declare function preflightCreateOpening(terms: OpeningTerms): {
|
|
1691
|
+
valid: boolean;
|
|
1692
|
+
code?: 'INVALID_AMOUNT' | 'INVALID_INPUT';
|
|
1693
|
+
error?: string;
|
|
1694
|
+
};
|
|
1695
|
+
/** Build the escrow-at-post tx: split USDC → `opening::create_open`. */
|
|
1696
|
+
declare function buildCreateOpeningTx({ client, buyer, terms, }: {
|
|
1697
|
+
client: SuiCoreClient;
|
|
1698
|
+
buyer: string;
|
|
1699
|
+
terms: OpeningTerms;
|
|
1700
|
+
}): Promise<Transaction>;
|
|
1701
|
+
/** Claim an opening (ASP side) — consumes it and mints the funded Job.
|
|
1702
|
+
* `registryId` = the shared `agent_id::registry::Registry` object
|
|
1703
|
+
* (callers pass `AGENT_ID_REGISTRY_ID` from `@t2000/id` — single source).
|
|
1704
|
+
*
|
|
1705
|
+
* S.1054: for a PROVEN opening (`claimPolicy` 1/2) pass `scoreId` — the
|
|
1706
|
+
* claimer's own `AgentScore` (compute with `deriveAgentScoreId`) — and the
|
|
1707
|
+
* call routes to `claim_proven`, which reads it immutably. Omitting it on
|
|
1708
|
+
* a Proven opening aborts on-chain; preflight with `meetsClaimPolicy`
|
|
1709
|
+
* first for an English refusal. */
|
|
1710
|
+
declare function buildClaimOpeningTx({ openingId, registryId, scoreId, }: {
|
|
1711
|
+
openingId: string;
|
|
1712
|
+
registryId: string;
|
|
1713
|
+
scoreId?: string;
|
|
1714
|
+
}): Transaction;
|
|
1715
|
+
/** Buyer withdraws an unclaimed opening — fee-free, any time. */
|
|
1716
|
+
declare function buildCancelOpeningTx(openingId: string): Transaction;
|
|
1717
|
+
/** Permissionless refund crank for an opening past `open_until`. */
|
|
1718
|
+
declare function buildRefundUnclaimedTx(openingId: string): Transaction;
|
|
1719
|
+
/** On-chain view of one Opening. */
|
|
1720
|
+
interface Opening {
|
|
1721
|
+
id: string;
|
|
1722
|
+
buyer: string;
|
|
1723
|
+
amountUsdc: number;
|
|
1724
|
+
feeBps: number;
|
|
1725
|
+
specHash: string;
|
|
1726
|
+
openUntilMs: number;
|
|
1727
|
+
slaMs: number;
|
|
1728
|
+
reviewWindowMs: number;
|
|
1729
|
+
rejectSplitBps: number;
|
|
1730
|
+
claimPolicy: number;
|
|
1731
|
+
createdAtMs: number;
|
|
1732
|
+
}
|
|
1733
|
+
/** Read one Opening by object id (null = gone: claimed/cancelled/refunded). */
|
|
1734
|
+
declare function getOpening(client: SuiCoreClient, openingId: string): Promise<Opening | null>;
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* On-chain reputation — client for `a2a_escrow::reputation` (S.1054,
|
|
1738
|
+
* SPEC_AGENT_ID_REPUTATION Phase C). One shared `AgentScore` per reviewed
|
|
1739
|
+
* seller, lazily created on their first review at a DETERMINISTIC address
|
|
1740
|
+
* derived from the shared `ScoreBoard` — `deriveAgentScoreId` computes it
|
|
1741
|
+
* locally, no lookup. Aggregates only (`review_count` + `stars_sum`);
|
|
1742
|
+
* review TEXT stays off-chain (jobId-keyed rows on the API).
|
|
1743
|
+
*
|
|
1744
|
+
* Write authority is Move-enforced: only the buyer of a RELEASED (and
|
|
1745
|
+
* actually delivered) `escrow::Job` can write, once per job — resubmitting
|
|
1746
|
+
* edits the stars in place. There is no admin mint: reputation is receipts.
|
|
1747
|
+
*
|
|
1748
|
+
* These aggregates are the ONE public score SSOT (profile stars, Proven
|
|
1749
|
+
* claim gates). `claim_policy` `1`/`2` openings claim via
|
|
1750
|
+
* `opening::claim_proven`, which reads the claimer's own score immutably.
|
|
1751
|
+
*/
|
|
1752
|
+
/** The shared `reputation::ScoreBoard` object id on MAINNET — the derived-
|
|
1753
|
+
* address namespace parent every `AgentScore` hangs off. Created ONCE by
|
|
1754
|
+
* the S.1054 cutover (`create_score_board`); single instance is
|
|
1755
|
+
* chain-enforced (S.1054b: the id records into the `ScoreBoardKey` DF on
|
|
1756
|
+
* FeeConfig and a second create aborts). This pin MUST equal
|
|
1757
|
+
* `escrow::config_score_board_id(FeeConfig)` — verify at cutover. */
|
|
1758
|
+
declare const MAINNET_A2A_SCORE_BOARD_ID = "0x7506f01e01b1c48d73832949a2808929b80dec2f7104889e012f8a4f09719f6e";
|
|
1759
|
+
/** Env-overridable board id for testnet/dev (NOT a trust anchor). */
|
|
1760
|
+
declare const A2A_SCORE_BOARD_ID: string;
|
|
1761
|
+
/** Reviews required for Proven (`claim_policy` 1, and the floor of 2). */
|
|
1762
|
+
declare const PROVEN_MIN_REVIEWS = 3;
|
|
1763
|
+
/** Average-stars floor for Proven · 4★+ (`claim_policy` 2), scaled ×10. */
|
|
1764
|
+
declare const PROVEN_MIN_AVG_STARS_X10 = 40;
|
|
1765
|
+
/** Star bounds on a review. */
|
|
1766
|
+
declare const REVIEW_MIN_STARS = 1;
|
|
1767
|
+
declare const REVIEW_MAX_STARS = 5;
|
|
1768
|
+
/** Compute the deterministic `AgentScore` object id for an agent — pure
|
|
1769
|
+
* local math (`sui::derived_object`), no RPC. The object may not exist
|
|
1770
|
+
* yet: no score object ⇔ zero on-chain reviews. */
|
|
1771
|
+
declare function deriveAgentScoreId(agent: string, boardId?: string): string;
|
|
1772
|
+
/** On-chain view of one agent's score aggregates. */
|
|
1773
|
+
interface AgentScore {
|
|
1774
|
+
id: string;
|
|
1775
|
+
agent: string;
|
|
1776
|
+
reviewCount: number;
|
|
1777
|
+
starsSum: number;
|
|
1778
|
+
/** Integer-safe average, rounded to 2dp for display (0 when no reviews). */
|
|
1779
|
+
averageStars: number;
|
|
1780
|
+
}
|
|
1781
|
+
/** Read an agent's score (null = no reviews yet — the lazy-create means the
|
|
1782
|
+
* object simply doesn't exist). */
|
|
1783
|
+
declare function getAgentScore(client: SuiCoreClient, agent: string, boardId?: string): Promise<AgentScore | null>;
|
|
1784
|
+
/** Does a score satisfy an Opening's claim policy? (`null` score = zero
|
|
1785
|
+
* reviews.) Mirrors the Move predicates exactly — integer math, and
|
|
1786
|
+
* policy 2 is strictly stronger than policy 1. */
|
|
1787
|
+
declare function meetsClaimPolicy(score: AgentScore | null, claimPolicy: number): boolean;
|
|
1788
|
+
/** Human label for a claim policy — every surface uses these, never the
|
|
1789
|
+
* raw enum. */
|
|
1790
|
+
declare function claimPolicyLabel(claimPolicy: number): string;
|
|
1791
|
+
/** One English sentence for a Proven refusal — CLI/MCP/prepare all reuse
|
|
1792
|
+
* this instead of surfacing a raw Move abort. */
|
|
1793
|
+
declare function claimPolicyRequirement(claimPolicy: number): string;
|
|
1794
|
+
/** Review a released job when the seller ALREADY has a score object —
|
|
1795
|
+
* also the star-EDIT path (same buyer re-rating the same job). */
|
|
1796
|
+
declare function buildSubmitReviewTx({ scoreId, jobId, stars, }: {
|
|
1797
|
+
scoreId: string;
|
|
1798
|
+
jobId: string;
|
|
1799
|
+
stars: number;
|
|
1800
|
+
}): Transaction;
|
|
1801
|
+
/** First review a seller ever receives — lazily creates their score at its
|
|
1802
|
+
* derived address (aborts on-chain if it raced into existence; retry with
|
|
1803
|
+
* `buildSubmitReviewTx`). */
|
|
1804
|
+
declare function buildSubmitFirstReviewTx({ jobId, stars, boardId, }: {
|
|
1805
|
+
jobId: string;
|
|
1806
|
+
stars: number;
|
|
1807
|
+
boardId?: string;
|
|
1808
|
+
}): Transaction;
|
|
1809
|
+
|
|
1604
1810
|
declare const DEFAULT_COMMERCE_API_BASE = "https://api.t2000.ai/v1";
|
|
1605
1811
|
/** The shape the API returns from GET /v1/services. */
|
|
1606
1812
|
interface ServiceListing {
|
|
@@ -1668,4 +1874,4 @@ declare function putJobSpec(base: string, content: string): Promise<string>;
|
|
|
1668
1874
|
* the store is untrusted; the chain hash is the authority). */
|
|
1669
1875
|
declare function getJobSpec(base: string, hash: string): Promise<string>;
|
|
1670
1876
|
|
|
1671
|
-
export {
|
|
1877
|
+
export { type SendAssetClass 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, type OverlayFeeConfig as F, GAS_RESERVE_MIN as G, PREFLIGHT_OK 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, PREFLIGHT_MAX_AMOUNT as P, PROVEN_MIN_AVG_STARS_X10 as Q, PROVEN_MIN_REVIEWS as R, type PayOptions as S, type PayResult as T, type PreflightResult as U, REVIEW_MAX_STARS as V, REVIEW_MIN_STARS as W, STABLE_ASSETS as X, SUI_DECIMALS as Y, SUI_TYPE as Z, SUPPORTED_ASSETS as _, A2A_ESCROW_PACKAGE_ID as a, mapWalletError as a$, type SendResult as a0, type ServiceListing as a1, type SimulationResult as a2, type StableAsset as a3, type SuiHolding as a4, type SuiRpcTxBlock as a5, type SupportedAsset as a6, type SwapRouteResult as a7, T2000Error as a8, type T2000ErrorCode as a9, claimPolicyLabel as aA, claimPolicyRequirement as aB, classifyAction as aC, classifyLabel as aD, classifySendAsset as aE, classifyTransaction as aF, deriveAgentScoreId as aG, executeTx as aH, extractAllUserLegs as aI, extractTransferDetails as aJ, extractTxCommands as aK, extractTxSender as aL, fallbackLabel as aM, fetchService as aN, findSwapRoute as aO, formatAssetAmount as aP, formatSui as aQ, formatUsd as aR, getAgentScore as aS, getDecimals as aT, getDecimalsForCoinType as aU, getJob as aV, getJobSpec as aW, invalidSendAssetMessage as aX, jobActionsFor as aY, listServices as aZ, mapMoveAbortCode as a_, type T2000ErrorData as aa, T2000_OVERLAY_FEE_WALLET as ab, TOKEN_MAP as ac, type TransactionLeg as ad, type TransactionRecord as ae, type TransactionSigner as af, type TxDirection as ag, USDC_DECIMALS as ah, USDC_TYPE as ai, USDE_TYPE as aj, USDSUI_TYPE as ak, USDT_TYPE as al, WAL_TYPE as am, WBTC_TYPE as an, type X402ActivityPayload as ao, type ZkLoginProof as ap, ZkLoginSigner as aq, buildCreateJobTx as ar, buildDeliverJobTx as as, buildRefundJobTx as at, buildRejectJobTx as au, buildReleaseJobTx as av, buildSendTx as aw, buildSwapTx as ax, checkPositiveAmount as ay, checkSuiAddress as az, type ActivityReportConfig as b, buildRefundUnclaimedTx as b$, meetsClaimPolicy as b0, mistToSui as b1, parseSuiRpcTx as b2, payWithX402 as b3, preflightCreateJob as b4, preflightFail as b5, preflightPay as b6, preflightSend as b7, preflightSwap as b8, putJobSpec as b9, A2A_SCORE_BOARD_ID as bA, CETUS_USDC_SUI_POOL as bB, type CoinPage as bC, DEFAULT_GRPC_URL as bD, GASLESS_MIN_STABLE_AMOUNT as bE, GASLESS_STABLE_TYPES as bF, MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID as bG, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID as bH, MAINNET_A2A_ESCROW_PACKAGE_ID as bI, MAINNET_A2A_SCORE_BOARD_ID as bJ, MAX_OPEN_WINDOW_MS as bK, OPERATION_ASSETS as bL, type Opening as bM, type OpeningTerms as bN, type Operation as bO, SENDABLE_ASSETS as bP, type SelectAndSplitResult as bQ, type SerializedCetusRoutePath as bR, type SerializedRouterDataV3 as bS, addSendToTx as bT, addSwapToTx as bU, assertAllowedAsset as bV, assertBuyerRequirements as bW, buildCancelOpeningTx as bX, buildClaimOpeningTx as bY, buildCreateOpeningTx as bZ, buildDeclineJobTx as b_, rawToStable as ba, rawToUsdc as bb, refineLendingLabel as bc, reportX402Activity as bd, resolveSymbol as be, resolveTokenType as bf, stableToRaw as bg, suiToMist as bh, truncateAddress as bi, usdcToRaw as bj, validateAddress as bk, verifyJobForSeller as bl, type T2000Options as bm, type X402Probe as bn, type SerializedCetusRoute as bo, type SwapResult as bp, type SwapQuoteResult as bq, type PaymentRequest as br, type SuiCoreClient as bs, type SponsoredCoinMergeCache as bt, type SendableAsset as bu, A2A_ESCROW_LATEST_PACKAGE_ID as bv, A2A_ESCROW_OPENING_PACKAGE_ID as bw, A2A_ESCROW_PACKAGE_V2_ID as bx, A2A_ESCROW_PACKAGE_V3_ID as by, A2A_ESCROW_PACKAGE_V6_ID as bz, type AgentScore as c, buildSubmitFirstReviewTx as c0, buildSubmitReviewTx as c1, deserializeCetusRoute as c2, fetchAllCoins as c3, getCoinMeta as c4, getOpening as c5, getSuiClient as c6, getSuiGrpcClient as c7, isAllowedAsset as c8, isCetusRouteFresh as c9, isInRegistry as ca, normalizeAsset as cb, normalizeCoinType as cc, preflightCreateOpening as cd, probeX402 as ce, queryHistory as cf, queryTransaction as cg, selectAndSplitCoin as ch, selectSuiCoin as ci, serializeCetusRoute as cj, simulateTransaction as ck, throwIfSimulationFailed as cl, verifyCetusRouteCoinMatch as cm, 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, LOFI_TYPE as q, MAX_DELIVER_HORIZON_MS as r, MAX_JOB_USDC as s, MAX_REVIEW_WINDOW_MS as t, MIN_JOB_USDC as u, MIST_PER_SUI as v, OPENING_CLAIM_POLICY_ANY_ACTIVE as w, OPENING_CLAIM_POLICY_PROVEN as x, OPENING_CLAIM_POLICY_PROVEN_4STAR as y, OVERLAY_FEE_RATE as z };
|