feat: support a public browser demo of the kiosk #88
3 changed files with 22 additions and 0 deletions
feat(lnbits): wrap the create_wallet RPC
The transport has exposed `create_wallet` (AUTH_ACCOUNT) since the RPC registry was written, but LnbitsClient never wrapped it — the ATM only ever needed the auto-created default wallet from `list_wallets`. Add `createWallet(name)` plus its `CreatedWallet` reply type. Account-scoped, so the envelope deliberately carries no `wallet_id`: that absence is what makes the server resolve auth to the Account rather than a Wallet. Not wrapped in `idempotent()` — a retry would mint a duplicate wallet, same reasoning as create_invoice. The reply carries the new wallet's adminkey/inkey, hence the type-level note not to log it verbatim. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013A6683cCHnQxFUosx1krY4
commit
ac40ea9bb6
|
|
@ -37,6 +37,7 @@ import type {
|
||||||
CreateInvoiceBody,
|
CreateInvoiceBody,
|
||||||
PayInvoiceBody,
|
PayInvoiceBody,
|
||||||
WalletInfo,
|
WalletInfo,
|
||||||
|
CreatedWallet,
|
||||||
MachineConfigResponse,
|
MachineConfigResponse,
|
||||||
SubscribePaymentsBody,
|
SubscribePaymentsBody,
|
||||||
SubscribeAck,
|
SubscribeAck,
|
||||||
|
|
@ -211,6 +212,17 @@ export class LnbitsClient {
|
||||||
return data ?? []
|
return data ?? []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an additional wallet on the calling account (`create_wallet`).
|
||||||
|
*
|
||||||
|
* Account-scoped (AUTH_ACCOUNT): the envelope carries no `wallet_id`, which
|
||||||
|
* is what makes the server resolve auth to the Account rather than a Wallet.
|
||||||
|
* NOT wrapped in `idempotent()` — a retry would mint a duplicate wallet.
|
||||||
|
*/
|
||||||
|
async createWallet(name: string): Promise<CreatedWallet> {
|
||||||
|
return this.sendRpc<CreatedWallet>('create_wallet', { body: { name } })
|
||||||
|
}
|
||||||
|
|
||||||
/** Pull server-delivered machine config (operator pubkey + fee config) over
|
/** Pull server-delivered machine config (operator pubkey + fee config) over
|
||||||
* the authenticated transport — spirekeeper's `get_machine_config` RPC
|
* the authenticated transport — spirekeeper's `get_machine_config` RPC
|
||||||
* (bitspire#70 P1). Lets a seed-only ATM configure itself with no per-machine
|
* (bitspire#70 P1). Lets a seed-only ATM configure itself with no per-machine
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ export type {
|
||||||
CreateInvoiceBody,
|
CreateInvoiceBody,
|
||||||
PayInvoiceBody,
|
PayInvoiceBody,
|
||||||
WalletInfo,
|
WalletInfo,
|
||||||
|
CreatedWallet,
|
||||||
SubscribePaymentsBody,
|
SubscribePaymentsBody,
|
||||||
SubscribeAck,
|
SubscribeAck,
|
||||||
SubscribePush,
|
SubscribePush,
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,15 @@ export interface WalletInfo {
|
||||||
balance: number
|
balance: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Reply shape of the `create_wallet` RPC — unlike WalletInfo it carries the
|
||||||
|
* fresh wallet's keys, so never log it verbatim. */
|
||||||
|
export interface CreatedWallet {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
adminkey: string
|
||||||
|
inkey: string
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Subscriptions
|
// Subscriptions
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue