@t2000/sdk 10.37.2 → 10.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.cjs +105 -22
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +96 -23
- package/dist/{commerce-gDWVYXP8.d.cts → commerce-D14qzqAV.d.cts} +91 -14
- package/dist/{commerce-gDWVYXP8.d.ts → commerce-D14qzqAV.d.ts} +91 -14
- package/dist/index.cjs +149 -31
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +139 -32
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -275,6 +275,14 @@ __export(coinSelection_exports, {
|
|
|
275
275
|
selectAndSplitCoin: () => selectAndSplitCoin,
|
|
276
276
|
selectSuiCoin: () => selectSuiCoin
|
|
277
277
|
});
|
|
278
|
+
function formatRawAmount(raw, coinType) {
|
|
279
|
+
const decimals = getDecimalsForCoinType(coinType);
|
|
280
|
+
const dp = Math.min(decimals, 8);
|
|
281
|
+
const s = raw.toString().padStart(decimals + 1, "0");
|
|
282
|
+
const whole = s.slice(0, s.length - decimals);
|
|
283
|
+
const frac = s.slice(s.length - decimals).slice(0, dp).replace(/0+$/, "");
|
|
284
|
+
return frac ? `${whole}.${frac}` : whole;
|
|
285
|
+
}
|
|
278
286
|
async function fetchAllCoins(client, owner, coinType) {
|
|
279
287
|
const [balance, ids] = await Promise.all([
|
|
280
288
|
client.core.getBalance({ owner, coinType }),
|
|
@@ -307,15 +315,25 @@ async function selectAndSplitCoin(tx, client, owner, coinType, amount, options =
|
|
|
307
315
|
}
|
|
308
316
|
const balanceResp = await client.core.getBalance({ owner, coinType });
|
|
309
317
|
const totalBalance = BigInt(balanceResp.balance.balance);
|
|
318
|
+
const symbol = resolveSymbol(coinType);
|
|
310
319
|
if (totalBalance === 0n) {
|
|
311
|
-
throw new T2000Error(
|
|
320
|
+
throw new T2000Error(
|
|
321
|
+
"INSUFFICIENT_BALANCE",
|
|
322
|
+
amount === "all" ? `No ${symbol} in this wallet.` : `Insufficient ${symbol}: need ${formatRawAmount(amount, coinType)}, the wallet holds 0.`,
|
|
323
|
+
{ available: "0", required: amount === "all" ? "0" : amount.toString(), coinType }
|
|
324
|
+
);
|
|
312
325
|
}
|
|
313
326
|
const allowSwapAll = options.allowSwapAll ?? true;
|
|
314
327
|
if (amount !== "all" && amount > totalBalance && !allowSwapAll) {
|
|
315
|
-
throw new T2000Error(
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
328
|
+
throw new T2000Error(
|
|
329
|
+
"INSUFFICIENT_BALANCE",
|
|
330
|
+
`Insufficient ${symbol}: need ${formatRawAmount(amount, coinType)}, the wallet holds ${formatRawAmount(totalBalance, coinType)}.`,
|
|
331
|
+
{
|
|
332
|
+
available: totalBalance.toString(),
|
|
333
|
+
required: amount.toString(),
|
|
334
|
+
coinType
|
|
335
|
+
}
|
|
336
|
+
);
|
|
319
337
|
}
|
|
320
338
|
const requested = amount === "all" ? totalBalance : amount;
|
|
321
339
|
const swapAll = amount === "all" || requested >= totalBalance;
|
|
@@ -330,7 +348,7 @@ async function selectCoinObjectsOnly(tx, client, owner, coinType, amount, allowS
|
|
|
330
348
|
if (cached.remaining === 0n || requested2 > cached.remaining) {
|
|
331
349
|
throw new T2000Error(
|
|
332
350
|
"ADDRESS_BALANCE_UNSPONSORABLE",
|
|
333
|
-
`Not enough ${coinType} in coin objects to cover all legs of this sponsored bundle. The remaining funds are in your address balance, which sponsored transactions can't access yet.`,
|
|
351
|
+
`Not enough ${resolveSymbol(coinType)} in coin objects to cover all legs of this sponsored bundle. The remaining funds are in your address balance, which sponsored transactions can't access yet.`,
|
|
334
352
|
{ remaining: cached.remaining.toString(), requested: requested2.toString(), coinType }
|
|
335
353
|
);
|
|
336
354
|
}
|
|
@@ -395,7 +413,7 @@ function buildCoinToAddressBalanceMigration(args) {
|
|
|
395
413
|
migratedRaw += c.balance;
|
|
396
414
|
}
|
|
397
415
|
if (migratedRaw < minAmount) {
|
|
398
|
-
throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient ${coinType} coin objects to migrate`, {
|
|
416
|
+
throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient ${resolveSymbol(coinType)} coin objects to migrate`, {
|
|
399
417
|
available: migratedRaw.toString(),
|
|
400
418
|
required: minAmount.toString()
|
|
401
419
|
});
|
|
@@ -421,6 +439,7 @@ async function selectSuiCoin(tx, client, owner, amountMist, sponsoredContext, me
|
|
|
421
439
|
var init_coinSelection = __esm({
|
|
422
440
|
"src/wallet/coinSelection.ts"() {
|
|
423
441
|
init_errors();
|
|
442
|
+
init_token_registry();
|
|
424
443
|
}
|
|
425
444
|
});
|
|
426
445
|
|
|
@@ -2980,7 +2999,7 @@ init_coinSelection();
|
|
|
2980
2999
|
init_errors();
|
|
2981
3000
|
init_token_registry();
|
|
2982
3001
|
init_coinSelection();
|
|
2983
|
-
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "
|
|
3002
|
+
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0x5c90ec07da01bf885a4e65247ce98b75ab8a042cd965d30d7213856d579c4afa";
|
|
2984
3003
|
var MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID;
|
|
2985
3004
|
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;
|
|
2986
3005
|
var A2A_ESCROW_OPENING_PACKAGE_ID = A2A_ESCROW_LATEST_PACKAGE_ID;
|
|
@@ -2989,6 +3008,7 @@ var A2A_ESCROW_PACKAGE_V3_ID = "0x69ad93c555519de520a5c7f7f2963ad6f8b91cefc098fc
|
|
|
2989
3008
|
var A2A_ESCROW_PACKAGE_V6_ID = "0xb065033b6f72c4899055a0b3afac28f09dc7b0b7b491eada793157de20000618";
|
|
2990
3009
|
var A2A_ESCROW_PACKAGE_V7_ID = "0x4249f0b242c47c7baf0c37304365bc4bbe769bcedf11f3525e84682d59a3b23e";
|
|
2991
3010
|
var A2A_ESCROW_PACKAGE_V8_ID = "0x1595b80bc05a03607f3908702c866ca63cf961025b4263b5ecbe419e07f8ff31";
|
|
3011
|
+
var A2A_ESCROW_PACKAGE_V10_ID = process.env.A2A_ESCROW_PACKAGE_V10_ID ?? "0x5c90ec07da01bf885a4e65247ce98b75ab8a042cd965d30d7213856d579c4afa";
|
|
2992
3012
|
var CLOCK_ID2 = "0x6";
|
|
2993
3013
|
var MODULE = "opening";
|
|
2994
3014
|
var SHA256_HEX_RE = /^(0x)?[0-9a-fA-F]{64}$/;
|
|
@@ -3063,6 +3083,14 @@ function preflightCreateOpening(terms) {
|
|
|
3063
3083
|
error: "claimPolicy must be 0 (Anyone), 1 (Proven) or 2 (Proven \xB7 4\u2605+) \u2014 anything else aborts on-chain."
|
|
3064
3084
|
};
|
|
3065
3085
|
}
|
|
3086
|
+
const minLevel = terms.minSellerLevel ?? 0;
|
|
3087
|
+
if (!Number.isInteger(minLevel) || minLevel < 0 || minLevel > 4) {
|
|
3088
|
+
return {
|
|
3089
|
+
valid: false,
|
|
3090
|
+
code: "INVALID_INPUT",
|
|
3091
|
+
error: "minSellerLevel must be 0 (no floor) or 1\u20134 (Level 1\u20134) \u2014 anything else aborts on-chain (S.1192)."
|
|
3092
|
+
};
|
|
3093
|
+
}
|
|
3066
3094
|
return { valid: true };
|
|
3067
3095
|
}
|
|
3068
3096
|
async function buildCreateOpeningTx({
|
|
@@ -3078,7 +3106,9 @@ async function buildCreateOpeningTx({
|
|
|
3078
3106
|
allowSwapAll: false
|
|
3079
3107
|
});
|
|
3080
3108
|
tx.moveCall({
|
|
3081
|
-
|
|
3109
|
+
// S.1192: create_open is a dead abort stub after the v10 migrate —
|
|
3110
|
+
// every post rides v2 (adds the min_seller_level DF write).
|
|
3111
|
+
target: `${A2A_ESCROW_OPENING_PACKAGE_ID}::${MODULE}::create_open_v2`,
|
|
3082
3112
|
typeArguments: [USDC_TYPE],
|
|
3083
3113
|
arguments: [
|
|
3084
3114
|
coin,
|
|
@@ -3088,6 +3118,7 @@ async function buildCreateOpeningTx({
|
|
|
3088
3118
|
tx.pure.u64(terms.reviewWindowMs),
|
|
3089
3119
|
tx.pure.u64(terms.rejectSplitBps),
|
|
3090
3120
|
tx.pure.u8(terms.claimPolicy ?? OPENING_CLAIM_POLICY_ANY_ACTIVE),
|
|
3121
|
+
tx.pure.u8(terms.minSellerLevel ?? 0),
|
|
3091
3122
|
feeConfigArg(tx),
|
|
3092
3123
|
tx.object(CLOCK_ID2)
|
|
3093
3124
|
]
|
|
@@ -3097,23 +3128,26 @@ async function buildCreateOpeningTx({
|
|
|
3097
3128
|
function buildClaimOpeningTx({
|
|
3098
3129
|
openingId,
|
|
3099
3130
|
registryId,
|
|
3100
|
-
scoreId
|
|
3131
|
+
scoreId,
|
|
3132
|
+
claimPolicy = OPENING_CLAIM_POLICY_ANY_ACTIVE
|
|
3101
3133
|
}) {
|
|
3134
|
+
if (!scoreId) {
|
|
3135
|
+
throw new T2000Error(
|
|
3136
|
+
"INVALID_INPUT",
|
|
3137
|
+
"Claiming needs the claimer's own AgentScore id (S.1192 \u2014 every claim moves the active-job counter). Derive it with deriveAgentScoreId; create it first with buildCreateEmptyScoreTx when it does not exist yet."
|
|
3138
|
+
);
|
|
3139
|
+
}
|
|
3140
|
+
const proven = claimPolicy !== OPENING_CLAIM_POLICY_ANY_ACTIVE;
|
|
3102
3141
|
const tx = new Transaction();
|
|
3103
3142
|
tx.moveCall({
|
|
3104
|
-
target: `${A2A_ESCROW_OPENING_PACKAGE_ID}::${MODULE}::${
|
|
3143
|
+
target: `${A2A_ESCROW_OPENING_PACKAGE_ID}::${MODULE}::${proven ? "claim_proven_v2" : "claim_v2"}`,
|
|
3105
3144
|
typeArguments: [USDC_TYPE],
|
|
3106
|
-
arguments:
|
|
3145
|
+
arguments: [
|
|
3107
3146
|
tx.object(openingId),
|
|
3108
3147
|
tx.object(registryId),
|
|
3109
3148
|
tx.object(scoreId),
|
|
3110
3149
|
feeConfigArg(tx),
|
|
3111
3150
|
tx.object(CLOCK_ID2)
|
|
3112
|
-
] : [
|
|
3113
|
-
tx.object(openingId),
|
|
3114
|
-
tx.object(registryId),
|
|
3115
|
-
feeConfigArg(tx),
|
|
3116
|
-
tx.object(CLOCK_ID2)
|
|
3117
3151
|
]
|
|
3118
3152
|
});
|
|
3119
3153
|
return tx;
|
|
@@ -3133,6 +3167,24 @@ function buildCancelOpeningTx(openingId) {
|
|
|
3133
3167
|
function buildRefundUnclaimedTx(openingId) {
|
|
3134
3168
|
return openingCall(openingId, "refund_unclaimed");
|
|
3135
3169
|
}
|
|
3170
|
+
async function readMinSellerLevelDf(client, openingId) {
|
|
3171
|
+
if (!A2A_ESCROW_PACKAGE_V10_ID) return 0;
|
|
3172
|
+
try {
|
|
3173
|
+
const fieldId = deriveDynamicFieldID(
|
|
3174
|
+
openingId,
|
|
3175
|
+
`${A2A_ESCROW_PACKAGE_V10_ID}::${MODULE}::MinSellerLevelKey`,
|
|
3176
|
+
new Uint8Array([0])
|
|
3177
|
+
);
|
|
3178
|
+
const resp = await client.core.getObject({
|
|
3179
|
+
objectId: fieldId,
|
|
3180
|
+
include: { json: true }
|
|
3181
|
+
});
|
|
3182
|
+
const json = resp?.object?.json;
|
|
3183
|
+
return Number(json?.value ?? 0);
|
|
3184
|
+
} catch {
|
|
3185
|
+
return 0;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3136
3188
|
function bytesToHex(bytes) {
|
|
3137
3189
|
return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
|
|
3138
3190
|
}
|
|
@@ -3143,6 +3195,7 @@ async function getOpening(client, openingId) {
|
|
|
3143
3195
|
if (!json || !objType.includes(`::${MODULE}::Opening<`)) {
|
|
3144
3196
|
return null;
|
|
3145
3197
|
}
|
|
3198
|
+
const minSellerLevel = await readMinSellerLevelDf(client, openingId);
|
|
3146
3199
|
return {
|
|
3147
3200
|
id: openingId,
|
|
3148
3201
|
buyer: String(json.buyer),
|
|
@@ -3154,6 +3207,7 @@ async function getOpening(client, openingId) {
|
|
|
3154
3207
|
reviewWindowMs: Number(json.review_window_ms),
|
|
3155
3208
|
rejectSplitBps: Number(json.reject_split_bps),
|
|
3156
3209
|
claimPolicy: Number(json.claim_policy ?? 0),
|
|
3210
|
+
minSellerLevel,
|
|
3157
3211
|
createdAtMs: Number(json.created_at_ms ?? 0)
|
|
3158
3212
|
};
|
|
3159
3213
|
}
|
|
@@ -3283,15 +3337,6 @@ function buildDeclineJobTx(jobId) {
|
|
|
3283
3337
|
});
|
|
3284
3338
|
return tx;
|
|
3285
3339
|
}
|
|
3286
|
-
function jobCall(jobId, fn) {
|
|
3287
|
-
const tx = new Transaction();
|
|
3288
|
-
tx.moveCall({
|
|
3289
|
-
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::${MODULE2}::${fn}`,
|
|
3290
|
-
typeArguments: [USDC_TYPE],
|
|
3291
|
-
arguments: [tx.object(jobId), feeConfigArg2(tx), tx.object(CLOCK_ID3)]
|
|
3292
|
-
});
|
|
3293
|
-
return tx;
|
|
3294
|
-
}
|
|
3295
3340
|
function buildRejectJobTx(jobId, v2) {
|
|
3296
3341
|
const tx = new Transaction();
|
|
3297
3342
|
tx.moveCall({
|
|
@@ -3342,8 +3387,19 @@ function buildDeliverJobTx(jobId, deliveryHash) {
|
|
|
3342
3387
|
});
|
|
3343
3388
|
return tx;
|
|
3344
3389
|
}
|
|
3345
|
-
function buildReleaseJobTx(jobId) {
|
|
3346
|
-
|
|
3390
|
+
function buildReleaseJobTx(jobId, v2) {
|
|
3391
|
+
const tx = new Transaction();
|
|
3392
|
+
tx.moveCall({
|
|
3393
|
+
target: `${A2A_ESCROW_LATEST_PACKAGE_ID}::reputation::release_v2`,
|
|
3394
|
+
typeArguments: [USDC_TYPE],
|
|
3395
|
+
arguments: [
|
|
3396
|
+
tx.object(jobId),
|
|
3397
|
+
tx.object(v2.sellerScoreId),
|
|
3398
|
+
feeConfigArg2(tx),
|
|
3399
|
+
tx.object(CLOCK_ID3)
|
|
3400
|
+
]
|
|
3401
|
+
});
|
|
3402
|
+
return tx;
|
|
3347
3403
|
}
|
|
3348
3404
|
async function getJob(client, jobId) {
|
|
3349
3405
|
const resp = await client.core.getObject({ objectId: jobId, include: { json: true } }).catch((e) => {
|
|
@@ -3432,6 +3488,10 @@ var PROVEN_MIN_REVIEWS = 3;
|
|
|
3432
3488
|
var PROVEN_MIN_AVG_STARS_X10 = 40;
|
|
3433
3489
|
var REVIEW_MIN_STARS = 1;
|
|
3434
3490
|
var REVIEW_MAX_STARS = 5;
|
|
3491
|
+
var SELLER_LEVEL_ACTIVE_CAPS = [4, 10, 20, 30];
|
|
3492
|
+
var NO_DELIVERY_REGRESSION_FLOOR = 3;
|
|
3493
|
+
var LEVEL4_MIN_REVIEWS = 20;
|
|
3494
|
+
var LEVEL4_MAX_NO_DELIVERY = 2;
|
|
3435
3495
|
function boardIdOrThrow(boardId) {
|
|
3436
3496
|
const id = boardId ?? A2A_SCORE_BOARD_ID;
|
|
3437
3497
|
if (!id) {
|
|
@@ -3477,11 +3537,12 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
3477
3537
|
}
|
|
3478
3538
|
const reviewCount = Number(json.review_count ?? 0);
|
|
3479
3539
|
const starsSum = Number(json.stars_sum ?? 0);
|
|
3480
|
-
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected] = await Promise.all([
|
|
3540
|
+
const [distinctBuyers, rejectedAfterDelivery, noDelivery, asBuyerRejected, activeSellerJobs] = await Promise.all([
|
|
3481
3541
|
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V7_ID, "DistinctCountKey"),
|
|
3482
3542
|
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "RejectedAfterDeliveryKey"),
|
|
3483
3543
|
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "NoDeliveryKey"),
|
|
3484
|
-
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey")
|
|
3544
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V8_ID, "AsBuyerRejectedKey"),
|
|
3545
|
+
readCounterDf(client, scoreId, A2A_ESCROW_PACKAGE_V10_ID, "ActiveSellerJobsKey")
|
|
3485
3546
|
]);
|
|
3486
3547
|
return {
|
|
3487
3548
|
id: scoreId,
|
|
@@ -3492,7 +3553,8 @@ async function getAgentScore(client, agent, boardId) {
|
|
|
3492
3553
|
distinctBuyers,
|
|
3493
3554
|
rejectedAfterDelivery,
|
|
3494
3555
|
noDelivery,
|
|
3495
|
-
asBuyerRejected
|
|
3556
|
+
asBuyerRejected,
|
|
3557
|
+
activeSellerJobs
|
|
3496
3558
|
};
|
|
3497
3559
|
}
|
|
3498
3560
|
function buildCreateEmptyScoreTx({
|
|
@@ -3537,6 +3599,51 @@ function claimPolicyRequirement(claimPolicy) {
|
|
|
3537
3599
|
}
|
|
3538
3600
|
return "Anyone can claim (active Agent ID required).";
|
|
3539
3601
|
}
|
|
3602
|
+
function sellerLevel(score) {
|
|
3603
|
+
if (!score) return 1;
|
|
3604
|
+
const provenAvg = score.distinctBuyers >= PROVEN_MIN_REVIEWS && score.starsSum * 10 >= score.reviewCount * PROVEN_MIN_AVG_STARS_X10;
|
|
3605
|
+
if (provenAvg) {
|
|
3606
|
+
return score.reviewCount >= LEVEL4_MIN_REVIEWS && score.noDelivery <= LEVEL4_MAX_NO_DELIVERY ? 4 : 3;
|
|
3607
|
+
}
|
|
3608
|
+
return score.distinctBuyers >= PROVEN_MIN_REVIEWS ? 2 : 1;
|
|
3609
|
+
}
|
|
3610
|
+
function effectiveSellerLevel(score) {
|
|
3611
|
+
if (!score) return 1;
|
|
3612
|
+
if (score.noDelivery >= NO_DELIVERY_REGRESSION_FLOOR) return 1;
|
|
3613
|
+
return sellerLevel(score);
|
|
3614
|
+
}
|
|
3615
|
+
function activeCapForLevel(level) {
|
|
3616
|
+
return SELLER_LEVEL_ACTIVE_CAPS[level - 1];
|
|
3617
|
+
}
|
|
3618
|
+
function meetsMinSellerLevel(score, minLevel) {
|
|
3619
|
+
if (minLevel <= 0) return true;
|
|
3620
|
+
return effectiveSellerLevel(score) >= minLevel;
|
|
3621
|
+
}
|
|
3622
|
+
function sellerLevelLabel(level) {
|
|
3623
|
+
return level >= 1 && level <= 4 ? `Level ${level}` : `Level ? (${level})`;
|
|
3624
|
+
}
|
|
3625
|
+
function preflightClaimOpening(score, opening) {
|
|
3626
|
+
if (!meetsClaimPolicy(score, opening.claimPolicy)) {
|
|
3627
|
+
return { valid: false, error: claimPolicyRequirement(opening.claimPolicy) };
|
|
3628
|
+
}
|
|
3629
|
+
const level = effectiveSellerLevel(score);
|
|
3630
|
+
const cap = activeCapForLevel(level);
|
|
3631
|
+
const active = score?.activeSellerJobs ?? 0;
|
|
3632
|
+
if (active >= cap) {
|
|
3633
|
+
return {
|
|
3634
|
+
valid: false,
|
|
3635
|
+
error: `Active: ${active}/${cap} \u2014 ${sellerLevelLabel(level)} caps in-flight claimed jobs at ${cap}. Finish (deliver + settle) a job or wait for a deadline refund, then claim again.`
|
|
3636
|
+
};
|
|
3637
|
+
}
|
|
3638
|
+
const minLevel = opening.minSellerLevel ?? 0;
|
|
3639
|
+
if (!meetsMinSellerLevel(score, minLevel)) {
|
|
3640
|
+
return {
|
|
3641
|
+
valid: false,
|
|
3642
|
+
error: `This opening needs ${sellerLevelLabel(minLevel)}+ \u2014 this wallet is ${sellerLevelLabel(level)}. Level 2 = reviews from ${PROVEN_MIN_REVIEWS}+ distinct buyers; Level 3 adds a 4.0\u2605 average; reliability (no-shows) can regress a level. Earn it on openings without a floor first.`
|
|
3643
|
+
};
|
|
3644
|
+
}
|
|
3645
|
+
return { valid: true };
|
|
3646
|
+
}
|
|
3540
3647
|
function assertStars(stars) {
|
|
3541
3648
|
if (!Number.isInteger(stars) || stars < REVIEW_MIN_STARS || stars > REVIEW_MAX_STARS) {
|
|
3542
3649
|
throw new T2000Error("INVALID_INPUT", "Stars must be an integer 1-5.");
|
|
@@ -4799,4 +4906,4 @@ function displayHandle(label, parentName = AUDRIC_PARENT_NAME) {
|
|
|
4799
4906
|
// src/index.ts
|
|
4800
4907
|
init_preflight();
|
|
4801
4908
|
|
|
4802
|
-
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, AGENT_CATEGORIES, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, CommerceClient, 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, MAX_SLUG_LENGTH, MAX_TIER_BASE_LENGTH, 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, SERVICE_SLUG_RE, SERVICE_TIERS, 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, agentResolveUrl, 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, createPackage, customHireEnvelope, dailySpentToday, deriveAgentScoreId, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, endpointIssueLines, ensureCategory, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, fetchChallengeNonce, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getAgentProfile, getAgentScore, getCoinMeta, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, invalidSendAssetMessage, isAllowedAsset, isCetusRouteFresh, isCustomHireEnvelope, isInRegistry, jobActionsFor, keypairFromPrivateKey, listEndpoint, listModels, listOpenJobs, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, meetsClaimPolicy, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, packageBaseFromName, packageBaseSlug, packageTierSlugs, parseAgentCategory, parseServiceTierSlug, parseSuiRpcTx, payWithX402, planPackage, postOpenJob, preflightCreateJob, preflightCreateOpening, preflightFail, preflightPay, preflightSend, preflightSwap, probeX402, profileChallengeMessage, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, refundOpenJob, registerAgent, removeEndpoint, reportX402Activity, resolveAddressToSuinsViaRpc, resolveAgentRef, resolveCreatedObjectId, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, retireService, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, serviceChallengeMessage, servicePayloadSha256, serviceUpsertPayload, setLimits, setSponsoredTxGuard, signChallenge, simulateTransaction, slugify, slugifyLoner, slugifyUnbounded, stableToRaw, submitJobReview, suiToMist, throwIfSimulationFailed, trimDashes, truncateAddress, updateProfile, upsertService, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, walletExists, writeLimitsFile };
|
|
4909
|
+
export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_LATEST_PACKAGE_ID, A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_ID, A2A_ESCROW_PACKAGE_V10_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, AGENT_CATEGORIES, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, CommerceClient, 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, LEVEL4_MAX_NO_DELIVERY, LEVEL4_MIN_REVIEWS, 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, MAX_SLUG_LENGTH, MAX_TIER_BASE_LENGTH, MIN_JOB_USDC, MIST_PER_SUI, NAVX_TYPE, NO_DELIVERY_REGRESSION_FLOOR, OPENING_CLAIM_POLICIES, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPENING_CLAIM_POLICY_PROVEN, OPENING_CLAIM_POLICY_PROVEN_4STAR, 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, SELLER_LEVEL_ACTIVE_CAPS, SENDABLE_ASSETS, SERVICE_SLUG_RE, SERVICE_TIERS, 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, activeCapForLevel, addSendToTx, addSwapToTx, agentResolveUrl, 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, createPackage, customHireEnvelope, dailySpentToday, deriveAgentScoreId, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, effectiveSellerLevel, endpointIssueLines, ensureCategory, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, fetchChallengeNonce, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getAgentProfile, getAgentScore, getCoinMeta, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, invalidSendAssetMessage, isAllowedAsset, isCetusRouteFresh, isCustomHireEnvelope, isInRegistry, jobActionsFor, keypairFromPrivateKey, listEndpoint, listModels, listOpenJobs, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, meetsClaimPolicy, meetsMinSellerLevel, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, packageBaseFromName, packageBaseSlug, packageTierSlugs, parseAgentCategory, parseServiceTierSlug, parseSuiRpcTx, payWithX402, planPackage, postOpenJob, preflightClaimOpening, preflightCreateJob, preflightCreateOpening, preflightFail, preflightPay, preflightSend, preflightSwap, probeX402, profileChallengeMessage, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, refundOpenJob, registerAgent, removeEndpoint, reportX402Activity, resolveAddressToSuinsViaRpc, resolveAgentRef, resolveCreatedObjectId, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, retireService, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, sellerLevel, sellerLevelLabel, serializeCetusRoute, serviceChallengeMessage, servicePayloadSha256, serviceUpsertPayload, setLimits, setSponsoredTxGuard, signChallenge, simulateTransaction, slugify, slugifyLoner, slugifyUnbounded, stableToRaw, submitJobReview, suiToMist, throwIfSimulationFailed, trimDashes, truncateAddress, updateProfile, upsertService, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, walletExists, writeLimitsFile };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/sdk",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.38.1",
|
|
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.38.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/bn.js": "^5.1.5",
|