@web3auth/no-modal
Version:
Multi chain wallet aggregator for web3Auth
13 lines (10 loc) • 379 B
JavaScript
import '@babel/runtime/helpers/objectSpread2';
const formatChainId = chainId => {
if (typeof chainId === "number") {
return `0x${chainId.toString(16)}`;
} else if (typeof chainId === "string") {
return chainId.startsWith("0x") ? chainId : `0x${parseInt(chainId, 10).toString(16)}`;
}
throw new Error(`Invalid chainId: ${chainId}`);
};
export { formatChainId };