@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,145 +1,145 @@
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
- }
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
+ }