@crossmint/lobster.cash 0.1.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 ADDED
@@ -0,0 +1,121 @@
1
+ # Crossmint Wallet Plugin
2
+
3
+ Solana wallet integration for OpenClaw agents using the lobster.cash server flow.
4
+
5
+ ## Overview
6
+
7
+ This plugin enables OpenClaw agents to:
8
+
9
+ - Generate and manage local Solana signing keys (ed25519)
10
+ - Pair with a user wallet using consent-based setup (`/api/claw/setup/*`)
11
+ - Use server-issued tokens for authenticated wallet and order operations
12
+ - Check wallet balances
13
+ - Send tokens
14
+ - Buy products from Amazon
15
+
16
+ The plugin no longer requires manual API key pasting.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ openclaw plugins install @crossmint/openclaw-wallet
22
+ ```
23
+
24
+ ## Configuration
25
+
26
+ Enable the plugin in `~/.openclaw/.openclaw.json5`:
27
+
28
+ ```json5
29
+ {
30
+ plugins: {
31
+ entries: {
32
+ "openclaw-wallet": {
33
+ enabled: true,
34
+ config: {
35
+ serverBaseUrl: "https://www.lobster.cash",
36
+ requestTimeoutMs: 15000,
37
+ },
38
+ },
39
+ },
40
+ },
41
+ }
42
+ ```
43
+
44
+ ## Setup Workflow
45
+
46
+ ### Step 1: Start setup
47
+
48
+ Ask the agent: "Set up my Crossmint wallet"
49
+
50
+ The plugin will:
51
+
52
+ 1. Generate (or reuse) a local signer keypair
53
+ 2. Call `POST /api/claw/setup/start`
54
+ 3. Sign `pairingNonce` locally
55
+ 4. Call `POST /api/claw/setup/verify`
56
+ 5. Return a consent URL for the user to open
57
+
58
+ ### Step 2: User approves consent URL
59
+
60
+ Open the URL in browser and approve.
61
+
62
+ ### Step 3: Finalize setup
63
+
64
+ Run `crossmint_setup` again.
65
+
66
+ The plugin will:
67
+
68
+ 1. Poll `GET /api/claw/setup/status`
69
+ 2. Read `retrievalNonce` when approved
70
+ 3. Sign `retrievalNonce`
71
+ 4. Call `POST /api/claw/setup/retrieve`
72
+ 5. Store `walletAddress`, `accessToken`, `refreshToken`, and expiry locally
73
+
74
+ ## Authentication Model
75
+
76
+ - Protected calls use `Authorization: Bearer <accessToken>`
77
+ - On expiry, plugin refreshes automatically via:
78
+ - `POST /api/claw/token/refresh/init`
79
+ - `POST /api/claw/token/refresh`
80
+ - Refresh is proof-of-possession gated (signed nonce)
81
+
82
+ ## Tools
83
+
84
+ | Tool | Description |
85
+ | ------------------------ | ------------------------------------------------------------------- |
86
+ | `crossmint_setup` | Start/finalize server-based setup flow |
87
+ | `crossmint_configure` | Deprecated (kept for compatibility) |
88
+ | `crossmint_balance` | Check wallet balances |
89
+ | `crossmint_send` | Send tokens to another address |
90
+ | `crossmint_wallet_info` | Get wallet/setup session info |
91
+ | `crossmint_tx_status` | Check transaction status |
92
+ | `crossmint_buy` | Buy products from Amazon with SOL or USDC |
93
+ | `crossmint_order_status` | Check order status (uses stored order client secret when available) |
94
+
95
+ ## Order Flow
96
+
97
+ For purchases, plugin uses proxy endpoints:
98
+
99
+ 1. `POST /api/proxy/orders`
100
+ 2. `POST /api/proxy/wallets/:wallet/transactions` (serialized transaction)
101
+ 3. Local signature + `POST /api/proxy/wallets/:wallet/transactions/:txId/approve`
102
+ 4. `POST /api/proxy/orders/:orderId/payment` with `x-order-client-secret`
103
+
104
+ ## Local Storage
105
+
106
+ Plugin state is stored at:
107
+
108
+ - `~/.openclaw/crossmint-wallets/wallets.json`
109
+ - or `CROSSMINT_WALLETS_DIR` if set
110
+
111
+ Per agent it stores:
112
+
113
+ - local signer keypair
114
+ - pairing/setup state
115
+ - wallet address
116
+ - access/refresh tokens
117
+ - order client secrets for follow-up status calls
118
+
119
+ ## Migration Note
120
+
121
+ If you previously configured wallet + API key manually, run `crossmint_setup` again to migrate.
package/index.ts ADDED
@@ -0,0 +1,73 @@
1
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
2
+ import {
3
+ createCrossmintSetupTool,
4
+ createCrossmintConfigureTool,
5
+ createCrossmintBalanceTool,
6
+ createCrossmintSendTool,
7
+ createCrossmintWalletInfoTool,
8
+ createCrossmintTxStatusTool,
9
+ createCrossmintBuyTool,
10
+ createCrossmintOrderStatusTool,
11
+ } from "./src/tools.js";
12
+ import { crossmintConfigSchema } from "./src/config.js";
13
+
14
+ const plugin = {
15
+ id: "openclaw-wallet",
16
+ name: "Crossmint Wallet",
17
+ description:
18
+ "Solana wallet integration with Crossmint. Manage wallets, check balances, and send tokens using delegated signing.",
19
+
20
+ configSchema: crossmintConfigSchema,
21
+
22
+ register(api: OpenClawPluginApi) {
23
+ // Parse and validate config at registration time
24
+ const config = crossmintConfigSchema.parse(api.pluginConfig);
25
+
26
+ // Register wallet setup tool (generates keypair, shows delegation URL)
27
+ api.registerTool(createCrossmintSetupTool(api, config), {
28
+ name: "crossmint_setup",
29
+ });
30
+
31
+ // Register configure tool (saves wallet address and API key from web)
32
+ api.registerTool(createCrossmintConfigureTool(api, config), {
33
+ name: "crossmint_configure",
34
+ });
35
+
36
+ // Register balance tool
37
+ api.registerTool(createCrossmintBalanceTool(api, config), {
38
+ name: "crossmint_balance",
39
+ });
40
+
41
+ // Register send tool
42
+ api.registerTool(createCrossmintSendTool(api, config), {
43
+ name: "crossmint_send",
44
+ });
45
+
46
+ // Register wallet info tool
47
+ api.registerTool(createCrossmintWalletInfoTool(api, config), {
48
+ name: "crossmint_wallet_info",
49
+ });
50
+
51
+ // Register transaction status tool
52
+ api.registerTool(createCrossmintTxStatusTool(api, config), {
53
+ name: "crossmint_tx_status",
54
+ });
55
+
56
+ // Register Amazon buy tool
57
+ api.registerTool(createCrossmintBuyTool(api, config), {
58
+ name: "crossmint_buy",
59
+ });
60
+
61
+ // Register order status tool
62
+ api.registerTool(createCrossmintOrderStatusTool(api, config), {
63
+ name: "crossmint_order_status",
64
+ });
65
+
66
+ api.logger.info("Crossmint wallet plugin loaded", {
67
+ serverBaseUrl: config.serverBaseUrl,
68
+ requestTimeoutMs: config.requestTimeoutMs,
69
+ });
70
+ },
71
+ };
72
+
73
+ export default plugin;
@@ -0,0 +1,11 @@
1
+ {
2
+ "id": "openclaw-wallet",
3
+ "name": "Crossmint",
4
+ "description": "Solana wallet integration using Crossmint smart wallets with delegated signing.",
5
+ "version": "0.3.0",
6
+ "skills": ["skills/crossmint"],
7
+ "configSchema": {
8
+ "type": "object",
9
+ "additionalProperties": false
10
+ }
11
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@crossmint/lobster.cash",
3
+ "version": "0.1.1",
4
+ "description": "OpenClaw plugin for Solana wallet integration with Crossmint smart wallets",
5
+ "type": "module",
6
+ "main": "./index.ts",
7
+ "files": [
8
+ "index.ts",
9
+ "src/",
10
+ "skills/",
11
+ "openclaw.plugin.json",
12
+ "README.md"
13
+ ],
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/Crossmint/lobster.cash",
18
+ "directory": "packages/openclaw-crossmint-plugin"
19
+ },
20
+ "keywords": [
21
+ "openclaw",
22
+ "crossmint",
23
+ "solana",
24
+ "wallet",
25
+ "plugin",
26
+ "crypto",
27
+ "web3"
28
+ ],
29
+ "dependencies": {
30
+ "@sinclair/typebox": "^0.34.48",
31
+ "@solana/web3.js": "^1.98.0",
32
+ "bs58": "^6.0.0",
33
+ "tweetnacl": "^1.0.3"
34
+ },
35
+ "peerDependencies": {
36
+ "openclaw": ">=2026.1.26"
37
+ },
38
+ "openclaw": {
39
+ "extensions": [
40
+ "./index.ts"
41
+ ]
42
+ }
43
+ }
@@ -0,0 +1,274 @@
1
+ ---
2
+ name: crossmint
3
+ description: Use when the user wants to manage Solana wallets, check balances, send tokens, buy from Amazon, or run Crossmint/lobster.cash setup flow.
4
+ metadata: { "openclaw": { "emoji": "💳" } }
5
+ ---
6
+
7
+ # Crossmint Wallet
8
+
9
+ Manage Solana wallets through the lobster.cash server-backed consent flow.
10
+
11
+ This skill is the source of truth for how agents should operate the Crossmint plugin safely and correctly.
12
+
13
+ ## Critical model (read first)
14
+
15
+ 1. This is a **server-session flow**, not manual API key setup.
16
+ 2. `crossmint_setup` is the entry point for both first-time setup and setup finalization.
17
+ 3. The agent keeps a **local signer** (ed25519 keypair) and signs server nonces.
18
+ 4. The server issues short-lived `accessToken` + longer-lived `refreshToken`.
19
+ 5. Protected wallet/order actions use Bearer access token; refresh happens automatically.
20
+ 6. `crossmint_configure` is deprecated and should not be used for normal setup.
21
+
22
+ ## When to activate this skill
23
+
24
+ Activate whenever the user asks to:
25
+
26
+ 1. Set up or reconnect agent wallet access
27
+ 2. Check wallet balance
28
+ 3. Send USDC
29
+ 4. Track transaction status
30
+ 5. Buy Amazon products through the plugin
31
+ 6. Track order status
32
+ 7. Debug pairing/token/session failures
33
+
34
+ ## Tool selection map
35
+
36
+ | User intent | Tool | Notes |
37
+ | ------------------------------- | ------------------------ | ---------------------------------------------------------- |
38
+ | Connect wallet first time | `crossmint_setup` | Returns consent URL, then must be run again after approval |
39
+ | Re-run pending setup | `crossmint_setup` | Polls setup status and finalizes retrieval when approved |
40
+ | See setup/session state | `crossmint_wallet_info` | Includes setup status and pending consent URL |
41
+ | Check funds | `crossmint_balance` | Requires completed setup |
42
+ | Send tokens | `crossmint_send` | Optionally wait for completion |
43
+ | Check send tx status | `crossmint_tx_status` | Optionally wait for completion |
44
+ | Buy Amazon item | `crossmint_buy` | Requires complete shipping + recipient fields |
45
+ | Check order/delivery status | `crossmint_order_status` | Uses stored `clientSecret` or user-provided one |
46
+ | Legacy config confusion | `crossmint_setup` | Migrates legacy wallets to server-token model |
47
+ | Ask about `crossmint_configure` | `crossmint_configure` | Returns deprecation guidance; keep for compatibility only |
48
+
49
+ ## Setup workflow (exact behavior)
50
+
51
+ ### First run of `crossmint_setup`
52
+
53
+ The plugin:
54
+
55
+ 1. Generates/reuses local signer keypair
56
+ 2. Calls `POST /api/claw/setup/start`
57
+ 3. Signs `pairingNonce` with local signer
58
+ 4. Calls `POST /api/claw/setup/verify`
59
+ 5. Stores `pairingId` and `consentUrl`
60
+ 6. Returns instructions to open consent URL
61
+
62
+ ### User action
63
+
64
+ User opens consent URL and approves in browser.
65
+
66
+ ### Second run of `crossmint_setup`
67
+
68
+ The plugin:
69
+
70
+ 1. Calls `GET /api/claw/setup/status?pairingId=...`
71
+ 2. If approved, reads `retrievalNonce`
72
+ 3. Signs `retrievalNonce`
73
+ 4. Calls `POST /api/claw/setup/retrieve`
74
+ 5. Stores `walletAddress`, `accessToken`, `refreshToken`, `expiresAt`
75
+ 6. Marks setup configured
76
+
77
+ ## Setup status handling
78
+
79
+ When setup is pending, `crossmint_setup` may return these states:
80
+
81
+ 1. `awaiting-consent`:
82
+ URL issued; user still needs to approve
83
+ 2. `awaiting-approval`:
84
+ Verification done, waiting on consent completion
85
+ 3. `denied`:
86
+ User denied; ask user to re-run setup to generate a new consent request
87
+ 4. `expired`:
88
+ Consent window expired; re-run setup to restart
89
+ 5. `configured`:
90
+ Wallet ready
91
+
92
+ Agent behavior:
93
+
94
+ 1. Never invent success if setup is not configured
95
+ 2. If pending, always show consent URL and next step
96
+ 3. If denied/expired, explain that a fresh `crossmint_setup` run is required
97
+
98
+ ## Auth and refresh behavior
99
+
100
+ 1. Protected calls include `Authorization: Bearer <accessToken>`
101
+ 2. Plugin refreshes automatically before expiry and on `ACCESS_TOKEN_EXPIRED`
102
+ 3. Refresh sequence:
103
+ 1. `POST /api/claw/token/refresh/init`
104
+ 2. Sign `refreshNonce`
105
+ 3. `POST /api/claw/token/refresh`
106
+ 4. If refresh token is missing/invalid, agent must ask user to run setup again
107
+
108
+ ## Wallet and transfer operations
109
+
110
+ ### `crossmint_balance`
111
+
112
+ Use for funds overview. Returns token/amount list.
113
+
114
+ If no wallet/session:
115
+
116
+ 1. Tell user to run `crossmint_setup`
117
+ 2. If setup pending, point user to consent and rerun setup
118
+
119
+ ### `crossmint_send`
120
+
121
+ USDC-only policy:
122
+
123
+ 1. Always send `usdc`
124
+ 2. Never choose `sol` or other token identifiers
125
+
126
+ Required:
127
+
128
+ 1. `to`
129
+ 2. `amount`
130
+
131
+ Optional:
132
+
133
+ 1. `wait` (default `false`)
134
+ 2. `timeoutMs` (default `60000`)
135
+
136
+ Transfer flow:
137
+
138
+ 1. Create proxy transaction
139
+ 2. Sign approval message locally
140
+ 3. Approve transaction
141
+ 4. Return pending/success/failed with tx details
142
+
143
+ ### `crossmint_tx_status`
144
+
145
+ Use when user asks "did it go through?" or wants confirmation wait.
146
+
147
+ ## Amazon purchase operations
148
+
149
+ ### `crossmint_buy` requirements
150
+
151
+ Do not call unless all required fields are known:
152
+
153
+ 1. `productId` (ASIN or Amazon URL)
154
+ 2. `recipientEmail`
155
+ 3. `recipientName`
156
+ 4. `addressLine1`
157
+ 5. `city`
158
+ 6. `postalCode`
159
+ 7. `country`
160
+
161
+ Optional:
162
+
163
+ 1. `addressLine2`
164
+ 2. `state`
165
+
166
+ Currency policy:
167
+
168
+ 1. Always use `usdc`
169
+ 2. Do not use `sol`
170
+
171
+ ### Safe purchase policy (mandatory)
172
+
173
+ Before purchase:
174
+
175
+ 1. Confirm the exact product if user request is vague
176
+ 2. Confirm shipping fields
177
+ 3. Keep payment currency as `usdc`
178
+
179
+ After purchase:
180
+
181
+ 1. Read returned product title and price back to user
182
+ 2. Share order ID and transaction explorer link
183
+ 3. Tell user to use `crossmint_order_status` for delivery updates
184
+
185
+ ### `crossmint_order_status`
186
+
187
+ 1. Takes `orderId`
188
+ 2. Can use optional `clientSecret`
189
+ 3. If no stored or provided client secret exists, explain that status lookup requires it
190
+
191
+ ## Legacy/migration behavior
192
+
193
+ If wallet info indicates legacy API-key setup:
194
+
195
+ 1. Explain legacy config is deprecated
196
+ 2. Instruct user to run `crossmint_setup` again to migrate
197
+ 3. Do not request manual API key paste
198
+
199
+ ## Error playbook
200
+
201
+ ### "No wallet found"
202
+
203
+ Meaning: setup never started.
204
+
205
+ Action: run `crossmint_setup`.
206
+
207
+ ### "Wallet not configured" or pending setup text
208
+
209
+ Meaning: consent flow not complete.
210
+
211
+ Action:
212
+
213
+ 1. open consent URL
214
+ 2. re-run `crossmint_setup`
215
+
216
+ ### `ACCESS_TOKEN_EXPIRED`
217
+
218
+ Meaning: access token expired.
219
+
220
+ Action: plugin should refresh automatically; if it still fails, run `crossmint_setup` again.
221
+
222
+ ### Missing refresh token / invalid session
223
+
224
+ Meaning: stored session no longer usable.
225
+
226
+ Action: rerun full setup flow.
227
+
228
+ ### Order status missing client secret
229
+
230
+ Meaning: plugin has no stored order session.
231
+
232
+ Action: ask user for explicit `clientSecret` for that order.
233
+
234
+ ## Agent response style guidelines
235
+
236
+ When operating this skill:
237
+
238
+ 1. Keep next actions explicit and numbered
239
+ 2. Include concrete status (`pending`, `configured`, `denied`, `expired`) in user-facing text
240
+ 3. For high-risk operations (send/buy), echo critical details before execution
241
+ 4. Never claim money moved unless tx/order status indicates success/completed
242
+
243
+ ## Local storage and security notes
244
+
245
+ 1. State file: `~/.openclaw/crossmint-wallets/wallets.json` (or `CROSSMINT_WALLETS_DIR`)
246
+ 2. Stored per agent:
247
+ 1. local keypair
248
+ 2. setup/pairing status
249
+ 3. wallet address
250
+ 4. access/refresh tokens + expiry
251
+ 5. order client secrets
252
+ 3. Private key stays local; only signatures are sent to server endpoints
253
+
254
+ ## Quick examples
255
+
256
+ ### User: "Connect my wallet"
257
+
258
+ 1. Call `crossmint_setup`
259
+ 2. Return consent URL
260
+ 3. Tell user to approve it
261
+ 4. Tell user to run setup again after approval
262
+
263
+ ### User: "Send 20 USDC to <address> and wait"
264
+
265
+ 1. Ensure configured wallet
266
+ 2. Call `crossmint_send` with `wait=true` (USDC-only policy)
267
+ 3. Return tx id, status, hash/explorer if available
268
+
269
+ ### User: "Buy this Amazon ASIN B00O79SKV6"
270
+
271
+ 1. Confirm shipping + email fields
272
+ 2. Call `crossmint_buy`
273
+ 3. Return order ID, payment status, explorer link
274
+ 4. Offer `crossmint_order_status` follow-up