1
1
import { toast } from 'react-toastify'
2
2
import { ChainMetadata , allChains , chainIdToChain } from 'src/config/chains'
3
+ import { cleanupStaleWalletSessions } from 'src/config/wallets'
3
4
import { reset as accountReset } from 'src/features/accounts/accountSlice'
4
5
import { reset as blockReset } from 'src/features/blocks/blockSlice'
5
6
import { resetTokenPrices } from 'src/features/chart/tokenPriceSlice'
@@ -25,6 +26,7 @@ export function NetworkModal({ isOpen, close }: Props) {
25
26
try {
26
27
if ( ! switchNetworkAsync ) throw new Error ( 'switchNetworkAsync undefined' )
27
28
logger . debug ( 'Resetting and switching to network' , c . name )
29
+ cleanupStaleWalletSessions ( )
28
30
await switchNetworkAsync ( c . chainId )
29
31
dispatch ( blockReset ( ) )
30
32
dispatch ( accountReset ( ) )
@@ -38,9 +40,9 @@ export function NetworkModal({ isOpen, close }: Props) {
38
40
39
41
return (
40
42
< Modal isOpen = { isOpen } close = { close } title = "Network details" width = "max-w-md" >
41
- < div className = "px-4 sm:px-6 w-full justify-between items-end inline-flex " >
42
- < div className = "w-full py-3 sm: py-4 bg-gray-100 dark:bg-zinc-900 rounded-xl font-inter border border-gray-200 dark:border-zinc-800 flex-col justify-start items-center gap-4 inline-flex " >
43
- < div className = "px-3 sm:px-4 w-full justify-between items-end inline-flex " >
43
+ < div className = "inline-flex items-end justify-between w-full px-4 sm:px-6 " >
44
+ < div className = "inline-flex flex-col items-center justify-start w-full gap-4 py-3 bg-gray-100 border border-gray-200 sm:py-4 dark:bg-zinc-900 rounded-xl font-inter dark:border-zinc-800" >
45
+ < div className = "inline-flex items-end justify-between w-full px-3 sm:px-4 " >
44
46
< div className = "text-neutral-500 dark:text-gray-400 text-[14px] sm:text-[15px] font-normal leading-tight" >
45
47
Connected to:
46
48
</ div >
@@ -49,7 +51,7 @@ export function NetworkModal({ isOpen, close }: Props) {
49
51
</ div >
50
52
</ div >
51
53
< div className = "w-full h-[0px] border-t border-gray-200 dark:border-zinc-800" > </ div >
52
- < div className = "px-3 sm:px-4 w-full justify-between items-end inline-flex " >
54
+ < div className = "inline-flex items-end justify-between w-full px-3 sm:px-4 " >
53
55
< div className = "text-neutral-500 dark:text-gray-400 text-[14px] sm:text-[15px] font-normal leading-tight" >
54
56
Block Number:
55
57
</ div >
@@ -58,7 +60,7 @@ export function NetworkModal({ isOpen, close }: Props) {
58
60
</ div >
59
61
</ div >
60
62
< div className = "w-full h-[0px] border-t border-gray-200 dark:border-zinc-800" > </ div >
61
- < div className = "px-3 sm:px-4 w-full justify-between items-end inline-flex " >
63
+ < div className = "inline-flex items-end justify-between w-full px-3 sm:px-4 " >
62
64
< div className = "text-neutral-500 dark:text-gray-400 text-[14px] sm:text-[15px] font-normal leading-tight" >
63
65
Node Rpc Url:
64
66
</ div >
@@ -69,7 +71,7 @@ export function NetworkModal({ isOpen, close }: Props) {
69
71
</ div >
70
72
</ div >
71
73
< div className = "mt-4 sm:mt-6 w-full h-[0px] border-t border-gray-200 dark:border-zinc-800" > </ div >
72
- < div className = "py-4 sm:py-6 px-4 sm:px-6 w-full justify-start items-start gap -4 inline-flex font-inter" >
74
+ < div className = "inline-flex items-start justify-start w-full gap-4 px-4 py -4 sm:py-6 sm:px-6 font-inter" >
73
75
{ allChains . map ( ( c ) => (
74
76
< button
75
77
onClick = { ( ) => switchToNetwork ( c ) }
@@ -97,27 +99,27 @@ export function NetworkModal({ isOpen, close }: Props) {
97
99
}
98
100
/*
99
101
<div className="grow shrink basis-0 h-[50px] px-4 py-3 rounded-lg border border border border border-gray-950 justify-center items-center flex">
100
- <div className="justify-start items-center gap-1 flex ">
102
+ <div className="flex items-center justify-start gap-1">
101
103
<div className="text-gray-950 text-[16px] font-semibold leading-relaxed">Baklava</div>
102
104
</div>
103
105
</div>
104
106
105
107
106
108
<div className="relative flex flex-col items-center">
107
- <div className="flex justify-between items-center mt-3">
108
- <div className="mr-2 w-28 text-left text-sm ">Connected to:</div>
109
+ <div className="flex items-center justify-between mt-3">
110
+ <div className="mr-2 text-sm text-left w-28 ">Connected to:</div>
109
111
<div className="w-48 ml-1 text-sm">{currentChain?.name || 'Unknown'}</div>
110
112
</div>
111
- <div className="flex justify-between items-center mt-3">
112
- <div className="mr-2 w-28 text-left text-sm ">Block Number:</div>
113
+ <div className="flex items-center justify-between mt-3">
114
+ <div className="mr-2 text-sm text-left w-28 ">Block Number:</div>
113
115
<div className="w-48 ml-1 text-sm">{latestBlock?.number || 'Unknown'}</div>
114
116
</div>
115
- <div className="flex justify-between items-center mt-3">
116
- <div className="mr-2 w-28 text-left text-sm ">Node Rpc Url:</div>
117
+ <div className="flex items-center justify-between mt-3">
118
+ <div className="mr-2 text-sm text-left w-28 ">Node Rpc Url:</div>
117
119
<div className="w-48 ml-1 text-sm">{shortenUrl(currentChain?.rpcUrl) || 'Unknown'}</div>
118
120
</div>
119
121
<HrDivider classes="my-6" />
120
- <div className="flex items-center space-x-6 pb-2 ">
122
+ <div className="flex items-center pb-2 space-x-6">
121
123
{allChains.map((c) => (
122
124
<button
123
125
onClick={() => switchToNetwork(c)}
0 commit comments