x402-proxy 0.10.7 → 0.10.9
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/CHANGELOG.md +23 -1
- package/README.md +7 -1
- package/dist/Credential-COZQnr1-.js +2055 -0
- package/dist/Mcp-CrCEqLqO.js +10 -0
- package/dist/Sse-ChldYgU7.js +9742 -0
- package/dist/Sse-kCB38G56.js +16482 -0
- package/dist/accounts-DsuvWwph.js +232 -0
- package/dist/accounts-DzvAlQRn.js +5 -0
- package/dist/accounts-IG-Cmrwy.js +229 -0
- package/dist/api-CUzmQvTQ.js +2802 -0
- package/dist/auth-DTzQmnZ_.js +1196 -0
- package/dist/bin/cli.js +585 -242
- package/dist/ccip-Bx-zoUCJ.js +240 -0
- package/dist/ccip-C2k1DD1T.js +153 -0
- package/dist/ccip-C6CQOJYv.js +152 -0
- package/dist/ccip-RZzsZ5Mv.js +156 -0
- package/dist/chain-CafcHffR.js +1997 -0
- package/dist/chain-DwfP5RGZ.js +1968 -0
- package/dist/chunk-DBEY4PJZ.js +16 -0
- package/dist/chunk-DjEMn6fM.js +36 -0
- package/dist/client-Blw2V7LF.js +657 -0
- package/dist/client-C37gWJOZ.js +102 -0
- package/dist/client-CEc4NYAA.js +6388 -0
- package/dist/client-CVDTUY0l.js +5152 -0
- package/dist/config-BUQsit4s.js +3 -0
- package/dist/config-DR1Fs_wL.js +6600 -0
- package/dist/{config-D9wIR3xc.js → config-rvKA3SYT.js} +10 -5
- package/dist/decodeFunctionData-DuFcwhC_.js +4510 -0
- package/dist/decodeFunctionData-JPOUdvil.js +4394 -0
- package/dist/derive-DNUl8LU9.js +9109 -0
- package/dist/dist-C2YO6HSQ.js +6581 -0
- package/dist/dist-DM5_F3r5.js +4 -0
- package/dist/dist-DxJCYyL5.js +1388 -0
- package/dist/hashTypedData-BHmP9dBd.js +859 -0
- package/dist/hashTypedData-CtEdfx4y.js +846 -0
- package/dist/helpers-CuUSw-tH.js +7125 -0
- package/dist/hmac-59IlS_by.js +648 -0
- package/dist/http-BAtucMbS.js +2060 -0
- package/dist/index.d.ts +1903 -9
- package/dist/index.js +18006 -50
- package/dist/index.node-CxkL0OFh.js +3592 -0
- package/dist/index.node-DvmeuZBj.js +3 -0
- package/dist/isAddressEqual-BLrd1Hg1.js +9 -0
- package/dist/isAddressEqual-DsAqfQOD.js +10 -0
- package/dist/localBatchGatewayRequest-C-RPJyDO.js +6260 -0
- package/dist/localBatchGatewayRequest-DOdQ9bR7.js +93 -0
- package/dist/localBatchGatewayRequest-DQkbZaSy.js +6261 -0
- package/dist/parseUnits-CApwcKSD.js +49 -0
- package/dist/parseUnits-cMO2udMe.js +48 -0
- package/dist/schemas-BxMFYNbH.js +1270 -0
- package/dist/secp256k1-BZpiyffY.js +2525 -0
- package/dist/secp256k1-BjenrLl5.js +1877 -0
- package/dist/secp256k1-CLPUX17u.js +3 -0
- package/dist/sendRawTransactionSync-DvSkhZtW.js +3612 -0
- package/dist/server-CSq0IuUq.js +565 -0
- package/dist/setup-BY4J49Lv.js +1110 -0
- package/dist/setup-wMOAgrsN.js +3 -0
- package/dist/sha256-FAs0qeni.js +17 -0
- package/dist/sha3-CYkWM8Xa.js +195 -0
- package/dist/sha3-DbMJRJ3C.js +194 -0
- package/dist/sse-B4LLqBQm.js +408 -0
- package/dist/status-Bu23RjW6.js +3 -0
- package/dist/{status-DihAcUSC.js → status-X21VnGUO.js} +16 -15
- package/dist/stdio-BADqxZdZ.js +85 -0
- package/dist/streamableHttp-BHkJypcI.js +358 -0
- package/dist/tempo-3nttrxgQ.js +17 -0
- package/dist/tempo-DER0P-ul.js +18 -0
- package/dist/types-BEKUz-Mf.js +1240 -0
- package/dist/types-DatK5vR5.js +3 -0
- package/dist/utils-BYjkXZDF.js +444 -0
- package/dist/utils-SeGHMW9O.js +445 -0
- package/dist/wallet-DKVlrR1S.js +3 -0
- package/dist/wallet-DSyht15_.js +17759 -0
- package/package.json +18 -71
- package/dist/config-B_upkJeK.js +0 -66
- package/dist/config-Be35NM5s.js +0 -3
- package/dist/config-J1m-CWXT.js +0 -27
- package/dist/derive-CL6e8K0Z.js +0 -81
- package/dist/openclaw/plugin.d.ts +0 -15
- package/dist/openclaw/plugin.js +0 -2067
- package/dist/openclaw.plugin.json +0 -93
- package/dist/setup-CNyMLnM-.js +0 -197
- package/dist/setup-DTIxPe58.js +0 -3
- package/dist/status-DZlJ4pS7.js +0 -3
- package/dist/wallet-B0S-rma9.js +0 -544
- package/dist/wallet-DBrVZJqe.js +0 -3
- package/openclaw.plugin.json +0 -93
- package/skills/SKILL.md +0 -183
- package/skills/references/library.md +0 -85
- package/skills/references/openclaw-plugin.md +0 -145
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "x402-proxy",
|
|
3
|
-
"name": "mpp/x402 Payments Proxy",
|
|
4
|
-
"description": "x402 and MPP payments, wallet tools, and paid inference proxying",
|
|
5
|
-
"version": "1.0.0",
|
|
6
|
-
"providers": ["surf"],
|
|
7
|
-
"autoEnableWhenConfiguredProviders": ["surf"],
|
|
8
|
-
"skills": ["skills"],
|
|
9
|
-
"contracts": {
|
|
10
|
-
"tools": ["x_wallet", "x_balance", "x_request", "x_payment"]
|
|
11
|
-
},
|
|
12
|
-
"configSchema": {
|
|
13
|
-
"type": "object",
|
|
14
|
-
"additionalProperties": false,
|
|
15
|
-
"properties": {
|
|
16
|
-
"providers": {
|
|
17
|
-
"type": "object",
|
|
18
|
-
"description": "Provider catalog keyed by name. Defaults to the built-in surf provider when omitted.",
|
|
19
|
-
"additionalProperties": {
|
|
20
|
-
"type": "object",
|
|
21
|
-
"additionalProperties": false,
|
|
22
|
-
"properties": {
|
|
23
|
-
"baseUrl": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"description": "Gateway base path for this provider, typically under /x402-proxy"
|
|
26
|
-
},
|
|
27
|
-
"upstreamUrl": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"description": "Upstream inference origin to proxy to"
|
|
30
|
-
},
|
|
31
|
-
"protocol": {
|
|
32
|
-
"type": "string",
|
|
33
|
-
"enum": ["x402", "mpp", "auto"],
|
|
34
|
-
"description": "Payment protocol for this provider. Defaults to mpp."
|
|
35
|
-
},
|
|
36
|
-
"mppSessionBudget": {
|
|
37
|
-
"type": "string",
|
|
38
|
-
"description": "Maximum USDC budget to lock for MPP sessions for this provider (default: 0.5)"
|
|
39
|
-
},
|
|
40
|
-
"models": {
|
|
41
|
-
"type": "array",
|
|
42
|
-
"description": "Static OpenClaw model catalog entries for this provider"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"protocol": {
|
|
48
|
-
"type": "string",
|
|
49
|
-
"enum": ["x402", "mpp", "auto"],
|
|
50
|
-
"description": "Default payment protocol fallback for providers that do not override it."
|
|
51
|
-
},
|
|
52
|
-
"mppSessionBudget": {
|
|
53
|
-
"type": "string",
|
|
54
|
-
"description": "Default maximum USDC budget to lock for MPP sessions (default: 0.5)"
|
|
55
|
-
},
|
|
56
|
-
"keypairPath": {
|
|
57
|
-
"type": "string",
|
|
58
|
-
"description": "Optional path to Solana keypair JSON file (overrides x402-proxy wallet resolution for Solana/x402 surfaces)"
|
|
59
|
-
},
|
|
60
|
-
"rpcUrl": {
|
|
61
|
-
"type": "string",
|
|
62
|
-
"description": "Solana RPC URL"
|
|
63
|
-
},
|
|
64
|
-
"dashboardUrl": {
|
|
65
|
-
"type": "string",
|
|
66
|
-
"description": "URL to link from /x_wallet dashboard"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"required": []
|
|
70
|
-
},
|
|
71
|
-
"uiHints": {
|
|
72
|
-
"protocol": {
|
|
73
|
-
"label": "Default protocol",
|
|
74
|
-
"help": "Used only when a provider entry does not set its own protocol."
|
|
75
|
-
},
|
|
76
|
-
"mppSessionBudget": {
|
|
77
|
-
"label": "Default MPP budget",
|
|
78
|
-
"placeholder": "0.5"
|
|
79
|
-
},
|
|
80
|
-
"keypairPath": {
|
|
81
|
-
"label": "Solana keypair path",
|
|
82
|
-
"advanced": true
|
|
83
|
-
},
|
|
84
|
-
"rpcUrl": {
|
|
85
|
-
"label": "Solana RPC URL",
|
|
86
|
-
"advanced": true
|
|
87
|
-
},
|
|
88
|
-
"dashboardUrl": {
|
|
89
|
-
"label": "Dashboard URL",
|
|
90
|
-
"advanced": true
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
package/dist/setup-CNyMLnM-.js
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { c as isConfigured, d as saveConfig, i as getConfigDirShort, p as saveWalletFile, s as getWalletPath, u as loadWalletFile } from "./config-D9wIR3xc.js";
|
|
3
|
-
import { n as deriveSolanaKeypair, r as generateMnemonic, t as deriveEvmKeypair } from "./derive-CL6e8K0Z.js";
|
|
4
|
-
import { buildCommand } from "@stricli/core";
|
|
5
|
-
import pc from "picocolors";
|
|
6
|
-
import * as prompts from "@clack/prompts";
|
|
7
|
-
//#region src/commands/setup.ts
|
|
8
|
-
async function runSetup(opts) {
|
|
9
|
-
const nonInteractive = opts?.nonInteractive ?? false;
|
|
10
|
-
if (nonInteractive && isConfigured() && !opts?.force) {
|
|
11
|
-
const walletFile = loadWalletFile();
|
|
12
|
-
if (walletFile) {
|
|
13
|
-
process.stdout.write(`${JSON.stringify({
|
|
14
|
-
base: walletFile.addresses.evm,
|
|
15
|
-
tempo: walletFile.addresses.evm,
|
|
16
|
-
solana: walletFile.addresses.solana
|
|
17
|
-
})}\n`);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
if (isConfigured() && !opts?.force) {
|
|
22
|
-
prompts.log.warn(`Already configured. Wallet at ${pc.dim(getWalletPath())}\nTo reconfigure, run:\n ${pc.cyan("$ npx x402-proxy setup --force")}`);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
let mnemonic;
|
|
26
|
-
if (nonInteractive) {
|
|
27
|
-
if (opts?.importMnemonic) {
|
|
28
|
-
const words = opts.importMnemonic.trim().split(/\s+/);
|
|
29
|
-
if (words.length !== 12 && words.length !== 24) {
|
|
30
|
-
process.stderr.write("Error: mnemonic must be 12 or 24 words\n");
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
mnemonic = opts.importMnemonic.trim();
|
|
34
|
-
} else mnemonic = generateMnemonic();
|
|
35
|
-
const evm = deriveEvmKeypair(mnemonic);
|
|
36
|
-
const sol = deriveSolanaKeypair(mnemonic);
|
|
37
|
-
saveWalletFile({
|
|
38
|
-
version: 1,
|
|
39
|
-
mnemonic,
|
|
40
|
-
addresses: {
|
|
41
|
-
evm: evm.address,
|
|
42
|
-
solana: sol.address
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
saveConfig({ preferredProtocol: "x402" });
|
|
46
|
-
process.stdout.write(`${JSON.stringify({
|
|
47
|
-
base: evm.address,
|
|
48
|
-
tempo: evm.address,
|
|
49
|
-
solana: sol.address
|
|
50
|
-
})}\n`);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
prompts.intro(pc.cyan("x402-proxy setup"));
|
|
54
|
-
prompts.log.info("This will generate a single BIP-39 mnemonic that derives wallets for both Solana and EVM chains.");
|
|
55
|
-
const action = await prompts.select({
|
|
56
|
-
message: "How would you like to set up your wallet?",
|
|
57
|
-
options: [{
|
|
58
|
-
value: "generate",
|
|
59
|
-
label: "Generate a new mnemonic"
|
|
60
|
-
}, {
|
|
61
|
-
value: "import",
|
|
62
|
-
label: "Import an existing mnemonic"
|
|
63
|
-
}]
|
|
64
|
-
});
|
|
65
|
-
if (prompts.isCancel(action)) {
|
|
66
|
-
prompts.cancel("Setup cancelled.");
|
|
67
|
-
process.exit(0);
|
|
68
|
-
}
|
|
69
|
-
if (action === "generate") {
|
|
70
|
-
mnemonic = generateMnemonic();
|
|
71
|
-
prompts.log.warn("Write down your mnemonic and store it safely. It will NOT be shown again.");
|
|
72
|
-
prompts.log.message(pc.bold(mnemonic));
|
|
73
|
-
} else {
|
|
74
|
-
const input = await prompts.text({
|
|
75
|
-
message: "Enter your 24-word mnemonic:",
|
|
76
|
-
validate: (v = "") => {
|
|
77
|
-
const words = v.trim().split(/\s+/);
|
|
78
|
-
if (words.length !== 12 && words.length !== 24) return "Mnemonic must be 12 or 24 words";
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
if (prompts.isCancel(input)) {
|
|
82
|
-
prompts.cancel("Setup cancelled.");
|
|
83
|
-
process.exit(0);
|
|
84
|
-
}
|
|
85
|
-
mnemonic = input.trim();
|
|
86
|
-
}
|
|
87
|
-
const evm = deriveEvmKeypair(mnemonic);
|
|
88
|
-
const sol = deriveSolanaKeypair(mnemonic);
|
|
89
|
-
prompts.log.success(`Base address: ${pc.green(evm.address)}`);
|
|
90
|
-
prompts.log.success(`Tempo address: ${pc.green(evm.address)}`);
|
|
91
|
-
prompts.log.success(`Solana address: ${pc.green(sol.address)}`);
|
|
92
|
-
saveWalletFile({
|
|
93
|
-
version: 1,
|
|
94
|
-
mnemonic,
|
|
95
|
-
addresses: {
|
|
96
|
-
evm: evm.address,
|
|
97
|
-
solana: sol.address
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
const protocol = await prompts.select({
|
|
101
|
-
message: "Preferred payment protocol?",
|
|
102
|
-
options: [{
|
|
103
|
-
value: "x402",
|
|
104
|
-
label: "x402 - on-chain payments (Base, Solana)"
|
|
105
|
-
}, {
|
|
106
|
-
value: "mpp",
|
|
107
|
-
label: "MPP - machine payments over HTTP 402 (Tempo)"
|
|
108
|
-
}]
|
|
109
|
-
});
|
|
110
|
-
if (prompts.isCancel(protocol)) {
|
|
111
|
-
prompts.cancel("Setup cancelled.");
|
|
112
|
-
process.exit(0);
|
|
113
|
-
}
|
|
114
|
-
const networkOptions = protocol === "mpp" ? [{
|
|
115
|
-
value: "tempo",
|
|
116
|
-
label: "Tempo"
|
|
117
|
-
}] : [
|
|
118
|
-
{
|
|
119
|
-
value: "auto",
|
|
120
|
-
label: "Auto-detect (pick chain with highest balance)"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
value: "base",
|
|
124
|
-
label: "Base (EVM)"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
value: "solana",
|
|
128
|
-
label: "Solana"
|
|
129
|
-
}
|
|
130
|
-
];
|
|
131
|
-
const network = await prompts.select({
|
|
132
|
-
message: "Preferred network?",
|
|
133
|
-
options: networkOptions
|
|
134
|
-
});
|
|
135
|
-
if (prompts.isCancel(network)) {
|
|
136
|
-
prompts.cancel("Setup cancelled.");
|
|
137
|
-
process.exit(0);
|
|
138
|
-
}
|
|
139
|
-
const config = { preferredProtocol: protocol };
|
|
140
|
-
if (network !== "auto") config.defaultNetwork = network;
|
|
141
|
-
saveConfig(config);
|
|
142
|
-
prompts.log.info(`Config directory: ${pc.dim(getConfigDirShort())}`);
|
|
143
|
-
prompts.log.step("Fund your wallets to start using x402 resources:");
|
|
144
|
-
prompts.log.message(` Solana (USDC): Send USDC to ${pc.cyan(sol.address)}`);
|
|
145
|
-
prompts.log.message(` Base (USDC): Send USDC to ${pc.cyan(evm.address)}`);
|
|
146
|
-
prompts.log.step("Try your first request:");
|
|
147
|
-
prompts.log.message(` ${pc.cyan(`$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user`)}`);
|
|
148
|
-
prompts.outro(pc.green("Setup complete!"));
|
|
149
|
-
}
|
|
150
|
-
const setupCommand = buildCommand({
|
|
151
|
-
docs: {
|
|
152
|
-
brief: "Set up x402-proxy wallet (generate new or import existing mnemonic)",
|
|
153
|
-
fullDescription: `Set up x402-proxy wallet interactively, or use --non-interactive for automated environments.
|
|
154
|
-
|
|
155
|
-
Non-interactive mode auto-generates a wallet and outputs JSON to stdout:
|
|
156
|
-
$ npx x402-proxy setup --non-interactive
|
|
157
|
-
{"base":"0x...","tempo":"0x...","solana":"..."}
|
|
158
|
-
|
|
159
|
-
Import an existing mnemonic non-interactively:
|
|
160
|
-
$ npx x402-proxy setup --non-interactive --import-mnemonic "word1 word2 ... word24"
|
|
161
|
-
|
|
162
|
-
If a wallet already exists, --non-interactive outputs the existing addresses.`
|
|
163
|
-
},
|
|
164
|
-
parameters: {
|
|
165
|
-
flags: {
|
|
166
|
-
force: {
|
|
167
|
-
kind: "boolean",
|
|
168
|
-
brief: "Overwrite existing configuration",
|
|
169
|
-
default: false
|
|
170
|
-
},
|
|
171
|
-
nonInteractive: {
|
|
172
|
-
kind: "boolean",
|
|
173
|
-
brief: "Auto-generate wallet and output addresses as JSON (no prompts)",
|
|
174
|
-
default: false
|
|
175
|
-
},
|
|
176
|
-
importMnemonic: {
|
|
177
|
-
kind: "parsed",
|
|
178
|
-
brief: "Import a BIP-39 mnemonic (use with --non-interactive)",
|
|
179
|
-
parse: String,
|
|
180
|
-
optional: true
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
positional: {
|
|
184
|
-
kind: "tuple",
|
|
185
|
-
parameters: []
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
async func(flags) {
|
|
189
|
-
await runSetup({
|
|
190
|
-
force: flags.force,
|
|
191
|
-
nonInteractive: flags.nonInteractive,
|
|
192
|
-
importMnemonic: flags.importMnemonic
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
//#endregion
|
|
197
|
-
export { setupCommand as n, runSetup as t };
|
package/dist/setup-DTIxPe58.js
DELETED
package/dist/status-DZlJ4pS7.js
DELETED