Skip to content

Dev/v2bo2#9

Merged
boboliu-1010 merged 2 commits intodev/v2from
dev/v2bo2
Mar 12, 2026
Merged

Dev/v2bo2#9
boboliu-1010 merged 2 commits intodev/v2from
dev/v2bo2

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 b308396 into dev/v2 Mar 12, 2026
7 checks passed
* Used by variable-amount settlement flows.
*/
export const X402_UPTO_PERMIT2_PROXY_ADDRESSES: Record<string, string> = {
"tron:mainnet": "TGHEYAovw8fZz1bgnVgRtgrdGLbagFZYq5",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缺少nile

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>
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>
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.

2 participants