Skip to content

Commit 69992e6

Browse files
committed
feat(openclaw): add wallet setup via providerAuthChoices and /x_wallet setup
- Interactive wallet generate/import flow via OpenClaw gateway prompter - /x_wallet setup subcommand for Telegram/slash-command wallet creation - BIP-39 mnemonic validation on import - createWalletFile() helper, static imports in handler.ts - Updated example URLs and OpenClaw compat to 2026.4.1
1 parent 7bffcd3 commit 69992e6

17 files changed

Lines changed: 535 additions & 206 deletions

File tree

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [0.11.0] - 2026-04-02
6+
7+
### Added
8+
9+
- OpenClaw `providerAuthChoices` wallet setup flow - interactive generate/import via gateway prompter
10+
- `/x_wallet setup` subcommand for Telegram/slash-command wallet creation (generate or import mnemonic)
11+
- BIP-39 mnemonic validation on import (both interactive and slash-command paths)
12+
- `createWalletFile()` helper in config module
13+
14+
### Changed
15+
16+
- Converted dynamic imports in `handler.ts` to static imports (mppx, viem/accounts)
17+
- Updated example URLs from POST `{"ref":"CoinbaseDev"}` to simpler GET `/twitter/user/openclaw`
18+
- Usage examples now show `npx x402-proxy` prefix consistently
19+
- OpenClaw compat bumped to `2026.4.1`
20+
- Wallet-not-found error messages now suggest `/x_wallet setup` instead of CLI-only instructions
21+
22+
### Removed
23+
24+
- Default model display from `/x_wallet` info output
25+
26+
## [0.10.12] - 2026-04-02
27+
28+
### Fixed
29+
30+
- Restore explicit SetComputeUnitLimit instruction for Solana transactions
31+
- Strip `outputSchema` from proxied MCP tool definitions
32+
- Downgrade @modelcontextprotocol/sdk to 1.27.1 for compatibility
33+
34+
[0.11.0]: https://github.com/cascade-protocol/x402-proxy/compare/v0.10.12...v0.11.0
35+
[0.10.12]: https://github.com/cascade-protocol/x402-proxy/releases/tag/v0.10.12

packages/x402-proxy/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## Quick Start
66

77
```bash
8-
npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user
8+
npx x402-proxy https://surf.cascade.fyi/api/v1/twitter/user/openclaw
99
```
1010

1111
That's it. The endpoint returns 402, x402-proxy pays and streams the response.
@@ -52,8 +52,8 @@ openclaw mcp set surf '{"command":"npx","args":["-y","x402-proxy","mcp","https:/
5252
Works like curl. Response body streams to stdout, payment info goes to stderr.
5353

