Skip to content

Arbitrum RPC calls in TokenSelect hit hardcoded LI.FI default instead of configured transport #469

Closed

Description

@gabitoesmiapodo

Description

Selecting Arbitrum in the TokenSelect component causes useTokens to fail with a CORS error followed by 429 Too Many Requests. No balances load. Other chains using the publicnode fallback configured in src/lib/networks.config.ts work correctly.

Console output:

Access to fetch at 'https://arb1.arbitrum.io/rpc' from origin 'http://localhost:5173' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*,*', but only one is allowed.
POST https://arb1.arbitrum.io/rpc net::ERR_FAILED 429 (Too Many Requests)
    at queryFn (useTokens.ts:115)

Steps to reproduce

  1. Run pnpm dev.
  2. Open a page that renders TokenSelect (e.g. the TokenInput demo).
  3. Open the network dropdown and switch to Arbitrum.
  4. Observe console errors from arb1.arbitrum.io/rpc.

Expected vs actual behavior

Expected: Token balances load on Arbitrum using the publicnode RPC fallback configured for viem/wagmi in src/lib/networks.config.ts.

Actual: CORS block (Access-Control-Allow-Origin: *,*) and HTTP 429 from arb1.arbitrum.io/rpc. Nothing loads.

Environment

OS: macOS (darwin 25.2.0)
Node: 24.x
Dev server: http://localhost:5173
Reproduces on: main and fix/465

Additional context

Root cause. LI.FI's EVM() provider at src/hooks/useTokens.ts:25-28 is constructed with no client/transport arguments:

lifiConfig({
  integrator: PUBLIC_APP_NAME,
  providers: [EVM()],
})

Without an explicit client, the LI.FI SDK uses its bundled default RPCs (hardcoded arb1.arbitrum.io for Arbitrum) rather than the transports defined in src/lib/networks.config.ts:21-22. PUBLIC_RPC_ARBITRUM does not fix this because that env var is only wired into the viem/wagmi transports, not LI.FI. There is no user-side workaround, hence severity: high.

The failure surfaces from useTokens.ts:115 where the queryFn calls LI.FI's getTokenBalances().

Suggested direction (non-binding): pass the project's wagmi config / viem publicClient factory into LI.FI's EVM() provider (or equivalent per the current LI.FI SDK version) so RPC calls route through the configured transports. Verify against the LI.FI SDK version pinned in package.json.

Related: #441 fixed the same class of CORS issue for viem/wagmi transports but did not cover LI.FI.

Files:

  • src/hooks/useTokens.ts:25-28 — LI.FI config init
  • src/hooks/useTokens.ts:115 — failing queryFn
  • src/lib/networks.config.ts:21-22 — Arbitrum publicnode fallback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingseverity: highBroken feature, no workaround

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions