@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.
- package/babel.config.js +9 -9
- package/dist/cjs/index.cjs +4 -13
- package/dist/cjs/locales/en.js +1 -1
- package/dist/cjs/locales/zh.js +1 -1
- package/dist/index.js +4 -13
- package/dist/locales/en.js +1 -1
- package/dist/locales/zh.js +1 -1
- package/dist/types/ClientProvider.d.ts +1 -1
- package/dist/types/LangProvider.d.ts +1 -1
- package/dist/types/WalletConnect/AccountPage.d.ts +1 -1
- package/dist/types/WalletConnect/ActivityList.d.ts +5 -4
- package/dist/types/WalletConnect/ConnectAlchemy/index.d.ts +2 -1
- package/dist/types/WalletConnect/ConnectDialog.d.ts +2 -1
- package/dist/types/WalletConnect/ConnectLedger/ErrorDialog.d.ts +1 -1
- package/dist/types/WalletConnect/ConnectLedger/LoadingDialog.d.ts +1 -1
- package/dist/types/WalletConnect/ConnectLedger/LockedDialog.d.ts +1 -1
- package/dist/types/WalletConnect/ConnectLedger/ProtocolDialog.d.ts +1 -1
- package/dist/types/WalletConnect/ConnectLedger/SelectAddressDialog.d.ts +1 -1
- package/dist/types/WalletConnect/ConnectLedger/SelectPathDialog.d.ts +1 -1
- package/dist/types/WalletConnect/ConnectLedger/index.d.ts +1 -1
- package/dist/types/WalletConnect/ConnectPage.d.ts +1 -1
- package/dist/types/WalletConnect/HasBalanceTokenList.d.ts +1 -1
- package/dist/types/WalletConnect/ReceiveTokenPage.d.ts +2 -1
- package/dist/types/WalletConnect/SendTokenPage.d.ts +2 -1
- package/dist/types/WalletConnect/WalletDialog.d.ts +2 -1
- package/dist/types/WalletConnectProvider.d.ts +2 -2
- package/dist/types/components/AddressWithLinkAndCopy.d.ts +2 -2
- package/dist/types/components/Dialog.d.ts +3 -3
- package/dist/types/components/WalletTag.d.ts +1 -1
- package/lingui.config.ts +13 -13
- package/package.json +90 -90
- package/rollup.config.mjs +106 -103
- package/src/ClientProvider.tsx +17 -17
- package/src/LangProvider.tsx +36 -36
- package/src/WalletConnect/AccountPage.tsx +498 -498
- package/src/WalletConnect/ActivityList.tsx +606 -606
- package/src/WalletConnect/ConnectAlchemy/index.tsx +248 -248
- package/src/WalletConnect/ConnectAlchemy/useConnectAlchemy.ts +105 -105
- package/src/WalletConnect/ConnectDialog.tsx +35 -35
- 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/ConnectPage.tsx +508 -508
- package/src/WalletConnect/HasBalanceTokenList.tsx +202 -202
- package/src/WalletConnect/ReceiveTokenPage.tsx +145 -145
- package/src/WalletConnect/SendTokenPage.tsx +251 -251
- package/src/WalletConnect/WalletDialog.tsx +80 -80
- package/src/WalletConnectProvider.tsx +57 -57
- package/src/components/AddressWithLinkAndCopy.tsx +202 -202
- package/src/components/Dialog.tsx +158 -158
- package/src/components/TokenLogo.tsx +167 -167
- package/src/components/WalletTag.tsx +117 -117
- package/src/constants/localstorage.ts +24 -24
- package/src/hooks/useConnectWallet.ts +150 -150
- package/src/hooks/useFetchFiatPrice.ts +53 -53
- package/src/hooks/useFetchTokensBalance.ts +53 -53
- package/src/hooks/useHasBalanceTokenList.ts +95 -95
- package/src/hooks/useTransactionList.ts +89 -89
- package/src/index.tsx +7 -7
- package/src/locales/en.js +1 -1
- package/src/locales/en.po +8 -8
- package/src/locales/zh.js +1 -1
- package/src/locales/zh.po +4 -4
- package/src/react19-types.d.ts +12 -0
- package/src/utils/formatter.ts +102 -102
- package/src/utils/time.ts +21 -21
- package/src/utils/utils.ts +8 -8
- package/tsconfig.json +22 -22
package/rollup.config.mjs
CHANGED
|
@@ -1,103 +1,106 @@
|
|
|
1
|
-
import { babel } from '@rollup/plugin-babel';
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
-
import json from '@rollup/plugin-json';
|
|
4
|
-
import typescript from '@rollup/plugin-typescript';
|
|
5
|
-
import terser from '@rollup/plugin-terser';
|
|
6
|
-
import url from '@rollup/plugin-url';
|
|
7
|
-
import replace from '@rollup/plugin-replace';
|
|
8
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
9
|
-
import svgr from '@svgr/rollup';
|
|
10
|
-
import pkg from './package.json' with { type: 'json' };
|
|
11
|
-
import globby from 'globby';
|
|
12
|
-
import css from 'rollup-plugin-import-css';
|
|
13
|
-
import clear from 'rollup-plugin-clear';
|
|
14
|
-
|
|
15
|
-
const extensions = ['.js', '.jsx', '.ts', '.tsx'];
|
|
16
|
-
const baseConfig = {
|
|
17
|
-
input: pkg.source,
|
|
18
|
-
jsx: {
|
|
19
|
-
mode: 'preserve',
|
|
20
|
-
factory: 'React.createElement',
|
|
21
|
-
fragment: 'React.Fragment',
|
|
22
|
-
importSource: 'react'
|
|
23
|
-
},
|
|
24
|
-
plugins: [
|
|
25
|
-
replace({
|
|
26
|
-
'../locales/${locale}.js': './locales/${locale}.js',
|
|
27
|
-
delimiters: ['', ''],
|
|
28
|
-
preventAssignment: true,
|
|
29
|
-
}),
|
|
30
|
-
url(),
|
|
31
|
-
svgr({
|
|
32
|
-
svgo: true,
|
|
33
|
-
svgoConfig: {
|
|
34
|
-
plugins: [
|
|
35
|
-
{
|
|
36
|
-
name: 'removeViewBox',
|
|
37
|
-
active: false,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
42
|
-
json(),
|
|
43
|
-
typescript({
|
|
44
|
-
declaration: false,
|
|
45
|
-
}),
|
|
46
|
-
commonjs(),
|
|
47
|
-
resolve(),
|
|
48
|
-
babel({
|
|
49
|
-
extensions,
|
|
50
|
-
babelHelpers: 'bundled',
|
|
51
|
-
}),
|
|
52
|
-
css(),
|
|
53
|
-
clear({
|
|
54
|
-
// required, point out which directories should be clear.
|
|
55
|
-
targets: ['dist'],
|
|
56
|
-
// optional, whether clear the directores when rollup recompile on --watch mode.
|
|
57
|
-
watch: true, // default: false
|
|
58
|
-
}),
|
|
59
|
-
],
|
|
60
|
-
external: [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
...Object.keys(pkg.
|
|
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
|
-
|
|
1
|
+
import { babel } from '@rollup/plugin-babel';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
import json from '@rollup/plugin-json';
|
|
4
|
+
import typescript from '@rollup/plugin-typescript';
|
|
5
|
+
import terser from '@rollup/plugin-terser';
|
|
6
|
+
import url from '@rollup/plugin-url';
|
|
7
|
+
import replace from '@rollup/plugin-replace';
|
|
8
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
9
|
+
import svgr from '@svgr/rollup';
|
|
10
|
+
import pkg from './package.json' with { type: 'json' };
|
|
11
|
+
import globby from 'globby';
|
|
12
|
+
import css from 'rollup-plugin-import-css';
|
|
13
|
+
import clear from 'rollup-plugin-clear';
|
|
14
|
+
|
|
15
|
+
const extensions = ['.js', '.jsx', '.ts', '.tsx'];
|
|
16
|
+
const baseConfig = {
|
|
17
|
+
input: pkg.source,
|
|
18
|
+
jsx: {
|
|
19
|
+
mode: 'preserve',
|
|
20
|
+
factory: 'React.createElement',
|
|
21
|
+
fragment: 'React.Fragment',
|
|
22
|
+
importSource: 'react'
|
|
23
|
+
},
|
|
24
|
+
plugins: [
|
|
25
|
+
replace({
|
|
26
|
+
'../locales/${locale}.js': './locales/${locale}.js',
|
|
27
|
+
delimiters: ['', ''],
|
|
28
|
+
preventAssignment: true,
|
|
29
|
+
}),
|
|
30
|
+
url(),
|
|
31
|
+
svgr({
|
|
32
|
+
svgo: true,
|
|
33
|
+
svgoConfig: {
|
|
34
|
+
plugins: [
|
|
35
|
+
{
|
|
36
|
+
name: 'removeViewBox',
|
|
37
|
+
active: false,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
json(),
|
|
43
|
+
typescript({
|
|
44
|
+
declaration: false,
|
|
45
|
+
}),
|
|
46
|
+
commonjs(),
|
|
47
|
+
resolve(),
|
|
48
|
+
babel({
|
|
49
|
+
extensions,
|
|
50
|
+
babelHelpers: 'bundled',
|
|
51
|
+
}),
|
|
52
|
+
css(),
|
|
53
|
+
clear({
|
|
54
|
+
// required, point out which directories should be clear.
|
|
55
|
+
targets: ['dist'],
|
|
56
|
+
// optional, whether clear the directores when rollup recompile on --watch mode.
|
|
57
|
+
watch: true, // default: false
|
|
58
|
+
}),
|
|
59
|
+
],
|
|
60
|
+
external: [
|
|
61
|
+
'react',
|
|
62
|
+
'react-dom',
|
|
63
|
+
'react/jsx-runtime',
|
|
64
|
+
...Object.keys(pkg.dependencies || {}).filter(
|
|
65
|
+
(key) => !['@dodoex/icons'].includes(key),
|
|
66
|
+
),
|
|
67
|
+
...Object.keys(pkg.peerDependencies || {}),
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const localesConfig = globby.sync('src/locales/*.js').map((inputFile) => ({
|
|
72
|
+
input: inputFile,
|
|
73
|
+
output: [
|
|
74
|
+
{
|
|
75
|
+
dir: 'dist/locales',
|
|
76
|
+
format: 'esm',
|
|
77
|
+
sourcemap: false,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
dir: 'dist/cjs/locales',
|
|
81
|
+
sourcemap: false,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
export default [
|
|
87
|
+
{
|
|
88
|
+
output: [
|
|
89
|
+
{
|
|
90
|
+
dir: 'dist',
|
|
91
|
+
format: 'es',
|
|
92
|
+
plugins: [terser()],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
dir: 'dist/cjs',
|
|
96
|
+
entryFileNames: '[name].cjs',
|
|
97
|
+
chunkFileNames: '[name]-[hash].cjs',
|
|
98
|
+
format: 'cjs',
|
|
99
|
+
sourcemap: false,
|
|
100
|
+
plugins: [terser()],
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
...baseConfig,
|
|
104
|
+
},
|
|
105
|
+
...localesConfig,
|
|
106
|
+
];
|
package/src/ClientProvider.tsx
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { createTheme, ThemeProvider } from '@dodoex/components';
|
|
4
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
5
|
-
import LangProvider from './LangProvider';
|
|
6
|
-
|
|
7
|
-
export default function ClientProvider({ children }: React.PropsWithChildren) {
|
|
8
|
-
const queryClient = new QueryClient();
|
|
9
|
-
const theme = createTheme();
|
|
10
|
-
return (
|
|
11
|
-
<QueryClientProvider client={queryClient}>
|
|
12
|
-
<ThemeProvider theme={theme}>
|
|
13
|
-
<LangProvider>{children}</LangProvider>
|
|
14
|
-
</ThemeProvider>
|
|
15
|
-
</QueryClientProvider>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createTheme, ThemeProvider } from '@dodoex/components';
|
|
4
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
5
|
+
import LangProvider from './LangProvider';
|
|
6
|
+
|
|
7
|
+
export default function ClientProvider({ children }: React.PropsWithChildren) {
|
|
8
|
+
const queryClient = new QueryClient();
|
|
9
|
+
const theme = createTheme();
|
|
10
|
+
return (
|
|
11
|
+
<QueryClientProvider client={queryClient}>
|
|
12
|
+
<ThemeProvider theme={theme}>
|
|
13
|
+
<LangProvider>{children}</LangProvider>
|
|
14
|
+
</ThemeProvider>
|
|
15
|
+
</QueryClientProvider>
|
|
16
|
+
);
|
|
17
|
+
}
|
package/src/LangProvider.tsx
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { i18n } from '@lingui/core';
|
|
4
|
-
import { I18nProvider } from '@lingui/react';
|
|
5
|
-
import { ReactNode, useEffect } from 'react';
|
|
6
|
-
|
|
7
|
-
export const supportedLang = ['en', 'zh'];
|
|
8
|
-
export type SupportedLang = typeof supportedLang[number];
|
|
9
|
-
|
|
10
|
-
export const defaultLang: SupportedLang = 'en';
|
|
11
|
-
|
|
12
|
-
interface LangProviderProps {
|
|
13
|
-
locale?: SupportedLang;
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function loadI18(locale: SupportedLang = defaultLang) {
|
|
18
|
-
try {
|
|
19
|
-
const catalog = await import(`./locales/${locale}.js`);
|
|
20
|
-
i18n.load(locale, catalog.messages || catalog.default.messages);
|
|
21
|
-
} catch (error) {
|
|
22
|
-
console.error(error);
|
|
23
|
-
}
|
|
24
|
-
i18n.activate(locale);
|
|
25
|
-
}
|
|
26
|
-
export function LangProvider({ locale, children }: LangProviderProps) {
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
const loadLocale = async () => {
|
|
29
|
-
await loadI18(locale);
|
|
30
|
-
};
|
|
31
|
-
loadLocale();
|
|
32
|
-
}, [locale]);
|
|
33
|
-
return <I18nProvider i18n={i18n}>{children}</I18nProvider>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default LangProvider;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import { I18nProvider } from '@lingui/react';
|
|
5
|
+
import { ReactNode, useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
export const supportedLang = ['en', 'zh'];
|
|
8
|
+
export type SupportedLang = typeof supportedLang[number];
|
|
9
|
+
|
|
10
|
+
export const defaultLang: SupportedLang = 'en';
|
|
11
|
+
|
|
12
|
+
interface LangProviderProps {
|
|
13
|
+
locale?: SupportedLang;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function loadI18(locale: SupportedLang = defaultLang) {
|
|
18
|
+
try {
|
|
19
|
+
const catalog = await import(`./locales/${locale}.js`);
|
|
20
|
+
i18n.load(locale, catalog.messages || catalog.default.messages);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error(error);
|
|
23
|
+
}
|
|
24
|
+
i18n.activate(locale);
|
|
25
|
+
}
|
|
26
|
+
export function LangProvider({ locale, children }: LangProviderProps) {
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const loadLocale = async () => {
|
|
29
|
+
await loadI18(locale);
|
|
30
|
+
};
|
|
31
|
+
loadLocale();
|
|
32
|
+
}, [locale]);
|
|
33
|
+
return <I18nProvider i18n={i18n}>{children}</I18nProvider>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default LangProvider;
|