UNPKG

@web3auth/no-modal

Version:
15 lines (11 loc) 409 B
'use strict'; require('@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}`); }; exports.formatChainId = formatChainId;