@dodoex/wallet-web3-react 0.2.1 → 0.3.0
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.
- package/babel.config.js +9 -9
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/lingui.config.ts +13 -13
- package/package.json +90 -77
- package/rollup.config.mjs +100 -100
- package/src/ClientProvider.tsx +17 -15
- package/src/LangProvider.tsx +36 -34
- package/src/WalletConnect/AccountPage.tsx +496 -494
- package/src/WalletConnect/ActivityList.tsx +606 -604
- package/src/WalletConnect/ConnectAlchemy/index.tsx +248 -246
- package/src/WalletConnect/ConnectAlchemy/useConnectAlchemy.ts +105 -105
- package/src/WalletConnect/ConnectDialog.tsx +35 -33
- package/src/WalletConnect/ConnectLedger/ErrorDialog.tsx +61 -61
- package/src/WalletConnect/ConnectLedger/LockedDialog.tsx +54 -54
- package/src/WalletConnect/ConnectLedger/helper.ts +14 -14
- package/src/WalletConnect/ConnectLedger/index.tsx +2 -0
- package/src/WalletConnect/ConnectPage.tsx +508 -506
- package/src/WalletConnect/HasBalanceTokenList.tsx +202 -200
- package/src/WalletConnect/ReceiveTokenPage.tsx +145 -143
- package/src/WalletConnect/SendTokenPage.tsx +251 -249
- package/src/WalletConnect/WalletDialog.tsx +80 -78
- package/src/WalletConnectProvider.tsx +57 -55
- package/src/components/AddressWithLinkAndCopy.tsx +202 -200
- package/src/components/Dialog.tsx +158 -156
- package/src/components/TokenLogo.tsx +167 -165
- package/src/components/WalletTag.tsx +117 -115
- package/src/constants/localstorage.ts +24 -22
- package/src/hooks/useConnectWallet.ts +150 -148
- package/src/hooks/useFetchFiatPrice.ts +53 -51
- package/src/hooks/useFetchTokensBalance.ts +53 -51
- package/src/hooks/useHasBalanceTokenList.ts +95 -93
- package/src/hooks/useTransactionList.ts +89 -87
- package/src/index.tsx +7 -7
- package/src/locales/en.po +51 -51
- package/src/locales/zh.po +51 -51
- package/src/utils/formatter.ts +102 -102
- package/src/utils/time.ts +21 -21
- package/src/utils/utils.ts +8 -8
- package/tsconfig.json +23 -23
|
@@ -1,143 +1,145 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
'
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useWalletStore } from '@dodoex/wallet-web3';
|
|
4
|
+
import { ArrowBack, Copy } from '@dodoex/icons';
|
|
5
|
+
import { Trans } from '@lingui/macro';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import copy from 'copy-to-clipboard';
|
|
8
|
+
import { QRCodeSVG } from 'qrcode.react';
|
|
9
|
+
import { DialogTitle } from '../components/Dialog';
|
|
10
|
+
import { Box, ButtonBase, Tooltip } from '@dodoex/components';
|
|
11
|
+
|
|
12
|
+
export default function ReceiveTokenPage({
|
|
13
|
+
onClose,
|
|
14
|
+
onBack,
|
|
15
|
+
}: {
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
onBack: () => void;
|
|
18
|
+
}) {
|
|
19
|
+
const { account } = useWalletStore();
|
|
20
|
+
const [showCopyTooltip, setShowCopyTooltip] = React.useState(false);
|
|
21
|
+
const autoCloseShowCopyTooltip = React.useCallback(() => {
|
|
22
|
+
const time = setTimeout(() => {
|
|
23
|
+
setShowCopyTooltip(false);
|
|
24
|
+
}, 1500);
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
clearTimeout(time);
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
if (!account) return null;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<DialogTitle onClose={onClose}>
|
|
36
|
+
<ButtonBase
|
|
37
|
+
onClick={onBack}
|
|
38
|
+
sx={{
|
|
39
|
+
display: 'flex',
|
|
40
|
+
gap: 8,
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
typography: 'caption',
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<Box
|
|
46
|
+
component={ArrowBack}
|
|
47
|
+
sx={{
|
|
48
|
+
width: 16,
|
|
49
|
+
height: 16,
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
<Trans>Receive</Trans>
|
|
53
|
+
</ButtonBase>
|
|
54
|
+
</DialogTitle>
|
|
55
|
+
<Box
|
|
56
|
+
sx={{
|
|
57
|
+
display: 'flex',
|
|
58
|
+
flexDirection: 'column',
|
|
59
|
+
flex: 1,
|
|
60
|
+
overflowY: 'auto',
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<Box
|
|
64
|
+
sx={{
|
|
65
|
+
display: 'flex',
|
|
66
|
+
flexDirection: 'column',
|
|
67
|
+
justifyContent: 'space-between',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
flex: 1,
|
|
70
|
+
pt: 28,
|
|
71
|
+
pb: 20,
|
|
72
|
+
width: 326,
|
|
73
|
+
mx: 'auto',
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<Box>
|
|
77
|
+
<Box
|
|
78
|
+
sx={{
|
|
79
|
+
p: 36,
|
|
80
|
+
borderRadius: 12,
|
|
81
|
+
border: 'solid 1px',
|
|
82
|
+
borderColor: 'border.main',
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<QRCodeSVG id="qrcode" size={252} value={account} level="M" />
|
|
86
|
+
</Box>
|
|
87
|
+
<Box
|
|
88
|
+
sx={{
|
|
89
|
+
mt: 12,
|
|
90
|
+
color: 'text.secondary',
|
|
91
|
+
wordBreak: 'break-all',
|
|
92
|
+
textAlign: 'center',
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
{account}
|
|
96
|
+
</Box>
|
|
97
|
+
</Box>
|
|
98
|
+
<Tooltip
|
|
99
|
+
onlyClick
|
|
100
|
+
arrow={false}
|
|
101
|
+
title={<Trans>Copied</Trans>}
|
|
102
|
+
open={showCopyTooltip}
|
|
103
|
+
onOpen={() => {
|
|
104
|
+
setShowCopyTooltip(true);
|
|
105
|
+
autoCloseShowCopyTooltip();
|
|
106
|
+
}}
|
|
107
|
+
onClose={() => setShowCopyTooltip(false)}
|
|
108
|
+
>
|
|
109
|
+
<ButtonBase
|
|
110
|
+
onClick={() => {
|
|
111
|
+
copy(account);
|
|
112
|
+
}}
|
|
113
|
+
sx={{
|
|
114
|
+
display: 'flex',
|
|
115
|
+
alignItems: 'center',
|
|
116
|
+
justifyContent: 'center',
|
|
117
|
+
gap: 4,
|
|
118
|
+
mt: 12,
|
|
119
|
+
px: 16,
|
|
120
|
+
py: 6,
|
|
121
|
+
width: '100%',
|
|
122
|
+
height: 48,
|
|
123
|
+
fontWeight: 600,
|
|
124
|
+
backgroundColor: 'background.paperDarkContrast',
|
|
125
|
+
borderRadius: 8,
|
|
126
|
+
'&:hover': {
|
|
127
|
+
opacity: 0.7,
|
|
128
|
+
},
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<Box
|
|
132
|
+
component={Copy}
|
|
133
|
+
sx={{
|
|
134
|
+
width: 18,
|
|
135
|
+
height: 18,
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
<Trans>Copy wallet address</Trans>
|
|
139
|
+
</ButtonBase>
|
|
140
|
+
</Tooltip>
|
|
141
|
+
</Box>
|
|
142
|
+
</Box>
|
|
143
|
+
</>
|
|
144
|
+
);
|
|
145
|
+
}
|