Skip to content

feat: send evm transactions through the viem-based hub3 evm namespace - #1523

Open
arlert-armin wants to merge 29 commits into
nextfrom
feat/rc-516-adopt-the-viem-based-evm-namespace-in-rango-client-and-the-playground
Open

arlert-armin wants to merge 29 commits into
nextfrom
feat/rc-516-adopt-the-viem-based-evm-namespace-in-rango-client-and-the-playground

Conversation

@arlert-armin

@arlert-armin arlert-armin commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The hub3 EVM namespace now exposes viem's wallet and public actions (rango-exchange/hub3js#91, rango-exchange/hub3js#92). This PR moves rango-client onto it and stops using the EVM signers.

hub3 version: no stable hub3 release contains the viem namespace yet, so these are pinned exactly to hub3's next prereleases. @hub3js/evm is on 0.8.1-next.2, which includes the TypedDataDefinition export (rango-exchange/hub3js#102). @hub3js/namespaces is on 0.8.1-next.1, which takes that evm. Later namespaces prereleases bring a tron package whose TronWeb types don't compile in the providers. Exact pins are used because a caret range on a prerelease can resolve to a different build.

Providers

  • Breaking: every provider's buildProvider takes the RPC urls of its namespaces (NamespacesRPCUrls). They're optional, and none are hardcoded. EVM urls are given per chain.
  • Injected EVM wallets register viemWalletAdapter, which serves both the wallet and the public actions through the wallet's own provider. Reads and receipts follow the chain the wallet is on.
  • Ledger and Trezor have no injected provider:
    • They read through viemPublicAdapter(rpcUrls).
    • They sign on the device through their own sendTransaction and signMessage actions.
  • Ledger Wallet uses viemPublicAdapter(rpcUrls), plus viemWalletAdapter limited to the reads its provider serves. Its provider has no eth_getTransactionReceipt.
  • WalletConnect 2 exposes an EIP-1193 view of its session. Methods the session negotiated go to the wallet over the relay, and reads go to a node for the active chain. Relay errors carry the session's namespaces, peer metadata and code, which end up in the signer error's context for the logs.
  • Safe signs messages off-chain through its SDK. It also gets a resolveTransactionHash action that maps a safeTxHash to the on-chain hash. A wallet's own actions win over the viem adapter's, and a test covers Safe's signMessage.
  • EVM signers are no longer registered, and @rango-dev/signer-evm is dropped from the providers. The package itself stays for now and can be deleted in a follow-up.

