@rozoai/checkout 0.1.1 → 0.1.3

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 CHANGED
@@ -32,18 +32,108 @@ npx @rozoai/checkout pay <coinbase-link> --with usdt-solana
32
32
  | Polygon | `usdt-polygon` `usdc-polygon` | `137` | 6 decimals |
33
33
  | Base | `usdc-base` | `8453` | 6 decimals |
34
34
  | Solana | `usdt-solana` `usdc-solana` | `900` | SPL; native SOL not supported |
35
- | Stellar | `usdc-stellar` | `1500` | memo required — shown in the deposit block |
35
+ | Stellar | `usdc-stellar` | `1500` | `MEMO_TEXT` memo required — shown in the deposit block |
36
36
  | Bitcoin Lightning | `btc-lightning` | `lightning` | BOLT11; amounts in satoshis |
37
37
 
38
38
  Native gas coins (SOL, BNB, ETH, MATIC) and on-chain BTC are not accepted.
39
39
 
40
+ ## Which wallet do I need?
41
+
42
+ **One wallet, on one chain — not one per chain.** Pick whichever coin above you
43
+ already hold and pay from wherever it already lives.
44
+
45
+ - **Any wallet works, and so does an exchange withdrawal.** The default path
46
+ just prints a deposit block: send exactly that `amount` of that
47
+ `tokenSymbol`, on that `chain`, to that `receiverAddress`. Nothing connects to
48
+ a site and nothing is approved in a browser. In practice people use MetaMask
49
+ or Rabby on the EVM chains, Phantom or Solflare on Solana, and a Lightning
50
+ wallet such as Phoenix or Wallet of Satoshi for BTC.
51
+ - **Stellar is the one to be careful with.** Its deposits route through a shared
52
+ address plus `receiverMemo`, so whatever you send from — exchange or wallet —
53
+ must let you set a memo. Omit it and the payment is lost.
54
+ - **Lightning pays an invoice, not an address.** Scan or paste
55
+ `deposit.lnInvoice`; there is no address to send to.
56
+ - **Only `--send` needs a private key**, read from `ROZO_CHECKOUT_EVM_KEY` or
57
+ `ROZO_CHECKOUT_SOL_KEY`, and it covers EVM chains and Solana only. Everything
58
+ else is keyless.
59
+
40
60
  ## Use it from your agent
41
61
 
42
62
  The payload is the same everywhere: the one-liner above, or point the agent at
43
63
  [llms.txt](llms.txt). Agents and scripts should always pass `--with` — the
44
64
  picker only appears on a terminal, and there is deliberately no default coin. **Paying from your own wallet never needs a key.** Only
