@one-source/api-mcp 5.2.1 → 5.3.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/README.md +8 -5
- package/README.npm.md +8 -5
- package/README.repo.md +8 -5
- package/dist/tools/chain/refund.d.ts +6 -0
- package/dist/tools/chain/refund.d.ts.map +1 -0
- package/dist/tools/chain/refund.js +23 -0
- package/dist/tools/chain/refund.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/x402.d.ts +19 -0
- package/dist/x402.d.ts.map +1 -1
- package/dist/x402.js +162 -23
- package/dist/x402.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# onesource-api-mcp
|
|
2
2
|
|
|
3
|
-
MCP server for OneSource blockchain data.
|
|
3
|
+
MCP server for OneSource blockchain data. 27 named tools for balances, NFTs, transactions, events, and live chain queries via API key or x402 micropayments.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
npx onesource-api-mcp
|
|
@@ -23,7 +23,7 @@ claude mcp add onesource-api -- npx onesource-api-mcp
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
## Tools (
|
|
26
|
+
## Tools (27)
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
### Live Chain Data (12 tools)
|
|
@@ -62,11 +62,12 @@ claude mcp add onesource-api -- npx onesource-api-mcp
|
|
|
62
62
|
| `1s_storage_read` | Read storage slot |
|
|
63
63
|
| `1s_tx_receipt` | Transaction receipt |
|
|
64
64
|
|
|
65
|
-
###
|
|
65
|
+
### Payments (2 tools)
|
|
66
66
|
|
|
67
67
|
| Tool | Description |
|
|
68
68
|
|------|-------------|
|
|
69
69
|
| `1s_payment_mode` | View or switch the x402 payment scheme (`exact` per-call vs `batch` payment channel) |
|
|
70
|
+
| `1s_refund` | Refund unused `batch` channel balance back to your wallet on demand |
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
## Networks
|
|
@@ -117,6 +118,8 @@ X402_PRIVATE_KEY=your-private-key-hex npx onesource-api-mcp
|
|
|
117
118
|
|
|
118
119
|
Payments default to the **exact** scheme (one USDC payment per call). For a burst of calls you can switch to **batch** settlement — a payment channel that funds many off-chain calls from a single on-chain deposit, settled with one claim — by calling the `1s_payment_mode` tool with `{ "mode": "batch" }`, or by setting `X402_PAYMENT_MODE=batch`. Both modes use the same wallet.
|
|
119
120
|
|
|
121
|
+
In batch mode the first paid call deposits `price × X402_DEPOSIT_MULTIPLIER` (default 10) up front, so a session typically over-funds the channel. Reclaim the unused balance whenever you're done with the `1s_refund` tool; idle channels are also auto-refunded by the receiver after a few hours. The deposit residual is always recoverable.
|
|
122
|
+
|
|
120
123
|
### No auth
|
|
121
124
|
|
|
122
125
|
Without either variable, tools work for free endpoints. Paid endpoints return 402 errors with a descriptive message.
|
|
@@ -132,8 +135,8 @@ Without either variable, tools work for free endpoints. Paid endpoints return 40
|
|
|
132
135
|
| `X402_PAYMENT_MODE` | `exact` | Initial x402 scheme: `exact` (per-call) or `batch` (payment channel). Switch in-session with the `1s_payment_mode` tool. |
|
|
133
136
|
| `X402_RPC_URL` | Base default | Base RPC endpoint used to submit channel deposits in batch mode |
|
|
134
137
|
| `X402_CHANNEL_DIR` | — | Directory to persist batch channel state across restarts. Unset = in-memory (channel lost on restart). |
|
|
135
|
-
| `X402_DEPOSIT_MULTIPLIER` | `
|
|
136
|
-
| `X402_CHANNEL_SALT` | zero | Batch mode: 32-byte hex salt to derive
|
|
138
|
+
| `X402_DEPOSIT_MULTIPLIER` | `10` | Batch mode: deposit = price × this multiplier, funding that many calls per channel. Unused balance is reclaimable via `1s_refund`. |
|
|
139
|
+
| `X402_CHANNEL_SALT` | zero | Batch mode: 32-byte hex salt to derive the starting channel id. The client auto-rotates to the next salt when a channel is exhausted or refunded. |
|
|
137
140
|
|
|
138
141
|
|
|
139
142
|
## License
|
package/README.npm.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# onesource-api-mcp
|
|
2
2
|
|
|
3
|
-
MCP server for OneSource blockchain data.
|
|
3
|
+
MCP server for OneSource blockchain data. 27 named tools for balances, NFTs, transactions, events, and live chain queries via API key or x402 micropayments.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
npx onesource-api-mcp
|
|
@@ -23,7 +23,7 @@ claude mcp add onesource-api -- npx onesource-api-mcp
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
## Tools (
|
|
26
|
+
## Tools (27)
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
### Live Chain Data (12 tools)
|
|
@@ -62,11 +62,12 @@ claude mcp add onesource-api -- npx onesource-api-mcp
|
|
|
62
62
|
| `1s_storage_read` | Read storage slot |
|
|
63
63
|
| `1s_tx_receipt` | Transaction receipt |
|
|
64
64
|
|
|
65
|
-
###
|
|
65
|
+
### Payments (2 tools)
|
|
66
66
|
|
|
67
67
|
| Tool | Description |
|
|
68
68
|
|------|-------------|
|
|
69
69
|
| `1s_payment_mode` | View or switch the x402 payment scheme (`exact` per-call vs `batch` payment channel) |
|
|
70
|
+
| `1s_refund` | Refund unused `batch` channel balance back to your wallet on demand |
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
## Networks
|
|
@@ -117,6 +118,8 @@ X402_PRIVATE_KEY=your-private-key-hex npx onesource-api-mcp
|
|
|
117
118
|
|
|
118
119
|
Payments default to the **exact** scheme (one USDC payment per call). For a burst of calls you can switch to **batch** settlement — a payment channel that funds many off-chain calls from a single on-chain deposit, settled with one claim — by calling the `1s_payment_mode` tool with `{ "mode": "batch" }`, or by setting `X402_PAYMENT_MODE=batch`. Both modes use the same wallet.
|
|
119
120
|
|
|
121
|
+
In batch mode the first paid call deposits `price × X402_DEPOSIT_MULTIPLIER` (default 10) up front, so a session typically over-funds the channel. Reclaim the unused balance whenever you're done with the `1s_refund` tool; idle channels are also auto-refunded by the receiver after a few hours. The deposit residual is always recoverable.
|
|
122
|
+
|
|
120
123
|
### No auth
|
|
121
124
|
|
|
122
125
|
Without either variable, tools work for free endpoints. Paid endpoints return 402 errors with a descriptive message.
|
|
@@ -132,8 +135,8 @@ Without either variable, tools work for free endpoints. Paid endpoints return 40
|
|
|
132
135
|
| `X402_PAYMENT_MODE` | `exact` | Initial x402 scheme: `exact` (per-call) or `batch` (payment channel). Switch in-session with the `1s_payment_mode` tool. |
|
|
133
136
|
| `X402_RPC_URL` | Base default | Base RPC endpoint used to submit channel deposits in batch mode |
|
|
134
137
|
| `X402_CHANNEL_DIR` | — | Directory to persist batch channel state across restarts. Unset = in-memory (channel lost on restart). |
|
|
135
|
-
| `X402_DEPOSIT_MULTIPLIER` | `
|
|
136
|
-
| `X402_CHANNEL_SALT` | zero | Batch mode: 32-byte hex salt to derive
|
|
138
|
+
| `X402_DEPOSIT_MULTIPLIER` | `10` | Batch mode: deposit = price × this multiplier, funding that many calls per channel. Unused balance is reclaimable via `1s_refund`. |
|
|
139
|
+
| `X402_CHANNEL_SALT` | zero | Batch mode: 32-byte hex salt to derive the starting channel id. The client auto-rotates to the next salt when a channel is exhausted or refunded. |
|
|
137
140
|
|
|
138
141
|
|
|
139
142
|
## License
|
package/README.repo.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# onesource-api-mcp
|
|
2
2
|
|
|
3
|
-
MCP server for OneSource blockchain data.
|
|
3
|
+
MCP server for OneSource blockchain data. 27 named tools for balances, NFTs, transactions, events, and live chain queries via API key or x402 micropayments.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
npx onesource-api-mcp
|
|
@@ -23,7 +23,7 @@ claude mcp add onesource-api -- npx onesource-api-mcp
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
## Tools (
|
|
26
|
+
## Tools (27)
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
### Live Chain Data (12 tools)
|
|
@@ -62,11 +62,12 @@ claude mcp add onesource-api -- npx onesource-api-mcp
|
|
|
62
62
|
| `1s_storage_read` | Read storage slot |
|
|
63
63
|
| `1s_tx_receipt` | Transaction receipt |
|
|
64
64
|
|
|
65
|
-
###
|
|
65
|
+
### Payments (2 tools)
|
|
66
66
|
|
|
67
67
|
| Tool | Description |
|
|
68
68
|
|------|-------------|
|
|
69
69
|
| `1s_payment_mode` | View or switch the x402 payment scheme (`exact` per-call vs `batch` payment channel) |
|
|
70
|
+
| `1s_refund` | Refund unused `batch` channel balance back to your wallet on demand |
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
## Networks
|
|
@@ -117,6 +118,8 @@ X402_PRIVATE_KEY=your-private-key-hex npx onesource-api-mcp
|
|
|
117
118
|
|
|
118
119
|
Payments default to the **exact** scheme (one USDC payment per call). For a burst of calls you can switch to **batch** settlement — a payment channel that funds many off-chain calls from a single on-chain deposit, settled with one claim — by calling the `1s_payment_mode` tool with `{ "mode": "batch" }`, or by setting `X402_PAYMENT_MODE=batch`. Both modes use the same wallet.
|
|
119
120
|
|
|
121
|
+
In batch mode the first paid call deposits `price × X402_DEPOSIT_MULTIPLIER` (default 10) up front, so a session typically over-funds the channel. Reclaim the unused balance whenever you're done with the `1s_refund` tool; idle channels are also auto-refunded by the receiver after a few hours. The deposit residual is always recoverable.
|
|
122
|
+
|
|
120
123
|
### No auth
|
|
121
124
|
|
|
122
125
|
Without either variable, tools work for free endpoints. Paid endpoints return 402 errors with a descriptive message.
|
|
@@ -132,8 +135,8 @@ Without either variable, tools work for free endpoints. Paid endpoints return 40
|
|
|
132
135
|
| `X402_PAYMENT_MODE` | `exact` | Initial x402 scheme: `exact` (per-call) or `batch` (payment channel). Switch in-session with the `1s_payment_mode` tool. |
|
|
133
136
|
| `X402_RPC_URL` | Base default | Base RPC endpoint used to submit channel deposits in batch mode |
|
|
134
137
|
| `X402_CHANNEL_DIR` | — | Directory to persist batch channel state across restarts. Unset = in-memory (channel lost on restart). |
|
|
135
|
-
| `X402_DEPOSIT_MULTIPLIER` | `
|
|
136
|
-
| `X402_CHANNEL_SALT` | zero | Batch mode: 32-byte hex salt to derive
|
|
138
|
+
| `X402_DEPOSIT_MULTIPLIER` | `10` | Batch mode: deposit = price × this multiplier, funding that many calls per channel. Unused balance is reclaimable via `1s_refund`. |
|
|
139
|
+
| `X402_CHANNEL_SALT` | zero | Batch mode: 32-byte hex salt to derive the starting channel id. The client auto-rotates to the next salt when a channel is exhausted or refunded. |
|
|
137
140
|
| `ONESOURCE_ANALYTICS` | `true` | Set `false` to disable all analytics |
|
|
138
141
|
| `ONESOURCE_ANALYTICS_URL` | `https://1s-analytics.vercel.app` | Dashboard endpoint for event ingestion (baked in by default) |
|
|
139
142
|
| `X402_ANALYTICS_KEY` | `onesource-api-mcp` | Bearer token for the analytics dashboard (baked in by default) |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../../src/tools/chain/refund.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,IAAI,EAAE,OAuBlB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getPaymentModeInfo, refundBatchChannel } from '../../x402.js';
|
|
2
|
+
export const tool = {
|
|
3
|
+
name: '1s_refund',
|
|
4
|
+
description: 'Refund unused balance from your x402 batch payment channel back to your wallet on Base. ' +
|
|
5
|
+
'Batch mode deposits enough USDC up front to cover many calls (price × deposit multiplier); ' +
|
|
6
|
+
'whatever you do not spend stays locked in the channel. ' +
|
|
7
|
+
'Call this when you are done making batch calls to get the leftover escrow back right away, ' +
|
|
8
|
+
'instead of waiting for the gateway\'s automatic idle refund. Refunds the full remaining balance. ' +
|
|
9
|
+
'Only relevant when paying via x402 in batch mode (X402_PRIVATE_KEY set); with an API key, calls are covered by your plan and there is nothing to refund.',
|
|
10
|
+
category: 'chain',
|
|
11
|
+
schema: {},
|
|
12
|
+
handler: async () => {
|
|
13
|
+
const info = getPaymentModeInfo();
|
|
14
|
+
if (!info.enabled) {
|
|
15
|
+
return ('x402 payment is not active in this session, so there is no channel balance to refund. ' +
|
|
16
|
+
'Refunds apply only when paying per-call via x402 (set X402_PRIVATE_KEY to a funded Base wallet). ' +
|
|
17
|
+
'With an API key (ONESOURCE_API_KEY), calls are covered by your plan and no x402 payment is made.');
|
|
18
|
+
}
|
|
19
|
+
const res = await refundBatchChannel();
|
|
20
|
+
return res.message;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=refund.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refund.js","sourceRoot":"","sources":["../../../src/tools/chain/refund.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,CAAC,MAAM,IAAI,GAAY;IAC3B,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,0FAA0F;QAC1F,6FAA6F;QAC7F,yDAAyD;QACzD,6FAA6F;QAC7F,mGAAmG;QACnG,0JAA0J;IAC5J,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,MAAM,IAAI,GAAG,kBAAkB,EAAE,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,CACL,wFAAwF;gBACxF,mGAAmG;gBACnG,kGAAkG,CACnG,CAAC;QACJ,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,kBAAkB,EAAE,CAAC;QACvC,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAiC3C,eAAO,MAAM,QAAQ,EAAE,OAAO,EA+B7B,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { tool as nftMetadataLive } from './live/nft-metadata.js';
|
|
|
11
11
|
import { tool as nftOwnerLive } from './live/nft-owner.js';
|
|
12
12
|
import { tool as totalSupplyLive } from './live/total-supply.js';
|
|
13
13
|
import { tool as txDetailsLive } from './live/tx-details.js';
|
|
14
|
-
// --- Chain utilities (
|
|
14
|
+
// --- Chain utilities (15 tools) ---
|
|
15
15
|
import { tool as blockByNumber } from './chain/block-by-number.js';
|
|
16
16
|
import { tool as blockNumber } from './chain/block-number.js';
|
|
17
17
|
import { tool as chainId } from './chain/chain-id.js';
|
|
@@ -23,6 +23,7 @@ import { tool as nonce } from './chain/nonce.js';
|
|
|
23
23
|
import { tool as paymentMode } from './chain/payment-mode.js';
|
|
24
24
|
import { tool as pendingBlock } from './chain/pending-block.js';
|
|
25
25
|
import { tool as proxyDetect } from './chain/proxy-detect.js';
|
|
26
|
+
import { tool as refund } from './chain/refund.js';
|
|
26
27
|
import { tool as simulateCall } from './chain/simulate-call.js';
|
|
27
28
|
import { tool as storageRead } from './chain/storage-read.js';
|
|
28
29
|
import { tool as txReceipt } from './chain/tx-receipt.js';
|
|
@@ -52,6 +53,7 @@ export const allTools = [
|
|
|
52
53
|
paymentMode,
|
|
53
54
|
pendingBlock,
|
|
54
55
|
proxyDetect,
|
|
56
|
+
refund,
|
|
55
57
|
simulateCall,
|
|
56
58
|
storageRead,
|
|
57
59
|
txReceipt,
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":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AI,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,CAAC,MAAM,QAAQ,GAAc;IACjC,kBAAkB;IAClB,aAAa;IACb,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,UAAU;IACV,gBAAgB;IAChB,eAAe;IACf,YAAY;IACZ,eAAe;IACf,aAAa;IAEb,kBAAkB;IAClB,aAAa;IACb,WAAW;IACX,OAAO;IACP,YAAY;IACZ,UAAU;IACV,WAAW;IACX,WAAW;IACX,KAAK;IACL,WAAW;IACX,YAAY;IACZ,WAAW;IACX,MAAM;IACN,YAAY;IACZ,WAAW;IACX,SAAS;CACV,CAAC"}
|
package/dist/x402.d.ts
CHANGED
|
@@ -24,4 +24,23 @@ export declare function getPaymentMode(): PaymentMode;
|
|
|
24
24
|
export declare function setPaymentMode(mode: PaymentMode): PaymentMode;
|
|
25
25
|
/** Snapshot of payment state for the 1s_payment_mode tool. */
|
|
26
26
|
export declare function getPaymentModeInfo(): PaymentModeInfo;
|
|
27
|
+
export interface RefundResult {
|
|
28
|
+
ok: boolean;
|
|
29
|
+
/** Human-readable outcome, safe to surface directly to the user. */
|
|
30
|
+
message: string;
|
|
31
|
+
/** Refund transaction hash, when the receiver settled one. */
|
|
32
|
+
transaction?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Cooperatively refund the unused balance of the current batch payment channel
|
|
36
|
+
* back to the payer wallet. Probes {@link REFUND_PROBE_PATH} for the channel
|
|
37
|
+
* requirements, then asks the receiver (via its receiverAuthorizer) to sign and
|
|
38
|
+
* submit the on-chain refund. Always a full refund of the remaining escrow.
|
|
39
|
+
*
|
|
40
|
+
* Returns a structured result rather than throwing, so the calling tool can
|
|
41
|
+
* surface a clear message for the common "nothing to refund" / "no channel"
|
|
42
|
+
* cases. Uses the unwrapped global fetch (the SDK attaches the refund payload
|
|
43
|
+
* itself; the payment-wrapping fetch would wrongly try to pay the 402 probe).
|
|
44
|
+
*/
|
|
45
|
+
export declare function refundBatchChannel(): Promise<RefundResult>;
|
|
27
46
|
//# sourceMappingURL=x402.d.ts.map
|
package/dist/x402.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x402.d.ts","sourceRoot":"","sources":["../src/x402.ts"],"names":[],"mappings":"AA6BA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"x402.d.ts","sourceRoot":"","sources":["../src/x402.ts"],"names":[],"mappings":"AA6BA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;AAkB5C,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC;CACzB;AAiCD,wBAAgB,SAAS,IAAI,eAAe,CAkF3C;AA4BD,8BAA8B;AAC9B,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAK7D;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAuBD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAWD;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,YAAY,CAAC,CAgDhE"}
|
package/dist/x402.js
CHANGED
|
@@ -24,19 +24,22 @@ import { toClientEvmSigner } from '@x402/evm';
|
|
|
24
24
|
import { BatchSettlementEvmScheme } from '@x402/evm/batch-settlement/client';
|
|
25
25
|
import { FileClientChannelStorage } from '@x402/evm/batch-settlement/client/file-storage';
|
|
26
26
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
27
|
-
import { createPublicClient, http } from 'viem';
|
|
27
|
+
import { createPublicClient, http, numberToHex } from 'viem';
|
|
28
28
|
import { base } from 'viem/chains';
|
|
29
29
|
const ZERO_SALT = `0x${'0'.repeat(64)}`;
|
|
30
30
|
// Each channel's first paid call deposits depositMultiplier × the call price,
|
|
31
|
-
// funding that many calls before a top-up
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
// funding that many calls before a top-up is needed. We keep modest headroom
|
|
32
|
+
// (10 calls per deposit; e.g. 0.05 USDC at $0.005/call) rather than a large
|
|
33
|
+
// upfront lockup: top-ups are now safe — the gateway gates on confirmed onchain
|
|
34
|
+
// escrow (after the 2026-06-05 multiplier-5 free-call incident) and the client
|
|
35
|
+
// rotates the channel salt past dead/refunded channels — and any unspent
|
|
36
|
+
// balance is reclaimable via 1s_refund or the gateway's idle auto-refund.
|
|
37
|
+
// Override with X402_DEPOSIT_MULTIPLIER (SDK minimum is 3).
|
|
38
|
+
const DEFAULT_DEPOSIT_MULTIPLIER = 10;
|
|
39
|
+
// How many times one batch request will bump the channel salt to skip a dead
|
|
40
|
+
// channel before giving up (and letting the caller fall back to exact). Each
|
|
41
|
+
// bump is a fresh channelId; the failed verify that triggers it isn't charged.
|
|
42
|
+
const MAX_SALT_BUMPS = 8;
|
|
40
43
|
let _applied = false;
|
|
41
44
|
let _cachedResult;
|
|
42
45
|
// Runtime-mutable mode state. `setupX402` seeds it from X402_PAYMENT_MODE; the
|
|
@@ -45,6 +48,16 @@ let _enabled = false;
|
|
|
45
48
|
let _address;
|
|
46
49
|
let _mode = 'exact';
|
|
47
50
|
let _batchAvailable = false;
|
|
51
|
+
// The batch-settlement client scheme, retained at module scope so the
|
|
52
|
+
// `1s_refund` tool can call its cooperative-refund flow after setup.
|
|
53
|
+
let _batchScheme;
|
|
54
|
+
// Batch fetch + the machinery to rebuild it under a new channel salt. The salt
|
|
55
|
+
// is rotated when the current channel is dead (exhausted/refunded), so a refund
|
|
56
|
+
// doesn't permanently strand the wallet's batch path on one channelId.
|
|
57
|
+
let _batchFetch;
|
|
58
|
+
let _buildBatch;
|
|
59
|
+
let _baseSalt = ZERO_SALT;
|
|
60
|
+
let _saltOffset = 0n;
|
|
48
61
|
function initialMode() {
|
|
49
62
|
return process.env.X402_PAYMENT_MODE?.trim().toLowerCase() === 'batch'
|
|
50
63
|
? 'batch'
|
|
@@ -73,7 +86,9 @@ export function setupX402() {
|
|
|
73
86
|
// Built eagerly but lazily funded: no on-chain deposit happens until the
|
|
74
87
|
// first paid request is made while in batch mode. If construction fails
|
|
75
88
|
// (e.g. RPC misconfig), fall back to exact-only rather than crashing the MCP.
|
|
76
|
-
|
|
89
|
+
//
|
|
90
|
+
// _buildBatch (re)constructs the scheme for a given salt so the dispatcher can
|
|
91
|
+
// rotate to a fresh channelId when the current channel is dead — see bumpSalt.
|
|
77
92
|
try {
|
|
78
93
|
const publicClient = createPublicClient({
|
|
79
94
|
chain: base,
|
|
@@ -81,34 +96,84 @@ export function setupX402() {
|
|
|
81
96
|
});
|
|
82
97
|
const batchSigner = toClientEvmSigner(account, publicClient);
|
|
83
98
|
const channelDir = process.env.X402_CHANNEL_DIR?.trim() || undefined;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
_baseSalt = process.env.X402_CHANNEL_SALT?.trim() || ZERO_SALT;
|
|
100
|
+
_saltOffset = 0n;
|
|
101
|
+
_buildBatch = (salt) => {
|
|
102
|
+
const batchScheme = new BatchSettlementEvmScheme(batchSigner, {
|
|
103
|
+
depositPolicy: { depositMultiplier: depositMultiplier() },
|
|
104
|
+
salt,
|
|
105
|
+
...(channelDir ? { storage: new FileClientChannelStorage({ directory: channelDir }) } : {}),
|
|
106
|
+
});
|
|
107
|
+
const batchClient = new x402Client();
|
|
108
|
+
batchClient.register('eip155:*', batchScheme);
|
|
109
|
+
_batchScheme = batchScheme;
|
|
110
|
+
_batchFetch = wrapFetchWithPayment(fetch, batchClient);
|
|
111
|
+
};
|
|
112
|
+
// Initial build uses the base salt verbatim (no numberToHex) — offset 0.
|
|
113
|
+
_buildBatch(_baseSalt);
|
|
93
114
|
_batchAvailable = true;
|
|
94
115
|
}
|
|
95
116
|
catch (err) {
|
|
96
117
|
_batchAvailable = false;
|
|
118
|
+
_batchFetch = undefined;
|
|
119
|
+
_buildBatch = undefined;
|
|
97
120
|
console.error(`[onesource-api] warning: batch payment scheme unavailable (${err instanceof Error ? err.message : String(err)}); falling back to exact-only`);
|
|
98
121
|
}
|
|
99
122
|
_enabled = true;
|
|
100
123
|
_address = account.address;
|
|
101
124
|
_mode = initialMode();
|
|
102
125
|
// If batch was requested but is unavailable, stay on exact.
|
|
103
|
-
if (_mode === 'batch' && !
|
|
126
|
+
if (_mode === 'batch' && !_batchFetch)
|
|
104
127
|
_mode = 'exact';
|
|
105
128
|
// Dispatcher: route each request through the active scheme. Reads `_mode`
|
|
106
|
-
// live so in-session switches
|
|
107
|
-
|
|
129
|
+
// and `_batchFetch` live so in-session mode switches and salt rotations take
|
|
130
|
+
// effect immediately. In batch mode, a "channel exhausted/refunded" 402 means
|
|
131
|
+
// the deterministic channelId is dead; rotate the salt to a fresh channel and
|
|
132
|
+
// retry, bounded by MAX_SALT_BUMPS, so a prior refund can't strand batch.
|
|
133
|
+
const dispatchFetch = async (input, init) => {
|
|
134
|
+
if (!(_mode === 'batch' && _batchFetch))
|
|
135
|
+
return exactFetch(input, init);
|
|
136
|
+
let resp = await _batchFetch(input, init);
|
|
137
|
+
let bumps = 0;
|
|
138
|
+
while (_mode === 'batch' && bumps < MAX_SALT_BUMPS && (await isDeadChannel402(resp))) {
|
|
139
|
+
if (!bumpSalt())
|
|
140
|
+
break;
|
|
141
|
+
bumps += 1;
|
|
142
|
+
resp = await _batchFetch(input, init);
|
|
143
|
+
}
|
|
144
|
+
return resp;
|
|
145
|
+
};
|
|
108
146
|
_applied = true;
|
|
109
147
|
_cachedResult = { enabled: true, address: account.address, fetch: dispatchFetch };
|
|
110
148
|
return _cachedResult;
|
|
111
149
|
}
|
|
150
|
+
// isDeadChannel402 reports whether a response is a "this channel can't be
|
|
151
|
+
// reused" rejection — the deterministic channelId is exhausted or was refunded,
|
|
152
|
+
// so the voucher's cumulative can't be backed. Detected from the gateway's 402
|
|
153
|
+
// body reason (cumulative_exceeds_balance / cumulative_below_claimed). Cloning
|
|
154
|
+
// leaves the original body readable for the caller when we don't retry.
|
|
155
|
+
async function isDeadChannel402(resp) {
|
|
156
|
+
if (!resp || resp.status !== 402)
|
|
157
|
+
return false;
|
|
158
|
+
try {
|
|
159
|
+
const text = await resp.clone().text();
|
|
160
|
+
return /cumulative_exceeds_balance|cumulative_below_claimed/.test(text);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// bumpSalt advances the channel salt by one and rebuilds the batch scheme/fetch,
|
|
167
|
+
// so the next request opens a fresh channelId instead of the dead one. Returns
|
|
168
|
+
// false when batch isn't built (nothing to rebuild).
|
|
169
|
+
function bumpSalt() {
|
|
170
|
+
if (!_buildBatch)
|
|
171
|
+
return false;
|
|
172
|
+
_saltOffset += 1n;
|
|
173
|
+
const next = numberToHex(BigInt(_baseSalt) + _saltOffset, { size: 32 });
|
|
174
|
+
_buildBatch(next);
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
112
177
|
/** Current payment scheme. */
|
|
113
178
|
export function getPaymentMode() {
|
|
114
179
|
return _mode;
|
|
@@ -137,5 +202,79 @@ export function resetX402() {
|
|
|
137
202
|
_address = undefined;
|
|
138
203
|
_mode = 'exact';
|
|
139
204
|
_batchAvailable = false;
|
|
205
|
+
_batchScheme = undefined;
|
|
206
|
+
_batchFetch = undefined;
|
|
207
|
+
_buildBatch = undefined;
|
|
208
|
+
_baseSalt = ZERO_SALT;
|
|
209
|
+
_saltOffset = 0n;
|
|
210
|
+
}
|
|
211
|
+
// A batch-eligible (/api/chain/*) endpoint the refund flow probes for the
|
|
212
|
+
// channel's payment requirements (receiver, asset, receiverAuthorizer) — it's
|
|
213
|
+
// a plain unpaid GET that the gateway answers with a 402 challenge, so any
|
|
214
|
+
// such route works and the specific one is irrelevant to the wallet/channel.
|
|
215
|
+
const REFUND_PROBE_PATH = '/api/chain/block-number';
|
|
216
|
+
function atomicToUsdc(atomic) {
|
|
217
|
+
try {
|
|
218
|
+
const n = Number(BigInt(atomic)) / 1e6;
|
|
219
|
+
return n.toFixed(6).replace(/\.?0+$/, '');
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
return atomic;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Cooperatively refund the unused balance of the current batch payment channel
|
|
227
|
+
* back to the payer wallet. Probes {@link REFUND_PROBE_PATH} for the channel
|
|
228
|
+
* requirements, then asks the receiver (via its receiverAuthorizer) to sign and
|
|
229
|
+
* submit the on-chain refund. Always a full refund of the remaining escrow.
|
|
230
|
+
*
|
|
231
|
+
* Returns a structured result rather than throwing, so the calling tool can
|
|
232
|
+
* surface a clear message for the common "nothing to refund" / "no channel"
|
|
233
|
+
* cases. Uses the unwrapped global fetch (the SDK attaches the refund payload
|
|
234
|
+
* itself; the payment-wrapping fetch would wrongly try to pay the 402 probe).
|
|
235
|
+
*/
|
|
236
|
+
export async function refundBatchChannel() {
|
|
237
|
+
if (!_enabled) {
|
|
238
|
+
return { ok: false, message: 'x402 payment is not active in this session (set X402_PRIVATE_KEY).' };
|
|
239
|
+
}
|
|
240
|
+
if (!_batchScheme) {
|
|
241
|
+
return { ok: false, message: 'Batch payment channels are unavailable in this session, so there is nothing to refund.' };
|
|
242
|
+
}
|
|
243
|
+
const base = (process.env.ONESOURCE_BASE_URL ?? 'https://skills.onesource.io').replace(/\/+$/, '');
|
|
244
|
+
const probeUrl = base + REFUND_PROBE_PATH;
|
|
245
|
+
try {
|
|
246
|
+
const settle = (await _batchScheme.refund(probeUrl));
|
|
247
|
+
const tx = settle?.transaction;
|
|
248
|
+
const balance = settle?.extra?.channelState?.balance;
|
|
249
|
+
const remaining = typeof balance === 'string' ? ` Remaining channel balance: ${atomicToUsdc(balance)} USDC.` : '';
|
|
250
|
+
// The refunded channel is now closed; advance the salt so the next batch
|
|
251
|
+
// burst opens a fresh channelId rather than re-deriving the dead one.
|
|
252
|
+
bumpSalt();
|
|
253
|
+
return {
|
|
254
|
+
ok: true,
|
|
255
|
+
transaction: tx,
|
|
256
|
+
message: `Refund submitted${tx ? ` (tx ${tx})` : ''}.${remaining} ` +
|
|
257
|
+
`Unused channel escrow is being returned to ${_address ?? 'your wallet'} on Base.`,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
262
|
+
const lower = raw.toLowerCase();
|
|
263
|
+
if (lower.includes('no remaining balance') || lower.includes('amount_too_low')) {
|
|
264
|
+
return {
|
|
265
|
+
ok: false,
|
|
266
|
+
message: 'Nothing to refund — the channel has no unused balance (everything deposited has been spent or already refunded).',
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
if (lower.includes('existing channel record')) {
|
|
270
|
+
return {
|
|
271
|
+
ok: false,
|
|
272
|
+
message: 'No payment channel found for this wallet. Open one by making a call in batch mode first (1s_payment_mode → batch).',
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
// Collapse the SDK's own "Refund failed:" prefix(es) so we don't double it.
|
|
276
|
+
const clean = raw.replace(/^(refund failed:\s*)+/i, '');
|
|
277
|
+
return { ok: false, message: `Refund failed: ${clean}` };
|
|
278
|
+
}
|
|
140
279
|
}
|
|
141
280
|
//# sourceMappingURL=x402.js.map
|
package/dist/x402.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x402.js","sourceRoot":"","sources":["../src/x402.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"x402.js","sourceRoot":"","sources":["../src/x402.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mC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
|
"name": "@one-source/api-mcp",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "MCP server for OneSource blockchain data —
|
|
5
|
+
"description": "MCP server for OneSource blockchain data — 27 named tools for balances, NFTs, transactions, events, live chain queries, and x402 payment-mode + refund control via x402",
|
|
6
6
|
"bin": {
|
|
7
7
|
"onesource-api-mcp": "./dist/cli.js"
|
|
8
8
|
},
|