Skip to content

Dev/v2merge#14

Merged
boboliu-1010 merged 3 commits intodev/v2from
dev/v2merge
Mar 12, 2026
Merged

Dev/v2merge#14
boboliu-1010 merged 3 commits intodev/v2from
dev/v2merge

Conversation

@boboliu-1010
Copy link
Copy Markdown
Collaborator

Description

Tests

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits

@boboliu-1010 boboliu-1010 merged commit 9690c59 into dev/v2 Mar 12, 2026
7 checks passed
boboliu-1010 pushed a commit that referenced this pull request Apr 28, 2026
…ANGELOG + docs

User requirement: "默认用 exact_permit 和 exact" — the CLI should pick
the cheapest user-fee scheme by default rather than always defaulting
to exact_gasfree's 0.1 USDT relayer cut.

Headline behavior change:
- Profile.scheme is now optional. When unset, transfer/pay auto-pick
  per (network, token) via the new src/schemes.ts table:
    eip155:97 DHLU       → exact          (ERC-3009)
    eip155:97/56 USDT/USDC → exact_permit (EIP-2612)
    tron:* USDT          → exact_permit  (TIP-712), with allowance-
                                          failure auto-fallback to
                                          exact_gasfree
- Default `nile` profile pinned to exact_permit (was exact_gasfree).
  Both BSC and TRON exact_permit settle through the BankofAI root
  facilitator with feeAmount=0 — verified live on BSC Testnet, tx
  0xe6458fcbf1da1da9a0c638cf68b357982781ae932b6742a02331d2371bfeaf30.

Implementation:
- src/schemes.ts (+10 unit tests): recommendedSchemes / pickScheme /
  isKnownScheme. Single source of truth for per-token scheme support.
- src/commands/transfer.ts: split into settleViaFacilitator (exact /
  exact_permit via FacilitatorHttpClient /fee/quote /verify /settle)
  and settleViaGasFree (in-process GasFreeAPIClient.submit). 9 unit
  tests covering both paths, dry-run, fallback, and error envelopes.
- src/commands/pay.ts: registers exact + exact_permit on EVM and
  exact_permit + exact_gasfree on TRON. Selector filters server
  accepts[] by scheme/maxAmount.
- src/commands/request.ts (+5 unit tests): offline transfer-request URI
  generator. Falls back to built-in defaults when ~/.x402/config.json
  is absent.
- src/wallet.ts: createTronClientSignerFromEnv /
  createEvmClientSignerFromEnv. Pure env-key path, no agent-wallet
  dependency at signing time. EVM derivation supported (was post-MVP).
- src/facilitator.ts: getFacilitatorBaseUrl(eip155:*) now returns the
  root URL (was a non-existent /bsc-testnet 404). Per solutions.md
  #14 the BankofAI proxy serves EVM schemes from root, only TRON
  GasFree uses network-scoped paths.
- src/commands/doctor.ts: readiness probe falls back to /supported
  when /api/v1/config/provider/all 404s, so EVM doctors don't
  misreport facilitator=fail.

Documentation:
- typescript/packages/cli/CHANGELOG.md: new file. 0.1.0 entry covering
  every shipped command + known limitations (TRON USDT transferFrom
  revert, single Nile GasFree provider, scheme registry coverage).
- typescript/packages/cli/README.md: rewritten "Schemes & fees"
  section with the cost-comparison table; first-run flow now
  recommends BSC testnet for fee-free demo; live tx hash linked.
- docs/solutions.md #13: TRON USDT (TRC-20) transferFrom returns no
  data — breaks exact_permit settle. Workaround: pin --scheme
  exact_gasfree on TRON USDT until SDK ships a TRC-20-aware adapter.
- docs/solutions.md #14: BankofAI facilitator URL semantics — root
  for everything except the TRON GasFree balance proxy.
- specs/002-bankofai-cli/notes/decisions.md D4 updated: EVM facilitator
  is root, not per-chain slug.

Tests: 15 files, 114 unit tests. Build clean. Real-chain BSC
exact_permit verified end-to-end with feeAmount=0; TRON exact_permit
dry-run works (live fee_quote returns 0); TRON exact_gasfree path
intact (prior session txs).

Co-Authored-By: Claude Opus 4.7 (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