45
- the optional `--send` flag signs locally, and only that flag reads
46
- `ROZO_CHECKOUT_EVM_KEY` / `ROZO_CHECKOUT_SOL_KEY`.
65
+ the optional `--send` flag signs locally: on Solana it uses the
66
+ `~/.config/solana/id.json` that `solana-keygen` already created, and on EVM an
67
+ encrypted JSON keystore whose passphrase is prompted. A raw key in the
68
+ environment (or a gitignored `.env`) still works for unattended automation.
69
+
70
+ <details>
71
+ <summary><b>Set up a local wallet for <code>--send</code></b> — .env template and per-wallet export steps</summary>
72
+
73
+ **None of this is needed for the default path.** Paying from your own wallet
74
+ needs no key and no configuration, and works with wallets that can never be
75
+ used here — including hardware wallets and exchange accounts.
76
+
77
+ A `.env` in the directory you run from, with every variable this tool reads:
78
+
79
+ ```bash
80
+ # None of this is needed to pay from your own wallet. These are read only
81
+ # when you use --send.
82
+
83
+ # Solana secret key: a base58 string, or a JSON byte array. Only needed if you
84
+ # do NOT have ~/.config/solana/id.json, which is picked up automatically.
85
+ ROZO_CHECKOUT_SOL_KEY=REPLACE_ME_base58_secret_key
86
+
87
+ # EVM raw private key: 64 hex characters, 0x prefix optional. The least safe
88
+ # option — prefer the keystore below.
89
+ ROZO_CHECKOUT_EVM_KEY=0x0000000000000000000000000000000000000000000000000000000000000000
90
+
91
+ # EVM encrypted V3 keystore: path to the file. Preferred over the raw key.
92
+ ROZO_CHECKOUT_EVM_KEYSTORE=/replace/me/keystores/my-hot-wallet
93
+
94
+ # Passphrase for that keystore. Only for unattended runs; on a terminal you
95
+ # are prompted instead, and nothing is stored.
96
+ ROZO_CHECKOUT_KEYSTORE_PASSPHRASE=REPLACE_ME_not_a_real_passphrase
97
+
98
+ # Optional RPC overrides, one per chain id. 8453 = Base, 900 = Solana.
99
+ ROZO_CHECKOUT_RPC_8453=https://mainnet.base.org
100
+ ROZO_CHECKOUT_RPC_900=https://api.mainnet-beta.solana.com
101
+ ```
102
+
103
+ Then lock it down and keep it out of git:
104
+
105
+ ```bash
106
+ chmod 600 .env
107
+ echo '.env' >> .gitignore
108
+ ```
109
+
110
+ **Solana**
111
+
112
+ - `solana-keygen new` writes `~/.config/solana/id.json`. Nothing to configure —
113
+ it is found automatically. This is the path we recommend.
114
+ - **Phantom** → Settings → Export Private Key gives a **base58** string. Put it
115
+ in `ROZO_CHECKOUT_SOL_KEY`.
116
+ - **Solflare** exports a base58 string in current versions and a JSON byte
117
+ array in older ones. Both are accepted as-is.
118
+
119
+ **EVM**
120
+
121
+ - **MetaMask** and **Rabby** → Export private key gives 64 hex characters.
122
+ Paste it into `ROZO_CHECKOUT_EVM_KEY` as-is; the `0x` prefix is optional.
123
+ - **Encrypted keystore (safer).** Browser wallets export raw keys, not
124
+ keystores. To turn one into an encrypted keystore, use Foundry:
125
+ `cast wallet import my-hot-wallet --interactive` prompts for the key and
126
+ writes an encrypted V3 keystore to `~/.foundry/keystores/my-hot-wallet`
127
+ (`--keystore-dir` changes where). Point `ROZO_CHECKOUT_EVM_KEYSTORE` at that
128
+ file. `geth account import` also produces a V3 keystore.
129
+
130
+ **Wallets that cannot be used with `--send`:** hardware wallets (Ledger,
131
+ Trezor), WalletConnect-only mobile wallets, and exchange accounts. None of them
132
+ hand over a signing key, by design. Use the default keyless path instead — it
133
+ works with all of them.
134
+
135
+ </details>
136
+
47
137
 
48
138
  <details>
49
139
  <summary><b>Claude Code</b> — install the skill, or paste the one-liner</summary>
@@ -78,7 +168,9 @@ To pay an OpenRouter / Coinbase payment link, run:
78
168
  npx @rozoai/checkout pay <coinbase-link> --with usdt-solana
79
169
  ```
80
170
 
81
- Wallet: any wallet, no key. `--send` needs the env key.
171
+ Wallet: any wallet, no key. `--send` signs locally using your Solana CLI
172
+ keypair or an encrypted keystore, and supports EVM chains and Solana only —
173
+ Stellar and Lightning are Mode A only.
82
174
  </details>
83
175
 
84
176
  <details>
@@ -91,7 +183,9 @@ above works unchanged. The shortest path is still the command itself:
91
183
  npx @rozoai/checkout pay <coinbase-link> --with usdt-solana
92
184
  ```
93
185
 
94
- Wallet: any wallet, no key. `--send` needs the env key.
186
+ Wallet: any wallet, no key. `--send` signs locally using your Solana CLI
187
+ keypair or an encrypted keystore, and supports EVM chains and Solana only —
188
+ Stellar and Lightning are Mode A only.
95
189
  </details>
96
190
 
97
191
  <details>
@@ -104,7 +198,9 @@ To pay an OpenRouter / Coinbase payment link, run:
104
198
  npx @rozoai/checkout pay <coinbase-link> --with usdt-solana
105
199
  ```
106
200
 
107
- Wallet: any wallet, no key. `--send` needs the env key.
201
+ Wallet: any wallet, no key. `--send` signs locally using your Solana CLI
202
+ keypair or an encrypted keystore, and supports EVM chains and Solana only —
203
+ Stellar and Lightning are Mode A only.
108
204
  </details>
109
205
 
110
206
  <details>
@@ -117,7 +213,9 @@ To pay an OpenRouter / Coinbase payment link, run:
117
213
  npx @rozoai/checkout pay <coinbase-link> --with usdt-solana
118
214
  ```
119
215
 
