@contractjs/erc20
Version:
A TypeScript utility library for ERC20 contracts.
21 lines • 689 B
JavaScript
import { supportedChains } from "../constants";
export const normalizeChain = (chain) => {
let _chain;
if (typeof chain === 'number') {
_chain = supportedChains[chain];
}
else if (typeof chain === 'string') {
_chain = supportedChains[chain];
if (!_chain) {
throw new Error(`[Pool Utility] Chain with name "${chain}" is not a valid viem chain.`);
}
}
else if (typeof chain === 'object' && chain.id) {
_chain = chain;
}
else {
throw new Error('[Pool Utility] Invalid input. Please provide a chain name, chain ID, or viem Chain object.');
}
return _chain;
};
//# sourceMappingURL=index.js.map