@@ -13,9 +13,6 @@ import type {
13
13
WalletClient ,
14
14
} from "../types" ;
15
15
16
- import { getChain , getMode , isDevelopmentNetwork } from "./chains" ;
17
- import { getAccounts } from "./accounts" ;
18
-
19
16
/**
20
17
* Get a PublicClient instance. This is a read-only client that can be used to
21
18
* query the blockchain.
@@ -28,6 +25,7 @@ export async function getPublicClient(
28
25
provider : EthereumProvider ,
29
26
publicClientConfig ?: Partial < PublicClientConfig >
30
27
) : Promise < PublicClient > {
28
+ const { getChain } = await import ( "./chains" ) ;
31
29
const chain = publicClientConfig ?. chain ?? ( await getChain ( provider ) ) ;
32
30
return innerGetPublicClient ( provider , chain , publicClientConfig ) ;
33
31
}
@@ -38,6 +36,7 @@ export async function innerGetPublicClient(
38
36
publicClientConfig ?: Partial < PublicClientConfig >
39
37
) : Promise < PublicClient > {
40
38
const viem = await import ( "viem" ) ;
39
+ const { isDevelopmentNetwork } = await import ( "./chains" ) ;
41
40
const defaultParameters = isDevelopmentNetwork ( chain . id )
42
41
? { pollingInterval : 50 , cacheTime : 0 }
43
42
: { } ;
@@ -65,6 +64,8 @@ export async function getWalletClients(
65
64
provider : EthereumProvider ,
66
65
walletClientConfig ?: Partial < WalletClientConfig >
67
66
) : Promise < WalletClient [ ] > {
67
+ const { getAccounts } = await import ( "./accounts" ) ;
68
+ const { getChain } = await import ( "./chains" ) ;
68
69
const chain = walletClientConfig ?. chain ?? ( await getChain ( provider ) ) ;
69
70
const accounts = await getAccounts ( provider ) ;
70
71
return innerGetWalletClients ( provider , chain , accounts , walletClientConfig ) ;
@@ -77,6 +78,7 @@ export async function innerGetWalletClients(
77
78
walletClientConfig ?: Partial < WalletClientConfig >
78
79
) : Promise < WalletClient [ ] > {
79
80
const viem = await import ( "viem" ) ;
81
+ const { isDevelopmentNetwork } = await import ( "./chains" ) ;
80
82
const defaultParameters = isDevelopmentNetwork ( chain . id )
81
83
? { pollingInterval : 50 , cacheTime : 0 }
82
84
: { } ;
@@ -108,6 +110,7 @@ export async function getWalletClient(
108
110
address : Address ,
109
111
walletClientConfig ?: Partial < WalletClientConfig >
110
112
) : Promise < WalletClient > {
113
+ const { getChain } = await import ( "./chains" ) ;
111
114
const chain = walletClientConfig ?. chain ?? ( await getChain ( provider ) ) ;
112
115
return (
113
116
await innerGetWalletClients ( provider , chain , [ address ] , walletClientConfig )
@@ -126,6 +129,7 @@ export async function getTestClient(
126
129
provider : EthereumProvider ,
127
130
testClientConfig ?: Partial < TestClientConfig >
128
131
) : Promise < TestClient > {
132
+ const { getChain, getMode } = await import ( "./chains" ) ;
129
133
const chain = testClientConfig ?. chain ?? ( await getChain ( provider ) ) ;
130
134
const mode = await getMode ( provider ) ;
131
135
return innerGetTestClient ( provider , chain , mode , testClientConfig ) ;
0 commit comments