120
- Wallet: any wallet, no key. `--send` needs the env key.
216
+ Wallet: any wallet, no key. `--send` signs locally using your Solana CLI
217
+ keypair or an encrypted keystore, and supports EVM chains and Solana only —
218
+ Stellar and Lightning are Mode A only.
121
219
  </details>
122
220
 
123
221
  <details>
@@ -131,7 +229,9 @@ Fetch https://checkout.rozo.ai/llms.txt, then pay this OpenRouter link:
131
229
  npx @rozoai/checkout pay <coinbase-link> --with usdt-solana
132
230
  ```
133
231
 
134
- Wallet: any wallet, no key. `--send` needs the env key.
232
+ Wallet: any wallet, no key. `--send` signs locally using your Solana CLI
233
+ keypair or an encrypted keystore, and supports EVM chains and Solana only —
234
+ Stellar and Lightning are Mode A only.
135
235
  </details>
136
236
 
137
237
  <details>
@@ -144,7 +244,9 @@ trigger from a script or a chat channel:
144
244
  openclaw agent exec "Pay this OpenRouter link with USDT on Solana by running: npx @rozoai/checkout pay <coinbase-link> --with usdt-solana"
145
245
  ```
146
246
 
147
- Wallet: any wallet, no key. `--send` needs the env key.
247
+ Wallet: any wallet, no key. `--send` signs locally using your Solana CLI
248
+ keypair or an encrypted keystore, and supports EVM chains and Solana only —
249
+ Stellar and Lightning are Mode A only.
148
250
  </details>
149
251
 
150
252
  <details>
@@ -158,7 +260,9 @@ Pay this OpenRouter link with USDT on Solana by running:
158
260
  npx @rozoai/checkout pay <coinbase-link> --with usdt-solana
