File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,12 @@ export const getViemPublicClient = async ({
5050 networkModule : any ;
5151} ) => {
5252 const viemChainConfig = networkModule . getChainConfig ( ) ;
53+ const defaultRpcUrl = viemChainConfig . rpcUrls . default . http [ 0 ] ;
54+ const isLocalNetwork = defaultRpcUrl . includes ( '127.0.0.1' ) ;
55+ const customRpcUrl = isLocalNetwork
56+ ? process . env [ 'LOCAL_RPC_URL' ]
57+ : process . env [ 'LIT_YELLOWSTONE_PRIVATE_RPC_URL' ] ;
5358
54- const customRpcUrl = process . env [ 'LIT_YELLOWSTONE_PRIVATE_RPC_URL' ] ;
5559 if ( customRpcUrl ) {
5660 console . log ( `🔧 Using custom E2E RPC URL: ***${ customRpcUrl . slice ( - 6 ) } ` ) ;
5761 }
Original file line number Diff line number Diff line change @@ -78,17 +78,24 @@ export const fundAccount = async (
7878 thenFundWith ?: string ;
7979 }
8080) => {
81- const customRpcUrl = process . env [ 'LIT_YELLOWSTONE_PRIVATE_RPC_URL' ] ;
81+ const defaultRpcUrl = networkModule . getChainConfig ( ) . rpcUrls . default . http [ 0 ] ;
82+ const isLocalNetwork = defaultRpcUrl . includes ( '127.0.0.1' ) ;
83+ const customRpcUrl = isLocalNetwork
84+ ? process . env [ 'LOCAL_RPC_URL' ]
85+ : process . env [ 'LIT_YELLOWSTONE_PRIVATE_RPC_URL' ] ;
86+
8287 if ( customRpcUrl ) {
8388 console . log ( `🔧 Using custom E2E RPC URL: ***${ customRpcUrl . slice ( - 6 ) } ` ) ;
89+ } else if ( isLocalNetwork ) {
90+ console . log ( `🔧 Using local Anvil RPC URL: ${ defaultRpcUrl } ` ) ;
91+ } else {
92+ console . log ( `🔧 Using default network RPC URL: ${ defaultRpcUrl } ` ) ;
8493 }
8594
8695 // check account balance
8796 const publicClient = createPublicClient ( {
8897 chain : networkModule . getChainConfig ( ) ,
89- transport : http (
90- customRpcUrl || networkModule . getChainConfig ( ) . rpcUrls . default . http [ 0 ]
91- ) ,
98+ transport : http ( customRpcUrl || defaultRpcUrl ) ,
9299 } ) ;
93100
94101 const balance = await publicClient . getBalance ( {
@@ -101,9 +108,7 @@ export const fundAccount = async (
101108
102109 const walletClient = createWalletClient ( {
103110 account : sponsorAccount ,
104- transport : http (
105- customRpcUrl || networkModule . getChainConfig ( ) . rpcUrls . default . http [ 0 ]
106- ) ,
111+ transport : http ( customRpcUrl || defaultRpcUrl ) ,
107112 } ) ;
108113
109114 // Get the next managed nonce for this sponsor account
You can’t perform that action at this time.
0 commit comments