@mysten-incubation/suipay-mcp 0.3.0-dev.22 → 0.3.0-dev.24
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/README.md
CHANGED
|
@@ -5,7 +5,7 @@ buyer-funded spend account. The buyer owns the account. The agent holds the
|
|
|
5
5
|
delegate key and can spend only under the on-chain grant (recipient bind,
|
|
6
6
|
per-payment cap, budget).
|
|
7
7
|
|
|
8
|
-
Pin `@mysten-incubation/suipay-mcp@0.3.0-dev.
|
|
8
|
+
Pin `@mysten-incubation/suipay-mcp@0.3.0-dev.24` in MCP config for the `latest` dist-tag.
|
|
9
9
|
`npx -y @mysten-incubation/suipay-mcp@dev` tracks the `dev` prerelease line.
|
|
10
10
|
`1.0.1` remains on the registry as a historical release; do not install it
|
|
11
11
|
for new agents.
|
|
@@ -13,7 +13,7 @@ for new agents.
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
claude mcp add --scope user suipay -- npx -y @mysten-incubation/suipay-mcp@0.3.0-dev.
|
|
16
|
+
claude mcp add --scope user suipay -- npx -y @mysten-incubation/suipay-mcp@0.3.0-dev.24
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
`@dev` installs the Railway-dev gateway/console defaults. A workspace
|
|
@@ -161,10 +161,10 @@ Default is Railway **suipay-dev**. `--local` / `target: "local"` is laptop-only.
|
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
163
|
# Railway suipay-dev (default)
|
|
164
|
-
npx @mysten-incubation/suipay-mcp@0.3.0-dev.
|
|
164
|
+
npx @mysten-incubation/suipay-mcp@0.3.0-dev.24
|
|
165
165
|
|
|
166
166
|
# Laptop stack
|
|
167
|
-
npx @mysten-incubation/suipay-mcp@0.3.0-dev.
|
|
167
|
+
npx @mysten-incubation/suipay-mcp@0.3.0-dev.24 --local
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
`SUIPAY_MCP_TARGET=local|dev` selects the same preset. Explicit
|
package/dist/bin/suipay.js
CHANGED
|
@@ -1360,6 +1360,24 @@ function createSpendAccountChain(options) {
|
|
|
1360
1360
|
return null;
|
|
1361
1361
|
}
|
|
1362
1362
|
},
|
|
1363
|
+
async readGrantLastChange(grantObjectId) {
|
|
1364
|
+
try {
|
|
1365
|
+
const { object } = await client.core.getObject({
|
|
1366
|
+
objectId: grantObjectId,
|
|
1367
|
+
include: { json: true, previousTransaction: true }
|
|
1368
|
+
});
|
|
1369
|
+
const json = object?.json;
|
|
1370
|
+
if (!json || typeof json.revoked !== "boolean")
|
|
1371
|
+
return null;
|
|
1372
|
+
const previous = object?.previousTransaction;
|
|
1373
|
+
return {
|
|
1374
|
+
revoked: json.revoked,
|
|
1375
|
+
previousTransaction: typeof previous === "string" && previous.trim() ? previous.trim() : null
|
|
1376
|
+
};
|
|
1377
|
+
} catch {
|
|
1378
|
+
return null;
|
|
1379
|
+
}
|
|
1380
|
+
},
|
|
1363
1381
|
async readPolicyBudget({ poolObjectId, onChainPolicyId }) {
|
|
1364
1382
|
try {
|
|
1365
1383
|
const response = await client.core.getDynamicField({
|
|
@@ -1484,13 +1502,18 @@ var GUARDED_DELEGATE_ARG_LAYOUT = {
|
|
|
1484
1502
|
recipient: null,
|
|
1485
1503
|
amount: 6,
|
|
1486
1504
|
paymentIdHash: 7,
|
|
1487
|
-
expiresAtMs: 9
|
|
1505
|
+
expiresAtMs: 9,
|
|
1506
|
+
// After clock (10): chain id, refund config, decide window, refund window.
|
|
1507
|
+
decideWindowMs: 13,
|
|
1508
|
+
refundWindowMs: 14
|
|
1488
1509
|
},
|
|
1489
1510
|
settle_any_recipient_to_refund_vault: {
|
|
1490
1511
|
recipient: 4,
|
|
1491
1512
|
amount: 5,
|
|
1492
1513
|
paymentIdHash: 6,
|
|
1493
|
-
expiresAtMs: 9
|
|
1514
|
+
expiresAtMs: 9,
|
|
1515
|
+
decideWindowMs: 13,
|
|
1516
|
+
refundWindowMs: 14
|
|
1494
1517
|
}
|
|
1495
1518
|
};
|
|
1496
1519
|
function pureBytesOf(data, arg) {
|
|
@@ -1570,11 +1593,48 @@ function recoverGuardedDelegateCalls(finalized) {
|
|
|
1570
1593
|
paymentIdHash: readPureVectorU8Hex(data, args[layout.paymentIdHash]),
|
|
1571
1594
|
amount: readPureU64(data, args[layout.amount]),
|
|
1572
1595
|
recipient: layout.recipient === null ? null : readPureAddress(data, args[layout.recipient]),
|
|
1573
|
-
expiresAtMs: readPureU64(data, args[layout.expiresAtMs])
|
|
1596
|
+
expiresAtMs: readPureU64(data, args[layout.expiresAtMs]),
|
|
1597
|
+
..."decideWindowMs" in layout ? {
|
|
1598
|
+
decideWindowMs: readPureU64(data, args[layout.decideWindowMs]),
|
|
1599
|
+
refundWindowMs: readPureU64(data, args[layout.refundWindowMs])
|
|
1600
|
+
} : {}
|
|
1574
1601
|
});
|
|
1575
1602
|
}
|
|
1576
1603
|
return calls;
|
|
1577
1604
|
}
|
|
1605
|
+
var VAULT_SETTLEMENT_TS_TIMEOUT_MS = 1e4;
|
|
1606
|
+
function withTimeout(work, ms, label) {
|
|
1607
|
+
return new Promise((resolve2, reject2) => {
|
|
1608
|
+
const timer = setTimeout(() => reject2(new Error(`${label} timed out after ${ms}ms`)), ms);
|
|
1609
|
+
Promise.resolve(work).then((value) => {
|
|
1610
|
+
clearTimeout(timer);
|
|
1611
|
+
resolve2(value);
|
|
1612
|
+
}, (err) => {
|
|
1613
|
+
clearTimeout(timer);
|
|
1614
|
+
reject2(err);
|
|
1615
|
+
});
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
async function readVaultSettlementMs(client, digest) {
|
|
1619
|
+
const ledger = client.ledgerService;
|
|
1620
|
+
if (!ledger?.getTransaction)
|
|
1621
|
+
return void 0;
|
|
1622
|
+
try {
|
|
1623
|
+
const call = await withTimeout(ledger.getTransaction({
|
|
1624
|
+
digest,
|
|
1625
|
+
readMask: { paths: ["timestamp"] }
|
|
1626
|
+
}), VAULT_SETTLEMENT_TS_TIMEOUT_MS, "vault settlement timestamp read");
|
|
1627
|
+
const ts = call.response.transaction?.timestamp;
|
|
1628
|
+
if (!ts || ts.seconds === void 0)
|
|
1629
|
+
return void 0;
|
|
1630
|
+
const seconds = Number(ts.seconds);
|
|
1631
|
+
if (!Number.isFinite(seconds))
|
|
1632
|
+
return void 0;
|
|
1633
|
+
return seconds * 1e3 + Math.floor((ts.nanos ?? 0) / 1e6);
|
|
1634
|
+
} catch {
|
|
1635
|
+
return void 0;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1578
1638
|
function createSpendAccountSettledTxReader(options) {
|
|
1579
1639
|
const network = toGrpcNetwork(options.network);
|
|
1580
1640
|
const client = options.client ?? createFailoverGrpcClient({
|
|
@@ -1629,6 +1689,7 @@ function createSpendAccountSettledTxReader(options) {
|
|
|
1629
1689
|
kind: e.eventType.split("::").pop() ?? e.eventType
|
|
1630
1690
|
}));
|
|
1631
1691
|
const guardedDelegateCalls = recoverGuardedDelegateCalls(finalized);
|
|
1692
|
+
const timestampMs = events.some((event) => event.kind === "VaultOpened") ? await readVaultSettlementMs(client, digest) : void 0;
|
|
1632
1693
|
return {
|
|
1633
1694
|
status: "success",
|
|
1634
1695
|
txDigest: digest,
|
|
@@ -1636,7 +1697,8 @@ function createSpendAccountSettledTxReader(options) {
|
|
|
1636
1697
|
moveCalls,
|
|
1637
1698
|
objectIds,
|
|
1638
1699
|
events,
|
|
1639
|
-
guardedDelegateCalls
|
|
1700
|
+
guardedDelegateCalls,
|
|
1701
|
+
...timestampMs !== void 0 ? { timestampMs } : {}
|
|
1640
1702
|
};
|
|
1641
1703
|
}
|
|
1642
1704
|
};
|
package/dist/http.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadBootProfile,
|
|
3
3
|
main
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DEOKRJ4A.js";
|
|
5
5
|
import {
|
|
6
6
|
MCP_TARGET_PRESETS,
|
|
7
7
|
PACKAGE_NAME,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
settlePreparedMcpPayment,
|
|
27
27
|
traceMcpHttpRequest,
|
|
28
28
|
verifySpendAccountPayReconstructs
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-UWD4OSIC.js";
|
|
30
30
|
export {
|
|
31
31
|
MCP_TARGET_PRESETS,
|
|
32
32
|
PACKAGE_NAME,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mysten-incubation/suipay-mcp",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SuiPay MCP — pay MPP-gated APIs from a spend-account grant with an agent-held delegate key.",
|
|
6
6
|
"repository": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"tsup": "^8.0.0",
|
|
43
43
|
"typescript": "^6.0.3",
|
|
44
44
|
"vitest": "^4.1.10",
|
|
45
|
-
"@cmdoss/suipay-
|
|
46
|
-
"@cmdoss/suipay-
|
|
45
|
+
"@cmdoss/suipay-sdk": "0.1.0",
|
|
46
|
+
"@cmdoss/suipay-core": "0.1.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsup",
|