159
261
  ```
160
262
 
161
- Wallet: any wallet, no key. `--send` needs the env key.
263
+ Wallet: any wallet, no key. `--send` signs locally using your Solana CLI
264
+ keypair or an encrypted keystore, and supports EVM chains and Solana only —
265
+ Stellar and Lightning are Mode A only.
162
266
  </details>
163
267
 
164
268
  <details>
@@ -190,7 +294,7 @@ refused/failed (read `error.code`), `2` usage, `3` submitted but unconfirmed.
190
294
  Full walkthrough: [QUICKSTART](docs/QUICKSTART.md).
191
295
 
192
296
  Wallet: any wallet, no key. For hot-wallet sending see `send-evm.js` /
193
- `send-sol.js`, which read `ROZO_CHECKOUT_EVM_KEY` / `ROZO_CHECKOUT_SOL_KEY`.
297
+ `send-sol.js`, which use your Solana CLI keypair or an encrypted keystore.
194
298
  </details>
195
299
 
196
300
  <details>
@@ -206,7 +310,9 @@ to pay this OpenRouter link: <coinbase-link>
206
310
  If the agent has no shell but can make HTTP requests, it can drive the four
207
311
  public endpoints directly — see [how it works](docs/how-it-works.md).
208
312
 
209
- Wallet: any wallet, no key. `--send` needs the env key.
313
+ Wallet: any wallet, no key. `--send` signs locally using your Solana CLI
314
+ keypair or an encrypted keystore, and supports EVM chains and Solana only —
315
+ Stellar and Lightning are Mode A only.
210
316
  </details>
211
317
 
212
318
  ## Three rules worth knowing
@@ -215,6 +321,10 @@ Wallet: any wallet, no key. `--send` needs the env key.
215
321
  cached response or a screenshot.
216
322
  - **Send the exact amount shown.** It is normally larger than the invoice — it
217
323
  includes the bridge and network fees.
324
+ - **Stellar deposits carry a memo, and it is `MEMO_TEXT`** — even when it looks
325
+ like a number (`65371582` is text, not an id). Sending it as `MEMO_ID`
326
+ produces a different memo and the payment will not be matched. The deposit
327
+ block states the type as `receiverMemoType`.
218
328
  - **Never pay a funded order twice.** If a payment has already been detected,
219
329
  stop and get a human to reconcile it; a second payment to a one-time address
220
330
  is not guaranteed to be credited.
@@ -233,6 +343,21 @@ The full list of what this refuses to do, and why, is in
233
343
 
234
344
  ## Changelog
235
345
 
346
+ - **0.1.3** — fixes found by the first real payment. The built bundles no
347
+ longer crash with `__filename is not defined` on Node 22+ (the esbuild banner
348
+ now shims `__filename`/`__dirname` as well as `require`, and every bundle is
349
+ now executed by the test suite). Stellar deposits state their memo type
350
+ (`MEMO_TEXT`, even when the memo looks numeric). Orders show remaining
351
+ validity as a duration ("expires in 47m") in the deposit block and in
352
+ `status`, with the exact command to make a fresh one. Reusing an existing
353
+ unpaid order, and asking for a coin that differs from it, are both explained
354
+ instead of reading as errors.
355
+ - **0.1.2** — Mode B no longer needs a raw private key in an environment
356
+ variable. On Solana it uses the `~/.config/solana/id.json` that
357
+ `solana-keygen` already wrote; on EVM an encrypted V3 keystore whose
358
+ passphrase is prompted. `--keyfile` names either explicitly, and settings can
359
+ come from a gitignored `.env`. Raw env keys still work for unattended
360
+ automation. Key files and `.env` must be `chmod 600` and untracked by git.
236
361
  - **0.1.1** — one spend limit instead of two: a single payment may not exceed
237
362
  $1,100 (sized for a $1,000 credit purchase plus its 5% fee), the cumulative
238
363
  session cap and the `--yes-large` override are removed. Docs make it explicit
@@ -57,6 +57,29 @@ LINK="https://payments.coinbase.com/payment-links/pl_01YOURLINKID"
57
57
  Ids de cadena: `1` Ethereum · `56` BNB Chain · `137` Polygon · `8453` Base ·
58
58
  `900` Solana · `1500` Stellar · `lightning` Bitcoin Lightning.
59
59
 
60
+ ## ¿Qué wallet necesito?
61
+
62
+ **Una wallet, en una cadena: no hace falta una por cada cadena.** Elige la
63
+ moneda que ya tengas y paga desde donde ya esté.
64
+
65
+ Sirve cualquier wallet, y también un retiro desde un exchange: el Mode A de
66
+ abajo solo imprime un bloque de depósito, y envías exactamente ese `amount` de
67
+ ese `tokenSymbol`, en esa `chain`, a esa `receiverAddress`. Nada se conecta a
68
+ ningún sitio ni se aprueba en el navegador. En la práctica la gente usa
69
+ MetaMask o Rabby en las cadenas EVM, Phantom o Solflare en Solana, y una wallet
70
+ Lightning como Phoenix o Wallet of Satoshi para BTC.
71
+
72
+ Dos casos son distintos. **Stellar** se enruta mediante una dirección
73
+ compartida más `receiverMemo`, así que aquello desde lo que envíes debe
74
+ permitirte fijar un memo: si lo omites, el pago se pierde. **Lightning** paga
75
+ la factura BOLT11 de `deposit.lnInvoice`; no hay ninguna dirección a la que
76
+ enviar.
77
+
78
+ Solo `--send` (Mode B) necesita una clave, y cubre únicamente las cadenas EVM y
79
+ Solana: en Solana usa el `~/.config/solana/id.json` que `solana-keygen` ya creó,
80
+ y en EVM un keystore cifrado cuya frase de contraseña se solicita. Una clave en
81
+ bruto en el entorno queda para la automatización desatendida.
82
+
60
83
  ## 1. Cotizarlo (solo lectura, gratis)
61
84
 
62
85
  ```bash
