Skip to content

fix(wallet): direct-key + Arbitrum One mainnet payments#44

Merged
Nic-dorman merged 1 commit intomainfrom
fix/direct-wallet-mainnet
Apr 22, 2026
Merged

fix(wallet): direct-key + Arbitrum One mainnet payments#44
Nic-dorman merged 1 commit intomainfrom
fix/direct-wallet-mainnet

Conversation

@Nic-dorman
Copy link
Copy Markdown
Contributor

Summary

  • Selecting "Arbitrum One (mainnet)" when importing a private key crashed every payment with viem's No URL was provided to the Transport error. The code path fell into the Anvil branch with a null RPC URL.
  • Added the missing mainnet branch in initDevnetWallet() and updated getActiveChainId() so the three direct-key modes (Anvil / Sepolia / Arbitrum One) are now explicit.
  • Replaced the ambiguous devnetIsSepolia boolean with devnetChainId: number | null across 9 files. The sidebar "DEVNET" badge now hides for the mainnet direct-key case.

Reporter workaround until this merges

Use WalletConnect for Arbitrum One. Only the Sepolia direct-key path was working before this PR.

Test plan

  • vitest — 21/21 pass (added coverage for mainnet direct-key + null fallback)
  • nuxi typecheck — clean (pre-existing codegen-asset noise unchanged)
  • Live mainnet smoke test before merge — import a low-balance Arbitrum One key in the dev app, upload one small file, confirm payment lands on-chain. Unit tests don't exercise the real RPC path.

Known follow-ups (out of scope)

  • Public RPC arb1.arbitrum.io/rpc is rate-limited; no UI to override for mainnet direct-key. If users hit limits on large merkle uploads, add an RPC URL input next to the network dropdown.
  • disconnectDirectWallet() doesn't clear devnetActive / devnetChainId; pre-existing leak, worth a separate follow-up so a stale state can't strand the next session.

🤖 Generated with Claude Code

Selecting "Arbitrum One (mainnet)" when importing a private key routed
wagmi through the Anvil devnet branch with a null RPC URL, causing viem
to reject every payment call with "No URL was provided to the
Transport".

Root cause: initDevnetWallet() only had Sepolia / Anvil branches, and
getActiveChainId() hard-coded Anvil for the devnetActive && !isSepolia
case. No code path actually implemented the mainnet direct-key flow.

Replace the boolean devnetIsSepolia with devnetChainId (number | null)
so the three modes — Anvil, Sepolia, Arbitrum One — are explicit. Route
the mainnet case through a new arbitrum branch in initDevnetWallet() and
hide the "DEVNET" sidebar badge when the direct-key target is mainnet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Nic-dorman added a commit that referenced this pull request Apr 22, 2026
Before the PR #44 rework, this comment was accurate — the dialog
called getUploadQuote directly. After the rework, the dialog uses
estimateFileCost and getUploadQuote is only reached via startRealUpload
once the user has committed. Update the comment to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Nic-dorman added a commit that referenced this pull request Apr 22, 2026
…#47)

* feat(upload): use ant-core estimate_upload_cost for pre-upload quotes

Both the Estimate Cost top-bar button and the Upload dialog's pre-quote
used to call start_upload (file_prepare_upload), which encrypts the
whole file to a spill and parks a PreparedUpload in pending_uploads for
30 minutes. Every dialog open or estimate click paid that full cost
even if the user cancelled, leaving hundreds of encrypted chunks in
memory until the GC loop expired them.

Switch both paths to the new estimate_upload_cost API (ant-core #44):
samples a single network quote for a representative chunk and
extrapolates total cost. No encryption-to-spill, no parked upload, no
wallet required. Estimates now run in parallel too — each is
independent, so multi-file dialog latency drops to the slowest sample.

Confirm click still runs the real start_upload via startRealUpload,
so the actual encryption + quote collection happens only when the user
commits. Drop the preQuote handoff plumbing and the pendingQuotes map;
startRealUpload's fresh-quote branch already does the right thing.

Rename the 'quoting' status label to "Preparing upload..." since the
heavy work now happens post-confirm.

Drop utils/payment.ts::estimatePaymentGasCost — PR #44's gas heuristic
replaces it. Its leftover GAS_* constants and getGasPrice import go
with it.

Bump ant-core pin f88c95d -> b0c501a (PR #44 merge).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(files): clarify getUploadQuote is internal to startRealUpload

Before the PR #44 rework, this comment was accurate — the dialog
called getUploadQuote directly. After the rework, the dialog uses
estimateFileCost and getUploadQuote is only reached via startRealUpload
once the user has committed. Update the comment to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman Nic-dorman merged commit 601ac58 into main Apr 22, 2026
4 checks passed
@Nic-dorman Nic-dorman deleted the fix/direct-wallet-mainnet branch April 22, 2026 11:44
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