File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
1
import { Static } from "@sinclair/typebox" ;
2
- import { allChains , getChainByChainId } from "@thirdweb-dev/chains" ;
2
+ import { allChains , getChainByChainIdAsync } from "@thirdweb-dev/chains" ;
3
3
import { getConfig } from "../../utils/cache/getConfig" ;
4
4
import { networkResponseSchema } from "../../utils/cache/getSdk" ;
5
5
@@ -26,8 +26,9 @@ export const getChainIdFromChain = async (chain: string): Promise<number> => {
26
26
if ( ! isNaN ( parseInt ( chain ) ) ) {
27
27
const unknownChainId = parseInt ( chain ) ;
28
28
try {
29
+ const chain = await getChainByChainIdAsync ( unknownChainId ) ;
29
30
// If the chain id is for a supported chain, use the chain id
30
- if ( getChainByChainId ( unknownChainId ) ) {
31
+ if ( chain ) {
31
32
chainId = unknownChainId ;
32
33
}
33
34
} catch {
@@ -40,7 +41,7 @@ export const getChainIdFromChain = async (chain: string): Promise<number> => {
40
41
) ;
41
42
}
42
43
}
43
- // If the chain id is unsupported, getChainByChainId will throw
44
+ // If the chain id is unsupported, getChainByChainIdAsync will throw
44
45
}
45
46
} else {
46
47
if ( config ?. chainOverrides ) {
Original file line number Diff line number Diff line change 1
1
import { Static } from "@sinclair/typebox" ;
2
- import { Chain , getChainByChainId } from "@thirdweb-dev/chains" ;
3
- import { LocalWallet } from "@thirdweb-dev/wallets" ;
2
+ import { getChainByChainIdAsync } from "@thirdweb-dev/chains" ;
3
+ import { Chain , LocalWallet } from "@thirdweb-dev/wallets" ;
4
4
import { getWalletDetails } from "../../../db/wallets/getWalletDetails" ;
5
5
import { getConfig } from "../../../utils/cache/getConfig" ;
6
6
import { networkResponseSchema } from "../../../utils/cache/getSdk" ;
@@ -21,7 +21,7 @@ export const getLocalWallet = async ({
21
21
const config = await getConfig ( ) ;
22
22
const CHAIN_OVERRIDES = config . chainOverrides ;
23
23
try {
24
- chain = getChainByChainId ( chainId ) ;
24
+ chain = await getChainByChainIdAsync ( chainId ) ;
25
25
} catch ( error ) { }
26
26
27
27
if ( CHAIN_OVERRIDES ) {
Original file line number Diff line number Diff line change 1
1
import { Static , Type } from "@sinclair/typebox" ;
2
- import { getChainByChainId } from "@thirdweb-dev/chains" ;
2
+ import { getChainByChainIdAsync } from "@thirdweb-dev/chains" ;
3
3
import { NetworkInput , ThirdwebSDK } from "@thirdweb-dev/sdk" ;
4
4
import * as fs from "fs" ;
5
5
import { PrismaTransaction } from "../../schema/prisma" ;
@@ -76,7 +76,7 @@ export const getSdk = async ({
76
76
77
77
let chain : NetworkInput | undefined = undefined ;
78
78
try {
79
- chain = getChainByChainId ( chainId ) ;
79
+ chain = await getChainByChainIdAsync ( chainId ) ;
80
80
} catch ( error ) { }
81
81
82
82
if ( CHAIN_OVERRIDES ) {
You can’t perform that action at this time.
0 commit comments