@@ -136,6 +159,7 @@ exigen los scripts de envío.
136
159
  ```
137
160
 
138
161
  Enviar exactamente los campos que entrega este bloque. Para Lightning,
162
+ En Stellar el memo es **`MEMO_TEXT`** aunque parezca numérico: enviarlo como `MEMO_ID` no coincidirá. `deposit.expiresIn` indica cuánto sigue siendo válida la orden.
139
163
  `deposit.lnInvoice` contiene la cadena BOLT11 que hay que escanear, y
140
164
  `deposit.amount` está en satoshis.
141
165
 
@@ -159,22 +183,115 @@ Eso es todo el Modo A. Continuar en el paso 5.
159
183
 
160
184
  ### La forma opcional: dejar que el script pague (Modo B)
161
185
 
162
- Solo si se quiere que esta máquina firme por uno, y solo en cadenas EVM y Solana.
163
- Esta es la única parte que necesita una clave privada:
186
+ Solo si se quiere que esta máquina firme, y únicamente en **cadenas EVM y
187
+ Solana**: no hay `--send` para Stellar ni Lightning, que se pagan desde la
188
+ propia billetera. Esta es la única parte que necesita una clave.
189
+
190
+ **Solana: usar el par de claves que ya se tiene.** Si alguna vez se ejecutó
191
+ `solana-keygen`, `~/.config/solana/id.json` ya existe y se usa automáticamente:
192
+
193
+ ```bash
194
+ node scripts/dist/send-sol.js --rozo-payment-id <rozoPaymentId> --send
195
+ ```
196
+
197
+ **EVM: usar un keystore cifrado.** Exportar un keystore JSON V3 desde la
198
+ billetera y apuntar a él. La frase de contraseña (passphrase) se solicita de
199
+ forma interactiva; nunca se pasa como bandera:
200
+
201
+ ```bash
202
+ ROZO_CHECKOUT_EVM_KEYSTORE=~/wallets/hot.json \
203
+ node scripts/dist/send-evm.js --rozo-payment-id <rozoPaymentId> --send
204
+ ```
205
+
206
+ Cualquiera de los dos archivos se puede indicar explícitamente con
207
+ `--keyfile <path>`, y `--dry-run` funciona con todas las fuentes: deriva la
208
+ dirección y ejecuta todas las comprobaciones sin firmar nada.
209
+
210
+ **Para automatización desatendida**, donde nadie puede escribir una frase de
211
+ contraseña, una clave en bruto en el entorno sigue funcionando igual que antes:
212
+ `ROZO_CHECKOUT_SOL_KEY` o `ROZO_CHECKOUT_EVM_KEY`, o bien
213
+ `ROZO_CHECKOUT_KEYSTORE_PASSPHRASE` junto a un keystore. En una máquina que usa
214
+ una persona, es preferible un archivo de claves.
215
+
216
+ Estos ajustes también pueden vivir en un `.env` en el directorio desde el que se
217
+ ejecuta (o `--env-file <path>`). Solo se leen de él las claves `ROZO_CHECKOUT_*`,
218
+ se analiza como texto plano y nunca se pasa por un shell, y lo que ya esté en el
219
+ entorno real tiene prioridad. **Añadir `.env` al `.gitignore`.**
220
+
221
+ Un archivo de claves o un `.env` no debe ser legible por otros usuarios
222
+ (`chmod 600`) ni estar bajo seguimiento de git. Ambos casos se rechazan, no se advierten.
223
+
224
+ <details>
225
+ <summary><b>Configurar una billetera local para <code>--send</code></b> — plantilla .env y pasos de exportación por billetera</summary>
226
+
227
+ **Nada de esto hace falta para la ruta por defecto.** Pagar desde la propia
228
+ billetera no necesita clave ni configuración, y funciona con billeteras que aquí
229
+ nunca se pueden usar, incluidas las de hardware y las cuentas de exchange.
230
+
231
+ Un `.env` en el directorio desde el que se ejecuta, con todas las variables que
232
+ esta herramienta lee:
164
233
 
165
234
  ```bash
166
- # Previsualizar exactamente lo que se firmaría — no firma nada
167
- ROZO_CHECKOUT_SOL_KEY=<base58 secret key> \
168
- node scripts/dist/send-sol.js --rozo-payment-id <rozoPaymentId> --dry-run
235
+ # Nada de esto hace falta para pagar desde la propia billetera. Solo se lee
236
+ # cuando se usa --send.
237
+
238
+ # Clave secreta de Solana: una cadena base58 o un arreglo JSON de bytes. Solo
239
+ # hace falta si NO se tiene ~/.config/solana/id.json, que se detecta solo.
240
+ ROZO_CHECKOUT_SOL_KEY=REPLACE_ME_base58_secret_key
241
+
242
+ # Clave privada EVM en bruto: 0x seguido de 64 caracteres hex. La opción menos
243
+ # segura: es preferible el keystore de abajo.
244
+ ROZO_CHECKOUT_EVM_KEY=0x0000000000000000000000000000000000000000000000000000000000000000
169
245
 
