We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c313106 commit 0f4df3bCopy full SHA for 0f4df3b
packages/automation/src/lib/utils/chain.ts
@@ -1,8 +1,15 @@
1
+import { ethers } from 'ethers';
2
+
3
import { LIT_EVM_CHAINS } from '@lit-protocol/constants';
4
-export function getEvmChain(evmChainId: number) {
5
+export function getEvmChain(evmChainId: ethers.BigNumberish) {
6
+ const evmChainIdNumber = ethers.BigNumber.from(evmChainId).toNumber();
7
+ if (evmChainIdNumber === 0) {
8
+ throw new Error('EVM chainId cannot be 0');
9
+ }
10
11
const chain = Object.values(LIT_EVM_CHAINS).find(
- (chain) => chain.chainId === evmChainId
12
+ (chain) => chain.chainId === evmChainIdNumber
13
);
14
if (!chain) {
15
throw new Error(`EVM chain with chainId ${evmChainId} not found`);
0 commit comments