Widget

  • New rpcUrls config, keyed by chain id: { evm: { 1: [...], 56: [...] } }. It's converted to NamespacesRPCUrls before the providers are built. On Ethereum, signers.customEthereumRPC is tried first.
  • Ethereum fallback: when a dapp configures no url for Ethereum (no rpcUrls.evm[1], no signers.customEthereumRPC), the widget uses the public node the EVM signer used (https://ethereum-rpc.publicnode.com). Dapps that predate rpcUrls keep Ledger and Trezor working as before. Other chains only get the urls the dapp configures. The providers hardcode no url; widget/app, the playground and the queue-manager demo pass one explicitly.

queue-manager

  • EVM transactions have their own action, executeEvmTransaction. It holds:
    • the EVM-only checks (wallet network, and the parallel-mode claim);
    • converting Rango's EVM transaction for viem;
    • the receipt wait.
  • The generic executeTransaction keeps a light check (wallet connected with the right address) and signs the other chains through their signers. A swap stored by an older version can still resume there with an EVM transaction, so it's handed over to the EVM action.
  • The conversion keeps what the signer did:
    • the wallet address and chain checks;
    • the retry without EIP-1559 fees;
    • error mapping that still reports a user rejection as a rejection;
    • replacement handling and the Tenderly failure lookup while waiting for the receipt.
  • The status check waits on EVM transactions through the namespace. No other signer had a wait, so the generic waiter is gone.
  • EVM approvals (prerequisites) send through the namespace. The adapter type no longer lets an EVM approval fall back to a signer. Tron approvals still sign through the Tron signer until the Tron namespace signs.
  • The server-side approval status check (checkApprovalStatus) is removed. Approvals run as prerequisites, and transactions are created with approve: false, so the server never builds an approve transaction. A swap saved by an older version while waiting on such an approval starts the step over, and the prerequisite flow reads the allowance on-chain.
  • Hyperliquid typed data is typed with viem's TypedDataDefinition, re-exported by @hub3js/evm.
  • A sent EVM transaction whose hash doesn't start with 0x fails. Some wallets (e.g. Rainbow over WalletConnect) resolve 'null' on rejection instead of throwing.

Other changes

  • viem is deduplicated to 2.57.17. Versions 2.57.13 to 2.57.16 reject : in EIP-712 struct names, which breaks Hyperliquid's HyperliquidTransaction:UsdSend. The ox patch moves to the version that comes with it (0.14.63), and the old viem patch is dropped because it no longer matched the installed version.
  • @reown/appkit moves to 1.8.24, because 1.8.20's typings don't accept viem 2.57.17. Its typings check as they are, so the appkit-controllers patch is removed.
  • hubProvider in wallets-react returns the hub's registered instance. The widget rebuilds its provider list, and a rebuilt provider has no store, so its namespaces threw "You need to set your store using .store method first."

How did you test this change?

  • All wallets, providers, queue-manager and widget packages build.
  • Unit tests pass for queue-manager, wallets and widget-embedded.
  • Tests check that a transaction sent through the namespace reaches the wallet with the same eth_sendTransaction params the signer sent:
    • hex quantities, gas, and an explicit zero value;
    • the legacy gas price;
    • the EIP-1559 retry;
    • user rejection;
    • chain and address mismatch.
  • Swap and approval with an injected wallet (MetaMask, OKX) on Ethereum and on another EVM chain.
  • Swap and approval with WalletConnect 2.
  • Safe: the safeTxHash is resolved to the on-chain hash.
  • Hyperliquid withdrawal (typed-data signing).
  • Ledger and Trezor on a device, with rpcUrls configured.
  • Ledger Wallet approval.

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Implemented a user interface (UI) change, referencing our Figma design to ensure pixel-perfect precision.

Comment thread wallets/provider-bitget/src/provider.ts Resolved
Pin @hub3js/evm and @hub3js/namespaces to the experimental build that
exposes viem's actions on the EVM namespace, dedupe viem to 2.57.3 and
move its ox patch to the matching version. Providers gain
@hub3js/namespaces and drop @rango-dev/signer-evm, which they no longer
use.
…ace actions

Ledger and Trezor have no injected provider. Their EVM namespaces now
register the public viem actions, including the receipt ones, and sign on
the device through their own `sendTransaction` and `signMessage`
actions, so they no longer need an EVM signer or a JSON-RPC provider of
their own. The allowance is read with the public client's `readContract`.
…espaces

Both now send through viem's wallet actions. Safe resolves its safeTxHash
to the on-chain hash with a `resolveTransactionHash` namespace action and
signs messages off-chain through its SDK. Their EVM signers are removed.
… viem

Methods the session negotiated go to the wallet over the relay, and reads
go to a node for the session's active chain. viem's wallet actions and
the receipt actions run on it, so the EVM signer is removed.
Their EVM namespaces register `viemWalletAdapter` and `viemPublicAdapter`,
plus wallet-transport `getTransactionReceipt` and
`waitForTransactionReceipt`, and are built with the EVM RPC URL. EVM
signers are no longer registered; providers left without a signer drop
their `signers` property.
Their EVM namespaces register `viemWalletAdapter` and `viemPublicAdapter`,
plus wallet-transport `getTransactionReceipt` and
`waitForTransactionReceipt`, and are built with the EVM RPC URL. EVM
signers are no longer registered; providers left without a signer drop
their `signers` property.
Their EVM namespaces register `viemWalletAdapter` and `viemPublicAdapter`,
plus wallet-transport `getTransactionReceipt` and
`waitForTransactionReceipt`, and are built with the EVM RPC URL. EVM
signers are no longer registered; providers left without a signer drop
their `signers` property.
Providers without an EVM namespace take the RPC URLs too, so any of their
namespaces can start using one.
`RPC_URLS` holds the RPC endpoint of each namespace, and is passed to
every provider where providers are built: the widget, the playground and
the queue-manager demo.

BREAKING CHANGE: `buildProvider` of every `@rango-dev/provider-*`
package, and each builder returned by `allProviders()`, now requires the
RPC URLs of its namespaces, e.g. `buildProvider(RPC_URLS)`. Providers no
longer expose an EVM signer.
EVM swaps, approvals and Hyperliquid signing go through the wallet's EVM
namespace instead of the EVM signer. `common/evm.ts` converts Rango's EVM
transaction for viem and keeps what the signer did: the wallet address and
chain checks, the retry without EIP-1559 fees, error mapping that still
recognises a user rejection, and, while waiting for the receipt,
replacement handling and the Tenderly failure lookup. Wallets whose
`sendTransaction` returns another kind of hash can register
`resolveTransactionHash`.

EVM approvals read viem's receipt: `getTransactionReceipt({ hash })`,
which throws while pending and reports `'success' | 'reverted'`.
…ider

hubProvider returned the provider from the configured list. The widget
rebuilds that list with the same ids, while the hub keeps the instances it
registered first, so the returned provider could have no store, and its
namespaces threw "You need to set your store using `.store` method
first." as soon as an action read their state, e.g. signing an EVM
transaction. Return the hub's own instance instead.
Pin @hub3js/evm and @hub3js/namespaces to 0.0.0-experimental-9a7dcf8b-20261019.
Ledger Wallet reads what its provider doesn't serve, e.g. transaction receipts,
from the public RPC.

@RyukTheCoder RyukTheCoder left a comment

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.

Tnx for your effort, I just left some comments. Also plz update the PR description as it changed a lot and the two hub3 stacked PRs are now merged so you can remove the experimental pinned versions.

… action

EVM sending, its environment checks (network and parallel claim) and the
receipt wait move into executeEvmTransaction. The generic execute action
keeps only the wallet check, and hands EVM transactions stored by older
versions over. The status check waits on EVM transactions directly, since
no other signer waits.
…own 1.8.24 to match

viem 2.57.13 to 2.57.16 reject ':' in EIP-712 struct names, which broke signing
Hyperliquid's HyperliquidTransaction:UsdSend. 2.57.17 allows it again.

reown 1.8.20's typings don't accept 2.57.17's new prepare phase, so reown moves
to 1.8.24, whose typings check without the old appkit-controllers patch. The
ox patch moves to the ox version 2.57.17 uses.
Comment thread wallets/provider-bitget/package.json Resolved
Comment thread wallets/provider-trezor/src/provider.ts Resolved
- Type hyperliquid typed data with viem's TypedDataDefinition, re-exported by
  @hub3js/evm. evm and namespaces are pinned to the experimental hub3 build
  that adds the export, and rango-preset declares @hub3js/evm.
- Reject a sent EVM transaction whose hash doesn't start with 0x, after both
  the first send and the legacy gas retry (some wallets resolve 'null').
- Keep the WalletConnect session context on relayed request errors, and pass
  wallet error context through to the signer error.
- Pass a chain 1 rpc url in widget/app, the playground and the queue-manager
  demo, so Ledger and Trezor reads work there.
- Declare @hub3js/namespaces in the providers that import it, and drop the
  unused @rango-dev/signer-evm from bitget, okx, trezor and walletconnect-2.
…configured

Ledger and Trezor read Ethereum through the EVM signer's public node before
rpcUrls existed. Dapps that predate rpcUrls pass none, so the widget now uses
that node for chain 1 when neither rpcUrls.evm[1] nor customEthereumRPC is set.
Providers still get no url of their own.
The export is merged and released as @hub3js/evm 0.8.1-next.2, so the
experimental build is no longer needed. @hub3js/namespaces stays on
0.8.1-next.1, which takes that evm. Later namespaces prereleases bring a tron
package whose TronWeb types don't compile in the providers.

This branch was successfully deployed

3 active deployments
app-preview — 3e343f5a Deployed Nov 11, 2026 by arlert-armin via app-preview #5573
playground-preview — 3e343f5a Deployed Nov 11, 2026 by arlert-armin via playground-preview #5573
preview — 3e343f5a Deployed Nov 11, 2026 by arlert-armin via deploy #5573
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