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 e0f89aa commit e1072a4Copy full SHA for e1072a4
lib/hooks/useContractAutoLoad.tsx
@@ -0,0 +1,19 @@
1
+import { useNetwork } from 'wagmi'
2
+
3
+export function useContractAutoLoad(contract: string, chainId?: number): any {
4
+ const { chain } = useNetwork()
5
+ switch (chainId || chain?.id) {
6
+ case 1:
7
+ switch (contract) {
8
+ case 'Contract':
9
+ return {
10
+ address: '',
11
+ abi: [],
12
+ }
13
+ default:
14
+ throw new Error(`Unknown contract ${contract}`)
15
16
17
+ throw new Error(`Unknown network ${chain?.id}`)
18
19
+}
0 commit comments