Skip to content

feat: add OWS (Open Wallet Standard) as x402 payment provider#390

Open
arein wants to merge 4 commits intonansen-ai:mainfrom
arein:feat/ows-x402-provider
Open

feat: add OWS (Open Wallet Standard) as x402 payment provider#390
arein wants to merge 4 commits intonansen-ai:mainfrom
arein:feat/ows-x402-provider

Conversation

@arein
Copy link
Copy Markdown
Contributor

@arein arein commented Apr 3, 2026

Summary

Screenshot 2026-04-03 at 1 31 57 PM
  • Adds Open Wallet Standard (OWS) as a new x402 payment provider, enabling nansen-cli to auto-pay API calls using OWS wallets
  • OWS signs internally (no private key export) — EIP-712 typed data for EVM, SPL TransferChecked for Solana
  • Falls back gracefully when OWS is not installed (no new npm dependencies)
  • Provider chain: Privy → Local → OWS → WalletConnect

New files

  • src/x402-ows.js — SDK loading (via createRequire from global node_modules), wallet discovery, EVM/Solana signing, async generator
  • src/__tests__/x402-ows.test.js — 19 tests covering SDK loading, wallet resolution, EVM signing, Solana signing, priority ordering

Modified files

  • src/api.js — 10-line insertion between local wallet and WalletConnect in the 402 handler

Environment variables

Variable Purpose Default
OWS_WALLET OWS wallet name/ID for payments First wallet with EVM+Solana accounts
OWS_PASSPHRASE Passphrase for encrypted OWS wallets null (unencrypted only)

Test plan

  • All 19 new OWS tests pass
  • Full test suite passes (1062 tests, 0 failures)
  • Manual: OWS_WALLET=agent-treasury nansen token info --address 0x... --chain ethereum triggers x402 → OWS signing

🤖 Generated with Claude Code

arein and others added 4 commits April 3, 2026 12:54
Enables nansen-cli to auto-pay x402 API calls using OWS wallets.
OWS signs internally (no private key export) via EIP-712 typed data
for EVM and SPL TransferChecked for Solana. Falls back gracefully
when OWS is not installed.

Provider chain: Privy → Local → OWS → WalletConnect

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Strip 0x prefix from Solana signature hex before Buffer.from
- Add comment explaining OWS extract_signable_bytes for full-tx signing
- Normalize log prefix to [x402] OWS: (matching codebase convention)
- Gate signing failure log behind DEBUG (matching Privy pattern)
- Add debug logging for wallet resolution and signing status
- Add debug logging for _x402Retry payment rejection
- Remove dead make402Response test helper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove all process.env.DEBUG logging
- Revert DEBUG logging added to _x402Retry in api.js
- Remove section dividers, reduce from 254 to 187 lines
- Fix double base64 decode in Solana path
- Add ed25519 signature length validation
- Consistent resource shape between EVM and Solana payloads
- Use options objects instead of 6 positional params
- Inline resolveOwsPassphrase() one-liner
- Remove 2 broken tests, dead code, unnecessary comments

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant