The isBase utility is designed to verify if the chain ID is a valid Base or Base Sepolia chain ID.

Parameters

chainId
number
required

The chain ID to verify. For example, 8453 for Base Mainnet or 84532 for Base Sepolia.

Returns

boolean
boolean

Returns true if the chain ID is Base or Base Sepolia, otherwise false.

Usage

import { isBase } from '@coinbase/onchainkit';
const chainId = 8453;
if (isBase({ chainId })) {
console.log('The chainId is Base.');
} else {
console.log('The chainId is not Base.');
}