{"id":45767133,"url":"https://github.com/zbdpay/agent-wallet","last_synced_at":"2026-03-04T08:00:34.126Z","repository":{"id":340669216,"uuid":"1167038776","full_name":"zbdpay/agent-wallet","owner":"zbdpay","description":"ZBD Wallet for AI Agents","archived":false,"fork":false,"pushed_at":"2026-02-28T20:24:30.000Z","size":435,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-01T06:19:34.124Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zbdpay.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-25T22:02:00.000Z","updated_at":"2026-02-28T20:24:31.000Z","dependencies_parsed_at":"2026-03-01T05:00:53.188Z","dependency_job_id":null,"html_url":"https://github.com/zbdpay/agent-wallet","commit_stats":null,"previous_names":["zbdpay/agent-wallet"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/zbdpay/agent-wallet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbdpay%2Fagent-wallet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbdpay%2Fagent-wallet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbdpay%2Fagent-wallet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbdpay%2Fagent-wallet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zbdpay","download_url":"https://codeload.github.com/zbdpay/agent-wallet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbdpay%2Fagent-wallet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29993526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-26T02:23:29.331Z","updated_at":"2026-03-02T06:00:28.327Z","avatar_url":"https://github.com/zbdpay.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @zbdpay/agent-wallet\n\n`zbdw` CLI for wallet operations, registration, history, and L402-aware fetch flows.\n\n## Requirements\n\n- Node.js `\u003e=22`\n- npm\n\n## Install\n\n```bash\nnpm install @zbdpay/agent-wallet\n```\n\nRun without installation:\n\n```bash\nnpx @zbdpay/agent-wallet init --key \u003capiKey\u003e\n```\n\nGlobal install for frequent use:\n\n```bash\nnpm install -g @zbdpay/agent-wallet\nzbdw balance\n```\n\nLocal repo usage from `/Users/andreneves/Code/zbd/agents`:\n\n```bash\nnpm --prefix agent-wallet run build\nalias zbdw='node agent-wallet/dist/cli.js'\n```\n\n## Environment Variables\n\n- `ZBD_API_KEY`: API key used by wallet calls and payments\n- `ZBD_API_BASE_URL`: ZBD API base URL, default `https://api.zbdpay.com`\n- `ZBD_AI_BASE_URL`: registration service base URL, default `https://zbd.ai`\n- `ZBD_WALLET_CONFIG`: config path, default `~/.zbd-wallet/config.json`\n- `ZBD_WALLET_PAYMENTS`: payment history path, default `~/.zbd-wallet/payments.json`\n- `ZBD_WALLET_TOKEN_CACHE`: token cache path, default `~/.zbd-wallet/token-cache.json`\n\n## Commands\n\n```bash\nzbdw init [--key \u003capiKey\u003e]\nzbdw info\nzbdw balance\n\nzbdw receive \u003camount_sats\u003e\nzbdw receive --static\n\nzbdw send \u003cdestination\u003e \u003camount_sats\u003e\nzbdw payments\nzbdw payment \u003cid\u003e\n\nzbdw withdraw create \u003camount_sats\u003e\nzbdw withdraw status \u003cwithdraw_id\u003e\n\nzbdw fetch \u003curl\u003e [--method \u003cmethod\u003e] [--data \u003cjson\u003e] [--max-sats \u003camount\u003e]\n```\n\n### Destination Types (`send`)\n\n- `lnbc...` -\u003e Bolt11 invoice\n- `lnurl...` -\u003e LNURL\n- `@name` -\u003e ZBD gamertag\n- `name@domain.com` -\u003e Lightning address\n\n## JSON Output Contract\n\nCLI writes JSON to stdout for both success and failure.\n\nFailure shape:\n\n```json\n{\n  \"error\": \"error_code\",\n  \"message\": \"Human-readable message\",\n  \"details\": {}\n}\n```\n\nExamples:\n\n- `init`: `{ \"lightningAddress\": \"name@zbd.ai\", \"status\": \"ok\" }`\n- `info`: `{ \"lightningAddress\": \"...\", \"apiKey\": \"***\", \"balance_sats\": 123 }`\n- `fetch`: `{ \"status\": 200, \"body\": {...}, \"payment_id\": \"...|null\", \"amount_paid_sats\": 21|null }`\n\n## Storage Files\n\n- Config: `~/.zbd-wallet/config.json`\n  - `apiKey`\n  - `lightningAddress`\n- Payment history: `~/.zbd-wallet/payments.json`\n- Token cache: `~/.zbd-wallet/token-cache.json`\n\n## L402 Fetch Flow\n\n`zbdw fetch` is powered by `@zbdpay/agent-fetch`.\n\n- parses `402` challenge\n- pays invoice via wallet API\n- retries with proof\n- caches token\n- enforces optional `--max-sats`\n\nCall twice against the same protected URL to verify cache reuse:\n\n```bash\nzbdw fetch \"https://your-protected-endpoint\" --max-sats 100\nzbdw fetch \"https://your-protected-endpoint\" --max-sats 100\n```\n\nOn the second call, `payment_id` should be `null` when cached token is reused.\n\n## Scripts\n\n```bash\nnpm run build\nnpm run test\nnpm run lint\nnpm run typecheck\nnpm run release:dry-run\n```\n\n## Troubleshooting\n\n- `zsh: command not found: zbdw`\n  - build first and add alias, or install package globally\n- `register_failed` during `init`\n  - ensure `ZBD_AI_BASE_URL` points to your running `zbd-ai` instance\n  - confirm upstream `ZBD_API_BASE_URL` and API key are valid for static charge creation\n- `wallet_response_invalid` during `info`/`balance`\n  - verify wallet endpoint returns a valid balance shape and that `ZBD_API_BASE_URL` is correct\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbdpay%2Fagent-wallet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzbdpay%2Fagent-wallet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbdpay%2Fagent-wallet/lists"}