170
- # Enviar de verdad. --send es obligatorio.
171
- ROZO_CHECKOUT_SOL_KEY=<base58 secret key> \
172
- node scripts/dist/send-sol.js --rozo-payment-id <rozoPaymentId> --send
246
+ # Keystore V3 cifrado para EVM: ruta al archivo. Preferible a la clave en bruto.
247
+ ROZO_CHECKOUT_EVM_KEYSTORE=/replace/me/keystores/my-hot-wallet
248
+
249
+ # Frase de contraseña de ese keystore. Solo para ejecuciones desatendidas; en
250
+ # una terminal se solicita y no se guarda nada.
251
+ ROZO_CHECKOUT_KEYSTORE_PASSPHRASE=REPLACE_ME_not_a_real_passphrase
252
+
253
+ # Sobrescrituras de RPC opcionales, una por id de cadena. 8453 = Base,
254
+ # 900 = Solana.
255
+ ROZO_CHECKOUT_RPC_8453=https://mainnet.base.org
256
+ ROZO_CHECKOUT_RPC_900=https://api.mainnet-beta.solana.com
173
257
  ```
174
258
 
175
- Usar `send-evm.js` con `ROZO_CHECKOUT_EVM_KEY` para Ethereum, BNB Chain,
176
- Polygon y Base. Un solo pago no puede superar los **$1,100**; por encima de eso,
177
- pagar desde la propia billetera como se explica arriba.
259
+ Después, restringir permisos y mantenerlo fuera de git:
260
+
261
+ ```bash
262
+ chmod 600 .env
263
+ echo '.env' >> .gitignore
264
+ ```
265
+
266
+ **Solana**
267
+
268
+ - `solana-keygen new` escribe `~/.config/solana/id.json`. No hay nada que
269
+ configurar: se encuentra automáticamente. Es la ruta recomendada.
270
+ - **Phantom** → Settings → Export Private Key da una cadena **base58**. Va en
271
+ `ROZO_CHECKOUT_SOL_KEY`.
272
+ - **Solflare** exporta una cadena base58 en las versiones actuales y un arreglo
273
+ JSON de bytes en las antiguas. Ambos se aceptan tal cual.
274
+
275
+ **EVM**
276
+
277
+ - **MetaMask** y **Rabby** exportan la clave privada como 64 caracteres hex.
278
+ Pegarla tal cual en `ROZO_CHECKOUT_EVM_KEY`; el prefijo `0x` es opcional.
279
+ - **Keystore cifrado (más seguro).** Las billeteras de navegador exportan claves
280
+ en bruto, no keystores. Para convertir una en un keystore cifrado, usar
281
+ Foundry: `cast wallet import my-hot-wallet --interactive` pide la clave y
282
+ escribe un keystore V3 cifrado en `~/.foundry/keystores/my-hot-wallet`
283
+ (`--keystore-dir` cambia la ubicación). Apuntar `ROZO_CHECKOUT_EVM_KEYSTORE` a
284
+ ese archivo. `geth account import` también genera un keystore V3.
285
+
286
+ **Billeteras que no se pueden usar con `--send`:** billeteras de hardware
287
+ (Ledger, Trezor), billeteras móviles solo con WalletConnect y cuentas de
288
+ exchange. Por diseño, ninguna entrega una clave de firma. Esos casos usan la
289
+ ruta por defecto sin clave, que funciona con todas ellas.
290
+
291
+ </details>
292
+
293
+ Un solo pago no puede superar **$1,100**; por encima de eso, pagar desde la
294
+ propia billetera como arriba.
178
295
 
179
296
  ```json
