Skip to content

Support ENS names wherever an address is accepted - #5

Merged
lijnati merged 1 commit into
mainfrom
ens-names
Oct 24, 2026
Merged

lijnati merged 1 commit into
mainfrom
ens-names

Conversation

@lijnati

@lijnati lijnati commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Lets users type ENS names (e.g. alice.eth) anywhere Chainly takes an address. Names are normalized and resolved on Ethereum Sepolia's own ENS registry via viem (the sepolia chain already includes the ENS resolver, so no new dependency). Plain 0x addresses work exactly as before, with no extra RPC call.

  • New src/lib/blockchain/ens.ts with resolveAddress().
  • getEthBalance, getTokenBalance (wallet side), analyzeWallet and prepareTransaction accept names and return the name alongside the resolved address.
  • Cards show the name next to the short address; the agent prompt and tool descriptions mention ENS.
  • Clear errors for invalid names and for names that don't resolve on Sepolia (with a note that mainnet names may not exist there).

Type of change

  • Bug fix
  • New feature (e.g. a new agent tool or UI)
  • Refactor / cleanup
  • Docs
  • Other:

How was it tested?

  • pnpm lint, pnpm typecheck, pnpm test and pnpm build pass locally
  • Tried it in the browser (pnpm dev) on Ethereum Sepolia — not done: the Sepolia RPC isn't reachable from the environment this was built in, so a live lookup still needs a manual check
  • Added or updated tests for new logic in src/lib/ (tests/ens.test.ts, 8 cases: name detection, normalization, unresolved and invalid names, balance results, transfer preview, zero-address refusal)

Screenshots

Not captured (small change: the name appears before the short address in result cards and the transaction preview).

Safety checklist (if this touches transactions or tools)

This touches transfer.ts and tools.ts:

  • No new tool can sign or broadcast transactions
  • The sender still comes from the connected wallet, not from LLM input (only the recipient can be a name)
  • No API keys or RPC URLs are exposed to the browser or in error messages (resolution errors go through toBlockchainError)

The recipient name is resolved once, when the preview is prepared; the preview, the browser signing guard and the wallet only ever use the resolved address. The preview shows "name resolves to 0x…" and warns the user to confirm it, since a name's owner can change where it points. A name resolving to the zero address is refused.

- Add lib/blockchain/ens.ts: resolveAddress() accepts a 0x address or an
  ENS name, normalizes the name and resolves it on Sepolia's ENS.
- Balance, token balance, wallet analysis and prepareTransaction accept
  names and return the name alongside the resolved address.
- Transfer previews record toEnsName, show "name resolves to 0x…" in the
  recipient check and warn the user to confirm the resolved address. The
  wallet still signs only the resolved address.
- Cards show the name next to the short address; the agent prompt and
  tool descriptions mention ENS.
- Add tests/ens.test.ts.
@vercel

vercel Bot commented Oct 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
chainly Ready Ready Preview Oct 24, 2026 5:17am UTC

Request Review

@lijnati
lijnati merged commit fc48772 into main Oct 24, 2026
3 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