Skip to content

Utilities

The Box Common package contains a number of helpful constants or utility functions that ease building with Decent.

Custom Chain Configs

Decent is designed to support any new chain on its first day. We are often adding chains that are not yet covered by Viem or other wallet connection libraries (see Viem's chain list here).

Chain will return in the Config type from @wagmi/core.

import { ChainId, getViemChain } from '@decent.xyz/box-common';
 
const rari = getViemChain(ChainId.RARI);

Get Native Token Info

getNativeTokenInfo returns the token info (see type) for the target chain's native gas token.

getRollupGasParentTokenInfo returns the token info for a rollup's parent chain. For example, Degen's parent chain is Base.

import { ChainId, getNativeTokenInfo, getRollupGasParentTokenInfo } from '@decent.xyz/box-common';
 
const degenLogo = getNativeTokenInfo(ChainId.DEGEN).logo;
const baseLogo = getRollupGasParentTokenInfo(ChainId.DEGEN).logo;