@web3jskit/walletkit 0.0.1
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/README.md +1 -0
- package/dist/package.json +42 -0
- package/dist/src/assets/svg/dataBase.d.ts +6 -0
- package/dist/src/assets/svg/dataBase.js +7 -0
- package/dist/src/assets/svg/dataBase.js.map +1 -0
- package/dist/src/assets/svg/metaMaskWallet.d.ts +1 -0
- package/dist/src/assets/svg/metaMaskWallet.js +35 -0
- package/dist/src/assets/svg/metaMaskWallet.js.map +1 -0
- package/dist/src/components/ConnectButton/ConnectedInfo.d.ts +1 -0
- package/dist/src/components/ConnectButton/ConnectedInfo.js +12 -0
- package/dist/src/components/ConnectButton/ConnectedInfo.js.map +1 -0
- package/dist/src/components/ConnectButton/index.d.ts +8 -0
- package/dist/src/components/ConnectButton/index.js +15 -0
- package/dist/src/components/ConnectButton/index.js.map +1 -0
- package/dist/src/components/Connecting/index.d.ts +5 -0
- package/dist/src/components/Connecting/index.js +10 -0
- package/dist/src/components/Connecting/index.js.map +1 -0
- package/dist/src/components/Connecting/style.d.ts +2 -0
- package/dist/src/components/Connecting/style.js +52 -0
- package/dist/src/components/Connecting/style.js.map +1 -0
- package/dist/src/components/GetWallet/index.d.ts +6 -0
- package/dist/src/components/GetWallet/index.js +38 -0
- package/dist/src/components/GetWallet/index.js.map +1 -0
- package/dist/src/components/GetWallet/style.d.ts +2 -0
- package/dist/src/components/GetWallet/style.js +115 -0
- package/dist/src/components/GetWallet/style.js.map +1 -0
- package/dist/src/components/Header/ModalHeader.d.ts +7 -0
- package/dist/src/components/Header/ModalHeader.js +10 -0
- package/dist/src/components/Header/ModalHeader.js.map +1 -0
- package/dist/src/components/Header/style.d.ts +2 -0
- package/dist/src/components/Header/style.js +73 -0
- package/dist/src/components/Header/style.js.map +1 -0
- package/dist/src/components/Icon/index.d.ts +23 -0
- package/dist/src/components/Icon/index.js +47 -0
- package/dist/src/components/Icon/index.js.map +1 -0
- package/dist/src/components/Introduce/index.d.ts +5 -0
- package/dist/src/components/Introduce/index.js +9 -0
- package/dist/src/components/Introduce/index.js.map +1 -0
- package/dist/src/components/Introduce/style.d.ts +2 -0
- package/dist/src/components/Introduce/style.js +72 -0
- package/dist/src/components/Introduce/style.js.map +1 -0
- package/dist/src/components/Modal/ConnectModal.d.ts +8 -0
- package/dist/src/components/Modal/ConnectModal.js +82 -0
- package/dist/src/components/Modal/ConnectModal.js.map +1 -0
- package/dist/src/components/Modal/WalletInfoModal.d.ts +5 -0
- package/dist/src/components/Modal/WalletInfoModal.js +40 -0
- package/dist/src/components/Modal/WalletInfoModal.js.map +1 -0
- package/dist/src/components/Modal/index.d.ts +12 -0
- package/dist/src/components/Modal/index.js +53 -0
- package/dist/src/components/Modal/index.js.map +1 -0
- package/dist/src/components/Modal/style.d.ts +5 -0
- package/dist/src/components/Modal/style.js +156 -0
- package/dist/src/components/Modal/style.js.map +1 -0
- package/dist/src/components/SVGs/backArrowSvg.d.ts +2 -0
- package/dist/src/components/SVGs/backArrowSvg.js +4 -0
- package/dist/src/components/SVGs/backArrowSvg.js.map +1 -0
- package/dist/src/components/SVGs/closeSvg.d.ts +2 -0
- package/dist/src/components/SVGs/closeSvg.js +4 -0
- package/dist/src/components/SVGs/closeSvg.js.map +1 -0
- package/dist/src/components/SVGs/copiedSvg.d.ts +2 -0
- package/dist/src/components/SVGs/copiedSvg.js +4 -0
- package/dist/src/components/SVGs/copiedSvg.js.map +1 -0
- package/dist/src/components/SVGs/copySvg.d.ts +2 -0
- package/dist/src/components/SVGs/copySvg.js +4 -0
- package/dist/src/components/SVGs/copySvg.js.map +1 -0
- package/dist/src/components/SVGs/exitSvg.d.ts +2 -0
- package/dist/src/components/SVGs/exitSvg.js +4 -0
- package/dist/src/components/SVGs/exitSvg.js.map +1 -0
- package/dist/src/components/SVGs/metamaskQrCode.d.ts +2 -0
- package/dist/src/components/SVGs/metamaskQrCode.js +4 -0
- package/dist/src/components/SVGs/metamaskQrCode.js.map +1 -0
- package/dist/src/components/SVGs/spinSvg.d.ts +4 -0
- package/dist/src/components/SVGs/spinSvg.js +4 -0
- package/dist/src/components/SVGs/spinSvg.js.map +1 -0
- package/dist/src/components/Text/index.d.ts +18 -0
- package/dist/src/components/Text/index.js +23 -0
- package/dist/src/components/Text/index.js.map +1 -0
- package/dist/src/components/WalletKitProvider/ChainProvider.d.ts +9 -0
- package/dist/src/components/WalletKitProvider/ChainProvider.js +21 -0
- package/dist/src/components/WalletKitProvider/ChainProvider.js.map +1 -0
- package/dist/src/components/WalletKitProvider/I18nProvider.d.ts +13 -0
- package/dist/src/components/WalletKitProvider/I18nProvider.js +41 -0
- package/dist/src/components/WalletKitProvider/I18nProvider.js.map +1 -0
- package/dist/src/components/WalletKitProvider/ThemeProvider.d.ts +8 -0
- package/dist/src/components/WalletKitProvider/ThemeProvider.js +12 -0
- package/dist/src/components/WalletKitProvider/ThemeProvider.js.map +1 -0
- package/dist/src/components/WalletKitProvider/index.d.ts +11 -0
- package/dist/src/components/WalletKitProvider/index.js +14 -0
- package/dist/src/components/WalletKitProvider/index.js.map +1 -0
- package/dist/src/components/WalletList/index.d.ts +7 -0
- package/dist/src/components/WalletList/index.js +9 -0
- package/dist/src/components/WalletList/index.js.map +1 -0
- package/dist/src/components/WalletList/style.d.ts +2 -0
- package/dist/src/components/WalletList/style.js +101 -0
- package/dist/src/components/WalletList/style.js.map +1 -0
- package/dist/src/components/WalletTriggerButton/index.d.ts +10 -0
- package/dist/src/components/WalletTriggerButton/index.js +27 -0
- package/dist/src/components/WalletTriggerButton/index.js.map +1 -0
- package/dist/src/components/WalletTriggerButton/style.d.ts +2 -0
- package/dist/src/components/WalletTriggerButton/style.js +50 -0
- package/dist/src/components/WalletTriggerButton/style.js.map +1 -0
- package/dist/src/hooks/useWalletKit.d.ts +6 -0
- package/dist/src/hooks/useWalletKit.js +20 -0
- package/dist/src/hooks/useWalletKit.js.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/locals/i18n.d.ts +2 -0
- package/dist/src/locals/i18n.js +17 -0
- package/dist/src/locals/i18n.js.map +1 -0
- package/dist/src/locals/languages/en.json +27 -0
- package/dist/src/locals/languages/zh.json +27 -0
- package/dist/src/locals/resources.d.ts +60 -0
- package/dist/src/locals/resources.js +11 -0
- package/dist/src/locals/resources.js.map +1 -0
- package/dist/src/stores/SlotsWalletStore.d.ts +18 -0
- package/dist/src/stores/SlotsWalletStore.js +33 -0
- package/dist/src/stores/SlotsWalletStore.js.map +1 -0
- package/dist/src/stores/index.d.ts +34 -0
- package/dist/src/stores/index.js +41 -0
- package/dist/src/stores/index.js.map +1 -0
- package/dist/src/styled/index.d.ts +17 -0
- package/dist/src/styled/index.js +76 -0
- package/dist/src/styled/index.js.map +1 -0
- package/dist/src/test/getwalletprovider.test.d.ts +1 -0
- package/dist/src/test/getwalletprovider.test.js +10 -0
- package/dist/src/test/getwalletprovider.test.js.map +1 -0
- package/dist/src/test/setup.d.ts +1 -0
- package/dist/src/test/setup.js +7 -0
- package/dist/src/test/setup.js.map +1 -0
- package/dist/src/theme/index.d.ts +53 -0
- package/dist/src/theme/index.js +92 -0
- package/dist/src/theme/index.js.map +1 -0
- package/dist/src/types/configType.d.ts +2 -0
- package/dist/src/types/configType.js +2 -0
- package/dist/src/types/configType.js.map +1 -0
- package/dist/src/types/slotsType.d.ts +23 -0
- package/dist/src/types/slotsType.js +2 -0
- package/dist/src/types/slotsType.js.map +1 -0
- package/dist/src/utils/formatter.d.ts +1 -0
- package/dist/src/utils/formatter.js +6 -0
- package/dist/src/utils/formatter.js.map +1 -0
- package/dist/src/utils/generateAvatar.d.ts +4 -0
- package/dist/src/utils/generateAvatar.js +32 -0
- package/dist/src/utils/generateAvatar.js.map +1 -0
- package/dist/src/wallets/GelWallet/index.d.ts +0 -0
- package/dist/src/wallets/GelWallet/index.js +2 -0
- package/dist/src/wallets/GelWallet/index.js.map +1 -0
- package/dist/src/wallets/SlotsWallets/index.d.ts +3 -0
- package/dist/src/wallets/SlotsWallets/index.js +26 -0
- package/dist/src/wallets/SlotsWallets/index.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +42 -0
- package/src/assets/svg/dataBase.ts +17 -0
- package/src/assets/svg/metaMaskWallet.ts +35 -0
- package/src/components/ConnectButton/ConnectedInfo.tsx +17 -0
- package/src/components/ConnectButton/index.tsx +41 -0
- package/src/components/Connecting/index.tsx +26 -0
- package/src/components/Connecting/style.ts +53 -0
- package/src/components/GetWallet/index.tsx +88 -0
- package/src/components/GetWallet/style.ts +116 -0
- package/src/components/Header/ModalHeader.tsx +24 -0
- package/src/components/Header/style.ts +74 -0
- package/src/components/Icon/index.tsx +120 -0
- package/src/components/Introduce/index.tsx +30 -0
- package/src/components/Introduce/style.ts +73 -0
- package/src/components/Modal/ConnectModal.tsx +131 -0
- package/src/components/Modal/WalletInfoModal.tsx +82 -0
- package/src/components/Modal/index.tsx +80 -0
- package/src/components/Modal/style.ts +160 -0
- package/src/components/SVGs/backArrowSvg.tsx +10 -0
- package/src/components/SVGs/closeSvg.tsx +11 -0
- package/src/components/SVGs/copiedSvg.tsx +11 -0
- package/src/components/SVGs/copySvg.tsx +11 -0
- package/src/components/SVGs/exitSvg.tsx +11 -0
- package/src/components/SVGs/metamaskQrCode.tsx +393 -0
- package/src/components/SVGs/spinSvg.tsx +10 -0
- package/src/components/Text/index.tsx +59 -0
- package/src/components/WalletKitProvider/ChainProvider.tsx +34 -0
- package/src/components/WalletKitProvider/I18nProvider.tsx +52 -0
- package/src/components/WalletKitProvider/ThemeProvider.tsx +16 -0
- package/src/components/WalletKitProvider/index.tsx +40 -0
- package/src/components/WalletList/index.tsx +35 -0
- package/src/components/WalletList/style.ts +101 -0
- package/src/components/WalletTriggerButton/index.tsx +50 -0
- package/src/components/WalletTriggerButton/style.ts +51 -0
- package/src/default.d.ts +18 -0
- package/src/hooks/useWalletKit.ts +38 -0
- package/src/index.ts +8 -0
- package/src/locals/i18n.ts +19 -0
- package/src/locals/languages/en.json +27 -0
- package/src/locals/languages/zh.json +27 -0
- package/src/locals/resources.ts +11 -0
- package/src/stores/SlotsWalletStore.ts +48 -0
- package/src/stores/index.ts +74 -0
- package/src/styled/index.ts +79 -0
- package/src/test/getwalletprovider.test.ts +9 -0
- package/src/test/setup.ts +7 -0
- package/src/theme/index.ts +93 -0
- package/src/theme/styled.d.ts +30 -0
- package/src/types/configType.ts +2 -0
- package/src/types/slotsType.ts +23 -0
- package/src/utils/formatter.ts +4 -0
- package/src/utils/generateAvatar.ts +35 -0
- package/src/wallets/GelWallet/index.ts +0 -0
- package/src/wallets/SlotsWallets/index.ts +30 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +55 -0
- package/vitest.config.ts +10 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import ModalHeader from '../Header/ModalHeader';
|
|
4
|
+
import GetWalletContainer from './style';
|
|
5
|
+
import { chromeIcon } from '../../assets/svg/dataBase';
|
|
6
|
+
import MetamaskQrCode from '../SVGs/metamaskQrCode';
|
|
7
|
+
import { phantomQrCode, tronLinkQrCode } from '../../assets/svg/dataBase';
|
|
8
|
+
|
|
9
|
+
interface GetWalletProps {
|
|
10
|
+
wallet: any;
|
|
11
|
+
onBack?: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const downloadConfig = {
|
|
15
|
+
MetaMask: {
|
|
16
|
+
extension: 'https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn',
|
|
17
|
+
qrCode: <MetamaskQrCode />
|
|
18
|
+
},
|
|
19
|
+
Phantom: {
|
|
20
|
+
extension: 'https://chromewebstore.google.com/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa',
|
|
21
|
+
qrCode: <img src={phantomQrCode} />
|
|
22
|
+
},
|
|
23
|
+
TronLink: {
|
|
24
|
+
extension: 'https://chromewebstore.google.com/detail/tronlink/ibnejdfjmmkpcnlpebklmnkoeoihofec',
|
|
25
|
+
qrCode: <img src={tronLinkQrCode} />
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export function GetWallet({ wallet, onBack }: GetWalletProps) {
|
|
30
|
+
const { t } = useTranslation();
|
|
31
|
+
|
|
32
|
+
const [showQRCode, setShowQRCode] = useState(false);
|
|
33
|
+
|
|
34
|
+
const currentDownloadConfig = useMemo(() => {
|
|
35
|
+
return downloadConfig[wallet.name as keyof typeof downloadConfig];
|
|
36
|
+
}, [wallet]);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<GetWalletContainer>
|
|
40
|
+
<ModalHeader
|
|
41
|
+
title={`${t('get')} ${wallet.name}`}
|
|
42
|
+
onBack={() => {
|
|
43
|
+
if (showQRCode) {
|
|
44
|
+
return setShowQRCode(false);
|
|
45
|
+
}
|
|
46
|
+
onBack && onBack();
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
{showQRCode ? (
|
|
50
|
+
<div className="qrCodeBox">
|
|
51
|
+
<div className="downloadTip">{t('getAppTip')}</div>
|
|
52
|
+
<div className="qrCode">{currentDownloadConfig.qrCode}</div>
|
|
53
|
+
<div className="button" onClick={() => setShowQRCode(false)}>
|
|
54
|
+
{t('continue')}
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
) : (
|
|
58
|
+
<div className="cardBox">
|
|
59
|
+
<div className="card">
|
|
60
|
+
<img src={chromeIcon} alt="Chrome" />
|
|
61
|
+
<div>
|
|
62
|
+
<div className="title">{`${wallet.name} ${t('forChrome')}`}</div>
|
|
63
|
+
<div className="description">{t('chromeDescription')}</div>
|
|
64
|
+
<div
|
|
65
|
+
className="button"
|
|
66
|
+
onClick={() => {
|
|
67
|
+
window.open(currentDownloadConfig.extension, '_blank');
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{t('addToChrome')}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<div className="card">
|
|
75
|
+
<img src={wallet.icon} alt={wallet.name} />
|
|
76
|
+
<div>
|
|
77
|
+
<div className="title">{`${wallet.name} ${t('forMobile')}`}</div>
|
|
78
|
+
<div className="description">{t('mobileDescription')}</div>
|
|
79
|
+
<div className="button" onClick={() => setShowQRCode(true)}>
|
|
80
|
+
{t('getMobileApp')}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
</GetWalletContainer>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { styled } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const GetWalletContainer = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
font-family: Manrope;
|
|
7
|
+
color: ${({ theme }) => theme.textColor1};
|
|
8
|
+
height: 100%;
|
|
9
|
+
|
|
10
|
+
.cardBox {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
margin: 0 64px 24px;
|
|
14
|
+
gap: 24px;
|
|
15
|
+
flex: 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.card {
|
|
19
|
+
display: flex;
|
|
20
|
+
gap: 24px;
|
|
21
|
+
padding: 40px 60px 0;
|
|
22
|
+
border: 1px solid ${({ theme }) => theme.borderColor};
|
|
23
|
+
border-radius: 12px;
|
|
24
|
+
flex: 1;
|
|
25
|
+
background: ${({ theme }) => theme.cardBg};
|
|
26
|
+
|
|
27
|
+
img {
|
|
28
|
+
width: 60px;
|
|
29
|
+
height: 60px;
|
|
30
|
+
border-radius: 12px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.title {
|
|
34
|
+
font-size: 14px;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
line-height: 14px;
|
|
37
|
+
color: ${({ theme }) => theme.textColor};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.description {
|
|
41
|
+
margin-top: 10px;
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
line-height: 14px;
|
|
45
|
+
color: ${({ theme }) => theme.textColor3};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.button {
|
|
49
|
+
margin-top: 18px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.button {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
padding: 11px 16px;
|
|
56
|
+
color: ${({ theme }) => theme.buttonColor};
|
|
57
|
+
background: ${({ theme }) => theme.buttonBg};
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
font-weight: 700;
|
|
60
|
+
line-height: 14px;
|
|
61
|
+
text-align: center;
|
|
62
|
+
border-radius: 8px;
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
height: 36px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.qrCodeBox {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: space-between;
|
|
73
|
+
flex: 1;
|
|
74
|
+
|
|
75
|
+
.downloadTip {
|
|
76
|
+
text-align: center;
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
font-weight: 600;
|
|
79
|
+
line-height: 18px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.qrCode {
|
|
83
|
+
margin-top: 24px;
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
align-items: center;
|
|
87
|
+
width: 270px;
|
|
88
|
+
height: 270px;
|
|
89
|
+
border-radius: 12px;
|
|
90
|
+
border: 1px solid ${({ theme }) => theme.borderColor};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.button {
|
|
94
|
+
margin-top: auto;
|
|
95
|
+
margin-bottom: 24px;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@media (max-width: 768px) {
|
|
100
|
+
.cardBox {
|
|
101
|
+
margin: 0 24px 24px;
|
|
102
|
+
|
|
103
|
+
.card {
|
|
104
|
+
padding: 35px 24px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.qrCodeBox {
|
|
109
|
+
.button {
|
|
110
|
+
margin-top: 16px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
|
|
116
|
+
export default GetWalletContainer;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { walletKitStore } from '../../stores';
|
|
2
|
+
import ModalHeaderBox from './style';
|
|
3
|
+
import BackArrowSvg from '../SVGs/backArrowSvg';
|
|
4
|
+
import CloseSvg from '../SVGs/closeSvg';
|
|
5
|
+
|
|
6
|
+
interface ModalHeaderProps {
|
|
7
|
+
title?: string | null;
|
|
8
|
+
onBack?: () => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function ModalHeader({ title = '', onBack, className }: ModalHeaderProps) {
|
|
13
|
+
const useCloseModal = walletKitStore((state: any) => state.closeModal);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<ModalHeaderBox className={className}>
|
|
17
|
+
{onBack ? <BackArrowSvg className="backBtn" onClick={onBack} /> : <div className="backBtn"></div>}
|
|
18
|
+
{title ? <div className="title">{title}</div> : <div></div>}
|
|
19
|
+
<div className="closeBtn" onClick={useCloseModal}>
|
|
20
|
+
<CloseSvg />
|
|
21
|
+
</div>
|
|
22
|
+
</ModalHeaderBox>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { styled } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const ModalHeaderBox = styled.div`
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 56px;
|
|
6
|
+
position: relative;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
|
|
12
|
+
.backBtn {
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
margin-left: 16px;
|
|
15
|
+
|
|
16
|
+
path {
|
|
17
|
+
fill: ${({ theme }) => theme.backArrowColor};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.title {
|
|
22
|
+
color: ${({ theme }) => theme.textColor};
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
font-weight: 700;
|
|
25
|
+
line-height: 170%;
|
|
26
|
+
letter-spacing: 0.3px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.closeBtn {
|
|
30
|
+
margin-right: 16px;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
width: 24px;
|
|
36
|
+
height: 24px;
|
|
37
|
+
border-radius: 12px;
|
|
38
|
+
transition: all 0.2s;
|
|
39
|
+
color: ${({ theme }) => theme.closeBtnColor};
|
|
40
|
+
transform-origin: 50% 50%;
|
|
41
|
+
background-color: ${({ theme }) => theme.closeBtnBg};
|
|
42
|
+
z-index: 1;
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
background-color: ${({ theme }) => theme.closeBtnHoverBg};
|
|
46
|
+
transform: rotate(180deg);
|
|
47
|
+
transition: all 0.2s;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.asideTitle {
|
|
52
|
+
justify-content: flex-start;
|
|
53
|
+
|
|
54
|
+
.closeBtn {
|
|
55
|
+
display: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (max-width: 768px) {
|
|
60
|
+
&.mainTitle {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.asideTitle {
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
|
|
67
|
+
.closeBtn {
|
|
68
|
+
display: flex;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
export default ModalHeaderBox;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
interface IconImageArg {
|
|
5
|
+
src: any;
|
|
6
|
+
width?: number | string;
|
|
7
|
+
height?: number | string;
|
|
8
|
+
borderRadius?: string;
|
|
9
|
+
isRadius?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface FoldIconImageArg {
|
|
14
|
+
src: Array<string>;
|
|
15
|
+
width?: number | string;
|
|
16
|
+
height?: number | string;
|
|
17
|
+
offset?: number;
|
|
18
|
+
proportion?: number;
|
|
19
|
+
className?: string;
|
|
20
|
+
isRadius?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const IconImage = styled.img`
|
|
24
|
+
display: block;
|
|
25
|
+
transition: all 0.2s;
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const IconImageBox = styled.div`
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
display: flex;
|
|
31
|
+
position: relative;
|
|
32
|
+
`;
|
|
33
|
+
const IconItem = styled.div`
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
float: left;
|
|
36
|
+
display: flex;
|
|
37
|
+
justify-items: center;
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
export const Icon: React.FC<IconImageArg> = ({ src, width, height, className }) => {
|
|
41
|
+
return (
|
|
42
|
+
<IconImage
|
|
43
|
+
className={className}
|
|
44
|
+
src={src}
|
|
45
|
+
width={width ? width + 'px' : '24px'}
|
|
46
|
+
height={height ? height + 'px' : '24px'}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Image: React.FC<IconImageArg> = ({ src, width, height, isRadius = true, className, borderRadius }) => {
|
|
52
|
+
return (
|
|
53
|
+
<IconImage
|
|
54
|
+
className={className}
|
|
55
|
+
src={src}
|
|
56
|
+
width={width ? width : 'auto'}
|
|
57
|
+
height={height ? height : 'auto'}
|
|
58
|
+
style={{ borderRadius: borderRadius ? borderRadius : isRadius ? '50%' : '0' }}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const FoldIconBox: React.FC<FoldIconImageArg> = ({ src, width, height, offset = 0, isRadius = true }) => {
|
|
64
|
+
return (
|
|
65
|
+
<IconImageBox>
|
|
66
|
+
{src.map((item, index) => {
|
|
67
|
+
return (
|
|
68
|
+
<IconItem
|
|
69
|
+
key={index}
|
|
70
|
+
style={{
|
|
71
|
+
zIndex: index + 1,
|
|
72
|
+
marginLeft: index == 0 ? '0px' : offset + 'px',
|
|
73
|
+
width: width ? width + 'px' : '24px',
|
|
74
|
+
height: height ? height + 'px' : '24px'
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<IconImage
|
|
78
|
+
src={item}
|
|
79
|
+
width={width ? width : 24}
|
|
80
|
+
height={height ? height : 24}
|
|
81
|
+
style={{ borderRadius: isRadius ? '50%' : '0' }}
|
|
82
|
+
/>
|
|
83
|
+
</IconItem>
|
|
84
|
+
);
|
|
85
|
+
})}
|
|
86
|
+
</IconImageBox>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
export const FoldIconBoxBig: React.FC<FoldIconImageArg> = ({ src, width, height, offset = 0, proportion = 1 }) => {
|
|
90
|
+
return (
|
|
91
|
+
<IconImageBox>
|
|
92
|
+
{src.map((item, index) => {
|
|
93
|
+
return (
|
|
94
|
+
<IconItem
|
|
95
|
+
key={index}
|
|
96
|
+
style={{
|
|
97
|
+
zIndex: index + 1,
|
|
98
|
+
marginLeft: index == 0 ? '0px' : offset + 'px',
|
|
99
|
+
marginTop: index == 0 ? '0px' : -(offset / 2) + 'px',
|
|
100
|
+
width: width ? width + 'px' : '24px',
|
|
101
|
+
height: height ? height + 'px' : '24px'
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
{index === src.length - 1 ? (
|
|
105
|
+
<IconImage
|
|
106
|
+
src={item}
|
|
107
|
+
width={width ? Number(width) * proportion : 24 * proportion}
|
|
108
|
+
height={height ? Number(height) * proportion : 24 * proportion}
|
|
109
|
+
/>
|
|
110
|
+
) : (
|
|
111
|
+
<IconImage src={item} width={width ? width : 24} height={height ? height : 24} />
|
|
112
|
+
)}
|
|
113
|
+
</IconItem>
|
|
114
|
+
);
|
|
115
|
+
})}
|
|
116
|
+
</IconImageBox>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export default Icon;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
import ModalHeader from '../Header/ModalHeader';
|
|
3
|
+
import IntroduceContainer from './style';
|
|
4
|
+
|
|
5
|
+
interface IntroduceProps {
|
|
6
|
+
onGetWallet?: () => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function Introduce({ onGetWallet }: IntroduceProps) {
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<ModalHeader className="mainTitle" />
|
|
15
|
+
<IntroduceContainer>
|
|
16
|
+
<div className="title">{t('introduceQuestion')}</div>
|
|
17
|
+
<div className="introduce">{t('introduceAnswer')}</div>
|
|
18
|
+
<div className="detail">{t('introduceDetail')}</div>
|
|
19
|
+
<div className="footer">
|
|
20
|
+
<div className="button" onClick={() => onGetWallet?.()}>
|
|
21
|
+
{t('getWallet')}
|
|
22
|
+
</div>
|
|
23
|
+
{/* <span className="more" onClick={() => {}}>
|
|
24
|
+
{t('learnMore')}
|
|
25
|
+
</span> */}
|
|
26
|
+
</div>
|
|
27
|
+
</IntroduceContainer>
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { styled } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const IntroduceContainer = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
margin: 84px 50px 0 96px;
|
|
7
|
+
font-family: Manrope;
|
|
8
|
+
color: ${({ theme }) => theme.textColor1};
|
|
9
|
+
|
|
10
|
+
.title {
|
|
11
|
+
color: ${({ theme }) => theme.blue};
|
|
12
|
+
font-size: 18px;
|
|
13
|
+
font-weight: 700;
|
|
14
|
+
line-height: 18px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.introduce {
|
|
18
|
+
margin-top: 24px;
|
|
19
|
+
font-size: 12px;
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
line-height: 14px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.detail {
|
|
25
|
+
margin-top: 16px;
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
line-height: 14px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.footer {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
align-items: center;
|
|
35
|
+
max-width: 120px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.button {
|
|
39
|
+
width: 100%;
|
|
40
|
+
display: inline-block;
|
|
41
|
+
margin-top: 32px;
|
|
42
|
+
padding: 11px 16px;
|
|
43
|
+
color: ${({ theme }) => theme.buttonColor};
|
|
44
|
+
background: ${({ theme }) => theme.buttonBg};
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
font-weight: 700;
|
|
47
|
+
line-height: 14px;
|
|
48
|
+
text-align: center;
|
|
49
|
+
border-radius: 8px;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.more {
|
|
55
|
+
margin-top: 8px;
|
|
56
|
+
font-size: 12px;
|
|
57
|
+
font-style: normal;
|
|
58
|
+
font-weight: 700;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (max-width: 768px) {
|
|
63
|
+
padding: 40px 32px 0;
|
|
64
|
+
margin: 0;
|
|
65
|
+
align-items: center;
|
|
66
|
+
|
|
67
|
+
.detail {
|
|
68
|
+
text-align: center;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
export default IntroduceContainer;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import ModalHeader from '../Header/ModalHeader';
|
|
2
|
+
import Modal from './index';
|
|
3
|
+
import { SlotWrapper } from '../../styled';
|
|
4
|
+
import { SupportWallets } from '@web3jskit/wallethelper';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useCallback, useEffect, useState, type ReactNode } from 'react';
|
|
7
|
+
import { WalletTriggerButton } from '../WalletTriggerButton';
|
|
8
|
+
import { Introduce } from '../Introduce';
|
|
9
|
+
import { WalletList } from '../WalletList';
|
|
10
|
+
import { GetWallet } from '../GetWallet';
|
|
11
|
+
import { Connecting } from '../Connecting';
|
|
12
|
+
import { useWalletKit } from '../../hooks/useWalletKit';
|
|
13
|
+
import { AsideList, ModalAside, ModalContainer, ModalMain } from './style';
|
|
14
|
+
|
|
15
|
+
interface ModalProps {
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
closeAble?: boolean;
|
|
18
|
+
slots?: ReactNode[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
enum Step {
|
|
22
|
+
Introduce = 0,
|
|
23
|
+
WalletList = 1,
|
|
24
|
+
GetWallet = 2,
|
|
25
|
+
Connecting = 3
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function ConnectModal({ isOpen, slots }: ModalProps) {
|
|
29
|
+
const { t } = useTranslation();
|
|
30
|
+
|
|
31
|
+
const { currentChain, getConnectors, currentConnector, connectStatus, closeModal } = useWalletKit();
|
|
32
|
+
|
|
33
|
+
const [step, setStep] = useState(Step.Introduce);
|
|
34
|
+
const [selectedWallet, setSelectedWallet] = useState<any | null>(null);
|
|
35
|
+
const [connectors, setConnectors] = useState<any[]>([]);
|
|
36
|
+
|
|
37
|
+
const requestConnectors = async () => {
|
|
38
|
+
const list = await getConnectors(currentChain);
|
|
39
|
+
setConnectors(list);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (isOpen) {
|
|
44
|
+
requestConnectors();
|
|
45
|
+
} else {
|
|
46
|
+
setStep(0);
|
|
47
|
+
setConnectors([]);
|
|
48
|
+
}
|
|
49
|
+
}, [isOpen, currentChain]);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
switch (connectStatus) {
|
|
53
|
+
case 'connected':
|
|
54
|
+
closeModal();
|
|
55
|
+
break;
|
|
56
|
+
default:
|
|
57
|
+
setStep(0);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}, [connectStatus]);
|
|
61
|
+
|
|
62
|
+
const renderMainByStep = useCallback(() => {
|
|
63
|
+
switch (step) {
|
|
64
|
+
case 0:
|
|
65
|
+
return (
|
|
66
|
+
<Introduce
|
|
67
|
+
onGetWallet={() => {
|
|
68
|
+
setStep(Step.WalletList);
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
case 1:
|
|
73
|
+
return (
|
|
74
|
+
<WalletList
|
|
75
|
+
list={SupportWallets}
|
|
76
|
+
onBack={() => {
|
|
77
|
+
setStep(0);
|
|
78
|
+
}}
|
|
79
|
+
onGetWallet={wallet => {
|
|
80
|
+
if (wallet.name === 'GelWallet') {
|
|
81
|
+
window.open('https://gelwallet.com', '_blank');
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setSelectedWallet(wallet);
|
|
85
|
+
setStep(Step.GetWallet);
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
case 2:
|
|
90
|
+
return (
|
|
91
|
+
<GetWallet
|
|
92
|
+
wallet={selectedWallet}
|
|
93
|
+
onBack={() => {
|
|
94
|
+
setStep(Step.WalletList);
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
default:
|
|
99
|
+
return <></>;
|
|
100
|
+
}
|
|
101
|
+
}, [step]);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Modal isOpen={isOpen}>
|
|
105
|
+
<ModalContainer>
|
|
106
|
+
<ModalAside className={step !== 0 ? 'hidden' : ''}>
|
|
107
|
+
<ModalHeader title={t('connectWallet')} className="asideTitle" />
|
|
108
|
+
<AsideList>
|
|
109
|
+
{connectors.length ? (
|
|
110
|
+
connectors.map((connector: any, index: number) => {
|
|
111
|
+
return <WalletTriggerButton key={index} connector={connector} />;
|
|
112
|
+
})
|
|
113
|
+
) : (
|
|
114
|
+
<></>
|
|
115
|
+
)}
|
|
116
|
+
{slots ? (
|
|
117
|
+
slots.map((Slot: ReactNode, index: number) => {
|
|
118
|
+
return <SlotWrapper key={index}>{Slot}</SlotWrapper>;
|
|
119
|
+
})
|
|
120
|
+
) : (
|
|
121
|
+
<></>
|
|
122
|
+
)}
|
|
123
|
+
</AsideList>
|
|
124
|
+
</ModalAside>
|
|
125
|
+
<ModalMain>
|
|
126
|
+
{connectStatus === 'connecting' ? <Connecting wallet={currentConnector} /> : renderMainByStep()}
|
|
127
|
+
</ModalMain>
|
|
128
|
+
</ModalContainer>
|
|
129
|
+
</Modal>
|
|
130
|
+
);
|
|
131
|
+
}
|