@dodoex/wallet-web3-react 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/babel.config.js +9 -9
  2. package/dist/cjs/index.cjs +4 -13
  3. package/dist/cjs/locales/en.js +1 -1
  4. package/dist/cjs/locales/zh.js +1 -1
  5. package/dist/index.js +4 -13
  6. package/dist/locales/en.js +1 -1
  7. package/dist/locales/zh.js +1 -1
  8. package/dist/types/ClientProvider.d.ts +1 -1
  9. package/dist/types/LangProvider.d.ts +1 -1
  10. package/dist/types/WalletConnect/AccountPage.d.ts +1 -1
  11. package/dist/types/WalletConnect/ActivityList.d.ts +5 -4
  12. package/dist/types/WalletConnect/ConnectAlchemy/index.d.ts +2 -1
  13. package/dist/types/WalletConnect/ConnectDialog.d.ts +2 -1
  14. package/dist/types/WalletConnect/ConnectLedger/ErrorDialog.d.ts +1 -1
  15. package/dist/types/WalletConnect/ConnectLedger/LoadingDialog.d.ts +1 -1
  16. package/dist/types/WalletConnect/ConnectLedger/LockedDialog.d.ts +1 -1
  17. package/dist/types/WalletConnect/ConnectLedger/ProtocolDialog.d.ts +1 -1
  18. package/dist/types/WalletConnect/ConnectLedger/SelectAddressDialog.d.ts +1 -1
  19. package/dist/types/WalletConnect/ConnectLedger/SelectPathDialog.d.ts +1 -1
  20. package/dist/types/WalletConnect/ConnectLedger/index.d.ts +1 -1
  21. package/dist/types/WalletConnect/ConnectPage.d.ts +1 -1
  22. package/dist/types/WalletConnect/HasBalanceTokenList.d.ts +1 -1
  23. package/dist/types/WalletConnect/ReceiveTokenPage.d.ts +2 -1
  24. package/dist/types/WalletConnect/SendTokenPage.d.ts +2 -1
  25. package/dist/types/WalletConnect/WalletDialog.d.ts +2 -1
  26. package/dist/types/WalletConnectProvider.d.ts +2 -2
  27. package/dist/types/components/AddressWithLinkAndCopy.d.ts +2 -2
  28. package/dist/types/components/Dialog.d.ts +3 -3
  29. package/dist/types/components/WalletTag.d.ts +1 -1
  30. package/lingui.config.ts +13 -13
  31. package/package.json +90 -90
  32. package/rollup.config.mjs +106 -103
  33. package/src/ClientProvider.tsx +17 -17
  34. package/src/LangProvider.tsx +36 -36
  35. package/src/WalletConnect/AccountPage.tsx +498 -498
  36. package/src/WalletConnect/ActivityList.tsx +606 -606
  37. package/src/WalletConnect/ConnectAlchemy/index.tsx +248 -248
  38. package/src/WalletConnect/ConnectAlchemy/useConnectAlchemy.ts +105 -105
  39. package/src/WalletConnect/ConnectDialog.tsx +35 -35
  40. package/src/WalletConnect/ConnectLedger/ErrorDialog.tsx +61 -61
  41. package/src/WalletConnect/ConnectLedger/LockedDialog.tsx +54 -54
  42. package/src/WalletConnect/ConnectLedger/helper.ts +14 -14
  43. package/src/WalletConnect/ConnectPage.tsx +508 -508
  44. package/src/WalletConnect/HasBalanceTokenList.tsx +202 -202
  45. package/src/WalletConnect/ReceiveTokenPage.tsx +145 -145
  46. package/src/WalletConnect/SendTokenPage.tsx +251 -251
  47. package/src/WalletConnect/WalletDialog.tsx +80 -80
  48. package/src/WalletConnectProvider.tsx +57 -57
  49. package/src/components/AddressWithLinkAndCopy.tsx +202 -202
  50. package/src/components/Dialog.tsx +158 -158
  51. package/src/components/TokenLogo.tsx +167 -167
  52. package/src/components/WalletTag.tsx +117 -117
  53. package/src/constants/localstorage.ts +24 -24
  54. package/src/hooks/useConnectWallet.ts +150 -150
  55. package/src/hooks/useFetchFiatPrice.ts +53 -53
  56. package/src/hooks/useFetchTokensBalance.ts +53 -53
  57. package/src/hooks/useHasBalanceTokenList.ts +95 -95
  58. package/src/hooks/useTransactionList.ts +89 -89
  59. package/src/index.tsx +7 -7
  60. package/src/locales/en.js +1 -1
  61. package/src/locales/en.po +8 -8
  62. package/src/locales/zh.js +1 -1
  63. package/src/locales/zh.po +4 -4
  64. package/src/react19-types.d.ts +12 -0
  65. package/src/utils/formatter.ts +102 -102
  66. package/src/utils/time.ts +21 -21
  67. package/src/utils/utils.ts +8 -8
  68. package/tsconfig.json +22 -22
