@t2000/cli 10.29.0 → 10.30.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/{chunk-SHZC6TMU.js → chunk-7ZMRX7L4.js} +2 -2
- package/dist/{chunk-T32A4PV6.js → chunk-AJX562JQ.js} +5 -5
- package/dist/{chunk-TVD4WMBT.js → chunk-IYBOBPGG.js} +4 -4
- package/dist/{chunk-CNTCUDEZ.js → chunk-KSHM4A6X.js} +2 -2
- package/dist/{dist-RTAF2SWN.js → dist-2P3XNMJC.js} +3 -3
- package/dist/{dist-JP4PBPBV.js → dist-VE3SAZWF.js} +5 -5
- package/dist/{grpc-AJNSMQ2Y.js → grpc-GFGD32S5.js} +3 -3
- package/dist/index.js +106 -38
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- /package/dist/{chunk-SHZC6TMU.js.map → chunk-7ZMRX7L4.js.map} +0 -0
- /package/dist/{chunk-T32A4PV6.js.map → chunk-AJX562JQ.js.map} +0 -0
- /package/dist/{chunk-TVD4WMBT.js.map → chunk-IYBOBPGG.js.map} +0 -0
- /package/dist/{chunk-CNTCUDEZ.js.map → chunk-KSHM4A6X.js.map} +0 -0
- /package/dist/{dist-RTAF2SWN.js.map → dist-2P3XNMJC.js.map} +0 -0
- /package/dist/{dist-JP4PBPBV.js.map → dist-VE3SAZWF.js.map} +0 -0
- /package/dist/{grpc-AJNSMQ2Y.js.map → grpc-GFGD32S5.js.map} +0 -0
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
fromBase64 as fromBase642,
|
|
11
11
|
suiBcs,
|
|
12
12
|
toBase64 as toBase642
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AJX562JQ.js";
|
|
14
14
|
import {
|
|
15
15
|
SUI_ADDRESS_LENGTH,
|
|
16
16
|
fromBase64,
|
|
@@ -12463,4 +12463,4 @@ export {
|
|
|
12463
12463
|
SuiGrpcClient,
|
|
12464
12464
|
types_exports
|
|
12465
12465
|
};
|
|
12466
|
-
//# sourceMappingURL=chunk-
|
|
12466
|
+
//# sourceMappingURL=chunk-7ZMRX7L4.js.map
|
|
@@ -2760,6 +2760,10 @@ function getNamesFromTypeList(types) {
|
|
|
2760
2760
|
}
|
|
2761
2761
|
|
|
2762
2762
|
export {
|
|
2763
|
+
TypeTagSerializer,
|
|
2764
|
+
ExecutionStatus,
|
|
2765
|
+
pureBcsSchemaFromTypeName,
|
|
2766
|
+
suiBcs,
|
|
2763
2767
|
integer,
|
|
2764
2768
|
is,
|
|
2765
2769
|
array,
|
|
@@ -2790,10 +2794,6 @@ export {
|
|
|
2790
2794
|
ValidDuringSchema,
|
|
2791
2795
|
TransactionExpiration2 as TransactionExpiration,
|
|
2792
2796
|
getIdFromCallArg,
|
|
2793
|
-
TypeTagSerializer,
|
|
2794
|
-
ExecutionStatus,
|
|
2795
|
-
pureBcsSchemaFromTypeName,
|
|
2796
|
-
suiBcs,
|
|
2797
2797
|
serializeV1TransactionData,
|
|
2798
2798
|
TransactionDataBuilder,
|
|
2799
2799
|
MOVE_STDLIB_ADDRESS,
|
|
@@ -2813,4 +2813,4 @@ export {
|
|
|
2813
2813
|
findNamesInTransaction,
|
|
2814
2814
|
replaceNames
|
|
2815
2815
|
};
|
|
2816
|
-
//# sourceMappingURL=chunk-
|
|
2816
|
+
//# sourceMappingURL=chunk-AJX562JQ.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'module'; import { fileURLToPath as __fileURLToPath } from 'url'; import { dirname as __pathDirname } from 'path'; const require = __createRequire(import.meta.url); const __filename = __fileURLToPath(import.meta.url); const __dirname = __pathDirname(__filename);
|
|
2
2
|
import {
|
|
3
3
|
SuiGrpcClient
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7ZMRX7L4.js";
|
|
5
5
|
import {
|
|
6
6
|
Transaction,
|
|
7
7
|
coinWithBalance
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KSHM4A6X.js";
|
|
9
9
|
import {
|
|
10
10
|
SUI_CLOCK_OBJECT_ID,
|
|
11
11
|
suiBcs
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AJX562JQ.js";
|
|
13
13
|
import {
|
|
14
14
|
normalizeSuiObjectId
|
|
15
15
|
} from "./chunk-BX4V52TZ.js";
|
|
@@ -32559,4 +32559,4 @@ mime-types/index.js:
|
|
|
32559
32559
|
*)
|
|
32560
32560
|
*)
|
|
32561
32561
|
*/
|
|
32562
|
-
//# sourceMappingURL=chunk-
|
|
32562
|
+
//# sourceMappingURL=chunk-IYBOBPGG.js.map
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
tuple,
|
|
48
48
|
union,
|
|
49
49
|
unknown
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-AJX562JQ.js";
|
|
51
51
|
import {
|
|
52
52
|
fromBase58,
|
|
53
53
|
fromBase64,
|
|
@@ -1635,4 +1635,4 @@ export {
|
|
|
1635
1635
|
coinWithBalance,
|
|
1636
1636
|
Transaction
|
|
1637
1637
|
};
|
|
1638
|
-
//# sourceMappingURL=chunk-
|
|
1638
|
+
//# sourceMappingURL=chunk-KSHM4A6X.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'module'; import { fileURLToPath as __fileURLToPath } from 'url'; import { dirname as __pathDirname } from 'path'; const require = __createRequire(import.meta.url); const __filename = __fileURLToPath(import.meta.url); const __dirname = __pathDirname(__filename);
|
|
2
2
|
import {
|
|
3
3
|
Transaction
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-KSHM4A6X.js";
|
|
5
|
+
import "./chunk-AJX562JQ.js";
|
|
6
6
|
import {
|
|
7
7
|
fromBase64,
|
|
8
8
|
normalizeSuiAddress,
|
|
@@ -348,4 +348,4 @@ export {
|
|
|
348
348
|
withRetry,
|
|
349
349
|
x402Network
|
|
350
350
|
};
|
|
351
|
-
//# sourceMappingURL=dist-
|
|
351
|
+
//# sourceMappingURL=dist-2P3XNMJC.js.map
|
|
@@ -171,10 +171,10 @@ import {
|
|
|
171
171
|
processEndpoint,
|
|
172
172
|
processFlattenRoutes,
|
|
173
173
|
restituteMsafeFastRouterSwapParams
|
|
174
|
-
} from "./chunk-
|
|
175
|
-
import "./chunk-
|
|
176
|
-
import "./chunk-
|
|
177
|
-
import "./chunk-
|
|
174
|
+
} from "./chunk-IYBOBPGG.js";
|
|
175
|
+
import "./chunk-7ZMRX7L4.js";
|
|
176
|
+
import "./chunk-KSHM4A6X.js";
|
|
177
|
+
import "./chunk-AJX562JQ.js";
|
|
178
178
|
import "./chunk-BX4V52TZ.js";
|
|
179
179
|
import "./chunk-YPWSCLE3.js";
|
|
180
180
|
export {
|
|
@@ -350,4 +350,4 @@ export {
|
|
|
350
350
|
processFlattenRoutes,
|
|
351
351
|
restituteMsafeFastRouterSwapParams
|
|
352
352
|
};
|
|
353
|
-
//# sourceMappingURL=dist-
|
|
353
|
+
//# sourceMappingURL=dist-VE3SAZWF.js.map
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
SuiGrpcClient,
|
|
6
6
|
isSuiGrpcClient,
|
|
7
7
|
types_exports
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-7ZMRX7L4.js";
|
|
9
|
+
import "./chunk-AJX562JQ.js";
|
|
10
10
|
import "./chunk-BX4V52TZ.js";
|
|
11
11
|
import "./chunk-YPWSCLE3.js";
|
|
12
12
|
export {
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
SuiGrpcClient,
|
|
17
17
|
isSuiGrpcClient
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=grpc-
|
|
19
|
+
//# sourceMappingURL=grpc-GFGD32S5.js.map
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'module'; import { fileURLToPat
|
|
|
3
3
|
import {
|
|
4
4
|
AggregatorClient,
|
|
5
5
|
Env
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IYBOBPGG.js";
|
|
7
7
|
import {
|
|
8
8
|
BalanceChange,
|
|
9
9
|
BaseClient,
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
parseTransactionEffectsBcs,
|
|
17
17
|
transactionDataToGrpcTransaction,
|
|
18
18
|
transactionToGrpcJson
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-7ZMRX7L4.js";
|
|
20
20
|
import {
|
|
21
21
|
Transaction,
|
|
22
22
|
coinWithBalance
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-KSHM4A6X.js";
|
|
24
24
|
import {
|
|
25
25
|
ObjectError,
|
|
26
26
|
SUI_TYPE_ARG,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
fromBase64 as fromBase642,
|
|
32
32
|
suiBcs,
|
|
33
33
|
toBase64 as toBase642
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-AJX562JQ.js";
|
|
35
35
|
import {
|
|
36
36
|
SIGNATURE_FLAG_TO_SCHEME,
|
|
37
37
|
SIGNATURE_SCHEME_TO_FLAG,
|
|
@@ -28542,7 +28542,7 @@ async function probeX402(args) {
|
|
|
28542
28542
|
BigInt(requirements.maxAmountRequired),
|
|
28543
28543
|
await assetDecimals(requirements.asset)
|
|
28544
28544
|
);
|
|
28545
|
-
const { isX402EscrowRequirements } = await import("./dist-
|
|
28545
|
+
const { isX402EscrowRequirements } = await import("./dist-2P3XNMJC.js");
|
|
28546
28546
|
if (isX402EscrowRequirements(requirements)) {
|
|
28547
28547
|
return {
|
|
28548
28548
|
kind: "escrow",
|
|
@@ -28613,7 +28613,7 @@ async function payWithX402(args) {
|
|
|
28613
28613
|
const pick = await pickSuiExactRequirements(probe, client.network);
|
|
28614
28614
|
if (pick.kind === "payable") {
|
|
28615
28615
|
const requirements = pick.requirements;
|
|
28616
|
-
const { isX402EscrowRequirements } = await import("./dist-
|
|
28616
|
+
const { isX402EscrowRequirements } = await import("./dist-2P3XNMJC.js");
|
|
28617
28617
|
if (isX402EscrowRequirements(requirements)) {
|
|
28618
28618
|
const escrow = requirements.extra.escrow;
|
|
28619
28619
|
const price = atomicToHuman(
|
|
@@ -28659,7 +28659,7 @@ async function pickSuiExactRequirements(response, network) {
|
|
|
28659
28659
|
const want = `sui:${network === "testnet" ? "testnet" : "mainnet"}`;
|
|
28660
28660
|
const entry = body2.accepts?.find((a) => a.scheme === "exact" && a.network === want);
|
|
28661
28661
|
if (!entry) return { kind: "none" };
|
|
28662
|
-
const { isX402EscrowRequirements } = await import("./dist-
|
|
28662
|
+
const { isX402EscrowRequirements } = await import("./dist-2P3XNMJC.js");
|
|
28663
28663
|
if (hasCompleteSuimppChallenge(entry) || isX402EscrowRequirements(entry)) {
|
|
28664
28664
|
return { kind: "payable", requirements: entry };
|
|
28665
28665
|
}
|
|
@@ -28677,7 +28677,7 @@ async function payViaX402(args) {
|
|
|
28677
28677
|
{ reason: "incomplete-x402-accepts" }
|
|
28678
28678
|
);
|
|
28679
28679
|
}
|
|
28680
|
-
const { buildX402SignedPayment, X402_PAYMENT_HEADER, X402_PAYMENT_RESPONSE_HEADER } = await import("./dist-
|
|
28680
|
+
const { buildX402SignedPayment, X402_PAYMENT_HEADER, X402_PAYMENT_RESPONSE_HEADER } = await import("./dist-2P3XNMJC.js");
|
|
28681
28681
|
const amountRaw = BigInt(requirements.maxAmountRequired);
|
|
28682
28682
|
assertWithinMaxPrice(atomicToHuman(amountRaw, await assetDecimals(requirements.asset)), options.maxPrice);
|
|
28683
28683
|
const migrationGasSui = await ensureAddressBalanceCovers({
|
|
@@ -28808,7 +28808,7 @@ async function finalize(response, opts) {
|
|
|
28808
28808
|
return { status: response.status, body: body2, paid: opts.paid };
|
|
28809
28809
|
}
|
|
28810
28810
|
async function makeGrpcBuildClient(client) {
|
|
28811
|
-
const { SuiGrpcClient: SuiGrpcClient3 } = await import("./grpc-
|
|
28811
|
+
const { SuiGrpcClient: SuiGrpcClient3 } = await import("./grpc-GFGD32S5.js");
|
|
28812
28812
|
const network = client.network === "testnet" ? "testnet" : "mainnet";
|
|
28813
28813
|
const baseUrl = network === "testnet" ? "https://fullnode.testnet.sui.io" : "https://fullnode.mainnet.sui.io";
|
|
28814
28814
|
return new SuiGrpcClient3({ baseUrl, network });
|
|
@@ -30548,8 +30548,9 @@ init_coinSelection();
|
|
|
30548
30548
|
init_errors();
|
|
30549
30549
|
init_token_registry();
|
|
30550
30550
|
init_coinSelection();
|
|
30551
|
-
var
|
|
30552
|
-
var
|
|
30551
|
+
var MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID = "0x83f02c59575b7daa4576eeccc22542f8a5679520e4edd02feeeee2daae16b819";
|
|
30552
|
+
var MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID = MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID;
|
|
30553
|
+
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;
|
|
30553
30554
|
var MAINNET_A2A_ESCROW_PACKAGE_ID = "0x358a819c1c016e2cc84ef5fbea81cba90c31f7f8a62bf45cb5e5276acf198bdd";
|
|
30554
30555
|
var A2A_ESCROW_PACKAGE_ID = process.env.A2A_ESCROW_PACKAGE_ID ?? MAINNET_A2A_ESCROW_PACKAGE_ID;
|
|
30555
30556
|
var A2A_ESCROW_FEE_CONFIG_ID = process.env.A2A_ESCROW_FEE_CONFIG_ID ?? "0xddaa25570950b7484dbf20797ebcf75707be9c87cd67bef2a06ed2e81d2c494b";
|
|
@@ -30558,6 +30559,7 @@ var A2A_ESCROW_FEE_CONFIG_VERSION = Number(
|
|
|
30558
30559
|
);
|
|
30559
30560
|
var MODULE2 = "escrow";
|
|
30560
30561
|
var MAX_JOB_USDC = 50;
|
|
30562
|
+
var MIN_JOB_USDC = 0.05;
|
|
30561
30563
|
var MAX_REVIEW_WINDOW_MS = 2592e6;
|
|
30562
30564
|
var MAX_DELIVER_HORIZON_MS = 31536e6;
|
|
30563
30565
|
var JOB_STATES = [
|
|
@@ -30593,6 +30595,12 @@ function preflightCreateJob(terms) {
|
|
|
30593
30595
|
if (!Number.isFinite(terms.amountUsdc) || terms.amountUsdc <= 0) {
|
|
30594
30596
|
return preflightFail("INVALID_AMOUNT", `Amount must be positive. Got ${terms.amountUsdc}.`);
|
|
30595
30597
|
}
|
|
30598
|
+
if (terms.amountUsdc < MIN_JOB_USDC) {
|
|
30599
|
+
return preflightFail(
|
|
30600
|
+
"INVALID_AMOUNT",
|
|
30601
|
+
`Escrow jobs start at ${MIN_JOB_USDC} USDC (contract-enforced minimum). Got ${terms.amountUsdc}.`
|
|
30602
|
+
);
|
|
30603
|
+
}
|
|
30596
30604
|
if (terms.amountUsdc > MAX_JOB_USDC) {
|
|
30597
30605
|
return preflightFail(
|
|
30598
30606
|
"INVALID_AMOUNT",
|
|
@@ -30946,60 +30954,66 @@ init_preflight();
|
|
|
30946
30954
|
var CANONICAL_API_ORIGIN = "https://api.t2000.ai";
|
|
30947
30955
|
var ALLOW_UNTRUSTED_FLAG = "--allow-untrusted-api";
|
|
30948
30956
|
var ACTION_TARGETS = {
|
|
30949
|
-
//
|
|
30957
|
+
// Escrow verbs — emitted at the original id (pre-S.981 SDK) or the latest
|
|
30958
|
+
// id (S.981+ SDK, the version-gated path).
|
|
30950
30959
|
create: {
|
|
30951
|
-
|
|
30960
|
+
pkgs: [MAINNET_A2A_ESCROW_PACKAGE_ID, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30952
30961
|
module: "escrow",
|
|
30953
30962
|
functions: ["create"]
|
|
30954
30963
|
},
|
|
30955
30964
|
deliver: {
|
|
30956
|
-
|
|
30965
|
+
pkgs: [MAINNET_A2A_ESCROW_PACKAGE_ID, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30957
30966
|
module: "escrow",
|
|
30958
30967
|
functions: ["deliver"]
|
|
30959
30968
|
},
|
|
30960
30969
|
release: {
|
|
30961
|
-
|
|
30970
|
+
pkgs: [MAINNET_A2A_ESCROW_PACKAGE_ID, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30962
30971
|
module: "escrow",
|
|
30963
30972
|
functions: ["release"]
|
|
30964
30973
|
},
|
|
30965
30974
|
reject: {
|
|
30966
|
-
|
|
30975
|
+
pkgs: [MAINNET_A2A_ESCROW_PACKAGE_ID, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30967
30976
|
module: "escrow",
|
|
30968
30977
|
functions: ["reject"]
|
|
30969
30978
|
},
|
|
30970
30979
|
refund: {
|
|
30971
|
-
|
|
30980
|
+
pkgs: [MAINNET_A2A_ESCROW_PACKAGE_ID, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30972
30981
|
module: "escrow",
|
|
30973
30982
|
functions: ["refund"]
|
|
30974
30983
|
},
|
|
30975
30984
|
// v3 opening package — note the `escrow` module.
|
|
30976
30985
|
decline: {
|
|
30977
|
-
|
|
30986
|
+
pkgs: [MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30978
30987
|
module: "escrow",
|
|
30979
30988
|
functions: ["decline"]
|
|
30980
30989
|
},
|
|
30981
30990
|
// Open board.
|
|
30982
30991
|
"open-create": {
|
|
30983
|
-
|
|
30992
|
+
pkgs: [MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30984
30993
|
module: "opening",
|
|
30985
30994
|
functions: ["create_open"]
|
|
30986
30995
|
},
|
|
30987
30996
|
"open-claim": {
|
|
30988
|
-
|
|
30997
|
+
pkgs: [MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30989
30998
|
module: "opening",
|
|
30990
30999
|
functions: ["claim"]
|
|
30991
31000
|
},
|
|
30992
31001
|
"open-cancel": {
|
|
30993
|
-
|
|
31002
|
+
pkgs: [MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30994
31003
|
module: "opening",
|
|
30995
31004
|
functions: ["cancel_open"]
|
|
30996
31005
|
},
|
|
30997
31006
|
"open-refund": {
|
|
30998
|
-
|
|
31007
|
+
pkgs: [MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID],
|
|
30999
31008
|
module: "opening",
|
|
31000
31009
|
functions: ["refund_unclaimed"]
|
|
31001
31010
|
}
|
|
31002
31011
|
};
|
|
31012
|
+
var SUI_FRAMEWORK_PACKAGE = normalizeSuiAddress("0x2");
|
|
31013
|
+
var FRAMEWORK_PRELUDE = {
|
|
31014
|
+
coin: /* @__PURE__ */ new Set(["redeem_funds", "into_balance", "zero", "destroy_zero"]),
|
|
31015
|
+
balance: /* @__PURE__ */ new Set(["redeem_funds", "zero"])
|
|
31016
|
+
};
|
|
31003
31017
|
var HOST_PINNED_ONLY = /* @__PURE__ */ new Set(["register", "link", "confirm"]);
|
|
31004
31018
|
var allowUntrustedApi = false;
|
|
31005
31019
|
function setAllowUntrustedApi(value) {
|
|
@@ -31046,17 +31060,23 @@ function assertTxMatchesIntent(txBytes, intent, opts = {}) {
|
|
|
31046
31060
|
`Refusing to sign: "${intent.action}" is not a verb this wallet knows how to verify.`
|
|
31047
31061
|
);
|
|
31048
31062
|
}
|
|
31063
|
+
let sender;
|
|
31064
|
+
let inputs;
|
|
31049
31065
|
let calls;
|
|
31050
31066
|
try {
|
|
31051
31067
|
const tx = Transaction.from(
|
|
31052
31068
|
new Uint8Array(Buffer.from(txBytes, "base64"))
|
|
31053
31069
|
);
|
|
31054
|
-
|
|
31070
|
+
const data = tx.getData();
|
|
31071
|
+
sender = data.sender;
|
|
31072
|
+
inputs = data.inputs;
|
|
31073
|
+
calls = data.commands.flatMap(
|
|
31055
31074
|
(c) => c.$kind === "MoveCall" && c.MoveCall ? [
|
|
31056
31075
|
{
|
|
31057
31076
|
pkg: c.MoveCall.package,
|
|
31058
31077
|
module: c.MoveCall.module,
|
|
31059
|
-
fn: c.MoveCall.function
|
|
31078
|
+
fn: c.MoveCall.function,
|
|
31079
|
+
args: c.MoveCall.arguments ?? []
|
|
31060
31080
|
}
|
|
31061
31081
|
] : []
|
|
31062
31082
|
);
|
|
@@ -31070,22 +31090,65 @@ function assertTxMatchesIntent(txBytes, intent, opts = {}) {
|
|
|
31070
31090
|
"Refusing to sign: the prepared transaction contains no Move calls."
|
|
31071
31091
|
);
|
|
31072
31092
|
}
|
|
31093
|
+
const expectedPkgs = expected.pkgs.map((p) => normalizeSuiAddress(p));
|
|
31094
|
+
let foundIntent = false;
|
|
31073
31095
|
for (const call of calls) {
|
|
31074
|
-
if (call.pkg
|
|
31075
|
-
|
|
31076
|
-
|
|
31077
|
-
|
|
31078
|
-
|
|
31079
|
-
|
|
31080
|
-
|
|
31081
|
-
|
|
31082
|
-
|
|
31096
|
+
if (expectedPkgs.includes(normalizeSuiAddress(call.pkg))) {
|
|
31097
|
+
if (call.module !== expected.module) {
|
|
31098
|
+
throw new IntentMismatchError(
|
|
31099
|
+
`Refusing to sign: "${intent.action}" should call ${expected.module}, but the transaction calls ${call.module}.`
|
|
31100
|
+
);
|
|
31101
|
+
}
|
|
31102
|
+
if (!expected.functions.includes(call.fn)) {
|
|
31103
|
+
throw new IntentMismatchError(
|
|
31104
|
+
`Refusing to sign: "${intent.action}" should call ${expected.module}::${expected.functions.join("|")}, but the transaction calls ${call.module}::${call.fn}.`
|
|
31105
|
+
);
|
|
31106
|
+
}
|
|
31107
|
+
foundIntent = true;
|
|
31108
|
+
continue;
|
|
31083
31109
|
}
|
|
31084
|
-
if (
|
|
31085
|
-
|
|
31086
|
-
`Refusing to sign: "${intent.action}" should call ${expected.module}::${expected.functions.join("|")}, but the transaction calls ${call.module}::${call.fn}.`
|
|
31087
|
-
);
|
|
31110
|
+
if (isAllowedCoinPrelude(call, sender, inputs)) {
|
|
31111
|
+
continue;
|
|
31088
31112
|
}
|
|
31113
|
+
throw new IntentMismatchError(
|
|
31114
|
+
`Refusing to sign: "${intent.action}" targets package ${expected.pkgs.join(" | ")}, but the transaction calls ${call.pkg}::${call.module}::${call.fn}.`
|
|
31115
|
+
);
|
|
31116
|
+
}
|
|
31117
|
+
if (!foundIntent) {
|
|
31118
|
+
throw new IntentMismatchError(
|
|
31119
|
+
`Refusing to sign: "${intent.action}" should call ${expected.module}::${expected.functions.join("|")}, but the transaction never does.`
|
|
31120
|
+
);
|
|
31121
|
+
}
|
|
31122
|
+
}
|
|
31123
|
+
function isAllowedCoinPrelude(call, sender, inputs) {
|
|
31124
|
+
if (normalizeSuiAddress(call.pkg) !== SUI_FRAMEWORK_PACKAGE) {
|
|
31125
|
+
return false;
|
|
31126
|
+
}
|
|
31127
|
+
if (FRAMEWORK_PRELUDE[call.module]?.has(call.fn)) {
|
|
31128
|
+
return true;
|
|
31129
|
+
}
|
|
31130
|
+
if (call.module === "coin" && call.fn === "send_funds") {
|
|
31131
|
+
return isSenderRemainderReturn(call, sender, inputs);
|
|
31132
|
+
}
|
|
31133
|
+
return false;
|
|
31134
|
+
}
|
|
31135
|
+
function isSenderRemainderReturn(call, sender, inputs) {
|
|
31136
|
+
if (!sender) {
|
|
31137
|
+
return false;
|
|
31138
|
+
}
|
|
31139
|
+
const recipientArg = call.args[1];
|
|
31140
|
+
if (!recipientArg || recipientArg.$kind !== "Input" || typeof recipientArg.Input !== "number") {
|
|
31141
|
+
return false;
|
|
31142
|
+
}
|
|
31143
|
+
const input = inputs[recipientArg.Input];
|
|
31144
|
+
if (!input || input.$kind !== "Pure" || !input.Pure?.bytes) {
|
|
31145
|
+
return false;
|
|
31146
|
+
}
|
|
31147
|
+
try {
|
|
31148
|
+
const recipient = suiBcs.Address.fromBase64(input.Pure.bytes);
|
|
31149
|
+
return normalizeSuiAddress(recipient) === normalizeSuiAddress(sender);
|
|
31150
|
+
} catch {
|
|
31151
|
+
return false;
|
|
31089
31152
|
}
|
|
31090
31153
|
}
|
|
31091
31154
|
function describeIntent(intent, base) {
|
|
@@ -36946,7 +37009,7 @@ Examples:
|
|
|
36946
37009
|
$ t2 service retire sui-market-report
|
|
36947
37010
|
`
|
|
36948
37011
|
);
|
|
36949
|
-
group.command("create").description("List a service under your Agent ID (re-run to update it)").requiredOption("--name <name>", "Service name (max 80 chars)").requiredOption("--price <usdc>", "Fixed price in USDC (0.
|
|
37012
|
+
group.command("create").description("List a service under your Agent ID (re-run to update it)").requiredOption("--name <name>", "Service name (max 80 chars)").requiredOption("--price <usdc>", "Fixed price in USDC (0.05\u201350)").requiredOption("--sla <duration>", "Delivery SLA \u2014 e.g. 30m, 24h, 7d").requiredOption("--description <text>", "What this service is (max 2000 chars)").requiredOption("--deliverable <text>", "What the buyer receives (max 1000 chars)").option("--slug <slug>", "Machine name (default: derived from --name)").requiredOption(
|
|
36950
37013
|
"--requirements <file-or-json-or-text>",
|
|
36951
37014
|
"The questions buyers answer at hire (REQUIRED \u2014 the API rejects listings that ask nothing): free text, or a JSON object of field names \u2192 hints (keys enforced non-empty at hire; file path ok)"
|
|
36952
37015
|
).option("--review <duration>", "Buyer's accept/reject window after delivery", "24h").option("--split <bps>", "Buyer's share in bps if they reject (0\u201310000)", "8000").option(
|
|
@@ -36959,6 +37022,11 @@ Examples:
|
|
|
36959
37022
|
if (!Number.isFinite(priceUsdc) || priceUsdc <= 0) {
|
|
36960
37023
|
throw new Error(`--price must be a positive number (got "${opts.price}").`);
|
|
36961
37024
|
}
|
|
37025
|
+
if (priceUsdc < MIN_JOB_USDC) {
|
|
37026
|
+
throw new Error(
|
|
37027
|
+
`--price must be at least ${MIN_JOB_USDC} USDC \u2014 escrow jobs start there (contract-enforced minimum).`
|
|
37028
|
+
);
|
|
37029
|
+
}
|
|
36962
37030
|
const slaMinutes = Math.round(parseDuration(opts.sla) / 6e4);
|
|
36963
37031
|
const reviewWindowMinutes = Math.round(parseDuration(opts.review) / 6e4);
|
|
36964
37032
|
const rejectSplitBps = Number.parseInt(opts.split, 10);
|