5454
```bash
55-
# POST request
56-
$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user
55+
# GET request
56+
$ npx x402-proxy https://surf.cascade.fyi/api/v1/twitter/user/openclaw
5757

5858
# POST with body and headers (curl-style short flags: -X, -H, -d)
5959
$ npx x402-proxy -X POST \

packages/x402-proxy/openclaw.plugin.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@
22
"id": "x402-proxy",
33
"name": "mpp/x402 Payments Proxy",
44
"description": "x402 and MPP payments, wallet tools, and paid inference proxying",
5-
"version": "0.10.8",
65
"providers": ["surf"],
76
"autoEnableWhenConfiguredProviders": ["surf"],
7+
"providerAuthChoices": [
8+
{
9+
"provider": "surf",
10+
"method": "wallet-setup",
11+
"choiceId": "x402-wallet-setup",
12+
"choiceLabel": "x402-proxy wallet",
13+
"choiceHint": "Generate or import a crypto wallet for paid inference",
14+
"groupId": "x402-proxy",
15+
"groupLabel": "x402-proxy",
16+
"groupHint": "Crypto wallet for x402/MPP payments"
17+
}
18+
],
819
"skills": ["skills"],
920
"contracts": {
1021
"tools": ["x_wallet", "x_balance", "x_request", "x_payment"]

packages/x402-proxy/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "x402-proxy",
33
"private": true,
4-
"version": "0.10.12",
4+
"version": "0.11.0",
55
"description": "curl for x402 paid APIs. Auto-pays any endpoint on Base, Solana, and Tempo.",
66
"type": "module",
77
"sideEffects": false,
@@ -26,12 +26,12 @@
2626
"surf"
2727
],
2828
"compat": {
29-
"pluginApi": ">=2026.3.24",
30-
"minGatewayVersion": "2026.3.24"
29+
"pluginApi": ">=2026.4.1",
30+
"minGatewayVersion": "2026.4.1"
3131
},
3232
"build": {
33-
"openclawVersion": "2026.3.24",
34-
"pluginSdkVersion": "2026.3.24"
33+
"openclawVersion": "2026.4.1",
34+
"pluginSdkVersion": "2026.4.1"
3535
}
3636
},
3737
"bin": {
@@ -71,7 +71,7 @@
7171
"yaml": "^2.8.3"
7272
},
7373
"peerDependencies": {
74-
"openclaw": ">=2026.3.8"
74+
"openclaw": ">=2026.3.24"
7575
},
7676
"peerDependenciesMeta": {
7777
"openclaw": {
@@ -80,7 +80,7 @@
8080
},
8181
"devDependencies": {
8282
"@types/node": "^25.5.0",
83-
"openclaw": "^2026.3.24",
83+
"openclaw": "^2026.4.1",
8484
"publint": "^0.3.18",
8585
"tsdown": "^0.21.5",
8686
"typescript": "^5.9.3",

packages/x402-proxy/skills/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: Use x402-proxy CLI for consuming and debugging x402 and MPP paid AP
1010
## Quick start
1111

1212
```bash
13-
npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user
13+
npx x402-proxy https://surf.cascade.fyi/api/v1/twitter/user/openclaw
1414
```
1515

1616
First run auto-creates a wallet. No setup needed.

packages/x402-proxy/src/commands/claude.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ ANTHROPIC_BASE_URL pointed at it. All inference requests go through
3838
the proxy, which handles payments automatically via MPP.
3939
4040
Usage:
41-
$ x402-proxy claude Start with default model
42-
$ x402-proxy claude --model z-ai/glm-5 Use a specific model
43-
$ x402-proxy claude -- --print "explain this" Pass args to Claude Code
44-
$ x402-proxy claude -- -p "summarize *.ts" Print mode (non-interactive)
41+
$ npx x402-proxy claude Start with default model
42+
$ npx x402-proxy claude --model z-ai/glm-5 Use a specific model
43+
$ npx x402-proxy claude -- --print "explain this" Pass args to Claude Code
44+
$ npx x402-proxy claude -- -p "summarize *.ts" Print mode (non-interactive)
4545
4646
Available models (via surf.cascade.fyi):
4747
${modelList}

packages/x402-proxy/src/commands/fetch.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ export const fetchCommand = buildCommand<FetchFlags, [url?: string], CommandCont
4343
fullDescription: `Make a paid HTTP request. Payment is automatic when the server returns 402.
4444
4545
Examples:
46-
$ x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user
47-
$ x402-proxy -X POST -d '{"url":"https://x402.org"}' https://surf.cascade.fyi/api/v1/web/crawl
48-
$ x402-proxy https://api.example.com/data | jq '.results'`,
46+
$ npx x402-proxy https://surf.cascade.fyi/api/v1/twitter/user/openclaw
47+
$ npx x402-proxy -X POST -d '{"url":"https://x402.org"}' https://surf.cascade.fyi/api/v1/web/crawl
48+
$ npx x402-proxy https://api.example.com/data | jq '.results'`,
4949
},
5050
parameters: {
5151
flags: {
@@ -157,9 +157,7 @@ Examples:
157157
console.log();
158158
console.log(
159159
pc.dim(" try: ") +
160-
pc.cyan(
161-
`$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user`,
162-
),
160+
pc.cyan(`$ npx x402-proxy https://surf.cascade.fyi/api/v1/twitter/user/openclaw`),
163161
);
164162
console.log();
165163
console.log(pc.dim(" https://github.com/cascade-protocol/x402-proxy"));

packages/x402-proxy/src/commands/mcp-add.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export const mcpAddCommand = buildCommand<McpAddFlags, [name: string, url: strin
251251

252252
prompts.log.step("Try your first request:");
253253
prompts.log.message(
254-
` ${pc.cyan(`$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user`)}`,
254+
` ${pc.cyan(`$ npx x402-proxy https://surf.cascade.fyi/api/v1/twitter/user/openclaw`)}`,
255255
);
256256
prompts.log.message(
257257
` ${pc.dim("Run")} ${pc.cyan("npx x402-proxy")} ${pc.dim("to see your wallet and balance")}`,

packages/x402-proxy/src/commands/serve.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ export const serveCommand = buildCommand<ServeFlags, [upstreamUrl?: string], Com
224224
fullDescription: `Start a local HTTP proxy that forwards inference requests upstream and auto-pays x402 or MPP 402 challenges.
225225
226226
Examples:
227-
$ x402-proxy serve
228-
$ x402-proxy serve --port 8402
229-
$ x402-proxy serve https://surf.cascade.fyi/api/v1/inference --protocol mpp`,
227+
$ npx x402-proxy serve
228+
$ npx x402-proxy serve --port 8402
229+
$ npx x402-proxy serve https://surf.cascade.fyi/api/v1/inference --protocol mpp`,
230230
},
231231
parameters: {
232232
flags: {

packages/x402-proxy/src/commands/setup.ts

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import * as prompts from "@clack/prompts";
22
import { buildCommand, type CommandContext } from "@stricli/core";
33
import pc from "picocolors";
44
import {
5+
createWalletFile,
56
getConfigDirShort,
67
getWalletPath,
78
isConfigured,
89
loadWalletFile,
910
type ProxyConfig,
1011
saveConfig,
1112
saveWalletFile,
12-
type WalletFile,
1313
} from "../lib/config.js";
14-
import { deriveEvmKeypair, deriveSolanaKeypair, generateMnemonic } from "../lib/derive.js";
14+
import { generateMnemonic } from "../lib/derive.js";
1515

1616
export async function runSetup(opts?: {
1717
force?: boolean;
@@ -53,19 +53,12 @@ export async function runSetup(opts?: {
5353
mnemonic = generateMnemonic();
5454
}
5555

56-
const evm = deriveEvmKeypair(mnemonic);
57-
const sol = deriveSolanaKeypair(mnemonic);
58-
59-
const wallet: WalletFile = {
60-
version: 1,
61-
mnemonic,
62-
addresses: { evm: evm.address, solana: sol.address },
63-
};
56+
const wallet = createWalletFile(mnemonic);
6457
saveWalletFile(wallet);
6558
saveConfig({ preferredProtocol: "x402" });
6659

6760
process.stdout.write(
68-
`${JSON.stringify({ base: evm.address, tempo: evm.address, solana: sol.address })}\n`,
61+
`${JSON.stringify({ base: wallet.addresses.evm, tempo: wallet.addresses.evm, solana: wallet.addresses.solana })}\n`,
6962
);
7063
return;
7164
}
@@ -109,18 +102,11 @@ export async function runSetup(opts?: {
109102
mnemonic = (input as string).trim();
110103
}
111104

112-
const evm = deriveEvmKeypair(mnemonic);
113-
const sol = deriveSolanaKeypair(mnemonic);
114-
115-
prompts.log.success(`Base address: ${pc.green(evm.address)}`);
116-
prompts.log.success(`Tempo address: ${pc.green(evm.address)}`);
117-
prompts.log.success(`Solana address: ${pc.green(sol.address)}`);
105+
const wallet = createWalletFile(mnemonic);
118106

119-
const wallet: WalletFile = {
120-
version: 1,
121-
mnemonic,
122-
addresses: { evm: evm.address, solana: sol.address },
123-
};
107+
prompts.log.success(`Base address: ${pc.green(wallet.addresses.evm)}`);
108+
prompts.log.success(`Tempo address: ${pc.green(wallet.addresses.evm)}`);
109+
prompts.log.success(`Solana address: ${pc.green(wallet.addresses.solana)}`);
124110

125111
saveWalletFile(wallet);
126112

@@ -167,12 +153,12 @@ export async function runSetup(opts?: {
167153
prompts.log.info(`Config directory: ${pc.dim(getConfigDirShort())}`);
168154

169155
prompts.log.step("Fund your wallets to start using x402 resources:");
170-
prompts.log.message(` Solana (USDC): Send USDC to ${pc.cyan(sol.address)}`);
171-
prompts.log.message(` Base (USDC): Send USDC to ${pc.cyan(evm.address)}`);
156+
prompts.log.message(` Solana (USDC): Send USDC to ${pc.cyan(wallet.addresses.solana)}`);
157+
prompts.log.message(` Base (USDC): Send USDC to ${pc.cyan(wallet.addresses.evm)}`);
172158

173159
prompts.log.step("Try your first request:");
174160
prompts.log.message(
175-
` ${pc.cyan(`$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user`)}`,
161+
` ${pc.cyan(`$ npx x402-proxy https://surf.cascade.fyi/api/v1/twitter/user/openclaw`)}`,
176162
);
177163

178164
prompts.outro(pc.green("Setup complete!"));

0 commit comments

Comments
 (0)