@t2000/sdk 10.33.1 → 10.35.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 +71 -11
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +72 -12
- package/dist/{commerce-CptpOlnv.d.cts → commerce-GI4hcxKU.d.cts} +59 -12
- package/dist/{commerce-CptpOlnv.d.ts → commerce-GI4hcxKU.d.ts} +59 -12
- package/dist/index.cjs +91 -11
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +90 -13
- package/package.json +2 -2
package/dist/browser.cjs
CHANGED
|
@@ -1332,8 +1332,10 @@ 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 = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
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
|
+
var A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe769bcedf11f3525e84682d59a3b23e";
|
|
1338
|
+
var A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1337
1339
|
var OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1338
1340
|
var OPENING_CLAIM_POLICY_PROVEN = 1;
|
|
1339
1341
|
var OPENING_CLAIM_POLICY_PROVEN_4STAR = 2;
|
|
@@ -1468,6 +1470,42 @@ function jobCall(jobId, fn) {
|
|
|
1468
1470
|
});
|
|
1469
1471
|
return tx;
|
|
1470
1472
|
}
|
|
1473
|
+
function buildRejectJobTx(jobId, v2) {
|
|
1474
|
+
const tx = new transactions.Transaction();
|
|
1475
|
+
tx.moveCall({
|
|
1476
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::${v2.buyerScoreId ? "reject_v2_agent_buyer" : "reject_v2"}`,
|
|
1477
|
+
typeArguments: [exports.USDC_TYPE],
|
|
1478
|
+
arguments: v2.buyerScoreId ? [
|
|
1479
|
+
tx.object(jobId),
|
|
1480
|
+
tx.object(v2.sellerScoreId),
|
|
1481
|
+
tx.object(v2.buyerScoreId),
|
|
1482
|
+
tx.object(v2.registryId),
|
|
1483
|
+
feeConfigArg(tx),
|
|
1484
|
+
tx.object(CLOCK_ID2)
|
|
1485
|
+
] : [
|
|
1486
|
+
tx.object(jobId),
|
|
1487
|
+
tx.object(v2.sellerScoreId),
|
|
1488
|
+
tx.object(v2.registryId),
|
|
1489
|
+
feeConfigArg(tx),
|
|
1490
|
+
tx.object(CLOCK_ID2)
|
|
1491
|
+
]
|
|
1492
|
+
});
|
|
1493
|
+
return tx;
|
|
1494
|
+
}
|
|
1495
|
+
function buildRefundJobTx(jobId, v2) {
|
|
1496
|
+
const tx = new transactions.Transaction();
|
|
1497
|
+
tx.moveCall({
|
|
1498
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::refund_v2`,
|
|
1499
|
+
typeArguments: [exports.USDC_TYPE],
|
|
1500
|
+
arguments: [
|
|
1501
|
+
tx.object(jobId),
|
|
1502
|
+
tx.object(v2.sellerScoreId),
|
|
1503
|
+
feeConfigArg(tx),
|
|
1504
|
+
tx.object(CLOCK_ID2)
|
|
1505
|
+
]
|
|
1506
|
+
});
|
|
1507
|
+
return tx;
|
|
1508
|
+
}
|
|
1471
1509
|
function buildDeliverJobTx(jobId, deliveryHash) {
|
|
1472
1510
|
const tx = new transactions.Transaction();
|
|
1473
1511
|
tx.moveCall({
|
|
@@ -1485,12 +1523,6 @@ function buildDeliverJobTx(jobId, deliveryHash) {
|
|
|
1485
1523
|
function buildReleaseJobTx(jobId) {
|
|
1486
1524
|
return jobCall(jobId, "release");
|
|
1487
1525
|
}
|
|
1488
|
-
function buildRejectJobTx(jobId) {
|
|
1489
|
-
return jobCall(jobId, "reject");
|
|
1490
|
-
}
|
|
1491
|
-
function buildRefundJobTx(jobId) {
|
|
1492
|
-
return jobCall(jobId, "refund");
|
|
1493
|
-
}
|
|
1494
1526
|
async function getJob(client, jobId) {
|
|
1495
1527
|
const resp = await client.core.getObject({ objectId: jobId, include: { json: true } }).catch((e) => {
|
|
1496
1528
|
throw new exports.T2000Error(
|
|
@@ -1594,6 +1626,24 @@ function deriveAgentScoreId(agent, boardId) {
|
|
|
1594
1626
|
bcs.bcs.Address.serialize(validateAddress(agent)).toBytes()
|
|
1595
1627
|
);
|
|
1596
1628
|
}
|
|
1629
|
+
async function readCounterDf(client, scoreId, definingId, keyStruct) {
|
|
1630
|
+
if (!definingId) return 0;
|
|
1631
|
+
try {
|
|
1632
|
+
const fieldId = utils.deriveDynamicFieldID(
|
|
1633
|
+
scoreId,
|
|
1634
|
+
`${definingId}::${MODULE2}::${keyStruct}`,
|
|
1635
|
+
new Uint8Array([0])
|
|
1636
|
+
);
|
|
1637
|
+
const resp = await client.core.getObject({
|
|
1638
|
+
objectId: fieldId,
|
|
1639
|
+
include: { json: true }
|
|
1640
|
+
});
|
|
1641
|
+
const json = resp?.object?.json;
|
|
1642
|
+
return Number(json?.value ?? 0);
|
|
1643
|
+
} catch {
|
|
1644
|
+
return 0;
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1597
1647
|
async function getAgentScore(client, agent, boardId) {
|
|
1598
1648
|
const scoreId = deriveAgentScoreId(agent, boardId);
|
|
1599
1649
|
const resp = await client.core.getObject({ objectId: scoreId, include: { json: true } }).catch(() => null);
|
|
@@ -1604,18 +1654,28 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
1604
1654
|
}
|
|
1605
1655
|
const reviewCount = Number(json.review_count ?? 0);
|
|
1606
1656
|
const starsSum = Number(json.stars_sum ?? 0);
|
|
1657
|
+
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected] = await Promise.all([
|
|
1658
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V7_ID, "DistinctCountKey"),
|
|
1659
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "RejectedAfterDeliveryKey"),
|
|
1660
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "NoDeliveryKey"),
|
|
1661
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey")
|
|
1662
|
+
]);
|
|
1607
1663
|
return {
|
|
1608
1664
|
id: scoreId,
|
|
1609
1665
|
agent: String(json.agent),
|
|
1610
1666
|
reviewCount,
|
|
1611
1667
|
starsSum,
|
|
1612
|
-
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0
|
|
1668
|
+
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0,
|
|
1669
|
+
distinctBuyers,
|
|
1670
|
+
rejectedAfterDelivery,
|
|
1671
|
+
noDelivery,
|
|
1672
|
+
asBuyerRejected
|
|
1613
1673
|
};
|
|
1614
1674
|
}
|
|
1615
1675
|
function meetsClaimPolicy(score, claimPolicy) {
|
|
1616
1676
|
if (claimPolicy === 0) return true;
|
|
1617
1677
|
if (!score) return false;
|
|
1618
|
-
const proven = score.
|
|
1678
|
+
const proven = score.distinctBuyers >= PROVEN_MIN_REVIEWS;
|
|
1619
1679
|
if (claimPolicy === 1) return proven;
|
|
1620
1680
|
if (claimPolicy === 2) {
|
|
1621
1681
|
return proven && score.starsSum * 10 >= score.reviewCount * PROVEN_MIN_AVG_STARS_X10;
|
|
@@ -1630,10 +1690,10 @@ function claimPolicyLabel(claimPolicy) {
|
|
|
1630
1690
|
}
|
|
1631
1691
|
function claimPolicyRequirement(claimPolicy) {
|
|
1632
1692
|
if (claimPolicy === 1) {
|
|
1633
|
-
return `Claiming needs at least ${PROVEN_MIN_REVIEWS}
|
|
1693
|
+
return `Claiming needs at least ${PROVEN_MIN_REVIEWS} reviews from distinct buyers.`;
|
|
1634
1694
|
}
|
|
1635
1695
|
if (claimPolicy === 2) {
|
|
1636
|
-
return `Claiming needs at least ${PROVEN_MIN_REVIEWS}
|
|
1696
|
+
return `Claiming needs at least ${PROVEN_MIN_REVIEWS} reviews from distinct buyers and a 4.0\u2605 average.`;
|
|
1637
1697
|
}
|
|
1638
1698
|
return "Anyone can claim (active Agent ID required).";
|
|
1639
1699
|
}
|
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, 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-
|
|
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-GI4hcxKU.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, 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-
|
|
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-GI4hcxKU.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,5 +1,5 @@
|
|
|
1
1
|
import { coinWithBalance, Transaction } from '@mysten/sui/transactions';
|
|
2
|
-
import { isValidSuiAddress, normalizeSuiAddress, fromBase64, normalizeStructTag, deriveObjectID } from '@mysten/sui/utils';
|
|
2
|
+
import { isValidSuiAddress, normalizeSuiAddress, fromBase64, normalizeStructTag, deriveObjectID, deriveDynamicFieldID } 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';
|
|
@@ -1330,8 +1330,10 @@ 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 = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
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
|
+
var A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe769bcedf11f3525e84682d59a3b23e";
|
|
1336
|
+
var A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1335
1337
|
var OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1336
1338
|
var OPENING_CLAIM_POLICY_PROVEN = 1;
|
|
1337
1339
|
var OPENING_CLAIM_POLICY_PROVEN_4STAR = 2;
|
|
@@ -1466,6 +1468,42 @@ function jobCall(jobId, fn) {
|
|
|
1466
1468
|
});
|
|
1467
1469
|
return tx;
|
|
1468
1470
|
}
|
|
1471
|
+
function buildRejectJobTx(jobId, v2) {
|
|
1472
|
+
const tx = new Transaction();
|
|
1473
|
+
tx.moveCall({
|
|
1474
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::${v2.buyerScoreId ? "reject_v2_agent_buyer" : "reject_v2"}`,
|
|
1475
|
+
typeArguments: [USDC_TYPE],
|
|
1476
|
+
arguments: v2.buyerScoreId ? [
|
|
1477
|
+
tx.object(jobId),
|
|
1478
|
+
tx.object(v2.sellerScoreId),
|
|
1479
|
+
tx.object(v2.buyerScoreId),
|
|
1480
|
+
tx.object(v2.registryId),
|
|
1481
|
+
feeConfigArg(tx),
|
|
1482
|
+
tx.object(CLOCK_ID2)
|
|
1483
|
+
] : [
|
|
1484
|
+
tx.object(jobId),
|
|
1485
|
+
tx.object(v2.sellerScoreId),
|
|
1486
|
+
tx.object(v2.registryId),
|
|
1487
|
+
feeConfigArg(tx),
|
|
1488
|
+
tx.object(CLOCK_ID2)
|
|
1489
|
+
]
|
|
1490
|
+
});
|
|
1491
|
+
return tx;
|
|
1492
|
+
}
|
|
1493
|
+
function buildRefundJobTx(jobId, v2) {
|
|
1494
|
+
const tx = new Transaction();
|
|
1495
|
+
tx.moveCall({
|
|
1496
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::refund_v2`,
|
|
1497
|
+
typeArguments: [USDC_TYPE],
|
|
1498
|
+
arguments: [
|
|
1499
|
+
tx.object(jobId),
|
|
1500
|
+
tx.object(v2.sellerScoreId),
|
|
1501
|
+
feeConfigArg(tx),
|
|
1502
|
+
tx.object(CLOCK_ID2)
|
|
1503
|
+
]
|
|
1504
|
+
});
|
|
1505
|
+
return tx;
|
|
1506
|
+
}
|
|
1469
1507
|
function buildDeliverJobTx(jobId, deliveryHash) {
|
|
1470
1508
|
const tx = new Transaction();
|
|
1471
1509
|
tx.moveCall({
|
|
@@ -1483,12 +1521,6 @@ function buildDeliverJobTx(jobId, deliveryHash) {
|
|
|
1483
1521
|
function buildReleaseJobTx(jobId) {
|
|
1484
1522
|
return jobCall(jobId, "release");
|
|
1485
1523
|
}
|
|
1486
|
-
function buildRejectJobTx(jobId) {
|
|
1487
|
-
return jobCall(jobId, "reject");
|
|
1488
|
-
}
|
|
1489
|
-
function buildRefundJobTx(jobId) {
|
|
1490
|
-
return jobCall(jobId, "refund");
|
|
1491
|
-
}
|
|
1492
1524
|
async function getJob(client, jobId) {
|
|
1493
1525
|
const resp = await client.core.getObject({ objectId: jobId, include: { json: true } }).catch((e) => {
|
|
1494
1526
|
throw new T2000Error(
|
|
@@ -1592,6 +1624,24 @@ function deriveAgentScoreId(agent, boardId) {
|
|
|
1592
1624
|
bcs.Address.serialize(validateAddress(agent)).toBytes()
|
|
1593
1625
|
);
|
|
1594
1626
|
}
|
|
1627
|
+
async function readCounterDf(client, scoreId, definingId, keyStruct) {
|
|
1628
|
+
if (!definingId) return 0;
|
|
1629
|
+
try {
|
|
1630
|
+
const fieldId = deriveDynamicFieldID(
|
|
1631
|
+
scoreId,
|
|
1632
|
+
`${definingId}::${MODULE2}::${keyStruct}`,
|
|
1633
|
+
new Uint8Array([0])
|
|
1634
|
+
);
|
|
1635
|
+
const resp = await client.core.getObject({
|
|
1636
|
+
objectId: fieldId,
|
|
1637
|
+
include: { json: true }
|
|
1638
|
+
});
|
|
1639
|
+
const json = resp?.object?.json;
|
|
1640
|
+
return Number(json?.value ?? 0);
|
|
1641
|
+
} catch {
|
|
1642
|
+
return 0;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1595
1645
|
async function getAgentScore(client, agent, boardId) {
|
|
1596
1646
|
const scoreId = deriveAgentScoreId(agent, boardId);
|
|
1597
1647
|
const resp = await client.core.getObject({ objectId: scoreId, include: { json: true } }).catch(() => null);
|
|
@@ -1602,18 +1652,28 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
1602
1652
|
}
|
|
1603
1653
|
const reviewCount = Number(json.review_count ?? 0);
|
|
1604
1654
|
const starsSum = Number(json.stars_sum ?? 0);
|
|
1655
|
+
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected] = await Promise.all([
|
|
1656
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V7_ID, "DistinctCountKey"),
|
|
1657
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "RejectedAfterDeliveryKey"),
|
|
1658
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "NoDeliveryKey"),
|
|
1659
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey")
|
|
1660
|
+
]);
|
|
1605
1661
|
return {
|
|
1606
1662
|
id: scoreId,
|
|
1607
1663
|
agent: String(json.agent),
|
|
1608
1664
|
reviewCount,
|
|
1609
1665
|
starsSum,
|
|
1610
|
-
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0
|
|
1666
|
+
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0,
|
|
1667
|
+
distinctBuyers,
|
|
1668
|
+
rejectedAfterDelivery,
|
|
1669
|
+
noDelivery,
|
|
1670
|
+
asBuyerRejected
|
|
1611
1671
|
};
|
|
1612
1672
|
}
|
|
1613
1673
|
function meetsClaimPolicy(score, claimPolicy) {
|
|
1614
1674
|
if (claimPolicy === 0) return true;
|
|
1615
1675
|
if (!score) return false;
|
|
1616
|
-
const proven = score.
|
|
1676
|
+
const proven = score.distinctBuyers >= PROVEN_MIN_REVIEWS;
|
|
1617
1677
|
if (claimPolicy === 1) return proven;
|
|
1618
1678
|
if (claimPolicy === 2) {
|
|
1619
1679
|
return proven && score.starsSum * 10 >= score.reviewCount * PROVEN_MIN_AVG_STARS_X10;
|
|
@@ -1628,10 +1688,10 @@ function claimPolicyLabel(claimPolicy) {
|
|
|
1628
1688
|
}
|
|
1629
1689
|
function claimPolicyRequirement(claimPolicy) {
|
|
1630
1690
|
if (claimPolicy === 1) {
|
|
1631
|
-
return `Claiming needs at least ${PROVEN_MIN_REVIEWS}
|
|
1691
|
+
return `Claiming needs at least ${PROVEN_MIN_REVIEWS} reviews from distinct buyers.`;
|
|
1632
1692
|
}
|
|
1633
1693
|
if (claimPolicy === 2) {
|
|
1634
|
-
return `Claiming needs at least ${PROVEN_MIN_REVIEWS}
|
|
1694
|
+
return `Claiming needs at least ${PROVEN_MIN_REVIEWS} reviews from distinct buyers and a 4.0\u2605 average.`;
|
|
1635
1695
|
}
|
|
1636
1696
|
return "Anyone can claim (active Agent ID required).";
|
|
1637
1697
|
}
|
|
@@ -1565,14 +1565,28 @@ declare function buildCreateJobTx({ client, buyer, terms, }: {
|
|
|
1565
1565
|
* JobDeclined event is what distinguishes a decline from a deadline
|
|
1566
1566
|
* refund). Targets the latest package id — `decline` shipped in v3. */
|
|
1567
1567
|
declare function buildDeclineJobTx(jobId: string): Transaction;
|
|
1568
|
+
/** Buyer rejects delivered work — S.1063: settles through
|
|
1569
|
+
* `reputation::reject_v2` (Passport buyer) or `reject_v2_agent_buyer`
|
|
1570
|
+
* (registered Agent-ID buyer, who also accrues `as_buyer_rejected`), so
|
|
1571
|
+
* the protocol outcome lands on the seller's score. Score ids derive
|
|
1572
|
+
* locally (`deriveAgentScoreId`); pass `buyerScoreId` exactly when the
|
|
1573
|
+
* buyer is a registered agent — the contract refuses a mismatched
|
|
1574
|
+
* variant, so a registered buyer can't dodge its own counter. */
|
|
1575
|
+
declare function buildRejectJobTx(jobId: string, v2: {
|
|
1576
|
+
sellerScoreId: string;
|
|
1577
|
+
registryId: string;
|
|
1578
|
+
buyerScoreId?: string;
|
|
1579
|
+
}): Transaction;
|
|
1580
|
+
/** Deadline refund (no delivery) — S.1063: settles through
|
|
1581
|
+
* `reputation::refund_v2` so `no_delivery` lands on the seller's score.
|
|
1582
|
+
* Still permissionless: funds only ever return to the buyer. */
|
|
1583
|
+
declare function buildRefundJobTx(jobId: string, v2: {
|
|
1584
|
+
sellerScoreId: string;
|
|
1585
|
+
}): Transaction;
|
|
1568
1586
|
/** Seller posts the delivery commitment (hex hash) before the deadline. */
|
|
1569
1587
|
declare function buildDeliverJobTx(jobId: string, deliveryHash: string): Transaction;
|
|
1570
1588
|
/** Buyer accepts (or anyone, once the review window lapsed) → funds to seller. */
|
|
1571
1589
|
declare function buildReleaseJobTx(jobId: string): Transaction;
|
|
1572
|
-
/** Buyer rejects within the review window → split per the create terms. */
|
|
1573
|
-
declare function buildRejectJobTx(jobId: string): Transaction;
|
|
1574
|
-
/** Anyone, after the deadline with no delivery → funds back to the buyer. */
|
|
1575
|
-
declare function buildRefundJobTx(jobId: string): Transaction;
|
|
1576
1590
|
/** Fetch + parse a `Job` shared object. Throws `RPC_ERROR` when the id
|
|
1577
1591
|
* doesn't resolve to an a2a_escrow Job. */
|
|
1578
1592
|
declare function getJob(client: SuiCoreClient, jobId: string): Promise<Job>;
|
|
@@ -1613,8 +1627,9 @@ declare function verifyJobForSeller({ client, jobId, seller, minAmountUsdc, minR
|
|
|
1613
1627
|
* target the LATEST published id — the original id (types, Job verbs) is
|
|
1614
1628
|
* unchanged.
|
|
1615
1629
|
*/
|
|
1616
|
-
/** The LATEST published `a2a_escrow` package id on MAINNET (
|
|
1617
|
-
* 2026-08-15, S.
|
|
1630
|
+
/** The LATEST published `a2a_escrow` package id on MAINNET (v8 upgrade
|
|
1631
|
+
* 2026-08-15, S.1063 — outcome counters; v7 = distinct buyers (S.1062);
|
|
1632
|
+
* v6 = S.1054 — `reputation` module + `opening::claim_proven`;
|
|
1618
1633
|
* v5 locked open reject at 10000 (S.1019); v4 added amount bounds
|
|
1619
1634
|
* (S.981); v3 added `escrow::decline`; v2 the `opening` module).
|
|
1620
1635
|
* A literal, never an env read, so it can serve as a signature-time trust
|
|
@@ -1625,9 +1640,9 @@ declare function verifyJobForSeller({ client, jobId, seller, minAmountUsdc, minR
|
|
|
1625
1640
|
* upgrade + `migrate` cutover is a ONE-VALUE change here. The original id
|
|
1626
1641
|
* (`MAINNET_A2A_ESCROW_PACKAGE_ID` in job.ts) remains the anchor for type
|
|
1627
1642
|
* strings, event filters, and object-type queries — those never move. */
|
|
1628
|
-
declare const MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
1643
|
+
declare const MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1629
1644
|
/** Back-compat name for the latest id (pre-S.981 consumers import this). */
|
|
1630
|
-
declare const MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = "
|
|
1645
|
+
declare const MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1631
1646
|
/** Env-overridable latest id for testnet/dev (NOT a trust anchor). A fresh
|
|
1632
1647
|
* dev publish has original == latest, so `A2A_ESCROW_PACKAGE_ID` alone is
|
|
1633
1648
|
* honored as the fallback override. */
|
|
@@ -1654,6 +1669,16 @@ declare const A2A_ESCROW_PACKAGE_V3_ID = "0x69ad93c555519de520a5c7f7f2963ad6f8b9
|
|
|
1654
1669
|
* events and the ScoreBoard/AgentScore object types. A DEFINING-id anchor
|
|
1655
1670
|
* like V2/V3 — never moves again, even when LATEST does. */
|
|
1656
1671
|
declare const A2A_ESCROW_PACKAGE_V6_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
1672
|
+
/** v7 (S.1062, upgrade 3DcWdSPE… 2026-08-15) — defining id for the
|
|
1673
|
+
* distinct-buyer surface: the ReviewSubmittedV2 event and the
|
|
1674
|
+
* DistinctCountKey/BuyerSeenKey DF key types. A DEFINING-id anchor like
|
|
1675
|
+
* V2/V3/V6 — never moves again, even when LATEST does. */
|
|
1676
|
+
declare const A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe769bcedf11f3525e84682d59a3b23e";
|
|
1677
|
+
/** v8 (S.1063, upgrade HNphxqJx… 2026-08-15) — defining id for the
|
|
1678
|
+
* outcome surface: the OutcomeRecorded event and the
|
|
1679
|
+
* RejectedAfterDeliveryKey/NoDeliveryKey/AsBuyerRejectedKey DF key types.
|
|
1680
|
+
* A DEFINING-id anchor like V2/V3/V6/V7 — never moves again. */
|
|
1681
|
+
declare const A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1657
1682
|
/** Default claim policy: any ACTIVE registered Agent ID ($0 claim, FCFS). */
|
|
1658
1683
|
declare const OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1659
1684
|
/** S.1054 — Proven: claimer needs ≥ PROVEN_MIN_REVIEWS on-chain reviews
|
|
@@ -1758,7 +1783,10 @@ declare function getOpening(client: SuiCoreClient, openingId: string): Promise<O
|
|
|
1758
1783
|
declare const MAINNET_A2A_SCORE_BOARD_ID = "0x7506f01e01b1c48d73832949a2808929b80dec2f7104889e012f8a4f09719f6e";
|
|
1759
1784
|
/** Env-overridable board id for testnet/dev (NOT a trust anchor). */
|
|
1760
1785
|
declare const A2A_SCORE_BOARD_ID: string;
|
|
1761
|
-
/**
|
|
1786
|
+
/** The Proven floor (`claim_policy` 1, and the floor of 2). Since S.1062
|
|
1787
|
+
* this counts DISTINCT BUYERS, not raw reviews — one friendly buyer ×3
|
|
1788
|
+
* no longer unlocks Proven. The name survives for the published surface;
|
|
1789
|
+
* the value is unchanged at 3. */
|
|
1762
1790
|
declare const PROVEN_MIN_REVIEWS = 3;
|
|
1763
1791
|
/** Average-stars floor for Proven · 4★+ (`claim_policy` 2), scaled ×10. */
|
|
1764
1792
|
declare const PROVEN_MIN_AVG_STARS_X10 = 40;
|
|
@@ -1777,13 +1805,32 @@ interface AgentScore {
|
|
|
1777
1805
|
starsSum: number;
|
|
1778
1806
|
/** Integer-safe average, rounded to 2dp for display (0 when no reviews). */
|
|
1779
1807
|
averageStars: number;
|
|
1808
|
+
/** Distinct buyer addresses that have reviewed since S.1062 — the
|
|
1809
|
+
* Proven gate input. 0 when the DF is absent (pre-S.1062 scores never
|
|
1810
|
+
* grandfather in). */
|
|
1811
|
+
distinctBuyers: number;
|
|
1812
|
+
/** S.1063 protocol outcomes — display-only facts, NEVER stars and never
|
|
1813
|
+
* part of any Proven predicate. 0 when the DF is absent. */
|
|
1814
|
+
rejectedAfterDelivery: number;
|
|
1815
|
+
noDelivery: number;
|
|
1816
|
+
asBuyerRejected: number;
|
|
1780
1817
|
}
|
|
1781
1818
|
/** Read an agent's score (null = no reviews yet — the lazy-create means the
|
|
1782
1819
|
* object simply doesn't exist). */
|
|
1783
1820
|
declare function getAgentScore(client: SuiCoreClient, agent: string, boardId?: string): Promise<AgentScore | null>;
|
|
1821
|
+
/** Lazily create an agent's zero score (S.1063) — needed before an outcome
|
|
1822
|
+
* verb (reject/refund) when the target agent has no score yet: a shared
|
|
1823
|
+
* object can't be created and then passed as input inside one tx. A zero
|
|
1824
|
+
* score grants NOTHING (no stars, no distinct, no Proven). The sponsored
|
|
1825
|
+
* rail chains this automatically. */
|
|
1826
|
+
declare function buildCreateEmptyScoreTx({ agent, boardId, }: {
|
|
1827
|
+
agent: string;
|
|
1828
|
+
boardId?: string;
|
|
1829
|
+
}): Transaction;
|
|
1784
1830
|
/** Does a score satisfy an Opening's claim policy? (`null` score = zero
|
|
1785
|
-
* reviews.) Mirrors the Move predicates exactly —
|
|
1786
|
-
*
|
|
1831
|
+
* reviews.) Mirrors the Move predicates exactly — S.1062: the Proven
|
|
1832
|
+
* floor counts DISTINCT BUYERS; integer avg math; policy 2 strictly
|
|
1833
|
+
* stronger than policy 1. */
|
|
1787
1834
|
declare function meetsClaimPolicy(score: AgentScore | null, claimPolicy: number): boolean;
|
|
1788
1835
|
/** Human label for a claim policy — every surface uses these, never the
|
|
1789
1836
|
* raw enum. */
|
|
@@ -1874,4 +1921,4 @@ declare function putJobSpec(base: string, content: string): Promise<string>;
|
|
|
1874
1921
|
* the store is untrusted; the chain hash is the authority). */
|
|
1875
1922
|
declare function getJobSpec(base: string, hash: string): Promise<string>;
|
|
1876
1923
|
|
|
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,
|
|
1924
|
+
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, buildCreateEmptyScoreTx 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_ESCROW_PACKAGE_V7_ID as bA, A2A_ESCROW_PACKAGE_V8_ID as bB, A2A_SCORE_BOARD_ID as bC, CETUS_USDC_SUI_POOL as bD, type CoinPage as bE, DEFAULT_GRPC_URL as bF, GASLESS_MIN_STABLE_AMOUNT as bG, GASLESS_STABLE_TYPES as bH, MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID as bI, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID as bJ, MAINNET_A2A_ESCROW_PACKAGE_ID as bK, MAINNET_A2A_SCORE_BOARD_ID as bL, MAX_OPEN_WINDOW_MS as bM, OPERATION_ASSETS as bN, type Opening as bO, type OpeningTerms as bP, type Operation as bQ, SENDABLE_ASSETS as bR, type SelectAndSplitResult as bS, type SerializedCetusRoutePath as bT, type SerializedRouterDataV3 as bU, addSendToTx as bV, addSwapToTx as bW, assertAllowedAsset as bX, assertBuyerRequirements as bY, buildCancelOpeningTx as bZ, buildClaimOpeningTx 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, buildCreateOpeningTx as c0, buildDeclineJobTx as c1, buildRefundUnclaimedTx as c2, buildSubmitFirstReviewTx as c3, buildSubmitReviewTx as c4, deserializeCetusRoute as c5, fetchAllCoins as c6, getCoinMeta as c7, getOpening as c8, getSuiClient as c9, getSuiGrpcClient as ca, isAllowedAsset as cb, isCetusRouteFresh as cc, isInRegistry as cd, normalizeAsset as ce, normalizeCoinType as cf, preflightCreateOpening as cg, probeX402 as ch, queryHistory as ci, queryTransaction as cj, selectAndSplitCoin as ck, selectSuiCoin as cl, serializeCetusRoute as cm, simulateTransaction as cn, throwIfSimulationFailed as co, verifyCetusRouteCoinMatch as cp, 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 };
|
|
@@ -1565,14 +1565,28 @@ declare function buildCreateJobTx({ client, buyer, terms, }: {
|
|
|
1565
1565
|
* JobDeclined event is what distinguishes a decline from a deadline
|
|
1566
1566
|
* refund). Targets the latest package id — `decline` shipped in v3. */
|
|
1567
1567
|
declare function buildDeclineJobTx(jobId: string): Transaction;
|
|
1568
|
+
/** Buyer rejects delivered work — S.1063: settles through
|
|
1569
|
+
* `reputation::reject_v2` (Passport buyer) or `reject_v2_agent_buyer`
|
|
1570
|
+
* (registered Agent-ID buyer, who also accrues `as_buyer_rejected`), so
|
|
1571
|
+
* the protocol outcome lands on the seller's score. Score ids derive
|
|
1572
|
+
* locally (`deriveAgentScoreId`); pass `buyerScoreId` exactly when the
|
|
1573
|
+
* buyer is a registered agent — the contract refuses a mismatched
|
|
1574
|
+
* variant, so a registered buyer can't dodge its own counter. */
|
|
1575
|
+
declare function buildRejectJobTx(jobId: string, v2: {
|
|
1576
|
+
sellerScoreId: string;
|
|
1577
|
+
registryId: string;
|
|
1578
|
+
buyerScoreId?: string;
|
|
1579
|
+
}): Transaction;
|
|
1580
|
+
/** Deadline refund (no delivery) — S.1063: settles through
|
|
1581
|
+
* `reputation::refund_v2` so `no_delivery` lands on the seller's score.
|
|
1582
|
+
* Still permissionless: funds only ever return to the buyer. */
|
|
1583
|
+
declare function buildRefundJobTx(jobId: string, v2: {
|
|
1584
|
+
sellerScoreId: string;
|
|
1585
|
+
}): Transaction;
|
|
1568
1586
|
/** Seller posts the delivery commitment (hex hash) before the deadline. */
|
|
1569
1587
|
declare function buildDeliverJobTx(jobId: string, deliveryHash: string): Transaction;
|
|
1570
1588
|
/** Buyer accepts (or anyone, once the review window lapsed) → funds to seller. */
|
|
1571
1589
|
declare function buildReleaseJobTx(jobId: string): Transaction;
|
|
1572
|
-
/** Buyer rejects within the review window → split per the create terms. */
|
|
1573
|
-
declare function buildRejectJobTx(jobId: string): Transaction;
|
|
1574
|
-
/** Anyone, after the deadline with no delivery → funds back to the buyer. */
|
|
1575
|
-
declare function buildRefundJobTx(jobId: string): Transaction;
|
|
1576
1590
|
/** Fetch + parse a `Job` shared object. Throws `RPC_ERROR` when the id
|
|
1577
1591
|
* doesn't resolve to an a2a_escrow Job. */
|
|
1578
1592
|
declare function getJob(client: SuiCoreClient, jobId: string): Promise<Job>;
|
|
@@ -1613,8 +1627,9 @@ declare function verifyJobForSeller({ client, jobId, seller, minAmountUsdc, minR
|
|
|
1613
1627
|
* target the LATEST published id — the original id (types, Job verbs) is
|
|
1614
1628
|
* unchanged.
|
|
1615
1629
|
*/
|
|
1616
|
-
/** The LATEST published `a2a_escrow` package id on MAINNET (
|
|
1617
|
-
* 2026-08-15, S.
|
|
1630
|
+
/** The LATEST published `a2a_escrow` package id on MAINNET (v8 upgrade
|
|
1631
|
+
* 2026-08-15, S.1063 — outcome counters; v7 = distinct buyers (S.1062);
|
|
1632
|
+
* v6 = S.1054 — `reputation` module + `opening::claim_proven`;
|
|
1618
1633
|
* v5 locked open reject at 10000 (S.1019); v4 added amount bounds
|
|
1619
1634
|
* (S.981); v3 added `escrow::decline`; v2 the `opening` module).
|
|
1620
1635
|
* A literal, never an env read, so it can serve as a signature-time trust
|
|
@@ -1625,9 +1640,9 @@ declare function verifyJobForSeller({ client, jobId, seller, minAmountUsdc, minR
|
|
|
1625
1640
|
* upgrade + `migrate` cutover is a ONE-VALUE change here. The original id
|
|
1626
1641
|
* (`MAINNET_A2A_ESCROW_PACKAGE_ID` in job.ts) remains the anchor for type
|
|
1627
1642
|
* strings, event filters, and object-type queries — those never move. */
|
|
1628
|
-
declare const MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
1643
|
+
declare const MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1629
1644
|
/** Back-compat name for the latest id (pre-S.981 consumers import this). */
|
|
1630
|
-
declare const MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = "
|
|
1645
|
+
declare const MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1631
1646
|
/** Env-overridable latest id for testnet/dev (NOT a trust anchor). A fresh
|
|
1632
1647
|
* dev publish has original == latest, so `A2A_ESCROW_PACKAGE_ID` alone is
|
|
1633
1648
|
* honored as the fallback override. */
|
|
@@ -1654,6 +1669,16 @@ declare const A2A_ESCROW_PACKAGE_V3_ID = "0x69ad93c555519de520a5c7f7f2963ad6f8b9
|
|
|
1654
1669
|
* events and the ScoreBoard/AgentScore object types. A DEFINING-id anchor
|
|
1655
1670
|
* like V2/V3 — never moves again, even when LATEST does. */
|
|
1656
1671
|
declare const A2A_ESCROW_PACKAGE_V6_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
1672
|
+
/** v7 (S.1062, upgrade 3DcWdSPE… 2026-08-15) — defining id for the
|
|
1673
|
+
* distinct-buyer surface: the ReviewSubmittedV2 event and the
|
|
1674
|
+
* DistinctCountKey/BuyerSeenKey DF key types. A DEFINING-id anchor like
|
|
1675
|
+
* V2/V3/V6 — never moves again, even when LATEST does. */
|
|
1676
|
+
declare const A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe769bcedf11f3525e84682d59a3b23e";
|
|
1677
|
+
/** v8 (S.1063, upgrade HNphxqJx… 2026-08-15) — defining id for the
|
|
1678
|
+
* outcome surface: the OutcomeRecorded event and the
|
|
1679
|
+
* RejectedAfterDeliveryKey/NoDeliveryKey/AsBuyerRejectedKey DF key types.
|
|
1680
|
+
* A DEFINING-id anchor like V2/V3/V6/V7 — never moves again. */
|
|
1681
|
+
declare const A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
1657
1682
|
/** Default claim policy: any ACTIVE registered Agent ID ($0 claim, FCFS). */
|
|
1658
1683
|
declare const OPENING_CLAIM_POLICY_ANY_ACTIVE = 0;
|
|
1659
1684
|
/** S.1054 — Proven: claimer needs ≥ PROVEN_MIN_REVIEWS on-chain reviews
|
|
@@ -1758,7 +1783,10 @@ declare function getOpening(client: SuiCoreClient, openingId: string): Promise<O
|
|
|
1758
1783
|
declare const MAINNET_A2A_SCORE_BOARD_ID = "0x7506f01e01b1c48d73832949a2808929b80dec2f7104889e012f8a4f09719f6e";
|
|
1759
1784
|
/** Env-overridable board id for testnet/dev (NOT a trust anchor). */
|
|
1760
1785
|
declare const A2A_SCORE_BOARD_ID: string;
|
|
1761
|
-
/**
|
|
1786
|
+
/** The Proven floor (`claim_policy` 1, and the floor of 2). Since S.1062
|
|
1787
|
+
* this counts DISTINCT BUYERS, not raw reviews — one friendly buyer ×3
|
|
1788
|
+
* no longer unlocks Proven. The name survives for the published surface;
|
|
1789
|
+
* the value is unchanged at 3. */
|
|
1762
1790
|
declare const PROVEN_MIN_REVIEWS = 3;
|
|
1763
1791
|
/** Average-stars floor for Proven · 4★+ (`claim_policy` 2), scaled ×10. */
|
|
1764
1792
|
declare const PROVEN_MIN_AVG_STARS_X10 = 40;
|
|
@@ -1777,13 +1805,32 @@ interface AgentScore {
|
|
|
1777
1805
|
starsSum: number;
|
|
1778
1806
|
/** Integer-safe average, rounded to 2dp for display (0 when no reviews). */
|
|
1779
1807
|
averageStars: number;
|
|
1808
|
+
/** Distinct buyer addresses that have reviewed since S.1062 — the
|
|
1809
|
+
* Proven gate input. 0 when the DF is absent (pre-S.1062 scores never
|
|
1810
|
+
* grandfather in). */
|
|
1811
|
+
distinctBuyers: number;
|
|
1812
|
+
/** S.1063 protocol outcomes — display-only facts, NEVER stars and never
|
|
1813
|
+
* part of any Proven predicate. 0 when the DF is absent. */
|
|
1814
|
+
rejectedAfterDelivery: number;
|
|
1815
|
+
noDelivery: number;
|
|
1816
|
+
asBuyerRejected: number;
|
|
1780
1817
|
}
|
|
1781
1818
|
/** Read an agent's score (null = no reviews yet — the lazy-create means the
|
|
1782
1819
|
* object simply doesn't exist). */
|
|
1783
1820
|
declare function getAgentScore(client: SuiCoreClient, agent: string, boardId?: string): Promise<AgentScore | null>;
|
|
1821
|
+
/** Lazily create an agent's zero score (S.1063) — needed before an outcome
|
|
1822
|
+
* verb (reject/refund) when the target agent has no score yet: a shared
|
|
1823
|
+
* object can't be created and then passed as input inside one tx. A zero
|
|
1824
|
+
* score grants NOTHING (no stars, no distinct, no Proven). The sponsored
|
|
1825
|
+
* rail chains this automatically. */
|
|
1826
|
+
declare function buildCreateEmptyScoreTx({ agent, boardId, }: {
|
|
1827
|
+
agent: string;
|
|
1828
|
+
boardId?: string;
|
|
1829
|
+
}): Transaction;
|
|
1784
1830
|
/** Does a score satisfy an Opening's claim policy? (`null` score = zero
|
|
1785
|
-
* reviews.) Mirrors the Move predicates exactly —
|
|
1786
|
-
*
|
|
1831
|
+
* reviews.) Mirrors the Move predicates exactly — S.1062: the Proven
|
|
1832
|
+
* floor counts DISTINCT BUYERS; integer avg math; policy 2 strictly
|
|
1833
|
+
* stronger than policy 1. */
|
|
1787
1834
|
declare function meetsClaimPolicy(score: AgentScore | null, claimPolicy: number): boolean;
|
|
1788
1835
|
/** Human label for a claim policy — every surface uses these, never the
|
|
1789
1836
|
* raw enum. */
|
|
@@ -1874,4 +1921,4 @@ declare function putJobSpec(base: string, content: string): Promise<string>;
|
|
|
1874
1921
|
* the store is untrusted; the chain hash is the authority). */
|
|
1875
1922
|
declare function getJobSpec(base: string, hash: string): Promise<string>;
|
|
1876
1923
|
|
|
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,
|
|
1924
|
+
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, buildCreateEmptyScoreTx 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_ESCROW_PACKAGE_V7_ID as bA, A2A_ESCROW_PACKAGE_V8_ID as bB, A2A_SCORE_BOARD_ID as bC, CETUS_USDC_SUI_POOL as bD, type CoinPage as bE, DEFAULT_GRPC_URL as bF, GASLESS_MIN_STABLE_AMOUNT as bG, GASLESS_STABLE_TYPES as bH, MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID as bI, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID as bJ, MAINNET_A2A_ESCROW_PACKAGE_ID as bK, MAINNET_A2A_SCORE_BOARD_ID as bL, MAX_OPEN_WINDOW_MS as bM, OPERATION_ASSETS as bN, type Opening as bO, type OpeningTerms as bP, type Operation as bQ, SENDABLE_ASSETS as bR, type SelectAndSplitResult as bS, type SerializedCetusRoutePath as bT, type SerializedRouterDataV3 as bU, addSendToTx as bV, addSwapToTx as bW, assertAllowedAsset as bX, assertBuyerRequirements as bY, buildCancelOpeningTx as bZ, buildClaimOpeningTx 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, buildCreateOpeningTx as c0, buildDeclineJobTx as c1, buildRefundUnclaimedTx as c2, buildSubmitFirstReviewTx as c3, buildSubmitReviewTx as c4, deserializeCetusRoute as c5, fetchAllCoins as c6, getCoinMeta as c7, getOpening as c8, getSuiClient as c9, getSuiGrpcClient as ca, isAllowedAsset as cb, isCetusRouteFresh as cc, isInRegistry as cd, normalizeAsset as ce, normalizeCoinType as cf, preflightCreateOpening as cg, probeX402 as ch, queryHistory as ci, queryTransaction as cj, selectAndSplitCoin as ck, selectSuiCoin as cl, serializeCetusRoute as cm, simulateTransaction as cn, throwIfSimulationFailed as co, verifyCetusRouteCoinMatch as cp, 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 };
|
package/dist/index.cjs
CHANGED
|
@@ -3328,13 +3328,15 @@ init_coinSelection();
|
|
|
3328
3328
|
init_errors();
|
|
3329
3329
|
init_token_registry();
|
|
3330
3330
|
init_coinSelection();
|
|
3331
|
-
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
3331
|
+
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
3332
3332
|
var MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID;
|
|
3333
3333
|
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;
|
|
3334
3334
|
var A2A_ESCROW_OPENING_PACKAGE_ID = A2A_ESCROW_LATEST_PACKAGE_ID;
|
|
3335
3335
|
var A2A_ESCROW_PACKAGE_V2_ID = "0x860288d789dc617f6474a0a6801d6011e53bf30d5fb801cdad47b9bc6adb098b";
|
|
3336
3336
|
var A2A_ESCROW_PACKAGE_V3_ID = "0x69ad93c555519de520a5c7f7f2963ad6f8b91cefc098fc2eed75942dcb5bcbe7";
|
|
3337
3337
|
var A2A_ESCROW_PACKAGE_V6_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
3338
|
+
var A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe769bcedf11f3525e84682d59a3b23e";
|
|
3339
|
+
var A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
3338
3340
|
var CLOCK_ID2 = "0x6";
|
|
3339
3341
|
var MODULE = "opening";
|
|
3340
3342
|
var SHA256_HEX_RE = /^(0x)?[0-9a-fA-F]{64}$/;
|
|
@@ -3638,6 +3640,42 @@ function jobCall(jobId, fn) {
|
|
|
3638
3640
|
});
|
|
3639
3641
|
return tx;
|
|
3640
3642
|
}
|
|
3643
|
+
function buildRejectJobTx(jobId, v2) {
|
|
3644
|
+
const tx = new transactions.Transaction();
|
|
3645
|
+
tx.moveCall({
|
|
3646
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::${v2.buyerScoreId ? "reject_v2_agent_buyer" : "reject_v2"}`,
|
|
3647
|
+
typeArguments: [exports.USDC_TYPE],
|
|
3648
|
+
arguments: v2.buyerScoreId ? [
|
|
3649
|
+
tx.object(jobId),
|
|
3650
|
+
tx.object(v2.sellerScoreId),
|
|
3651
|
+
tx.object(v2.buyerScoreId),
|
|
3652
|
+
tx.object(v2.registryId),
|
|
3653
|
+
feeConfigArg2(tx),
|
|
3654
|
+
tx.object(CLOCK_ID3)
|
|
3655
|
+
] : [
|
|
3656
|
+
tx.object(jobId),
|
|
3657
|
+
tx.object(v2.sellerScoreId),
|
|
3658
|
+
tx.object(v2.registryId),
|
|
3659
|
+
feeConfigArg2(tx),
|
|
3660
|
+
tx.object(CLOCK_ID3)
|
|
3661
|
+
]
|
|
3662
|
+
});
|
|
3663
|
+
return tx;
|
|
3664
|
+
}
|
|
3665
|
+
function buildRefundJobTx(jobId, v2) {
|
|
3666
|
+
const tx = new transactions.Transaction();
|
|
3667
|
+
tx.moveCall({
|
|
3668
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::refund_v2`,
|
|
3669
|
+
typeArguments: [exports.USDC_TYPE],
|
|
3670
|
+
arguments: [
|
|
3671
|
+
tx.object(jobId),
|
|
3672
|
+
tx.object(v2.sellerScoreId),
|
|
3673
|
+
feeConfigArg2(tx),
|
|
3674
|
+
tx.object(CLOCK_ID3)
|
|
3675
|
+
]
|
|
3676
|
+
});
|
|
3677
|
+
return tx;
|
|
3678
|
+
}
|
|
3641
3679
|
function buildDeliverJobTx(jobId, deliveryHash) {
|
|
3642
3680
|
const tx = new transactions.Transaction();
|
|
3643
3681
|
tx.moveCall({
|
|
@@ -3655,12 +3693,6 @@ function buildDeliverJobTx(jobId, deliveryHash) {
|
|
|
3655
3693
|
function buildReleaseJobTx(jobId) {
|
|
3656
3694
|
return jobCall(jobId, "release");
|
|
3657
3695
|
}
|
|
3658
|
-
function buildRejectJobTx(jobId) {
|
|
3659
|
-
return jobCall(jobId, "reject");
|
|
3660
|
-
}
|
|
3661
|
-
function buildRefundJobTx(jobId) {
|
|
3662
|
-
return jobCall(jobId, "refund");
|
|
3663
|
-
}
|
|
3664
3696
|
async function getJob(client, jobId) {
|
|
3665
3697
|
const resp = await client.core.getObject({ objectId: jobId, include: { json: true } }).catch((e) => {
|
|
3666
3698
|
throw new exports.T2000Error(
|
|
@@ -3765,6 +3797,24 @@ function deriveAgentScoreId(agent, boardId) {
|
|
|
3765
3797
|
bcs.bcs.Address.serialize(validateAddress(agent)).toBytes()
|
|
3766
3798
|
);
|
|
3767
3799
|
}
|
|
3800
|
+
async function readCounterDf(client, scoreId, definingId, keyStruct) {
|
|
3801
|
+
if (!definingId) return 0;
|
|
3802
|
+
try {
|
|
3803
|
+
const fieldId = utils.deriveDynamicFieldID(
|
|
3804
|
+
scoreId,
|
|
3805
|
+
`${definingId}::${MODULE3}::${keyStruct}`,
|
|
3806
|
+
new Uint8Array([0])
|
|
3807
|
+
);
|
|
3808
|
+
const resp = await client.core.getObject({
|
|
3809
|
+
objectId: fieldId,
|
|
3810
|
+
include: { json: true }
|
|
3811
|
+
});
|
|
3812
|
+
const json = resp?.object?.json;
|
|
3813
|
+
return Number(json?.value ?? 0);
|
|
3814
|
+
} catch {
|
|
3815
|
+
return 0;
|
|
3816
|
+
}
|
|
3817
|
+
}
|
|
3768
3818
|
async function getAgentScore(client, agent, boardId) {
|
|
3769
3819
|
const scoreId = deriveAgentScoreId(agent, boardId);
|
|
3770
3820
|
const resp = await client.core.getObject({ objectId: scoreId, include: { json: true } }).catch(() => null);
|
|
@@ -3775,18 +3825,45 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
3775
3825
|
}
|
|
3776
3826
|
const reviewCount = Number(json.review_count ?? 0);
|
|
3777
3827
|
const starsSum = Number(json.stars_sum ?? 0);
|
|
3828
|
+
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected] = await Promise.all([
|
|
3829
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V7_ID, "DistinctCountKey"),
|
|
3830
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "RejectedAfterDeliveryKey"),
|
|
3831
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "NoDeliveryKey"),
|
|
3832
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey")
|
|
3833
|
+
]);
|
|
3778
3834
|
return {
|
|
3779
3835
|
id: scoreId,
|
|
3780
3836
|
agent: String(json.agent),
|
|
3781
3837
|
reviewCount,
|
|
3782
3838
|
starsSum,
|
|
3783
|
-
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0
|
|
3839
|
+
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0,
|
|
3840
|
+
distinctBuyers,
|
|
3841
|
+
rejectedAfterDelivery,
|
|
3842
|
+
noDelivery,
|
|
3843
|
+
asBuyerRejected
|
|
3784
3844
|
};
|
|
3785
3845
|
}
|
|
3846
|
+
function buildCreateEmptyScoreTx({
|
|
3847
|
+
agent,
|
|
3848
|
+
boardId
|
|
3849
|
+
}) {
|
|
3850
|
+
const tx = new transactions.Transaction();
|
|
3851
|
+
tx.moveCall({
|
|
3852
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::${MODULE3}::create_empty_score`,
|
|
3853
|
+
typeArguments: [],
|
|
3854
|
+
arguments: [
|
|
3855
|
+
tx.object(boardIdOrThrow(boardId)),
|
|
3856
|
+
tx.pure.address(validateAddress(agent)),
|
|
3857
|
+
feeConfigArg(tx),
|
|
3858
|
+
tx.object(CLOCK_ID4)
|
|
3859
|
+
]
|
|
3860
|
+
});
|
|
3861
|
+
return tx;
|
|
3862
|
+
}
|
|
3786
3863
|
function meetsClaimPolicy(score, claimPolicy) {
|
|
3787
3864
|
if (claimPolicy === 0) return true;
|
|
3788
3865
|
if (!score) return false;
|
|
3789
|
-
const proven = score.
|
|
3866
|
+
const proven = score.distinctBuyers >= PROVEN_MIN_REVIEWS;
|
|
3790
3867
|
if (claimPolicy === 1) return proven;
|
|
3791
3868
|
if (claimPolicy === 2) {
|
|
3792
3869
|
return proven && score.starsSum * 10 >= score.reviewCount * PROVEN_MIN_AVG_STARS_X10;
|
|
@@ -3801,10 +3878,10 @@ function claimPolicyLabel(claimPolicy) {
|
|
|
3801
3878
|
}
|
|
3802
3879
|
function claimPolicyRequirement(claimPolicy) {
|
|
3803
3880
|
if (claimPolicy === 1) {
|
|
3804
|
-
return `Claiming needs at least ${PROVEN_MIN_REVIEWS}
|
|
3881
|
+
return `Claiming needs at least ${PROVEN_MIN_REVIEWS} reviews from distinct buyers.`;
|
|
3805
3882
|
}
|
|
3806
3883
|
if (claimPolicy === 2) {
|
|
3807
|
-
return `Claiming needs at least ${PROVEN_MIN_REVIEWS}
|
|
3884
|
+
return `Claiming needs at least ${PROVEN_MIN_REVIEWS} reviews from distinct buyers and a 4.0\u2605 average.`;
|
|
3808
3885
|
}
|
|
3809
3886
|
return "Anyone can claim (active Agent ID required).";
|
|
3810
3887
|
}
|
|
@@ -4549,6 +4626,8 @@ exports.A2A_ESCROW_PACKAGE_ID = A2A_ESCROW_PACKAGE_ID;
|
|
|
4549
4626
|
exports.A2A_ESCROW_PACKAGE_V2_ID = A2A_ESCROW_PACKAGE_V2_ID;
|
|
4550
4627
|
exports.A2A_ESCROW_PACKAGE_V3_ID = A2A_ESCROW_PACKAGE_V3_ID;
|
|
4551
4628
|
exports.A2A_ESCROW_PACKAGE_V6_ID = A2A_ESCROW_PACKAGE_V6_ID;
|
|
4629
|
+
exports.A2A_ESCROW_PACKAGE_V7_ID = A2A_ESCROW_PACKAGE_V7_ID;
|
|
4630
|
+
exports.A2A_ESCROW_PACKAGE_V8_ID = A2A_ESCROW_PACKAGE_V8_ID;
|
|
4552
4631
|
exports.A2A_SCORE_BOARD_ID = A2A_SCORE_BOARD_ID;
|
|
4553
4632
|
exports.AUDRIC_PARENT = AUDRIC_PARENT;
|
|
4554
4633
|
exports.AUDRIC_PARENT_NAME = AUDRIC_PARENT_NAME;
|
|
@@ -4615,6 +4694,7 @@ exports.assertLimitConfig = assertLimitConfig;
|
|
|
4615
4694
|
exports.buildAddLeafTx = buildAddLeafTx;
|
|
4616
4695
|
exports.buildCancelOpeningTx = buildCancelOpeningTx;
|
|
4617
4696
|
exports.buildClaimOpeningTx = buildClaimOpeningTx;
|
|
4697
|
+
exports.buildCreateEmptyScoreTx = buildCreateEmptyScoreTx;
|
|
4618
4698
|
exports.buildCreateJobTx = buildCreateJobTx;
|
|
4619
4699
|
exports.buildCreateOpeningTx = buildCreateOpeningTx;
|
|
4620
4700
|
exports.buildDeclineJobTx = buildDeclineJobTx;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import { a8 as T2000Error, bm as T2000Options, af as TransactionSigner, S as PayOptions, bn as X402Probe, T as PayResult, bo as SerializedCetusRoute, bp as SwapResult, bq as SwapQuoteResult, a0 as SendResult, B as BalanceResponse, ae as TransactionRecord, j as DepositInfo, br as PaymentRequest, ap as ZkLoginProof, bs as SuiCoreClient, F as OverlayFeeConfig, bt as SponsoredCoinMergeCache, a6 as SupportedAsset, a7 as SwapRouteResult, bu as SendableAsset } from './commerce-
|
|
5
|
-
export { A as A2A_ESCROW_FEE_CONFIG_ID, bv as A2A_ESCROW_LATEST_PACKAGE_ID, bw as A2A_ESCROW_OPENING_PACKAGE_ID, a as A2A_ESCROW_PACKAGE_ID, bx as A2A_ESCROW_PACKAGE_V2_ID, by as A2A_ESCROW_PACKAGE_V3_ID, bz as A2A_ESCROW_PACKAGE_V6_ID, bA as A2A_SCORE_BOARD_ID, b as ActivityReportConfig, c as AgentScore,
|
|
4
|
+
import { a8 as T2000Error, bm as T2000Options, af as TransactionSigner, S as PayOptions, bn as X402Probe, T as PayResult, bo as SerializedCetusRoute, bp as SwapResult, bq as SwapQuoteResult, a0 as SendResult, B as BalanceResponse, ae as TransactionRecord, j as DepositInfo, br as PaymentRequest, ap as ZkLoginProof, bs as SuiCoreClient, F as OverlayFeeConfig, bt as SponsoredCoinMergeCache, a6 as SupportedAsset, a7 as SwapRouteResult, bu as SendableAsset } from './commerce-GI4hcxKU.cjs';
|
|
5
|
+
export { A as A2A_ESCROW_FEE_CONFIG_ID, bv as A2A_ESCROW_LATEST_PACKAGE_ID, bw as A2A_ESCROW_OPENING_PACKAGE_ID, a as A2A_ESCROW_PACKAGE_ID, bx as A2A_ESCROW_PACKAGE_V2_ID, by as A2A_ESCROW_PACKAGE_V3_ID, bz as A2A_ESCROW_PACKAGE_V6_ID, bA as A2A_ESCROW_PACKAGE_V7_ID, bB as A2A_ESCROW_PACKAGE_V8_ID, bC as A2A_SCORE_BOARD_ID, b as ActivityReportConfig, c as AgentScore, bD as CETUS_USDC_SUI_POOL, C as CLOCK_ID, d as COIN_REGISTRY, e as ClassifyBalanceChange, f as ClassifyResult, g as CoinMeta, bE as CoinPage, D as DEFAULT_ACTIVITY_REPORT_URL, h as DEFAULT_COMMERCE_API_BASE, bF as DEFAULT_GRPC_URL, i as DEFAULT_NETWORK, E as ETH_TYPE, k as ExtractedTransfer, bG as GASLESS_MIN_STABLE_AMOUNT, bH as GASLESS_STABLE_TYPES, 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, bI as MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID, bJ as MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, bK as MAINNET_A2A_ESCROW_PACKAGE_ID, bL as MAINNET_A2A_SCORE_BOARD_ID, M as MANIFEST_TYPE, r as MAX_DELIVER_HORIZON_MS, s as MAX_JOB_USDC, bM as MAX_OPEN_WINDOW_MS, 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, bN as OPERATION_ASSETS, z as OVERLAY_FEE_RATE, bO as Opening, bP as OpeningTerms, bQ as Operation, P as PREFLIGHT_MAX_AMOUNT, H as PREFLIGHT_OK, Q as PROVEN_MIN_AVG_STARS_X10, R as PROVEN_MIN_REVIEWS, U as PreflightResult, V as REVIEW_MAX_STARS, W as REVIEW_MIN_STARS, bR as SENDABLE_ASSETS, X as STABLE_ASSETS, Y as SUI_DECIMALS, Z as SUI_TYPE, _ as SUPPORTED_ASSETS, bS as SelectAndSplitResult, $ as SendAssetClass, bT as SerializedCetusRoutePath, bU as SerializedRouterDataV3, a1 as ServiceListing, a2 as SimulationResult, a3 as StableAsset, a4 as SuiHolding, a5 as SuiRpcTxBlock, a9 as T2000ErrorCode, aa as T2000ErrorData, ab as T2000_OVERLAY_FEE_WALLET, ac as TOKEN_MAP, ad as TransactionLeg, 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, aq as ZkLoginSigner, bV as addSendToTx, bW as addSwapToTx, bX as assertAllowedAsset, bY as assertBuyerRequirements, bZ as buildCancelOpeningTx, b_ as buildClaimOpeningTx, b$ as buildCreateEmptyScoreTx, ar as buildCreateJobTx, c0 as buildCreateOpeningTx, c1 as buildDeclineJobTx, as as buildDeliverJobTx, at as buildRefundJobTx, c2 as buildRefundUnclaimedTx, au as buildRejectJobTx, av as buildReleaseJobTx, aw as buildSendTx, c3 as buildSubmitFirstReviewTx, c4 as buildSubmitReviewTx, 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, c5 as deserializeCetusRoute, aH as executeTx, aI as extractAllUserLegs, aJ as extractTransferDetails, aK as extractTxCommands, aL as extractTxSender, aM as fallbackLabel, c6 as fetchAllCoins, aN as fetchService, aO as findSwapRoute, aP as formatAssetAmount, aQ as formatSui, aR as formatUsd, aS as getAgentScore, c7 as getCoinMeta, aT as getDecimals, aU as getDecimalsForCoinType, aV as getJob, aW as getJobSpec, c8 as getOpening, c9 as getSuiClient, ca as getSuiGrpcClient, aX as invalidSendAssetMessage, cb as isAllowedAsset, cc as isCetusRouteFresh, cd as isInRegistry, aY as jobActionsFor, aZ as listServices, a_ as mapMoveAbortCode, a$ as mapWalletError, b0 as meetsClaimPolicy, b1 as mistToSui, ce as normalizeAsset, cf as normalizeCoinType, b2 as parseSuiRpcTx, b3 as payWithX402, b4 as preflightCreateJob, cg as preflightCreateOpening, b5 as preflightFail, b6 as preflightPay, b7 as preflightSend, b8 as preflightSwap, ch as probeX402, b9 as putJobSpec, ci as queryHistory, cj as queryTransaction, ba as rawToStable, bb as rawToUsdc, bc as refineLendingLabel, bd as reportX402Activity, be as resolveSymbol, bf as resolveTokenType, ck as selectAndSplitCoin, cl as selectSuiCoin, cm as serializeCetusRoute, cn as simulateTransaction, bg as stableToRaw, bh as suiToMist, co as throwIfSimulationFailed, bi as truncateAddress, bj as usdcToRaw, bk as validateAddress, cp as verifyCetusRouteCoinMatch, bl as verifyJobForSeller } from './commerce-GI4hcxKU.cjs';
|
|
6
6
|
import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import { a8 as T2000Error, bm as T2000Options, af as TransactionSigner, S as PayOptions, bn as X402Probe, T as PayResult, bo as SerializedCetusRoute, bp as SwapResult, bq as SwapQuoteResult, a0 as SendResult, B as BalanceResponse, ae as TransactionRecord, j as DepositInfo, br as PaymentRequest, ap as ZkLoginProof, bs as SuiCoreClient, F as OverlayFeeConfig, bt as SponsoredCoinMergeCache, a6 as SupportedAsset, a7 as SwapRouteResult, bu as SendableAsset } from './commerce-
|
|
5
|
-
export { A as A2A_ESCROW_FEE_CONFIG_ID, bv as A2A_ESCROW_LATEST_PACKAGE_ID, bw as A2A_ESCROW_OPENING_PACKAGE_ID, a as A2A_ESCROW_PACKAGE_ID, bx as A2A_ESCROW_PACKAGE_V2_ID, by as A2A_ESCROW_PACKAGE_V3_ID, bz as A2A_ESCROW_PACKAGE_V6_ID, bA as A2A_SCORE_BOARD_ID, b as ActivityReportConfig, c as AgentScore,
|
|
4
|
+
import { a8 as T2000Error, bm as T2000Options, af as TransactionSigner, S as PayOptions, bn as X402Probe, T as PayResult, bo as SerializedCetusRoute, bp as SwapResult, bq as SwapQuoteResult, a0 as SendResult, B as BalanceResponse, ae as TransactionRecord, j as DepositInfo, br as PaymentRequest, ap as ZkLoginProof, bs as SuiCoreClient, F as OverlayFeeConfig, bt as SponsoredCoinMergeCache, a6 as SupportedAsset, a7 as SwapRouteResult, bu as SendableAsset } from './commerce-GI4hcxKU.js';
|
|
5
|
+
export { A as A2A_ESCROW_FEE_CONFIG_ID, bv as A2A_ESCROW_LATEST_PACKAGE_ID, bw as A2A_ESCROW_OPENING_PACKAGE_ID, a as A2A_ESCROW_PACKAGE_ID, bx as A2A_ESCROW_PACKAGE_V2_ID, by as A2A_ESCROW_PACKAGE_V3_ID, bz as A2A_ESCROW_PACKAGE_V6_ID, bA as A2A_ESCROW_PACKAGE_V7_ID, bB as A2A_ESCROW_PACKAGE_V8_ID, bC as A2A_SCORE_BOARD_ID, b as ActivityReportConfig, c as AgentScore, bD as CETUS_USDC_SUI_POOL, C as CLOCK_ID, d as COIN_REGISTRY, e as ClassifyBalanceChange, f as ClassifyResult, g as CoinMeta, bE as CoinPage, D as DEFAULT_ACTIVITY_REPORT_URL, h as DEFAULT_COMMERCE_API_BASE, bF as DEFAULT_GRPC_URL, i as DEFAULT_NETWORK, E as ETH_TYPE, k as ExtractedTransfer, bG as GASLESS_MIN_STABLE_AMOUNT, bH as GASLESS_STABLE_TYPES, 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, bI as MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID, bJ as MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, bK as MAINNET_A2A_ESCROW_PACKAGE_ID, bL as MAINNET_A2A_SCORE_BOARD_ID, M as MANIFEST_TYPE, r as MAX_DELIVER_HORIZON_MS, s as MAX_JOB_USDC, bM as MAX_OPEN_WINDOW_MS, 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, bN as OPERATION_ASSETS, z as OVERLAY_FEE_RATE, bO as Opening, bP as OpeningTerms, bQ as Operation, P as PREFLIGHT_MAX_AMOUNT, H as PREFLIGHT_OK, Q as PROVEN_MIN_AVG_STARS_X10, R as PROVEN_MIN_REVIEWS, U as PreflightResult, V as REVIEW_MAX_STARS, W as REVIEW_MIN_STARS, bR as SENDABLE_ASSETS, X as STABLE_ASSETS, Y as SUI_DECIMALS, Z as SUI_TYPE, _ as SUPPORTED_ASSETS, bS as SelectAndSplitResult, $ as SendAssetClass, bT as SerializedCetusRoutePath, bU as SerializedRouterDataV3, a1 as ServiceListing, a2 as SimulationResult, a3 as StableAsset, a4 as SuiHolding, a5 as SuiRpcTxBlock, a9 as T2000ErrorCode, aa as T2000ErrorData, ab as T2000_OVERLAY_FEE_WALLET, ac as TOKEN_MAP, ad as TransactionLeg, 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, aq as ZkLoginSigner, bV as addSendToTx, bW as addSwapToTx, bX as assertAllowedAsset, bY as assertBuyerRequirements, bZ as buildCancelOpeningTx, b_ as buildClaimOpeningTx, b$ as buildCreateEmptyScoreTx, ar as buildCreateJobTx, c0 as buildCreateOpeningTx, c1 as buildDeclineJobTx, as as buildDeliverJobTx, at as buildRefundJobTx, c2 as buildRefundUnclaimedTx, au as buildRejectJobTx, av as buildReleaseJobTx, aw as buildSendTx, c3 as buildSubmitFirstReviewTx, c4 as buildSubmitReviewTx, 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, c5 as deserializeCetusRoute, aH as executeTx, aI as extractAllUserLegs, aJ as extractTransferDetails, aK as extractTxCommands, aL as extractTxSender, aM as fallbackLabel, c6 as fetchAllCoins, aN as fetchService, aO as findSwapRoute, aP as formatAssetAmount, aQ as formatSui, aR as formatUsd, aS as getAgentScore, c7 as getCoinMeta, aT as getDecimals, aU as getDecimalsForCoinType, aV as getJob, aW as getJobSpec, c8 as getOpening, c9 as getSuiClient, ca as getSuiGrpcClient, aX as invalidSendAssetMessage, cb as isAllowedAsset, cc as isCetusRouteFresh, cd as isInRegistry, aY as jobActionsFor, aZ as listServices, a_ as mapMoveAbortCode, a$ as mapWalletError, b0 as meetsClaimPolicy, b1 as mistToSui, ce as normalizeAsset, cf as normalizeCoinType, b2 as parseSuiRpcTx, b3 as payWithX402, b4 as preflightCreateJob, cg as preflightCreateOpening, b5 as preflightFail, b6 as preflightPay, b7 as preflightSend, b8 as preflightSwap, ch as probeX402, b9 as putJobSpec, ci as queryHistory, cj as queryTransaction, ba as rawToStable, bb as rawToUsdc, bc as refineLendingLabel, bd as reportX402Activity, be as resolveSymbol, bf as resolveTokenType, ck as selectAndSplitCoin, cl as selectSuiCoin, cm as serializeCetusRoute, cn as simulateTransaction, bg as stableToRaw, bh as suiToMist, co as throwIfSimulationFailed, bi as truncateAddress, bj as usdcToRaw, bk as validateAddress, cp as verifyCetusRouteCoinMatch, bl as verifyJobForSeller } from './commerce-GI4hcxKU.js';
|
|
6
6
|
import { TransactionObjectArgument, Transaction } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeStructTag, isValidSuiAddress, normalizeSuiAddress, fromBase64, deriveObjectID } from '@mysten/sui/utils';
|
|
1
|
+
import { normalizeStructTag, isValidSuiAddress, normalizeSuiAddress, fromBase64, deriveObjectID, deriveDynamicFieldID } from '@mysten/sui/utils';
|
|
2
2
|
import { coinWithBalance, Transaction } from '@mysten/sui/transactions';
|
|
3
3
|
import { AggregatorClient, Env } from '@cetusprotocol/aggregator-sdk';
|
|
4
4
|
import BN from 'bn.js';
|
|
@@ -3322,13 +3322,15 @@ init_coinSelection();
|
|
|
3322
3322
|
init_errors();
|
|
3323
3323
|
init_token_registry();
|
|
3324
3324
|
init_coinSelection();
|
|
3325
|
-
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
3325
|
+
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
3326
3326
|
var MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID;
|
|
3327
3327
|
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;
|
|
3328
3328
|
var A2A_ESCROW_OPENING_PACKAGE_ID = A2A_ESCROW_LATEST_PACKAGE_ID;
|
|
3329
3329
|
var A2A_ESCROW_PACKAGE_V2_ID = "0x860288d789dc617f6474a0a6801d6011e53bf30d5fb801cdad47b9bc6adb098b";
|
|
3330
3330
|
var A2A_ESCROW_PACKAGE_V3_ID = "0x69ad93c555519de520a5c7f7f2963ad6f8b91cefc098fc2eed75942dcb5bcbe7";
|
|
3331
3331
|
var A2A_ESCROW_PACKAGE_V6_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
3332
|
+
var A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe769bcedf11f3525e84682d59a3b23e";
|
|
3333
|
+
var A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
3332
3334
|
var CLOCK_ID2 = "0x6";
|
|
3333
3335
|
var MODULE = "opening";
|
|
3334
3336
|
var SHA256_HEX_RE = /^(0x)?[0-9a-fA-F]{64}$/;
|
|
@@ -3632,6 +3634,42 @@ function jobCall(jobId, fn) {
|
|
|
3632
3634
|
});
|
|
3633
3635
|
return tx;
|
|
3634
3636
|
}
|
|
3637
|
+
function buildRejectJobTx(jobId, v2) {
|
|
3638
|
+
const tx = new Transaction();
|
|
3639
|
+
tx.moveCall({
|
|
3640
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::${v2.buyerScoreId ? "reject_v2_agent_buyer" : "reject_v2"}`,
|
|
3641
|
+
typeArguments: [USDC_TYPE],
|
|
3642
|
+
arguments: v2.buyerScoreId ? [
|
|
3643
|
+
tx.object(jobId),
|
|
3644
|
+
tx.object(v2.sellerScoreId),
|
|
3645
|
+
tx.object(v2.buyerScoreId),
|
|
3646
|
+
tx.object(v2.registryId),
|
|
3647
|
+
feeConfigArg2(tx),
|
|
3648
|
+
tx.object(CLOCK_ID3)
|
|
3649
|
+
] : [
|
|
3650
|
+
tx.object(jobId),
|
|
3651
|
+
tx.object(v2.sellerScoreId),
|
|
3652
|
+
tx.object(v2.registryId),
|
|
3653
|
+
feeConfigArg2(tx),
|
|
3654
|
+
tx.object(CLOCK_ID3)
|
|
3655
|
+
]
|
|
3656
|
+
});
|
|
3657
|
+
return tx;
|
|
3658
|
+
}
|
|
3659
|
+
function buildRefundJobTx(jobId, v2) {
|
|
3660
|
+
const tx = new Transaction();
|
|
3661
|
+
tx.moveCall({
|
|
3662
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::refund_v2`,
|
|
3663
|
+
typeArguments: [USDC_TYPE],
|
|
3664
|
+
arguments: [
|
|
3665
|
+
tx.object(jobId),
|
|
3666
|
+
tx.object(v2.sellerScoreId),
|
|
3667
|
+
feeConfigArg2(tx),
|
|
3668
|
+
tx.object(CLOCK_ID3)
|
|
3669
|
+
]
|
|
3670
|
+
});
|
|
3671
|
+
return tx;
|
|
3672
|
+
}
|
|
3635
3673
|
function buildDeliverJobTx(jobId, deliveryHash) {
|
|
3636
3674
|
const tx = new Transaction();
|
|
3637
3675
|
tx.moveCall({
|
|
@@ -3649,12 +3687,6 @@ function buildDeliverJobTx(jobId, deliveryHash) {
|
|
|
3649
3687
|
function buildReleaseJobTx(jobId) {
|
|
3650
3688
|
return jobCall(jobId, "release");
|
|
3651
3689
|
}
|
|
3652
|
-
function buildRejectJobTx(jobId) {
|
|
3653
|
-
return jobCall(jobId, "reject");
|
|
3654
|
-
}
|
|
3655
|
-
function buildRefundJobTx(jobId) {
|
|
3656
|
-
return jobCall(jobId, "refund");
|
|
3657
|
-
}
|
|
3658
3690
|
async function getJob(client, jobId) {
|
|
3659
3691
|
const resp = await client.core.getObject({ objectId: jobId, include: { json: true } }).catch((e) => {
|
|
3660
3692
|
throw new T2000Error(
|
|
@@ -3759,6 +3791,24 @@ function deriveAgentScoreId(agent, boardId) {
|
|
|
3759
3791
|
bcs.Address.serialize(validateAddress(agent)).toBytes()
|
|
3760
3792
|
);
|
|
3761
3793
|
}
|
|
3794
|
+
async function readCounterDf(client, scoreId, definingId, keyStruct) {
|
|
3795
|
+
if (!definingId) return 0;
|
|
3796
|
+
try {
|
|
3797
|
+
const fieldId = deriveDynamicFieldID(
|
|
3798
|
+
scoreId,
|
|
3799
|
+
`${definingId}::${MODULE3}::${keyStruct}`,
|
|
3800
|
+
new Uint8Array([0])
|
|
3801
|
+
);
|
|
3802
|
+
const resp = await client.core.getObject({
|
|
3803
|
+
objectId: fieldId,
|
|
3804
|
+
include: { json: true }
|
|
3805
|
+
});
|
|
3806
|
+
const json = resp?.object?.json;
|
|
3807
|
+
return Number(json?.value ?? 0);
|
|
3808
|
+
} catch {
|
|
3809
|
+
return 0;
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3762
3812
|
async function getAgentScore(client, agent, boardId) {
|
|
3763
3813
|
const scoreId = deriveAgentScoreId(agent, boardId);
|
|
3764
3814
|
const resp = await client.core.getObject({ objectId: scoreId, include: { json: true } }).catch(() => null);
|
|
@@ -3769,18 +3819,45 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
3769
3819
|
}
|
|
3770
3820
|
const reviewCount = Number(json.review_count ?? 0);
|
|
3771
3821
|
const starsSum = Number(json.stars_sum ?? 0);
|
|
3822
|
+
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected] = await Promise.all([
|
|
3823
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V7_ID, "DistinctCountKey"),
|
|
3824
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "RejectedAfterDeliveryKey"),
|
|
3825
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "NoDeliveryKey"),
|
|
3826
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey")
|
|
3827
|
+
]);
|
|
3772
3828
|
return {
|
|
3773
3829
|
id: scoreId,
|
|
3774
3830
|
agent: String(json.agent),
|
|
3775
3831
|
reviewCount,
|
|
3776
3832
|
starsSum,
|
|
3777
|
-
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0
|
|
3833
|
+
averageStars: reviewCount > 0 ? Math.round(starsSum / reviewCount * 100) / 100 : 0,
|
|
3834
|
+
distinctBuyers,
|
|
3835
|
+
rejectedAfterDelivery,
|
|
3836
|
+
noDelivery,
|
|
3837
|
+
asBuyerRejected
|
|
3778
3838
|
};
|
|
3779
3839
|
}
|
|
3840
|
+
function buildCreateEmptyScoreTx({
|
|
3841
|
+
agent,
|
|
3842
|
+
boardId
|
|
3843
|
+
}) {
|
|
3844
|
+
const tx = new Transaction();
|
|
3845
|
+
tx.moveCall({
|
|
3846
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::${MODULE3}::create_empty_score`,
|
|
3847
|
+
typeArguments: [],
|
|
3848
|
+
arguments: [
|
|
3849
|
+
tx.object(boardIdOrThrow(boardId)),
|
|
3850
|
+
tx.pure.address(validateAddress(agent)),
|
|
3851
|
+
feeConfigArg(tx),
|
|
3852
|
+
tx.object(CLOCK_ID4)
|
|
3853
|
+
]
|
|
3854
|
+
});
|
|
3855
|
+
return tx;
|
|
3856
|
+
}
|
|
3780
3857
|
function meetsClaimPolicy(score, claimPolicy) {
|
|
3781
3858
|
if (claimPolicy === 0) return true;
|
|
3782
3859
|
if (!score) return false;
|
|
3783
|
-
const proven = score.
|
|
3860
|
+
const proven = score.distinctBuyers >= PROVEN_MIN_REVIEWS;
|
|
3784
3861
|
if (claimPolicy === 1) return proven;
|
|
3785
3862
|
if (claimPolicy === 2) {
|
|
3786
3863
|
return proven && score.starsSum * 10 >= score.reviewCount * PROVEN_MIN_AVG_STARS_X10;
|
|
@@ -3795,10 +3872,10 @@ function claimPolicyLabel(claimPolicy) {
|
|
|
3795
3872
|
}
|
|
3796
3873
|
function claimPolicyRequirement(claimPolicy) {
|
|
3797
3874
|
if (claimPolicy === 1) {
|
|
3798
|
-
return `Claiming needs at least ${PROVEN_MIN_REVIEWS}
|
|
3875
|
+
return `Claiming needs at least ${PROVEN_MIN_REVIEWS} reviews from distinct buyers.`;
|
|
3799
3876
|
}
|
|
3800
3877
|
if (claimPolicy === 2) {
|
|
3801
|
-
return `Claiming needs at least ${PROVEN_MIN_REVIEWS}
|
|
3878
|
+
return `Claiming needs at least ${PROVEN_MIN_REVIEWS} reviews from distinct buyers and a 4.0\u2605 average.`;
|
|
3802
3879
|
}
|
|
3803
3880
|
return "Anyone can claim (active Agent ID required).";
|
|
3804
3881
|
}
|
|
@@ -4536,4 +4613,4 @@ function displayHandle(label, parentName = AUDRIC_PARENT_NAME) {
|
|
|
4536
4613
|
// src/index.ts
|
|
4537
4614
|
init_preflight();
|
|
4538
4615
|
|
|
4539
|
-
export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_LATEST_PACKAGE_ID, A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID, A2A_ESCROW_PACKAGE_V6_ID, A2A_SCORE_BOARD_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, DEFAULT_ACTIVITY_REPORT_URL, DEFAULT_API_BASE, DEFAULT_COMMERCE_API_BASE, DEFAULT_GRPC_URL, DEFAULT_NETWORK, ESCROW_JOB_TYPE_MARKER, ETH_TYPE, GASLESS_MIN_STABLE_AMOUNT, GASLESS_STABLE_TYPES, GAS_RESERVE_MIN, IKA_TYPE, InvalidAddressError, JOB_STATES, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, LimitEnforcer, LimitExceededError, MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAINNET_A2A_ESCROW_PACKAGE_ID, MAINNET_A2A_SCORE_BOARD_ID, MANIFEST_TYPE, MAX_DELIVER_HORIZON_MS, MAX_JOB_USDC, MAX_OPEN_WINDOW_MS, 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, OPENING_TYPE_MARKER, OPERATION_ASSETS, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, PROVEN_MIN_AVG_STARS_X10, PROVEN_MIN_REVIEWS, REVIEW_MAX_STARS, REVIEW_MIN_STARS, SENDABLE_ASSETS, SPONSORED_PYTH_DEPENDENT_PROVIDERS, STABLE_ASSETS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SuinsNotRegisteredError, SuinsRpcError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addSendToTx, addSwapToTx, approxUsdValue, assertAllowedAsset, assertBuyerRequirements, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateJobTx, buildCreateOpeningTx, buildDeclineJobTx, buildDeliverJobTx, buildRefundJobTx, buildRefundUnclaimedTx, buildRejectJobTx, buildReleaseJobTx, buildRevokeLeafTx, buildSendTx, buildSubmitFirstReviewTx, buildSubmitReviewTx, buildSwapTx, cancelOpenJob, canonicalizeRecipientInput, chatCompletion, chatCompletionStream, checkPositiveAmount, checkSuiAddress, claimOpenJob, claimPolicyLabel, claimPolicyRequirement, classifyAction, classifyLabel, classifySendAsset, classifyTransaction, clearLimits, composeTx, customHireEnvelope, dailySpentToday, deriveAgentScoreId, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getAgentScore, getCoinMeta, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, invalidSendAssetMessage, isAllowedAsset, isCetusRouteFresh, isCustomHireEnvelope, isInRegistry, jobActionsFor, keypairFromPrivateKey, listModels, listOpenJobs, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, meetsClaimPolicy, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseSuiRpcTx, payWithX402, postOpenJob, preflightCreateJob, preflightCreateOpening, preflightFail, preflightPay, preflightSend, preflightSwap, probeX402, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, refundOpenJob, reportX402Activity, resolveAddressToSuinsViaRpc, resolveCreatedObjectId, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, setSponsoredTxGuard, simulateTransaction, stableToRaw, submitJobReview, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, verifyReceipt, walletExists, writeLimitsFile };
|
|
4616
|
+
export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_LATEST_PACKAGE_ID, A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID, A2A_ESCROW_PACKAGE_V6_ID, A2A_ESCROW_PACKAGE_V7_ID, A2A_ESCROW_PACKAGE_V8_ID, A2A_SCORE_BOARD_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, DEFAULT_ACTIVITY_REPORT_URL, DEFAULT_API_BASE, DEFAULT_COMMERCE_API_BASE, DEFAULT_GRPC_URL, DEFAULT_NETWORK, ESCROW_JOB_TYPE_MARKER, ETH_TYPE, GASLESS_MIN_STABLE_AMOUNT, GASLESS_STABLE_TYPES, GAS_RESERVE_MIN, IKA_TYPE, InvalidAddressError, JOB_STATES, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, LimitEnforcer, LimitExceededError, MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAINNET_A2A_ESCROW_PACKAGE_ID, MAINNET_A2A_SCORE_BOARD_ID, MANIFEST_TYPE, MAX_DELIVER_HORIZON_MS, MAX_JOB_USDC, MAX_OPEN_WINDOW_MS, 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, OPENING_TYPE_MARKER, OPERATION_ASSETS, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, PROVEN_MIN_AVG_STARS_X10, PROVEN_MIN_REVIEWS, REVIEW_MAX_STARS, REVIEW_MIN_STARS, SENDABLE_ASSETS, SPONSORED_PYTH_DEPENDENT_PROVIDERS, STABLE_ASSETS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SuinsNotRegisteredError, SuinsRpcError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addSendToTx, addSwapToTx, approxUsdValue, assertAllowedAsset, assertBuyerRequirements, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateEmptyScoreTx, buildCreateJobTx, buildCreateOpeningTx, buildDeclineJobTx, buildDeliverJobTx, buildRefundJobTx, buildRefundUnclaimedTx, buildRejectJobTx, buildReleaseJobTx, buildRevokeLeafTx, buildSendTx, buildSubmitFirstReviewTx, buildSubmitReviewTx, buildSwapTx, cancelOpenJob, canonicalizeRecipientInput, chatCompletion, chatCompletionStream, checkPositiveAmount, checkSuiAddress, claimOpenJob, claimPolicyLabel, claimPolicyRequirement, classifyAction, classifyLabel, classifySendAsset, classifyTransaction, clearLimits, composeTx, customHireEnvelope, dailySpentToday, deriveAgentScoreId, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getAgentScore, getCoinMeta, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, invalidSendAssetMessage, isAllowedAsset, isCetusRouteFresh, isCustomHireEnvelope, isInRegistry, jobActionsFor, keypairFromPrivateKey, listModels, listOpenJobs, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, meetsClaimPolicy, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseSuiRpcTx, payWithX402, postOpenJob, preflightCreateJob, preflightCreateOpening, preflightFail, preflightPay, preflightSend, preflightSwap, probeX402, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, refundOpenJob, reportX402Activity, resolveAddressToSuinsViaRpc, resolveCreatedObjectId, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, setSponsoredTxGuard, simulateTransaction, stableToRaw, submitJobReview, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, verifyReceipt, walletExists, writeLimitsFile };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/sdk",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.35.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20"
|
|
6
6
|
},
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@phala/dcap-qvl": "^0.5.2",
|
|
56
56
|
"bn.js": "^5.2.1",
|
|
57
57
|
"eventemitter3": "^5",
|
|
58
|
-
"@t2000/sui-x402": "10.
|
|
58
|
+
"@t2000/sui-x402": "10.35.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/bn.js": "^5.1.5",
|