180
297
  {
@@ -54,6 +54,16 @@ LINK="https://payments.coinbase.com/payment-links/pl_01YOURLINKID"
54
54
  チェーン id: `1` Ethereum · `56` BNB Chain · `137` Polygon · `8453` Base ·
55
55
  `900` Solana · `1500` Stellar · `lightning` Bitcoin Lightning。
56
56
 
57
+ ## どのウォレットが必要ですか?
58
+
59
+ **ウォレットは 1 つ、チェーンも 1 つで足ります — チェーンごとに用意する必要はありません。**すでに持っている通貨を選び、それが今ある場所から支払ってください。
60
+
61
+ どのウォレットでも構いませんし、取引所からの出金でも構いません。下記の Mode A は入金情報を表示するだけで、示された `amount` の `tokenSymbol` を、その `chain` 上で `receiverAddress` へ送るだけです。どのサイトに接続することも、ブラウザで承認することもありません。実際には、EVM チェーンでは MetaMask や Rabby、Solana では Phantom や Solflare、BTC では Phoenix や Wallet of Satoshi といった Lightning ウォレットがよく使われています。
62
+
63
+ 異なるケースが 2 つあります。**Stellar** は共有アドレスと `receiverMemo` の組み合わせで振り分けられるため、送信元で memo を設定できる必要があります。memo を省くと、その支払いは失われます。**Lightning** は `deposit.lnInvoice` にある BOLT11 インボイスに支払います。送金先アドレスというものはありません。
64
+
65
+ 鍵が必要なのは `--send`(Mode B)だけで、対象は EVM チェーンと Solana のみです。Solana では `solana-keygen` が既に作成した `~/.config/solana/id.json` を、EVM では暗号化された keystore(パスフレーズは対話的に入力)を使います。環境変数の生の鍵は無人自動化向けに残されています。
66
+
57
67
  ## 1. 見積もりを取得する(読み取り専用、無料)
58
68
 
59
69
  ```bash
@@ -131,6 +141,7 @@ node scripts/dist/create-order.js --url "$LINK" --chain 900 --token USDT --confi
131
141
  ```
132
142
 
133
143
  このブロックが示すフィールドを、そのとおりに送金してください。Lightning の場合、
144
+ Stellar の memo は数字に見えても**常に `MEMO_TEXT`** です — `MEMO_ID` として送ると一致しません。`deposit.expiresIn` に残りの有効時間が出ます。
134
145
  `deposit.lnInvoice` にスキャン用の BOLT11 文字列が入り、`deposit.amount` は
135
146
  satoshi 単位になります。
136
147
 
@@ -153,22 +164,110 @@ satoshi 単位になります。
153
164
 
154
165
  ### 任意の方法: スクリプトに支払わせる(モード B)
155
166
 
156
- このマシンに署名させたい場合にだけ、そして EVM チェーンと Solana でのみ使えます。
157
- 秘密鍵が必要なのはこの部分だけです:
167
+ このマシンに署名させたい場合のみで、対象は **EVM チェーンと Solana だけ**です。Stellar と
168
+ Lightning に `--send` はなく、自分のウォレットから支払います。鍵が必要なのはこの部分だけです。
169
+
170
+ **Solana — すでにある鍵ペアをそのまま使います。** `solana-keygen` を一度でも実行して
171
+ いれば `~/.config/solana/id.json` が既に存在し、自動的に使われます:
172
+
173
+ ```bash
174
+ node scripts/dist/send-sol.js --rozo-payment-id <rozoPaymentId> --send
175
+ ```
176
+
177
+ **EVM — 暗号化された keystore を使います。** ウォレットから V3 形式の JSON keystore を
178
+ 書き出し、それを指定してください。パスフレーズは対話的に尋ねられ、フラグとして渡す
179
+ ことは決してありません:
180
+
181
+ ```bash
182
+ ROZO_CHECKOUT_EVM_KEYSTORE=~/wallets/hot.json \
183
+ node scripts/dist/send-evm.js --rozo-payment-id <rozoPaymentId> --send
184
+ ```
185
+
186
+ どちらのファイルも `--keyfile <path>` で明示的に指定できます。`--dry-run` はすべての
187
+ 取得元で機能し、アドレスを導出してすべてのチェックを実行しますが、署名は行いません。
188
+
189
+ **無人自動化の場合**(パスフレーズを入力できる人がいない場合)は、環境変数の生の鍵が
190
+ これまでどおり使えます — `ROZO_CHECKOUT_SOL_KEY` または `ROZO_CHECKOUT_EVM_KEY`、
191
+ あるいは keystore と併せて `ROZO_CHECKOUT_KEYSTORE_PASSPHRASE` です。人が使うマシンでは
192
+ 鍵ファイルを優先してください。
193
+
194
+ これらの設定は、実行するディレクトリの `.env` に置くこともできます(`--env-file <path>`
195
+ でも指定できます)。読み込まれるのは `ROZO_CHECKOUT_*` のキーだけで、ファイルはテキスト
196
+ として解析され、シェルで評価されることは決してありません。実際の環境変数のほうが優先
197
+ されます。**`.env` は `.gitignore` に追加してください。**
198
+
199
+ 鍵ファイルと `.env` は他のユーザーから読めてはならず(`chmod 600`)、git で追跡されて
200
+ いてもいけません。どちらの場合も警告ではなく拒否されます。
201
+
202
+ <details>
203
+ <summary><b><code>--send</code> 用のローカルウォレット設定</b> — .env テンプレートとウォレット別の書き出し手順</summary>
204
+
205
+ **既定の経路ではここに書かれたものは一切不要です。** 自分のウォレットから支払う場合、
206
+ 鍵も設定も要りません。しかもここでは決して使えないウォレット — ハードウェアウォレットや
207
+ 取引所アカウントを含む — でも支払えます。
208
+
209
+ コマンドを実行するディレクトリに `.env` を置きます。本ツールが読み取る変数の全一覧です:
158
210
 
159
211
  ```bash
160
- # 署名される内容を正確にプレビューします — 署名は一切行いません
161
- ROZO_CHECKOUT_SOL_KEY=<base58 secret key> \
162
- node scripts/dist/send-sol.js --rozo-payment-id <rozoPaymentId> --dry-run
212
+ # 自分のウォレットから支払う場合、以下はどれも不要です。--send を使うときだけ
213
+ # 読み込まれます。
214
+
215
+ # Solana の秘密鍵: base58 文字列、または JSON のバイト配列。
216
+ # ~/.config/solana/id.json (自動的に使われます) が無い場合にのみ必要です。
217
+ ROZO_CHECKOUT_SOL_KEY=REPLACE_ME_base58_secret_key
218
+
219
+ # EVM の生の秘密鍵: 0x + 16 進 64 文字。最も安全でない選択肢です。
220
+ # 下の keystore を優先してください。
221
+ ROZO_CHECKOUT_EVM_KEY=0x0000000000000000000000000000000000000000000000000000000000000000
163
222
 
164
- # 実際に送金します。--send は必須です。
165
- ROZO_CHECKOUT_SOL_KEY=<base58 secret key> \
166
- node scripts/dist/send-sol.js --rozo-payment-id <rozoPaymentId> --send
223
+ # EVM の暗号化 V3 keystore: そのファイルへのパス。上の生の鍵より推奨されます。
224
+ ROZO_CHECKOUT_EVM_KEYSTORE=/replace/me/keystores/my-hot-wallet
225
+
226
+ # その keystore のパスフレーズ。無人実行のときだけ必要で、端末では対話的に
227
+ # 尋ねられ、保存もされません。
228
+ ROZO_CHECKOUT_KEYSTORE_PASSPHRASE=REPLACE_ME_not_a_real_passphrase
229
+
230
+ # 任意の RPC 上書き。チェーン id ごとに 1 行。8453 = Base、900 = Solana。
231
+ ROZO_CHECKOUT_RPC_8453=https://mainnet.base.org
232
+ ROZO_CHECKOUT_RPC_900=https://api.mainnet-beta.solana.com
167
233
  ```
168
234
 
169
- Ethereum、BNB Chain、Polygon、Base では `send-evm.js` を `ROZO_CHECKOUT_EVM_KEY` と
170
- 併せて使います。1 回の支払いは **$1,100** を超えられません。それを超える場合は、上記の
171
- とおり自分のウォレットから支払ってください。
235
+ そのうえで権限を絞り、git に入らないようにします:
236
+
237
+ ```bash
238
+ chmod 600 .env
239
+ echo '.env' >> .gitignore
240
+ ```
241
+
242
+ **Solana**
243
+
244
+ - `solana-keygen new` は `~/.config/solana/id.json` を書き出します。設定は不要で、
245
+ 自動的に見つかります。これが推奨の経路です。
246
+ - **Phantom** → Settings → Export Private Key で得られるのは **base58** 文字列です。
247
+ `ROZO_CHECKOUT_SOL_KEY` に設定してください。
248
+ - **Solflare** は現行バージョンでは base58 文字列、古いバージョンでは JSON のバイト配列を
249
+ 書き出します。どちらもそのまま使えます。
250
+
251
+ **EVM**
252
+
253
+ - **MetaMask** と **Rabby** の秘密鍵の書き出しは 16 進 64 文字です。そのまま
254
+ `ROZO_CHECKOUT_EVM_KEY` に貼り付けてください。`0x` 接頭辞は付けても付けなくても
255
+ 構いません。
256
+ - **暗号化 keystore (より安全)。** ブラウザーウォレットが書き出せるのは生の鍵だけで、
257
+ keystore ではありません。生の鍵を暗号化 keystore に変えるには Foundry を使います:
258
+ `cast wallet import my-hot-wallet --interactive` が鍵の入力を促し、暗号化された
259
+ V3 keystore を `~/.foundry/keystores/my-hot-wallet` に書き出します
260
+ (`--keystore-dir` で場所を変更できます)。`ROZO_CHECKOUT_EVM_KEYSTORE` をその
261
+ ファイルに向けてください。`geth account import` も V3 keystore を生成します。
262
+
263
+ **`--send` に使えないウォレット:** ハードウェアウォレット (Ledger、Trezor)、
264
+ WalletConnect 専用のモバイルウォレット、取引所アカウント。いずれも設計上、署名鍵を
265
+ 渡しません。これらの場合は既定の鍵なしの経路を使ってください — すべてで動作します。
266
+
267
+ </details>
268
+
269
+ 1 回の支払いは **$1,100** を超えられません。それ以上は上記のとおり自分のウォレットから
270
+ 支払ってください。
172
271
 
173
272
  ```json
174
273
  {