Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

@uniswap/widgets is throwing error using base chainId as defaultChainId #646

@aadilhasan

Description

@aadilhasan

Bug Description
When using base chainId as defaultChainId, widget is throwing below error:

Error: Invalid chainId 8453. Make sure default chain is included in "chains" - chains specified in "optionalChains" may not be selected as the default, as they may not be supported by the wallet.

Steps to Reproduce
We are using @uniswap/widgets v2.59.0 and ethers v5.7.2
We have this component in the next.js page.

'use client';

import { BASE_RPC_ENDPOINT_PROD } fr

<img width="388" alt="Image" src="https://github.com/user-attachments/assets/8a2db258-6d8f-4e3b-b12b-387021f4d5c7" />

om '@/config';
import { Theme, SwapWidget, SupportedChainId } from '@uniswap/widgets';
import '@uniswap/widgets/fonts.css';
import { ethers } from 'ethers';

const enableColorExtractionTheme: Theme = {
  tokenColorExtraction: true, // Enable color extraction of the output token
};

const tokensList = 'https://ipfs.io/ipns/tokens.uniswap.org';

const provider = new ethers.providers.JsonRpcProvider(BASE_RPC_ENDPOINT_PROD);

export default function UniswapPage() {
  return (
    <div className='Uniswap'>
      <SwapWidget
        theme={enableColorExtractionTheme}
        tokenList={tokensList}
        provider={provider}
        defaultChainId={SupportedChainId.BASE}
      />
    </div>
  );
}

Expected Behavior
The widget should not crash, and allow swap using base chain coins.

Additional Context
Add any other context about the problem here (screenshots, whether the bug only occurs only in certain mobile/desktop/browser environments, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions