UNPKG

@0xsequence/connect

Version:
41 lines 1.34 kB
import { nativeTokenImageUrl } from '@0xsequence/design-system'; import { ContractType } from '@0xsequence/indexer'; import { zeroAddress } from 'viem'; import { chains } from '../chains/index.js'; export const getNativeTokenInfoByChainId = (chainId, wagmiChains) => { // Get chain data from wagmi const chain = wagmiChains.find(chain => chain.id === chainId) || chains[chainId]; if (chain) { return { chainId: chain.id, name: chain.nativeCurrency.name, symbol: chain.nativeCurrency.symbol, decimals: chain.nativeCurrency.decimals, logoURI: nativeTokenImageUrl(chain.id), blockExplorerName: chain.blockExplorers?.default.name, blockExplorerUrl: chain.blockExplorers?.default.url }; } return { chainId, name: 'Unknown', symbol: '???', decimals: 18, logoURI: '' }; }; export const createNativeTokenBalance = (chainId, accountAddress, balance = '0') => { return { chainId, contractAddress: zeroAddress, accountAddress, contractType: ContractType.UNKNOWN, balance, blockHash: '', blockNumber: 0, tokenID: '', isSummary: false, uniqueCollectibles: '' }; }; //# sourceMappingURL=tokens.js.map