@@ -1,251 +1,251 @@
1
- 'use client';
2
-
3
- import { useWalletStore } from '@dodoex/wallet-web3';
4
- import { isAddress } from '@ethersproject/address';
5
- import { ArrowBack, Loading } from '@dodoex/icons';
6
- import { useWalletConnectContext } from '../WalletConnectProvider';
7
- import React from 'react';
8
- import { TokenInfo } from '../components/TokenLogo';
9
- import { useMutation } from '@tanstack/react-query';
10
- import BigNumber from 'bignumber.js';
11
- import { Trans } from '@lingui/macro';
12
- import { DialogTitle } from '../components/Dialog';
13
- import { Box, Button, ButtonBase, useTheme } from '@dodoex/components';
14
- import { truncatePoolAddress } from '../components/AddressWithLinkAndCopy';
15
-
16
- export default function SendTokenPage({
17
- open,
18
- onClose,
19
- onBack,
20
- }: {
21
- open?: boolean;
22
- onClose: () => void;
23
- onBack: () => void;
24
- }) {
25
- const theme = useTheme();
26
- const { getChain } = useWalletConnectContext();
27
- const { chainId } = useWalletStore();
28
- const chain = getChain(chainId);
29
- const defaultToken = chain
30
- ? ({
31
- ...chain?.gasToken,
32
- chainId,
33
- } as TokenInfo)
34
- : null;
35
- const [token, setToken] = React.useState<TokenInfo | null>(defaultToken);
36
- const [amount, setAmount] = React.useState('');
37
- const [receiverAddress, setReceiverAddress] = React.useState('');
38
- const [receiverAddressFormat, setReceiverAddressFormat] = React.useState('');
39
- const [invalidReceiver, setInvalidReceiver] = React.useState(false);
40
-
41
- const disabled =
42
- !amount ||
43
- !receiverAddress ||
44
- invalidReceiver ||
45
- !isAddress(receiverAddress);
46
-
47
- const sendTokenMutation = useMutation({
48
- mutationFn: async () => {
49
- if (disabled || !token || token.decimals === undefined) return;
50
- const amountWei = new BigNumber(amount).times(10 ** token.decimals);
51
- const amountWeiStr = `0x${amountWei.toString(16)}`;
52
- let data = '';
53
- let paramsValue = '';
54
- let to = token.address;
55
- // if (
56
- // token.address.toLowerCase() === defaultToken?.address?.toLowerCase()
57
- // ) {
58
- // paramsValue = amountWeiStr;
59
- // data = '0x';
60
- // to = receiverAddress;
61
- // } else {
62
- // paramsValue = '0x0';
63
- // data = await TokenApi.encode.transferEncodeABI(
64
- // receiverAddress,
65
- // amountWeiStr,
66
- // );
67
- // }
68
- // const result = await execute({
69
- // brief: 'wallet.account.card.operate.send',
70
- // spec: {
71
- // opcode: OpCode.TX,
72
- // value: paramsValue,
73
- // to,
74
- // data,
75
- // },
76
- // successBack: () => {
77
- // // queryClient.invalidateQueries({
78
- // // queryKey: ['graphql', 'FetchCrossChainDODOOrderList'],
79
- // // });
80
- // },
81
- // metadata: {
82
- // [MetadataFlag.sendToken]: true,
83
- // },
84
- // });
85
- // if (result === ExecutionResult.Success) {
86
- // setAmount('');
87
- // }
88
- },
89
- });
90
-
91
- React.useEffect(() => {
92
- if (open) {
93
- setToken(defaultToken);
94
- setAmount('');
95
- sendTokenMutation.reset();
96
- }
97
- // eslint-disable-next-line react-hooks/exhaustive-deps
98
- }, [open]);
99
-
100
- return (
101
- <>
102
- <DialogTitle onClose={onClose}>
103
- <ButtonBase
104
- onClick={onBack}
105
- sx={{
106
- display: 'flex',
107
- gap: 8,
108
- alignItems: 'center',
109
- }}
110
- >
111
- <Box
112
- component={ArrowBack}
113
- sx={{
114
- width: 16,
115
- height: 16,
116
- }}
117
- />
118
- <Trans>Send</Trans>
119
- </ButtonBase>
120
- </DialogTitle>
121
- <Box
122
- sx={{
123
- display: 'flex',
124
- flexDirection: 'column',
125
- justifyContent: 'space-between',
126
- flex: 1,
127
- px: 20,
128
- pb: 20,
129
- overflowY: 'auto',
130
- }}
131
- >
132
- <Box>
133
- <Box
134
- sx={{
135
- p: 20,
136
- backgroundColor: 'background.input',
137
- borderRadius: 16,
138
- }}
139
- >
140
- <Box
141
- sx={{
142
- color: 'text.secondary',
143
- typography: 'h5',
144
- }}
145
- >
146
- <Trans>Receiver address</Trans>
147
- </Box>
148
- <Box
149
- component="input"
150
- sx={{
151
- mt: 12,
152
- width: '100%',
153
- fontSize: '36px',
154
- lineHeight: '40px',
155
- fontWeight: 600,
156
- backgroundColor: 'transparent',
157
- '&::placeholder': {
158
- color: 'text.disabled',
159
- },
160
- }}
161
- placeholder="0x..."
162
- value={receiverAddressFormat || receiverAddress}
163
- onChange={(evt) => {
164
- setReceiverAddress(evt.target.value);
165
- setInvalidReceiver(false);
166
- }}
167
- onFocus={() => {
168
- setReceiverAddressFormat('');
169
- }}
170
- onBlur={(evt) => {
171
- const value = evt.target.value;
172
- if (!value) return;
173
- if (!isAddress(value)) {
174
- setInvalidReceiver(true);
175
- } else {
176
- setReceiverAddressFormat(truncatePoolAddress(value));
177
- }
178
- }}
179
- />
180
- {!!invalidReceiver && (
181
- <Box
182
- sx={{
183
- mt: 4,
184
- color: 'error.main',
185
- typography: 'h6',
186
- }}
187
- >
188
- <Trans>Invalid wallet address</Trans>
189
- </Box>
190
- )}
191
- </Box>
192
- {/* <Widget>
193
- <TokenCard
194
- amt={amount}
195
- onInputChange={(v) => setAmount(v)}
196
- token={token}
197
- onTokenChange={(token) => setToken(token)}
198
- showPercentage
199
- sx={{
200
- mt: 12,
201
- pb: 20,
202
- '&&& input': {
203
- typography: 'h1',
204
- '&::placeholder': {
205
- typography: 'h1',
206
- },
207
- },
208
- }}
209
- />
210
- </Widget> */}
211
- </Box>
212
- <Button
213
- disabled={disabled}
214
- fullWidth
215
- onClick={() => {
216
- if (sendTokenMutation.isPending) return;
217
- sendTokenMutation.mutate();
218
- }}
219
- sx={{
220
- gap: 4,
221
- mt: 12,
222
- width: '100%',
223
- fontWeight: 600,
224
- }}
225
- >
226
- {sendTokenMutation.isPending && (
227
- <Box
228
- component={Loading}
229
- sx={{
230
- width: 20,
231
- '& path': {
232
- fill: theme.palette.primary.contrastText,
233
- },
234
- animation: 'loadingRotate 1.1s infinite linear',
235
- '@keyframes loadingRotate': {
236
- '0%': {
237
- transform: 'rotate(0deg)',
238
- },
239
- '100%': {
240
- transform: 'rotate(359deg)',
241
- },
242
- },
243
- }}
244
- />
245
- )}
246
- <Trans>Send</Trans>
247
- </Button>
248
- </Box>
249
- </>
250
- );
251
- }
1
+ 'use client';
2
+
3
+ import { useWalletStore } from '@dodoex/wallet-web3';
4
+ import { isAddress } from '@ethersproject/address';
5
+ import { ArrowBack, Loading } from '@dodoex/icons';
6
+ import { useWalletConnectContext } from '../WalletConnectProvider';
7
+ import React from 'react';
8
+ import { TokenInfo } from '../components/TokenLogo';
9
+ import { useMutation } from '@tanstack/react-query';
10
+ import BigNumber from 'bignumber.js';
11
+ import { Trans } from '@lingui/macro';
12
+ import { DialogTitle } from '../components/Dialog';
13
+ import { Box, Button, ButtonBase, useTheme } from '@dodoex/components';
14
+ import { truncatePoolAddress } from '../components/AddressWithLinkAndCopy';
15
+
16
+ export default function SendTokenPage({
17
+ open,
18
+ onClose,
19
+ onBack,
20
+ }: {
21
+ open?: boolean;
22
+ onClose: () => void;
23
+ onBack: () => void;
24
+ }) {
25
+ const theme = useTheme();
26
+ const { getChain } = useWalletConnectContext();
27
+ const { chainId } = useWalletStore();
28
+ const chain = getChain(chainId);
29
+ const defaultToken = chain
30
+ ? ({
31
+ ...chain?.gasToken,
32
+ chainId,
33
+ } as TokenInfo)
34
+ : null;
35
+ const [token, setToken] = React.useState<TokenInfo | null>(defaultToken);
36
+ const [amount, setAmount] = React.useState('');
37
+ const [receiverAddress, setReceiverAddress] = React.useState('');
38
+ const [receiverAddressFormat, setReceiverAddressFormat] = React.useState('');
39
+ const [invalidReceiver, setInvalidReceiver] = React.useState(false);
40
+
41
+ const disabled =
42
+ !amount ||
43
+ !receiverAddress ||
44
+ invalidReceiver ||
45
+ !isAddress(receiverAddress);
46
+
47
+ const sendTokenMutation = useMutation({
48
+ mutationFn: async () => {
49
+ if (disabled || !token || token.decimals === undefined) return;
50
+ const amountWei = new BigNumber(amount).times(10 ** token.decimals);
51
+ const amountWeiStr = `0x${amountWei.toString(16)}`;
52
+ let data = '';
53
+ let paramsValue = '';
54
+ let to = token.address;
55
+ // if (
56
+ // token.address.toLowerCase() === defaultToken?.address?.toLowerCase()
57
+ // ) {
58
+ // paramsValue = amountWeiStr;
59
+ // data = '0x';
60
+ // to = receiverAddress;
61
+ // } else {
62
+ // paramsValue = '0x0';
63
+ // data = await TokenApi.encode.transferEncodeABI(
64
+ // receiverAddress,
65
+ // amountWeiStr,
66
+ // );
67
+ // }
68
+ // const result = await execute({
69
+ // brief: 'wallet.account.card.operate.send',
70
+ // spec: {
71
+ // opcode: OpCode.TX,
72
+ // value: paramsValue,
73
+ // to,
74
+ // data,
75
+ // },
76
+ // successBack: () => {
77
+ // // queryClient.invalidateQueries({
78
+ // // queryKey: ['graphql', 'FetchCrossChainDODOOrderList'],
79
+ // // });
80
+ // },
81
+ // metadata: {
82
+ // [MetadataFlag.sendToken]: true,
83
+ // },
84
+ // });
85
+ // if (result === ExecutionResult.Success) {
86
+ // setAmount('');
87
+ // }
88
+ },
89
+ });
90
+
91
+ React.useEffect(() => {
92
+ if (open) {
93
+ setToken(defaultToken);
94
+ setAmount('');
95
+ sendTokenMutation.reset();
96
+ }
97
+ // eslint-disable-next-line react-hooks/exhaustive-deps
98
+ }, [open]);
99
+
100
+ return (
101
+ <>
102
+ <DialogTitle onClose={onClose}>
103
+ <ButtonBase
104
+ onClick={onBack}
105
+ sx={{
106
+ display: 'flex',
107
+ gap: 8,
108
+ alignItems: 'center',
109
+ }}
110
+ >
111
+ <Box
112
+ component={ArrowBack}
113
+ sx={{
114
+ width: 16,
115
+ height: 16,
116
+ }}
117
+ />
118
+ <Trans>Send</Trans>
119
+ </ButtonBase>
120
+ </DialogTitle>
121
+ <Box
122
+ sx={{
123
+ display: 'flex',
124
+ flexDirection: 'column',
125
+ justifyContent: 'space-between',
126
+ flex: 1,
127
+ px: 20,
128
+ pb: 20,
129
+ overflowY: 'auto',
130
+ }}
131
+ >
132
+ <Box>
133
+ <Box
134
+ sx={{
135
+ p: 20,
136
+ backgroundColor: 'background.input',
137
+ borderRadius: 16,
138
+ }}
139
+ >
140
+ <Box
141
+ sx={{
142
+ color: 'text.secondary',
143
+ typography: 'h5',
144
+ }}
145
+ >
146
+ <Trans>Receiver address</Trans>
147
+ </Box>
148
+ <Box
149
+ component="input"
150
+ sx={{
151
+ mt: 12,
152
+ width: '100%',
153
+ fontSize: '36px',
154
+ lineHeight: '40px',
155
+ fontWeight: 600,
156
+ backgroundColor: 'transparent',
157
+ '&::placeholder': {
158
+ color: 'text.disabled',
159
+ },
160
+ }}
161
+ placeholder="0x..."
162
+ value={receiverAddressFormat || receiverAddress}
163
+ onChange={(evt) => {
164
+ setReceiverAddress(evt.target.value);
165
+ setInvalidReceiver(false);
166
+ }}
167
+ onFocus={() => {
168
+ setReceiverAddressFormat('');
169
+ }}
170
+ onBlur={(evt) => {
171
+ const value = evt.target.value;
172
+ if (!value) return;
173
+ if (!isAddress(value)) {
174
+ setInvalidReceiver(true);
175
+ } else {
176
+ setReceiverAddressFormat(truncatePoolAddress(value));
177
+ }
178
+ }}
179
+ />
180
+ {!!invalidReceiver && (
181
+ <Box
182
+ sx={{
183
+ mt: 4,
184
+ color: 'error.main',
185
+ typography: 'h6',
186
+ }}
187
+ >
188
+ <Trans>Invalid wallet address</Trans>
189
+ </Box>
190
+ )}
191
+ </Box>
192
+ {/* <Widget>
193
+ <TokenCard
194
+ amt={amount}
195
+ onInputChange={(v) => setAmount(v)}
196
+ token={token}
197
+ onTokenChange={(token) => setToken(token)}
198
+ showPercentage
199
+ sx={{
200
+ mt: 12,
201
+ pb: 20,
202
+ '&&& input': {
203
+ typography: 'h1',
204
+ '&::placeholder': {
205
+ typography: 'h1',
206
+ },
207
+ },
208
+ }}
209
+ />
210
+ </Widget> */}
211
+ </Box>
212
+ <Button
213
+ disabled={disabled}
214
+ fullWidth
215
+ onClick={() => {
216
+ if (sendTokenMutation.isPending) return;
217
+ sendTokenMutation.mutate();
218
+ }}
219
+ sx={{
220
+ gap: 4,
221
+ mt: 12,
222
+ width: '100%',
223
+ fontWeight: 600,
224
+ }}
225
+ >
226
+ {sendTokenMutation.isPending && (
227
+ <Box
228
+ component={Loading}
229
+ sx={{
230
+ width: 20,
231
+ '& path': {
232
+ fill: theme.palette.primary.contrastText,
233
+ },
234
+ animation: 'loadingRotate 1.1s infinite linear',
235
+ '@keyframes loadingRotate': {
236
+ '0%': {
237
+ transform: 'rotate(0deg)',
238
+ },
239
+ '100%': {
240
+ transform: 'rotate(359deg)',
241
+ },
242
+ },
243
+ }}
244
+ />
245
+ )}
246
+ <Trans>Send</Trans>
247
+ </Button>
248
+ </Box>
249
+ </>
250
+ );
251
+ }
@@ -1,80 +1,80 @@
1
- 'use client';
2
-
3
- import WalletWeb3, { useWalletStore } from '@dodoex/wallet-web3';
4
- import AccountPage from './AccountPage';
5
- import React from 'react';
6
- import Dialog from '../components/Dialog';
7
- import ConnectPage, { ConnectPageProps } from './ConnectPage';
8
- import ReceiveTokenPage from './ReceiveTokenPage';
9
- import { useWalletConnectContext } from '../WalletConnectProvider';
10
-
11
- export default function WalletDialog({
12
- open,
13
- onClose,
14
- walletWeb3,
15
- onConnectWallet,
16
- WalletTag,
17
- }: {
18
- open: boolean;
19
- onClose: () => void;
20
- walletWeb3: WalletWeb3;
21
- onConnectWallet?: ConnectPageProps['onConnectWallet'];
22
- WalletTag?: ConnectPageProps['WalletTag'];
23
- }) {
24
- const { SendTokenPage, chainId: selectedChainId } = useWalletConnectContext();
25
- const { account, chainId: connectChainId, connected } = useWalletStore();
26
- const [showSendTokenPage, setShowSendTokenPage] = React.useState(false);
27
- const [showReceiveTokenPage, setShowReceiveTokenPage] = React.useState(false);
28
- return (
29
- <Dialog
30
- open={open}
31
- onClose={onClose}
32
- width={420}
33
- bodySx={{
34
- height: account && !!SendTokenPage ? '80vh' : undefined,
35
- }}
36
- >
37
- {!!SendTokenPage && account && connected?.wallet ? (
38
- <>
39
- {showSendTokenPage ? (
40
- <>
41
- {!!SendTokenPage && (
42
- <SendTokenPage
43
- open={showSendTokenPage}
44
- onClose={onClose}
45
- onBack={() => setShowSendTokenPage(false)}
46
- />
47
- )}
48
- </>
49
- ) : showReceiveTokenPage ? (
50
- <ReceiveTokenPage
51
- onClose={onClose}
52
- onBack={() => setShowReceiveTokenPage(false)}
53
- />
54
- ) : (
55
- <>
56
- <AccountPage
57
- chainId={selectedChainId ?? connectChainId}
58
- account={account}
59
- walletWeb3={walletWeb3}
60
- onClose={onClose}
61
- setShowSendTokenPage={setShowSendTokenPage}
62
- setShowReceiveTokenPage={setShowReceiveTokenPage}
63
- />
64
- </>
65
- )}
66
- </>
67
- ) : (
68
- <ConnectPage
69
- chainId={connectChainId}
70
- account={account}
71
- walletWeb3={walletWeb3}
72
- showOtherInjectWallet
73
- onClose={onClose}
74
- onConnectWallet={onConnectWallet}
75
- WalletTag={WalletTag}
76
- />
77
- )}
78
- </Dialog>
79
- );
80
- }
1
+ 'use client';
2
+
3
+ import WalletWeb3, { useWalletStore } from '@dodoex/wallet-web3';
4
+ import AccountPage from './AccountPage';
5
+ import React from 'react';
6
+ import Dialog from '../components/Dialog';
7
+ import ConnectPage, { ConnectPageProps } from './ConnectPage';
8
+ import ReceiveTokenPage from './ReceiveTokenPage';
9
+ import { useWalletConnectContext } from '../WalletConnectProvider';
10
+
11
+ export default function WalletDialog({
12
+ open,
13
+ onClose,
14
+ walletWeb3,
15
+ onConnectWallet,
16
+ WalletTag,
17
+ }: {
18
+ open: boolean;
19
+ onClose: () => void;
20
+ walletWeb3: WalletWeb3;
21
+ onConnectWallet?: ConnectPageProps['onConnectWallet'];
22
+ WalletTag?: ConnectPageProps['WalletTag'];
23
+ }) {
24
+ const { SendTokenPage, chainId: selectedChainId } = useWalletConnectContext();
25
+ const { account, chainId: connectChainId, connected } = useWalletStore();
26
+ const [showSendTokenPage, setShowSendTokenPage] = React.useState(false);
27
+ const [showReceiveTokenPage, setShowReceiveTokenPage] = React.useState(false);
28
+ return (
29
+ <Dialog
30
+ open={open}
31
+ onClose={onClose}
32
+ width={420}
33
+ bodySx={{
34
+ height: account && !!SendTokenPage ? '80vh' : undefined,
35
+ }}
36
+ >
37
+ {!!SendTokenPage && account && connected?.wallet ? (
38
+ <>
39
+ {showSendTokenPage ? (
40
+ <>
41
+ {!!SendTokenPage && (
42
+ <SendTokenPage
43
+ open={showSendTokenPage}
44
+ onClose={onClose}
45
+ onBack={() => setShowSendTokenPage(false)}
46
+ />
47
+ )}
48
+ </>
49
+ ) : showReceiveTokenPage ? (
50
+ <ReceiveTokenPage
51
+ onClose={onClose}
52
+ onBack={() => setShowReceiveTokenPage(false)}
53
+ />
54
+ ) : (
55
+ <>
56
+ <AccountPage
57
+ chainId={selectedChainId ?? connectChainId}
58
+ account={account}
59
+ walletWeb3={walletWeb3}
60
+ onClose={onClose}
61
+ setShowSendTokenPage={setShowSendTokenPage}
62
+ setShowReceiveTokenPage={setShowReceiveTokenPage}
63
+ />
64
+ </>
65
+ )}
66
+ </>
67
+ ) : (
68
+ <ConnectPage
69
+ chainId={connectChainId}
70
+ account={account}
71
+ walletWeb3={walletWeb3}
72
+ showOtherInjectWallet
73
+ onClose={onClose}
74
+ onConnectWallet={onConnectWallet}
75
+ WalletTag={WalletTag}
76
+ />
77
+ )}
78
+ </Dialog>
79
+ );
80
+ }