Merged
Conversation
Hades-Ye
reviewed
Mar 12, 2026
| * Used by variable-amount settlement flows. | ||
| */ | ||
| export const X402_UPTO_PERMIT2_PROXY_ADDRESSES: Record<string, string> = { | ||
| "tron:mainnet": "TGHEYAovw8fZz1bgnVgRtgrdGLbagFZYq5", |
boboliu-1010
pushed a commit
that referenced
this pull request
Apr 24, 2026
All three testnet scenarios now verified end-to-end on real chain: - exact_testnet — BSC tx 461d17b...159a0 - exact_permit_testnet — BSC tx 0xfc8b32d...98a23 - exact_gasfree_testnet — TRON Nile tx 1d77f242b72293116e65c46b5ad756dd2f8355ebc625078aec0eb4ea54d148d2 Two new solutions entries from closing the gasfree loop: #9 GasFree gasFreeAddress is per-query, not absolute. The API returns a fresh mapping for every queried address; our SDK queries with the main wallet and writes that layer's gasFreeAddress into the payload. If you deposit to a gasFreeAddress obtained by querying any *other* address (e.g. one resolved from a second hop), the balance won't register. Always deposit to api_client.get_address_info(main_wallet)["gasFreeAddress"]. #10 TRON multisig / witness accounts reject single-key signatures under the default permission_id=0 (owner). If owner_permission.threshold > 1, sign under an active permission via .permission_id(2) — confirmed on the Nile witness account used in our testnet .env. tronpy default path would otherwise return "Validate signature error: sig error" with no hint at the permission cause. Testnet README status table updated: all three rows ✅ verified. Regression: 217 pytest + 51 vitest + 8 mock e2e still green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
10 tasks
boboliu-1010
pushed a commit
that referenced
this pull request
Apr 27, 2026
…alance)
First slice of the BankofAI x402 CLI per specs/002-bankofai-cli/. This
PR delivers the read-only path: profile management, environment
diagnostics, and GasFree balance inspection. Signing commands (transfer,
pay, serve transfer, receipt) follow once this slice is reviewed.
Package: typescript/packages/cli, published as @bankofai/x402-cli with
the binary `x402`. Routes via commander; output via a wrapped envelope
matching D2 in specs/002-bankofai-cli/notes/decisions.md:
{ ok, command, network?, scheme?, result } # success
{ ok, command, error: { code, message, hint? } } # failure
Commands:
- `x402 config init / use / get / set / list` — pure file I/O at
~/.x402/config.json (override via X402_CONFIG_FILE). Defaults to a
`nile` profile pinned to TRON Nile + exact_gasfree.
- `x402 doctor` — five non-throwing checks: Node version, wallet env,
facilitator endpoint reachability, GasFree address info (when scheme
is exact_gasfree on TRON), and token registry sanity. Each check
reports ok/warn/fail/skipped; one failure flips `overall` but other
checks still run.
- `x402 balance` — main wallet + derived gasFreeAddress + per-asset
balance/transferFee/activateFee from the BankofAI Nile proxy.
Addresses masked by default; --verbose shows full strings. Honors
solutions.md #9 — never recursively re-queries gasFreeAddress.
Decisions encoded:
- D1 wallet via TRON_PRIVATE_KEY / EVM_PRIVATE_KEY env. No --private-key
flag; deriveWalletInfo throws WALLET_NOT_AVAILABLE with a hint when
the var is unset.
- D2 wrapped envelope is the only emitted shape; no flat fallback.
- D3 X402_* prefix for non-secret config (PROFILE / NETWORK / SCHEME /
TOKEN / OUTPUT / CONFIG_FILE); native names for secrets.
- D4 facilitator URL is derived from network — no `--facilitator-url`
flag, no profile field. X402_FACILITATOR_URL_OVERRIDE is the single
e2e-only escape hatch and emits a stderr warning when active.
Standard error codes from the spec are normalized in src/error.ts and
surfaced through the envelope's `error.code` field.
Test plan (verified live against BankofAI Nile, 2026-04-27):
- 19 unit tests across config / output / facilitator (all green).
- `x402 config init/use/get/set/list` happy + error paths produce the
envelope shape and exit codes documented in the spec.
- `x402 doctor` without TRON_PRIVATE_KEY: 4 ok, 1 fail (wallet), 1
skipped (gasfree depends on wallet); overall=fail.
- `x402 doctor` with TRON_PRIVATE_KEY: all 5 checks ok; reports the
real GasFree state for our test wallet (active=true, nonce=2 —
matches the two on-chain settlements from PR #69's testnet run).
- `x402 balance --json` returns the canonical GasFree address and
zero USDT balance (consumed by yesterday's gasfree e2e).
Regression: 217 pytest + 51 vitest (SDK) + 8 e2e mock scenarios still
green; the new package adds 19 vitest tests on its own.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Tests
Checklist