@crossmint/openclaw-wallet 0.2.4 → 0.3.0
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 +16 -7
- package/index.ts +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/crossmint/SKILL.md +6 -6
- package/src/amazon-order.test.ts +7 -3
- package/src/api.test.ts +9 -4
- package/src/api.ts +13 -7
- package/src/config.ts +1 -1
- package/src/tools.ts +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ Enable the plugin in `~/.openclaw/.openclaw.json5`:
|
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
> **Note:**
|
|
38
|
+
> **Note:** This plugin uses Solana mainnet (production) for real transactions.
|
|
39
39
|
|
|
40
40
|
## Usage
|
|
41
41
|
|
|
@@ -53,7 +53,7 @@ The agent will:
|
|
|
53
53
|
|
|
54
54
|
1. Open the delegation URL in your browser
|
|
55
55
|
2. The web app will:
|
|
56
|
-
- Create a Crossmint smart wallet on Solana
|
|
56
|
+
- Create a Crossmint smart wallet on Solana
|
|
57
57
|
- Add the agent's public key as a delegated signer
|
|
58
58
|
- Show you the **wallet address** and **API key**
|
|
59
59
|
|
|
@@ -98,7 +98,7 @@ Price: 0.05 SOL
|
|
|
98
98
|
Order ID: order_abc123
|
|
99
99
|
Payment: completed
|
|
100
100
|
|
|
101
|
-
Transaction: https://explorer.solana.com/tx/5x
|
|
101
|
+
Transaction: https://explorer.solana.com/tx/5x...
|
|
102
102
|
|
|
103
103
|
Use crossmint_order_status to check delivery status.
|
|
104
104
|
```
|
|
@@ -172,7 +172,7 @@ All steps are handled automatically by the plugin.
|
|
|
172
172
|
┌─────────────────────────────────────────────────────────────┐
|
|
173
173
|
│ Crossmint Smart Wallet │
|
|
174
174
|
├─────────────────────────────────────────────────────────────┤
|
|
175
|
-
│ - Deployed on Solana
|
|
175
|
+
│ - Deployed on Solana │
|
|
176
176
|
│ - Agent's address registered as delegated signer │
|
|
177
177
|
│ - User retains admin control │
|
|
178
178
|
│ - Holds SOL/USDC for purchases and transfers │
|
|
@@ -198,14 +198,14 @@ All steps are handled automatically by the plugin.
|
|
|
198
198
|
- Run `crossmint_configure` with wallet address and API key from the web app
|
|
199
199
|
|
|
200
200
|
**"Failed to get balance" or "Failed to send"**
|
|
201
|
-
- Verify the API key is correct (should start with `
|
|
201
|
+
- Verify the API key is correct (should start with `ck_production_`)
|
|
202
202
|
- Check that the wallet address matches the one shown in the web app
|
|
203
203
|
- Ensure the wallet has sufficient balance
|
|
204
204
|
|
|
205
205
|
**"Insufficient funds" (Amazon purchase)**
|
|
206
206
|
- Check balance with `crossmint_balance`
|
|
207
207
|
- Fund the wallet with more SOL or USDC
|
|
208
|
-
-
|
|
208
|
+
- Fund the wallet with real SOL or USDC on Solana mainnet
|
|
209
209
|
|
|
210
210
|
**"Timeout waiting for transaction to be broadcast"**
|
|
211
211
|
- Check transaction status with `crossmint_tx_status`
|
|
@@ -214,15 +214,24 @@ All steps are handled automatically by the plugin.
|
|
|
214
214
|
## Plugin Management
|
|
215
215
|
|
|
216
216
|
```bash
|
|
217
|
+
# Install the plugin
|
|
218
|
+
openclaw plugins install @crossmint/openclaw-wallet
|
|
219
|
+
|
|
220
|
+
# Upgrade to latest version
|
|
221
|
+
openclaw plugins update @crossmint/openclaw-wallet
|
|
222
|
+
|
|
217
223
|
# List all plugins
|
|
218
224
|
openclaw plugins list
|
|
219
225
|
|
|
220
|
-
# Check plugin info
|
|
226
|
+
# Check plugin info (shows current version)
|
|
221
227
|
openclaw plugins info openclaw-wallet
|
|
222
228
|
|
|
223
229
|
# Enable/disable
|
|
224
230
|
openclaw plugins enable openclaw-wallet
|
|
225
231
|
openclaw plugins disable openclaw-wallet
|
|
232
|
+
|
|
233
|
+
# Uninstall
|
|
234
|
+
openclaw plugins uninstall openclaw-wallet
|
|
226
235
|
```
|
|
227
236
|
|
|
228
237
|
## Supported Currencies
|
package/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
createCrossmintBuyTool,
|
|
10
10
|
createCrossmintOrderStatusTool,
|
|
11
11
|
} from "./src/tools.js";
|
|
12
|
-
import { crossmintConfigSchema } from "./src/config.js";
|
|
12
|
+
import { crossmintConfigSchema, ENVIRONMENT } from "./src/config.js";
|
|
13
13
|
|
|
14
14
|
const plugin = {
|
|
15
15
|
id: "openclaw-wallet",
|
|
@@ -64,7 +64,7 @@ const plugin = {
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
api.logger.info("Crossmint wallet plugin loaded", {
|
|
67
|
-
environment:
|
|
67
|
+
environment: ENVIRONMENT,
|
|
68
68
|
});
|
|
69
69
|
},
|
|
70
70
|
};
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ metadata: { "openclaw": { "emoji": "💳" } }
|
|
|
8
8
|
|
|
9
9
|
Manage Solana wallets using Crossmint smart wallets with delegated signing. The agent holds a local signing key, and users authorize it via a web-based delegation flow.
|
|
10
10
|
|
|
11
|
-
> **Note:**
|
|
11
|
+
> **Note:** This plugin uses **Solana mainnet** (production) for real transactions.
|
|
12
12
|
|
|
13
13
|
## When to Activate
|
|
14
14
|
|
|
@@ -48,7 +48,7 @@ This generates a local ed25519 keypair and returns a delegation URL pointing to
|
|
|
48
48
|
### Step 2: User completes web setup
|
|
49
49
|
|
|
50
50
|
The user opens the delegation URL in their browser. The web app (lobster.cash) will:
|
|
51
|
-
1. Create a Crossmint smart wallet on Solana
|
|
51
|
+
1. Create a Crossmint smart wallet on Solana
|
|
52
52
|
2. Add the agent's public key as a delegated signer
|
|
53
53
|
3. Display the **wallet address** and **API key** for the user to copy
|
|
54
54
|
|
|
@@ -190,7 +190,7 @@ Price: 0.05 SOL
|
|
|
190
190
|
Order ID: order_abc123
|
|
191
191
|
Payment: completed
|
|
192
192
|
|
|
193
|
-
Transaction: https://explorer.solana.com/tx/5x
|
|
193
|
+
Transaction: https://explorer.solana.com/tx/5x...
|
|
194
194
|
|
|
195
195
|
Shipping to:
|
|
196
196
|
John Doe
|
|
@@ -360,7 +360,7 @@ Agent:
|
|
|
360
360
|
|
|
361
361
|
### "Failed to get balance" or "Failed to send"
|
|
362
362
|
|
|
363
|
-
- Verify the API key is correct (should start with `
|
|
363
|
+
- Verify the API key is correct (should start with `ck_production_`)
|
|
364
364
|
- Check wallet address matches the one shown in the web app
|
|
365
365
|
- Ensure sufficient balance for transfers
|
|
366
366
|
|
|
@@ -372,7 +372,7 @@ The wallet doesn't have enough SOL or USDC for the purchase.
|
|
|
372
372
|
Agent:
|
|
373
373
|
1. Use crossmint_balance to check current balance
|
|
374
374
|
2. Ask user to fund the wallet with more SOL/USDC
|
|
375
|
-
3.
|
|
375
|
+
3. Fund the wallet with real SOL/USDC on Solana mainnet
|
|
376
376
|
```
|
|
377
377
|
|
|
378
378
|
### "Wrong product was purchased"
|
|
@@ -433,7 +433,7 @@ Agent:
|
|
|
433
433
|
3. **Confirm product title after purchase** - Check that the returned product title matches what was requested
|
|
434
434
|
4. **Always check balance before purchasing** - Avoid failed transactions due to insufficient funds
|
|
435
435
|
5. **Confirm shipping address with user** - Double-check addresses for Amazon purchases
|
|
436
|
-
6. **
|
|
436
|
+
6. **Fund wallet before purchasing** - Ensure the wallet has enough SOL or USDC before attempting purchases
|
|
437
437
|
7. **One wallet per agent** - Each agent ID gets its own keypair and wallet
|
|
438
438
|
8. **Save the order ID** - Users should note the order ID to track delivery status later
|
|
439
439
|
9. **Verify on-chain** - The explorer link lets users verify the payment transaction on Solana
|
package/src/amazon-order.test.ts
CHANGED
|
@@ -27,9 +27,13 @@ const API_KEY = process.env.CROSSMINT_API_KEY || "";
|
|
|
27
27
|
const PAYER_ADDRESS = process.env.PAYER_ADDRESS || ""; // Smart wallet address
|
|
28
28
|
const SIGNER_PRIVATE_KEY = process.env.PAYER_PRIVATE_KEY || ""; // Delegated signer private key
|
|
29
29
|
|
|
30
|
-
// Crossmint API base URLs
|
|
31
|
-
const
|
|
32
|
-
const
|
|
30
|
+
// Crossmint API base URLs - depends on environment
|
|
31
|
+
const CROSSMINT_ENV = process.env.CROSSMINT_ENV || "production";
|
|
32
|
+
const CROSSMINT_BASE_URL = CROSSMINT_ENV === "staging"
|
|
33
|
+
? "https://staging.crossmint.com/api"
|
|
34
|
+
: "https://www.crossmint.com/api";
|
|
35
|
+
const CROSSMINT_ORDERS_API = `${CROSSMINT_BASE_URL}/2022-06-09`;
|
|
36
|
+
const CROSSMINT_WALLETS_API = `${CROSSMINT_BASE_URL}/2025-06-09`;
|
|
33
37
|
|
|
34
38
|
// Test product - can be overridden via environment variable
|
|
35
39
|
const TEST_AMAZON_ASIN = process.env.TEST_AMAZON_ASIN || "B00AATAHY0";
|
package/src/api.test.ts
CHANGED
|
@@ -12,13 +12,18 @@ import {
|
|
|
12
12
|
/**
|
|
13
13
|
* Live integration tests for Crossmint Amazon purchase API.
|
|
14
14
|
*
|
|
15
|
-
* Run with: CROSSMINT_API_KEY=your-key pnpm test
|
|
15
|
+
* Run with: CROSSMINT_API_KEY=your-key pnpm test src/api.test.ts
|
|
16
16
|
*
|
|
17
|
-
* These tests make real API calls to Crossmint
|
|
18
|
-
* They require a valid
|
|
17
|
+
* These tests make real API calls to Crossmint.
|
|
18
|
+
* They require a valid API key with orders.create scope.
|
|
19
|
+
*
|
|
20
|
+
* Environment:
|
|
21
|
+
* CROSSMINT_ENV=staging -> Uses devnet (staging.crossmint.com)
|
|
22
|
+
* CROSSMINT_ENV=production (default) -> Uses mainnet (www.crossmint.com)
|
|
19
23
|
*/
|
|
20
24
|
|
|
21
25
|
const LIVE = process.env.CROSSMINT_API_KEY || process.env.LIVE;
|
|
26
|
+
const CROSSMINT_ENV = (process.env.CROSSMINT_ENV || "production") as "staging" | "production";
|
|
22
27
|
|
|
23
28
|
describe("crossmint api", () => {
|
|
24
29
|
describe("buildDelegationUrl", () => {
|
|
@@ -53,7 +58,7 @@ describe("crossmint api", () => {
|
|
|
53
58
|
describe.skipIf(!LIVE)("live: createOrder", () => {
|
|
54
59
|
const config: CrossmintApiConfig = {
|
|
55
60
|
apiKey: process.env.CROSSMINT_API_KEY!,
|
|
56
|
-
environment:
|
|
61
|
+
environment: CROSSMINT_ENV,
|
|
57
62
|
};
|
|
58
63
|
|
|
59
64
|
// Generate a test keypair for the payer address
|
package/src/api.ts
CHANGED
|
@@ -3,7 +3,7 @@ import bs58 from "bs58";
|
|
|
3
3
|
|
|
4
4
|
export type CrossmintApiConfig = {
|
|
5
5
|
apiKey: string;
|
|
6
|
-
environment: "staging"
|
|
6
|
+
environment: "staging" | "production";
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export type CrossmintBalance = {
|
|
@@ -26,9 +26,10 @@ export type CrossmintTransaction = {
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
function getBaseUrl(env: "staging" | "production"): string {
|
|
30
|
+
if (env === "production") {
|
|
31
|
+
return "https://www.crossmint.com/api";
|
|
32
|
+
}
|
|
32
33
|
return "https://staging.crossmint.com/api";
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -106,14 +107,19 @@ export async function getTransactionStatus(
|
|
|
106
107
|
|
|
107
108
|
const data = await response.json();
|
|
108
109
|
|
|
110
|
+
const txId = data.onChain?.txId;
|
|
111
|
+
const explorerLink = txId
|
|
112
|
+
? config.environment === "staging"
|
|
113
|
+
? `https://explorer.solana.com/tx/${txId}?cluster=devnet`
|
|
114
|
+
: `https://explorer.solana.com/tx/${txId}`
|
|
115
|
+
: undefined;
|
|
116
|
+
|
|
109
117
|
return {
|
|
110
118
|
id: data.id,
|
|
111
119
|
status: data.status,
|
|
112
120
|
hash: data.onChain?.txId || data.hash,
|
|
113
121
|
txId: data.txId, // Top-level txId from API response
|
|
114
|
-
explorerLink
|
|
115
|
-
? `https://explorer.solana.com/tx/${data.onChain.txId}?cluster=devnet`
|
|
116
|
-
: undefined,
|
|
122
|
+
explorerLink,
|
|
117
123
|
onChain: data.onChain,
|
|
118
124
|
};
|
|
119
125
|
}
|
package/src/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Hardcoded configuration - no user config needed
|
|
2
2
|
export const DELEGATION_URL = "https://www.lobster.cash/";
|
|
3
|
-
export const ENVIRONMENT = "
|
|
3
|
+
export const ENVIRONMENT = "production" as const;
|
|
4
4
|
|
|
5
5
|
export type CrossmintPluginConfig = Record<string, never>;
|
|
6
6
|
|
package/src/tools.ts
CHANGED
|
@@ -26,7 +26,7 @@ function getAgentId(ctx: OpenClawPluginToolContext): string {
|
|
|
26
26
|
return ctx.agentId || "main";
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function getApiConfig(walletData: { apiKey?: string }, environment: "staging"): CrossmintApiConfig {
|
|
29
|
+
function getApiConfig(walletData: { apiKey?: string }, environment: "staging" | "production"): CrossmintApiConfig {
|
|
30
30
|
if (!walletData.apiKey) {
|
|
31
31
|
throw new Error("Wallet not configured. Run crossmint_setup first and provide the API key.");
|
|
32
32
|
}
|