Skip to content

feat(address): surface undeployed-but-funded addresses instead of "not found" - #87

Merged
amanusk merged 1 commit into
masterfrom
feat/undeployed-address-balances
Jul 4, 2026
Merged

feat(address): surface undeployed-but-funded addresses instead of "not found"#87
amanusk merged 1 commit into
masterfrom
feat/undeployed-address-balances

Conversation

@amanusk

@amanusk amanusk commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Problem

An address can hold token balances before it's ever deployed — funds sent to a counterfactual / not-yet-deployed account. Searching for such an address fell through every probe (no class, tx, block, or declared class) and reported "Not found as address, transaction, block hash, or class hash", even though it exists on-chain as a token-transfer recipient.

What this does

Adds a final check to the search resolver: if a hex query matches nothing else but holds a non-zero balance in one of our known tokens, open the address view instead of erroring — header shows just the address + Class: N/A Nonce: 0 (no deployed-at line) plus a red ⚠ This contract is not deployed note, with the Balances tab populated.

The note is set only once the live class fetch confirms the class is absent (via a new AddressNotDeployed signal), so it never flashes during a normal address load, and it's gated on non-zero balances so a transient RPC error (which also nulls balances) can't produce a false positive.

No wasted API calls

An undeployed address has no txs, calls, events, or class history, so running the full address pipeline would only burn RPC / Dune / pf-query round trips for guaranteed-empty results. Both entry paths skip that work:

  • Search path emits AddressBalancesLoaded + AddressNotDeployed directly — a single balanceOf batch, no pipeline, no redundant second balance fetch.
  • Refresh / direct-nav pathfetch_and_send_address_info returns right after the nonce/class join when the class is absent, before any enrichment (find_deploy_tx was already skipped for these).
  • Tab switch — the MetaTxs tab no longer fires its pf-query bloom scan on entry for an undeployed address. Scroll pagination is already inert (gated by has_more flags that default false; empty lists never scroll) and the sanity-check/gap-fill only fires on non-empty tx lists.

The AddressNotDeployed handler also clears sources_pending / is_loading, so the view settles instead of spinning.

Verification

  • cargo build, cargo build --release, cargo clippy (0 issues in new code), cargo test (all passing).
  • RPC preconditions confirmed against production for a real undeployed-but-funded address: getClassHashAt → error code 20 "Contract not found", and non-zero balances across several known tokens — exactly the two conditions the code branches on.
  • Both code paths traced to confirm enrichment is only reachable after the early-return/skip points.
  • Did not drive the TUI interactively (non-interactive shell), so the red note wasn't eyeballed on screen.

🤖 Generated with Claude Code

…t found"

An address can hold token balances before it's ever deployed (funds sent
to a counterfactual / not-yet-deployed account). Previously a search for
such an address fell through every probe — no class, tx, block, or
declared class — and reported "Not found as address, transaction, block
hash, or class hash", even though it exists on-chain as a token-transfer
recipient.

Add a final check to the search resolver: if the hex resolves to nothing
else but holds a non-zero balance in one of our known tokens, open the
address view with a red "⚠ This contract is not deployed" note in the
header (no class line, no deployed-at) and the balances populated.

The note is set only once the live class fetch confirms absence (via a
new AddressNotDeployed signal), so it never flashes during a normal
address load, and it's gated on non-zero balances so a transient RPC
error (which also nulls balances) can't trigger a false positive.

Skip all enrichment for these addresses — an undeployed address has no
txs, calls, events, or class history, so the full pipeline would only
burn RPC/Dune/pf round trips for guaranteed-empty results:

- the search path emits balances + the marker directly (single balanceOf
  batch, no pipeline, no redundant second balance fetch)
- fetch_and_send_address_info returns right after the nonce/class join
  when the class is absent, covering the refresh / direct-nav paths
- the MetaTxs tab no longer fires its pf-query bloom scan on entry

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@amanusk
amanusk merged commit 7c61658 into master Jul 4, 2026
2 checks passed
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