Skip to content

feat: CLI, payments package, demo server, and tests#8

Merged
Blu-Jay-Dev merged 2 commits into
mainfrom
feat/cli-payments-demo
Mar 13, 2026
Merged

feat: CLI, payments package, demo server, and tests#8
Blu-Jay-Dev merged 2 commits into
mainfrom
feat/cli-payments-demo

Conversation

@Blu-Jay-Dev

Copy link
Copy Markdown
Contributor

Summary

  • @tollway/clinpx @tollway/cli with init, id, fetch, policy commands; Ed25519 DID keygen stored at ~/.tollway/config.json; chalk output; 15 unit tests
  • @tollway/paymentscreatePaymentHandler() sends real USDC on Base (mainnet + Sepolia) via viem; wires into @tollway/client via onPaymentRequired callback
  • @tollway/client — adds onPaymentRequired option; removes placeholder tx hash stub
  • demo/ — Express server with sample articles, @tollway/server middleware, 402 for train scope, Dockerfile for Railway/Render
  • Publish workflow — adds @tollway/cli and @tollway/payments publish steps

Test plan

  • CI passes (79 tests: 26 client, 38 server, 15 CLI)
  • npx @tollway/cli init generates a did:key:z... identity
  • npx @tollway/cli fetch https://example.com returns structured output
  • npx @tollway/cli policy https://tollway.dev shows policy
  • Demo server starts locally: cd demo && npm run dev
  • After merge: tag v0.2.0 to publish all four packages

🤖 Generated with Claude Code

Blu-Jay-Dev and others added 2 commits March 12, 2026 07:43
- @tollway/cli: `tollway init/id/fetch/policy` commands with Ed25519 DID keygen,
  chalk output, config stored at ~/.tollway/config.json
- @tollway/payments: viem-based USDC handler for Base mainnet + Sepolia,
  exports createPaymentHandler() compatible with @tollway/client
- @tollway/client: add onPaymentRequired callback to TollwayOptions,
  replaces placeholder stub — no real payment without an explicit handler
- demo/: Express server with sample articles, tollway middleware, Dockerfile

All packages build clean; 64 tests passing (26 client, 38 server).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract pure functions (base58Encode, generateDidKeyPair, loadConfig,
  saveConfig) into lib.ts for testability
- Add 15 unit tests for CLI lib (DID generation, base58, config I/O)
- Add @tollway/cli and @tollway/payments publish steps to CI workflow
- Total: 79 tests passing across 3 packages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Blu-Jay-Dev Blu-Jay-Dev merged commit f1c5ca5 into main Mar 13, 2026
2 of 3 checks passed
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