feat(setup): show live Base USDC balance + OKX-specific fund walkthrough#9
Open
KillerQueen-Z wants to merge 1 commit into
Open
feat(setup): show live Base USDC balance + OKX-specific fund walkthrough#9KillerQueen-Z wants to merge 1 commit into
KillerQueen-Z wants to merge 1 commit into
Conversation
After eden's "show what chain to fund + how much" request. The PR #8 wallet-ready box hinted at funding but had no live balance check and no concrete OKX-side steps. Users still asked "do I actually need to fund?" and "where on OKX do I send from?". Changes: - Query Base-chain USDC balance via the existing BalanceMonitor right after OKX login completes (or right after detecting an existing session in the already-signed-in branch). Network/RPC failure is non-fatal — we render "could not query Base RPC" instead of aborting setup. - Add a balance row to the wallet-ready summary box, severity-tagged: empty (< $0.0001) → yellow ⚠ "fund to unlock paid models" low ($0.0001..$1) → yellow ⚠ "recommend $5+" ok (≥ $1) → green ✓ "ready for paid models" - Only render the funding walkthrough when balance is missing/empty/low. Already-funded users see a tight 6-line box; users that need money see the OKX-specific 3-step guide: Fund via OKX (Base network, USDC): 1. Open the OKX app → Wallet 2. Send USDC on Base to the address above 3. ~$5 covers thousands of paid requests Naming OKX explicitly + naming Base explicitly avoids users bridging to a wrong network (the recurring support footgun). - Lazy-import BalanceMonitor so the CLI doesn't pull viem until setup actually needs to query a balance.
fead5b0 to
c31a46d
Compare
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.
Why
PR #8 added a static `Fund / send USDC on Base` line in the wallet-ready box. Eden's follow-up: the user still didn't know whether they actually had to fund or where on OKX to send it from — they asked both questions after seeing the box.
What
When `xclawrouter setup` finishes (either freshly logged in OR already-signed-in path), query the OKX wallet's Base-chain USDC balance via the existing `BalanceMonitor`, then render a severity-tagged balance row + a concrete OKX-side funding walkthrough only when the user actually needs to fund.
Live demo output (empty wallet path):
```
┌──────────────────────────────────────────────────────────────────┐
│ ✓ Wallet ready │
│ │
│ EVM address │
│ 0xe34c9d531953a1c51164ecd943b5a6cb81d910f0 │
│ │
│ Email andy@blockrun.ai │
│ Signing OKX TEE (no local private key) │
│ │
│ Balance $0.00 USDC on Base ⚠ empty — fund to unlock paid models │
│ │
│ Fund via OKX (Base network, USDC): │
│ 1. Open the OKX app → Wallet │
│ 2. Send USDC on Base to the address above │
│ 3. ~$5 covers thousands of paid requests │
└──────────────────────────────────────────────────────────────────┘
```
When the wallet is funded (≥ $1), the line collapses to green `✓ ready for paid models` and the funding walkthrough is hidden — re-running `setup` on a healthy install stays tight.
Severity buckets
Resilience
Network or RPC failure is non-fatal — the box prints `(could not query Base RPC — check your network)` and the funding walkthrough still appears as a fallback.
`BalanceMonitor` is dynamic-imported so the CLI doesn't pull viem (heavy) until setup is actually run.
Test plan