File tree Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Original file line number Diff line number Diff line change @@ -68,24 +68,17 @@ const FAUCET: Abi = [
6868 }
6969]
7070
71- const ENV_CHAIN_ID = process . env . NEXT_PUBLIC_CHAIN_ID
72- const ENV_FAUCET_ADDRESS = process . env . NEXT_PUBLIC_FAUCET_ADDRESS
71+ const faucetChainId = process . env . NEXT_PUBLIC_FAUCET_CHAIN_ID
72+ const faucetAddress = process . env . NEXT_PUBLIC_FAUCET_ADDRESS as `0x${ string } ` | undefined
7373
74- const PARSED_CHAIN_ID = Number ( ENV_CHAIN_ID )
75-
76- if ( ! ENV_CHAIN_ID || Number . isNaN ( PARSED_CHAIN_ID ) ) {
77- throw new Error ( 'Environment variable NEXT_PUBLIC_CHAIN_ID must be set to a valid number' )
78- }
79-
80- if ( ! ENV_FAUCET_ADDRESS ) {
81- throw new Error ( 'Environment variable NEXT_PUBLIC_FAUCET_ADDRESS must be set to a valid address' )
82- }
83-
84- export const contracts : Contract [ ] = [
85- {
86- chainId : PARSED_CHAIN_ID ,
87- name : 'Faucet' ,
88- address : ENV_FAUCET_ADDRESS as `0x${string } `,
89- abi : FAUCET
90- }
91- ]
74+ export const contracts : Contract [ ] =
75+ faucetChainId && faucetAddress
76+ ? [
77+ {
78+ chainId : Number ( faucetChainId ) ,
79+ name : 'Faucet' ,
80+ address : faucetAddress ,
81+ abi : FAUCET
82+ }
83+ ]
84+ : [ ]
You can’t perform that action at this time.
0 commit comments