@coinbase/coinbase-cli 0.0.7 → 0.0.8
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/dist/index.js +112 -112
- package/dist/version.txt +1 -1
- package/package.json +4 -2
- package/skills/coinbase-trading/SKILL.md +6 -1
- package/skills/coinbase-x402/SKILL.md +23 -0
package/dist/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.8
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/coinbase-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Coinbase for agents — CLI and MCP server for trading, wallets, payments, and onchain across the Coinbase platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "BUILD=external node scripts/embed-spec.mjs",
|
|
11
|
-
"gen:
|
|
11
|
+
"gen:spec": "BUILD=external node scripts/resolve-agent-spec.mjs",
|
|
12
|
+
"gen:types": "pnpm run gen:spec && BUNDLE_SKIP=1 BUILD=external node scripts/embed-spec.mjs && node scripts/gen-types.mjs dist/agent-api.yaml '' > generated/cli/types.ts && node scripts/gen-types.mjs dist/spec.json '' RetailBrokerageApi_ > generated/brokerage/types.ts && node scripts/gen-client.mjs > generated/brokerage/client.ts && node scripts/gen-surface.mjs dist/agent-api.yaml > generated/cli/surface.ts",
|
|
12
13
|
"gen:test": "node scripts/gen-mapping-tests.mjs",
|
|
14
|
+
"gen:check": "pnpm run gen:spec && node scripts/check-contract.mjs",
|
|
13
15
|
"typecheck": "tsc --noEmit",
|
|
14
16
|
"test": "node --experimental-strip-types --no-warnings --test 'src/**/*.test.ts'",
|
|
15
17
|
"test:keyring": "node --experimental-strip-types --no-warnings --test src/lib/keyring/keyring.integration-test.ts",
|
|
@@ -68,12 +68,17 @@ Prefer native order types — they are durable and server-side. Only use a `--un
|
|
|
68
68
|
```sh
|
|
69
69
|
coinbase orders list status==OPEN
|
|
70
70
|
coinbase orders get <order_id>
|
|
71
|
+
coinbase orders edit-preview order_id=<order_id> limit_price=50000
|
|
71
72
|
coinbase orders cancel order_ids:='["id-1","id-2"]'
|
|
72
73
|
coinbase orders edit <order_id> limit_price=50000
|
|
73
74
|
coinbase orders fills order_id==<order_id>
|
|
74
|
-
coinbase orders
|
|
75
|
+
coinbase orders close-position product_id=BTC-USD
|
|
75
76
|
```
|
|
76
77
|
|
|
78
|
+
`orders edit-preview` reprices an open order without editing it — distinct from
|
|
79
|
+
`orders preview`, which prices an order you have not placed yet. Supply at least
|
|
80
|
+
one of `base_size` or `limit_price`.
|
|
81
|
+
|
|
77
82
|
## Portfolio scope
|
|
78
83
|
|
|
79
84
|
CDP API keys derive portfolio scope from the key itself — no `retail_portfolio_id` needed in the body. To trade in a different portfolio, switch envs (`-e live-trading`); see `coinbase-portfolios`.
|
|
@@ -57,6 +57,29 @@ The header names are not interchangeable. Never send `X-PAYMENT` to a v2 resourc
|
|
|
57
57
|
|
|
58
58
|
If the resource rejects the header, first verify that the challenge's `x402Version`, the `x402_version` passed to `pay`, and the HTTP header name agree. Do not create another payment merely to try the other header name.
|
|
59
59
|
|
|
60
|
+
## Sign-In With X (SIWX)
|
|
61
|
+
|
|
62
|
+
When a v2 challenge includes `extensions["sign-in-with-x"]`, a wallet that has already paid for the resource may use SIWX instead of creating another payment. SIWX is a separate HTTP authentication flow: never add it to `x402 pay`.
|
|
63
|
+
|
|
64
|
+
`coinbase` cannot sign SIWX messages and `x402 fetch` cannot attach custom headers. Use the manual `x402 pay` flow only when the caller has a compatible external wallet signer and can make the resource request itself. Otherwise, omit `SIGN-IN-WITH-X` and pay normally.
|
|
65
|
+
|
|
66
|
+
Do not manually serialize or sign the extension JSON. Select a `supportedChains` entry compatible with the wallet, then use an x402 SIWX client implementation to:
|
|
67
|
+
|
|
68
|
+
1. Merge `extension.info` with the selected `chainId` and `type`.
|
|
69
|
+
2. Build the required CAIP-122 message, including the signing wallet address.
|
|
70
|
+
3. Sign that message with the matching wallet.
|
|
71
|
+
4. Emit a proof containing the copied `info` fields, `chainId`, `type`, `address`, and `signature`.
|
|
72
|
+
5. Base64-encode the proof JSON for `SIGN-IN-WITH-X`.
|
|
73
|
+
|
|
74
|
+
Use a CAIP-122-compatible SIWX client or wallet SDK to construct and sign the proof.
|
|
75
|
+
|
|
76
|
+
Reject redirects that leave the original catalog URL's origin. Only sign when `extension.info.domain` matches the final URL hostname and `extension.info.uri` exactly matches the final response URL. Preserve every challenge field unchanged. Send the SIWX header on the resource request, with the version-matched x402 payment header when payment is still required:
|
|
77
|
+
|
|
78
|
+
```http
|
|
79
|
+
PAYMENT-SIGNATURE: <payment_header>
|
|
80
|
+
SIGN-IN-WITH-X: <base64-encoded SIWX proof>
|
|
81
|
+
```
|
|
82
|
+
|
|
60
83
|
## Retry safety
|
|
61
84
|
|
|
62
85
|
Use the smallest `amount` and `max_amount` that satisfy the requirement. Reuse the returned `idempotency_key` only when retrying the same logical payment after an outcome-unknown failure. Starting a retry without it can create another hold.
|