File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -38,29 +38,27 @@ export function useNetworkStatus({
38
38
const network = networks . find ( ( x ) => x . rpcUrl === client . key )
39
39
40
40
if ( network ) {
41
- let updatedNetwork = { }
42
-
43
41
// If chain becomes out of sync, update to the new chain.
44
42
if (
45
43
chainId &&
46
44
network . rpcUrl === client . key &&
47
45
network . chainId !== chainId
48
- )
49
- updatedNetwork = { ...updatedNetwork , chainId }
46
+ ) {
47
+ upsertNetwork ( {
48
+ network : { chainId } ,
49
+ rpcUrl : client . key ,
50
+ } )
51
+ }
50
52
51
53
// If there is no fork block number, update to the current block number.
52
54
if ( typeof network . forkBlockNumber !== 'bigint' ) {
53
- updatedNetwork = {
54
- ...updatedNetwork ,
55
- forkBlockNumber : await client . getBlockNumber ( ) ,
56
- }
55
+ ; ( async ( ) => {
56
+ upsertNetwork ( {
57
+ network : { forkBlockNumber : await client . getBlockNumber ( ) } ,
58
+ rpcUrl : client . key ,
59
+ } )
60
+ } ) ( )
57
61
}
58
-
59
- if ( Object . keys ( updatedNetwork ) . length > 0 )
60
- upsertNetwork ( {
61
- network : updatedNetwork ,
62
- rpcUrl : client . key ,
63
- } )
64
62
}
65
63
66
64
return chainId
You can’t perform that action at this time.
0 commit comments