Skip to content

Pay x402 exact offers on nano:mainnet from a Nano keystore - #141

Closed
dhyabi2 wants to merge 2 commits into
agentscore:mainfrom
dhyabi2:feat/nano-exact-x402
Closed

dhyabi2 wants to merge 2 commits into
agentscore:mainfrom
dhyabi2:feat/nano-exact-x402

Conversation

@dhyabi2

@dhyabi2 dhyabi2 commented Oct 14, 2026

Copy link
Copy Markdown

Problem
A merchant whose 402 offers only x402 exact on nano:mainnet can't be paid with pay today: there's no Nano keystore, no scheme registered for that network, and quotes lists the rail as unsupported.

Change

  • src/chains/nano.ts: ed25519-blake2b keys, SLIP-10 m/44'/165'/0' for mnemonics, checksummed nano_/xrb_ addresses, exact raw/XNO conversion with bigint, a balance read, and a signed state send block published through a swappable RPC (work_generate + process); NANO_RPC_URL overrides the endpoint.
  • src/chains/nano-x402.ts: ExactNanoScheme, registered on nano:mainnet in payViaX402 next to Base. Payload { blockHash }. A retry within one invocation re-sends the block already published instead of paying again.
  • Nano is opt-in: used only with --chain nano; never auto-selected, not in the default wallet create, never priced in USD.
  • pay --chain nano requires --max-spend-xno (else limit_required), aborts over the cap before any block is built, and records price_xno, never price_usd, so USD limits and history totals are unchanged.
  • wallet create/import/address/list/export/remove accept --chain nano; quotes lists nano:mainnet exact as supported with no USD price. README updated.

Tests
Published Nano key->address vectors (zero seed and the BIP-39 path), signature and block-hash checks, and end-to-end pay against a local 402 merchant and mock node: settle, dry-run, missing cap, over cap, node error -> network_error, bad payTo checksum, xrb_ payTo, mainnet-only, retry without double pay, and Base still selected with --chain base when both rails are offered.

Ran: bun install --frozen-lockfile && bun run lint && bun run typecheck && bun run knip && bun run test -- --coverage && bun run build

  • Before: lint/typecheck/knip clean; 52 files passed, 1 skipped; 547 tests passed, 2 skipped; build ok.
  • After: lint/typecheck/knip clean; 54 files passed, 1 skipped; 586 tests passed, 2 skipped; coverage 90.53/85.21/92.95/92.22; build ok.

Limits: Nano is not under the global USD limits (only the per-call --max-spend-xno); check, discover, balance, fund, send do not take nano yet; an unopened account reads as insufficient balance.

dhyabi2 and others added 2 commits October 13, 2026 05:38
Add nano as an opt-in rail, reached only with --chain nano. It is never
auto-selected, not part of the default wallet set, and never priced in USD.

- src/chains/nano.ts: ed25519-blake2b keys, SLIP-10 m/44'/165'/0' for
  mnemonics, checksummed nano_/xrb_ addresses, exact raw <-> XNO, balance
  read, and a signed state send block published through an injectable RPC
  (work_generate + process). NANO_RPC_URL overrides the endpoint.
- src/chains/nano-x402.ts: ExactNanoScheme, registered on nano:mainnet in
  payViaX402 next to Base; payload is { blockHash }. A retry within one
  invocation re-presents the published block instead of paying again.
- pay --chain nano requires --max-spend-xno (limit_required otherwise),
  aborts over the cap before any block is built, and records price_xno
  instead of price_usd, so USD limits and history totals are unchanged.
- wallet create/import/address/list/export/remove accept --chain nano.
- quotes lists x402 exact on nano:mainnet as supported, without a USD price.
@vvillait88 vvillait88 closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants