edsadapter 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 +75 -0
- package/eslint.config.js +23 -0
- package/index.html +13 -0
- package/package.json +61 -0
- package/public/favicon.svg +1 -0
- package/public/icons.svg +24 -0
- package/src/App.css +184 -0
- package/src/App.tsx +35 -0
- package/src/assets/hero.png +0 -0
- package/src/assets/loading.png +0 -0
- package/src/assets/react.svg +1 -0
- package/src/assets/svg/close.svg +3 -0
- package/src/assets/svg/tick.svg +4 -0
- package/src/assets/vite.svg +1 -0
- package/src/assets/wallet/bitget.png +0 -0
- package/src/assets/wallet/coinbase.png +0 -0
- package/src/assets/wallet/endless.png +0 -0
- package/src/assets/wallet/luffa.png +0 -0
- package/src/assets/wallet/metamask.png +0 -0
- package/src/assets/wallet/okx.png +0 -0
- package/src/assets/wallet/phantom.png +0 -0
- package/src/assets/wallet/tron.png +0 -0
- package/src/assets/wallet/walletConnect.png +0 -0
- package/src/components/Button/index.tsx +9 -0
- package/src/components/ConnectModal/index.css +32 -0
- package/src/components/ConnectModal/index.tsx +77 -0
- package/src/components/ConnectModal/modal.tsx +261 -0
- package/src/components/ConnectModal/showConnectModal.tsx +20 -0
- package/src/components/ConnectModal/styles.ts +46 -0
- package/src/components/Modal.tsx +122 -0
- package/src/config/wallets.ts +98 -0
- package/src/contexts/Modal.tsx +33 -0
- package/src/contexts/Tables.tsx +32 -0
- package/src/hooks/store.ts +30 -0
- package/src/hooks/useIsMobile.ts +10 -0
- package/src/hooks/useSyncProvider.ts +4 -0
- package/src/hooks/useToast.tsx +163 -0
- package/src/hooks/useWallet.ts +66 -0
- package/src/index.css +111 -0
- package/src/index.ts +5 -0
- package/src/main.tsx +5 -0
- package/src/store/connectStore.ts +87 -0
- package/src/theme/components/Button.ts +100 -0
- package/src/theme/components/Checkbox.tsx +24 -0
- package/src/theme/components/Drawer.ts +60 -0
- package/src/theme/components/Input.ts +98 -0
- package/src/theme/components/Menu.ts +52 -0
- package/src/theme/components/Modal.ts +44 -0
- package/src/theme/components/NumberInput.ts +54 -0
- package/src/theme/components/Popover.ts +72 -0
- package/src/theme/components/Progress.ts +41 -0
- package/src/theme/components/Radio.tsx +66 -0
- package/src/theme/components/Switch.ts +30 -0
- package/src/theme/components/Table.ts +149 -0
- package/src/theme/components/Tabs.ts +90 -0
- package/src/theme/components/Tag.ts +21 -0
- package/src/theme/components/Textarea.ts +21 -0
- package/src/theme/components/Tooltip.ts +35 -0
- package/src/theme/index.ts +269 -0
- package/src/types/adapter.d.ts +43 -0
- package/src/types/global.d.ts +102 -0
- package/src/types/type.ts +100 -0
- package/src/web3/ethereum/index.ts +36 -0
- package/src/web3/index.ts +15 -0
- package/src/web3/solana/index.ts +104 -0
- package/src/web3/tron/index.ts +57 -0
- package/tsconfig.app.json +31 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +29 -0
- package/vite.config.ts +31 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import {
|
|
2
|
+
chakra,
|
|
3
|
+
Flex,
|
|
4
|
+
Box,
|
|
5
|
+
Text,
|
|
6
|
+
useToast as _useToast,
|
|
7
|
+
type UseToastOptions as _UseToastOptions,
|
|
8
|
+
Image,
|
|
9
|
+
} from "@chakra-ui/react";
|
|
10
|
+
import loadingIcon from "../assets/loading.png";
|
|
11
|
+
import tickIcon from "../assets/svg/tick.svg?react";
|
|
12
|
+
import closeIcon from "../assets/svg/close.svg?react";
|
|
13
|
+
import { keyframes } from "@emotion/react";
|
|
14
|
+
import { createStandaloneToast } from "@chakra-ui/react";
|
|
15
|
+
import theme from "../theme";
|
|
16
|
+
|
|
17
|
+
const { toast } = createStandaloneToast({ theme });
|
|
18
|
+
|
|
19
|
+
interface UseToastOptions extends _UseToastOptions {
|
|
20
|
+
message?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const _toast = (
|
|
24
|
+
option: UseToastOptions,
|
|
25
|
+
fn: (option: _UseToastOptions) => void,
|
|
26
|
+
) => {
|
|
27
|
+
const {
|
|
28
|
+
title,
|
|
29
|
+
message,
|
|
30
|
+
duration = 3000,
|
|
31
|
+
status,
|
|
32
|
+
containerStyle = { m: "10px" },
|
|
33
|
+
...rest
|
|
34
|
+
} = option;
|
|
35
|
+
fn({
|
|
36
|
+
title,
|
|
37
|
+
duration,
|
|
38
|
+
status,
|
|
39
|
+
containerStyle,
|
|
40
|
+
render: () => (
|
|
41
|
+
<Box overflow="hidden" pos="relative" borderRadius="10px">
|
|
42
|
+
<ToastBox
|
|
43
|
+
bg={
|
|
44
|
+
status === "success"
|
|
45
|
+
? "rgba(49, 207, 46, 0.10)"
|
|
46
|
+
: "rgba(255, 79, 79, 0.10)"
|
|
47
|
+
}
|
|
48
|
+
>
|
|
49
|
+
{status && status !== "warning" && (
|
|
50
|
+
<IconBox>
|
|
51
|
+
{status === "loading" && <LoadingIcon />}
|
|
52
|
+
{status === "success" && <SuccessIcon />}
|
|
53
|
+
{status === "error" && <ErrorIcon />}
|
|
54
|
+
</IconBox>
|
|
55
|
+
)}
|
|
56
|
+
|
|
57
|
+
<Flex
|
|
58
|
+
flexDir="column"
|
|
59
|
+
gap="2px"
|
|
60
|
+
justify="center"
|
|
61
|
+
color={status === "success" ? "#000" : "#FF4F4F"}
|
|
62
|
+
>
|
|
63
|
+
<Text fontSize="14px" fontWeight={600} lineHeight="1.6em">
|
|
64
|
+
{title}
|
|
65
|
+
</Text>
|
|
66
|
+
<Text
|
|
67
|
+
fontSize="12px"
|
|
68
|
+
fontWeight={500}
|
|
69
|
+
color="b2"
|
|
70
|
+
lineHeight="1.6em"
|
|
71
|
+
>
|
|
72
|
+
{message}
|
|
73
|
+
</Text>
|
|
74
|
+
</Flex>
|
|
75
|
+
</ToastBox>
|
|
76
|
+
</Box>
|
|
77
|
+
),
|
|
78
|
+
...rest,
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
export const standaloneToast = (option: UseToastOptions) => {
|
|
82
|
+
_toast(option, toast);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const useToast = () => {
|
|
86
|
+
const toast = _useToast();
|
|
87
|
+
|
|
88
|
+
return (option: UseToastOptions) => _toast(option, toast);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const ToastBox = chakra(Flex, {
|
|
92
|
+
baseStyle: {
|
|
93
|
+
gap: "16px",
|
|
94
|
+
p: "16px 45px 16px 24px",
|
|
95
|
+
align: "center",
|
|
96
|
+
borderRadius: "10px",
|
|
97
|
+
border: "1px solid rgba(255, 255, 255, 0.10)",
|
|
98
|
+
boxShadow: "0px 12px 36px 0px rgba(0, 0, 0, 0.80)",
|
|
99
|
+
backdropFilter: "blur(24px)",
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const IconBox = chakra(Flex, {
|
|
104
|
+
baseStyle: {
|
|
105
|
+
boxSize: "40px",
|
|
106
|
+
minW: "40px",
|
|
107
|
+
justifyContent: "center",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
border: "1px solid rgba(133, 137, 167, 0.20)",
|
|
110
|
+
backdropFilter: "blur(8px)",
|
|
111
|
+
borderRadius: "50%",
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const LoadingIcon = () => {
|
|
116
|
+
return (
|
|
117
|
+
<Image
|
|
118
|
+
src={loadingIcon}
|
|
119
|
+
boxSize="20px"
|
|
120
|
+
animation={`${rotateAnimation} 800ms linear infinite`}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const SuccessIcon = () => {
|
|
126
|
+
return (
|
|
127
|
+
<Flex
|
|
128
|
+
boxSize="24px"
|
|
129
|
+
bg="#0FD375"
|
|
130
|
+
borderRadius="50%"
|
|
131
|
+
align="center"
|
|
132
|
+
justify="center"
|
|
133
|
+
>
|
|
134
|
+
<TickIcon boxSize="18px" sx={{ "& rect": { fill: "white" } }} />
|
|
135
|
+
</Flex>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const ErrorIcon = () => {
|
|
140
|
+
return (
|
|
141
|
+
<Flex
|
|
142
|
+
boxSize="24px"
|
|
143
|
+
bg="#F34D4E"
|
|
144
|
+
borderRadius="50%"
|
|
145
|
+
align="center"
|
|
146
|
+
justify="center"
|
|
147
|
+
>
|
|
148
|
+
<CloseIcon boxSize="18px" sx={{ "& rect": { fill: "white" } }} />
|
|
149
|
+
</Flex>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const TickIcon = chakra(tickIcon);
|
|
154
|
+
const CloseIcon = chakra(closeIcon);
|
|
155
|
+
|
|
156
|
+
const rotateAnimation = keyframes`
|
|
157
|
+
from {
|
|
158
|
+
transform: rotate(0deg);
|
|
159
|
+
}
|
|
160
|
+
to {
|
|
161
|
+
transform: rotate(360deg);
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import useConnectStore from '../store/connectStore';
|
|
2
|
+
import { useCallback, useEffect } from 'react';
|
|
3
|
+
import { getProvider } from '../web3';
|
|
4
|
+
import { watchSolAccountChange } from '../web3/solana';
|
|
5
|
+
import { WalletType, } from '../types/type';
|
|
6
|
+
import { useSyncProviders } from './useSyncProvider';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export const useWallet = () => {
|
|
10
|
+
const { clearAll, jssdk, address, walletType, chain, walletIcon, walletName, setChain, updateAddress } = useConnectStore()
|
|
11
|
+
const providers = useSyncProviders();
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
watchWallet()
|
|
15
|
+
}, [walletType, chain, providers])
|
|
16
|
+
|
|
17
|
+
const watchWallet = async () => {
|
|
18
|
+
const ethProvider = providers?.find((wallet) => wallet.info.name === walletName)?.provider || null
|
|
19
|
+
const tronMessageHandle = (e: MessageEvent) => {
|
|
20
|
+
if (e.data.isTronLink) {
|
|
21
|
+
}
|
|
22
|
+
if (!e.data.isTronLink) return
|
|
23
|
+
|
|
24
|
+
if (e.data.message && e.data.message.action == 'disconnect') {
|
|
25
|
+
disconnect()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (e.data.message && e.data.message.action == 'setNode') {
|
|
29
|
+
useConnectStore.getState().setChain(`tron:${e.data.message.data.node.chainId}`)
|
|
30
|
+
}
|
|
31
|
+
if (e.data.message && e.data.message.action === 'accountsChanged') {
|
|
32
|
+
useConnectStore.getState().updateAddress(e.data.message.data.address)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (walletType === WalletType.TRONLINK) {
|
|
36
|
+
window.addEventListener('message', tronMessageHandle)
|
|
37
|
+
}
|
|
38
|
+
if (walletType === WalletType.PHANTOM) {
|
|
39
|
+
watchSolAccountChange(getProvider(walletType))
|
|
40
|
+
}
|
|
41
|
+
if (walletType !== WalletType.TRONLINK && ethProvider) {
|
|
42
|
+
ethProvider.on('chainChanged', (chainId: string) => {
|
|
43
|
+
setChain(`eip155:${Number(chainId)}`)
|
|
44
|
+
})
|
|
45
|
+
ethProvider.on('accountsChanged', (accounts: string[]) => {
|
|
46
|
+
|
|
47
|
+
updateAddress(accounts[0] || '')
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const disconnect = useCallback(() => {
|
|
53
|
+
clearAll();
|
|
54
|
+
jssdk?.disconnect()
|
|
55
|
+
}, []);
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
provider: address ? getProvider(walletType) : null,
|
|
60
|
+
account: address,
|
|
61
|
+
chainId: chain,
|
|
62
|
+
walletIcon: walletIcon,
|
|
63
|
+
disconnect,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
package/src/index.css
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--text: #6b6375;
|
|
3
|
+
--text-h: #08060d;
|
|
4
|
+
--bg: #fff;
|
|
5
|
+
--border: #e5e4e7;
|
|
6
|
+
--code-bg: #f4f3ec;
|
|
7
|
+
--accent: #aa3bff;
|
|
8
|
+
--accent-bg: rgba(170, 59, 255, 0.1);
|
|
9
|
+
--accent-border: rgba(170, 59, 255, 0.5);
|
|
10
|
+
--social-bg: rgba(244, 243, 236, 0.5);
|
|
11
|
+
--shadow:
|
|
12
|
+
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
|
|
13
|
+
|
|
14
|
+
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
|
|
15
|
+
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
|
|
16
|
+
--mono: ui-monospace, Consolas, monospace;
|
|
17
|
+
|
|
18
|
+
font: 18px/145% var(--sans);
|
|
19
|
+
letter-spacing: 0.18px;
|
|
20
|
+
color-scheme: light dark;
|
|
21
|
+
color: var(--text);
|
|
22
|
+
background: var(--bg);
|
|
23
|
+
font-synthesis: none;
|
|
24
|
+
text-rendering: optimizeLegibility;
|
|
25
|
+
-webkit-font-smoothing: antialiased;
|
|
26
|
+
-moz-osx-font-smoothing: grayscale;
|
|
27
|
+
|
|
28
|
+
@media (max-width: 1024px) {
|
|
29
|
+
font-size: 16px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (prefers-color-scheme: dark) {
|
|
34
|
+
:root {
|
|
35
|
+
--text: #9ca3af;
|
|
36
|
+
--text-h: #f3f4f6;
|
|
37
|
+
--bg: #16171d;
|
|
38
|
+
--border: #2e303a;
|
|
39
|
+
--code-bg: #1f2028;
|
|
40
|
+
--accent: #c084fc;
|
|
41
|
+
--accent-bg: rgba(192, 132, 252, 0.15);
|
|
42
|
+
--accent-border: rgba(192, 132, 252, 0.5);
|
|
43
|
+
--social-bg: rgba(47, 48, 58, 0.5);
|
|
44
|
+
--shadow:
|
|
45
|
+
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#social .button-icon {
|
|
49
|
+
filter: invert(1) brightness(2);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#root {
|
|
54
|
+
width: 1126px;
|
|
55
|
+
max-width: 100%;
|
|
56
|
+
margin: 0 auto;
|
|
57
|
+
text-align: center;
|
|
58
|
+
border-inline: 1px solid var(--border);
|
|
59
|
+
min-height: 100svh;
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
body {
|
|
66
|
+
margin: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
h1,
|
|
70
|
+
h2 {
|
|
71
|
+
font-family: var(--heading);
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
color: var(--text-h);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
h1 {
|
|
77
|
+
font-size: 56px;
|
|
78
|
+
letter-spacing: -1.68px;
|
|
79
|
+
margin: 32px 0;
|
|
80
|
+
@media (max-width: 1024px) {
|
|
81
|
+
font-size: 36px;
|
|
82
|
+
margin: 20px 0;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
h2 {
|
|
86
|
+
font-size: 24px;
|
|
87
|
+
line-height: 118%;
|
|
88
|
+
letter-spacing: -0.24px;
|
|
89
|
+
margin: 0 0 8px;
|
|
90
|
+
@media (max-width: 1024px) {
|
|
91
|
+
font-size: 20px;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
p {
|
|
95
|
+
margin: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
code,
|
|
99
|
+
.counter {
|
|
100
|
+
font-family: var(--mono);
|
|
101
|
+
display: inline-flex;
|
|
102
|
+
border-radius: 4px;
|
|
103
|
+
color: var(--text-h);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
code {
|
|
107
|
+
font-size: 15px;
|
|
108
|
+
line-height: 135%;
|
|
109
|
+
padding: 4px 8px;
|
|
110
|
+
background: var(--code-bg);
|
|
111
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Button } from './components/Button';
|
|
2
|
+
export { default as ConnectProvider } from './components/ConnectModal';
|
|
3
|
+
export { showDetailModal } from './components/ConnectModal';
|
|
4
|
+
export { useWallet } from './hooks/useWallet';
|
|
5
|
+
export { WalletEndNameEnum, WalletType } from './types/type';
|
package/src/main.tsx
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { WalletType } from '../types/type'
|
|
2
|
+
import type { EndlessJsSdk } from '@endlesslab/endless-web3-sdk'
|
|
3
|
+
import { BrowserProvider, ethers } from 'ethers'
|
|
4
|
+
import { create } from 'zustand'
|
|
5
|
+
import { createJSONStorage, persist } from 'zustand/middleware'
|
|
6
|
+
export interface IWC {
|
|
7
|
+
address: string
|
|
8
|
+
chains: string[]
|
|
9
|
+
chain: string
|
|
10
|
+
walletChainId: string
|
|
11
|
+
walletProvider: BrowserProvider | undefined
|
|
12
|
+
walletType: WalletType
|
|
13
|
+
jssdk: EndlessJsSdk | null
|
|
14
|
+
network: string
|
|
15
|
+
|
|
16
|
+
// ethProvider: EIP1193Provider | undefined
|
|
17
|
+
walletName: string
|
|
18
|
+
walletIcon: string
|
|
19
|
+
updateAddress: (address: string) => void
|
|
20
|
+
setChain: (chain: string) => void
|
|
21
|
+
setWalletChainId: (walletChainId: string) => void
|
|
22
|
+
setWalletProvider: (walletProvider: ethers.BrowserProvider) => void
|
|
23
|
+
updateWalletType: (walletType: WalletType) => void
|
|
24
|
+
updateWalletName: (walletName: string) => void
|
|
25
|
+
updateWalletIcon: (walletIcon: string) => void
|
|
26
|
+
updateJsSDK: (jssdk: EndlessJsSdk | null) => void
|
|
27
|
+
setNetwork: (network: string) => void
|
|
28
|
+
clearAll: () => void
|
|
29
|
+
|
|
30
|
+
// updateEthProvider: (provider: EIP1193Provider) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const useConnectStore = create(
|
|
34
|
+
persist<IWC>(
|
|
35
|
+
(set, get) => ({
|
|
36
|
+
jssdk: null,
|
|
37
|
+
address: '',
|
|
38
|
+
chains: [],
|
|
39
|
+
chain: '0x1',
|
|
40
|
+
walletChainId: '',
|
|
41
|
+
walletProvider: undefined,
|
|
42
|
+
walletType: WalletType.ENDLESS,
|
|
43
|
+
walletName: '',
|
|
44
|
+
walletIcon: '',
|
|
45
|
+
risk: false,
|
|
46
|
+
network: 'dev',
|
|
47
|
+
// ethProvider: undefined,
|
|
48
|
+
updateAddress: (address: string) => set({ address }),
|
|
49
|
+
|
|
50
|
+
setChain: (chain: string) => set({ chain }),
|
|
51
|
+
|
|
52
|
+
setWalletChainId: (chainId: string) => set({ walletChainId: chainId }),
|
|
53
|
+
|
|
54
|
+
setWalletProvider: (walletProvider: ethers.BrowserProvider) => set({ walletProvider }),
|
|
55
|
+
|
|
56
|
+
updateWalletType: (walletType: WalletType) => set({ walletType }),
|
|
57
|
+
|
|
58
|
+
updateWalletName: (walletName: string) => set({ walletName }),
|
|
59
|
+
|
|
60
|
+
updateWalletIcon: (walletIcon: string) => set({ walletIcon }),
|
|
61
|
+
|
|
62
|
+
updateJsSDK: (jssdk: EndlessJsSdk | null) => {
|
|
63
|
+
set({ jssdk })
|
|
64
|
+
},
|
|
65
|
+
setNetwork: (network: string) => set({ network }),
|
|
66
|
+
clearAll: () => set({ address: '', chain: '', network: 'dev', walletType: WalletType.ENDLESS, walletName: '', walletIcon: '' }),
|
|
67
|
+
|
|
68
|
+
// updateEthProvider: (provider: EIP1193Provider) => set({ ethProvider: provider }),
|
|
69
|
+
}),
|
|
70
|
+
{
|
|
71
|
+
name: `connectInfo-connectAdapter`,
|
|
72
|
+
storage: createJSONStorage(() => localStorage),
|
|
73
|
+
partialize: (state) =>
|
|
74
|
+
({
|
|
75
|
+
address: state.address,
|
|
76
|
+
chain: state.chain,
|
|
77
|
+
walletChainId: state.walletChainId,
|
|
78
|
+
network: state.network,
|
|
79
|
+
walletType: state.walletType,
|
|
80
|
+
walletName: state.walletName,
|
|
81
|
+
walletIcon: state.walletIcon,
|
|
82
|
+
// ethProvider: state.ethProvider,
|
|
83
|
+
}) as IWC,
|
|
84
|
+
},
|
|
85
|
+
),
|
|
86
|
+
)
|
|
87
|
+
export default useConnectStore
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineStyle, defineStyleConfig } from "@chakra-ui/react";
|
|
2
|
+
|
|
3
|
+
const base = defineStyle({
|
|
4
|
+
w: "100%",
|
|
5
|
+
display: 'flex',
|
|
6
|
+
// flexGrow: 1,
|
|
7
|
+
borderRadius: "1rem",
|
|
8
|
+
h: ".4rem",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
color: "a4",
|
|
12
|
+
fontSize: ".14rem",
|
|
13
|
+
fontWeight: "500",
|
|
14
|
+
cursor: "pointer",
|
|
15
|
+
bg: "#7534FF",
|
|
16
|
+
_hover: {
|
|
17
|
+
bg: "#7534FF",
|
|
18
|
+
},
|
|
19
|
+
_disabled: {
|
|
20
|
+
_hover: {
|
|
21
|
+
bg: '#7534FF !important',
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const add = defineStyle({
|
|
27
|
+
w: "80px",
|
|
28
|
+
// flexGrow: "1",
|
|
29
|
+
borderRadius: "4px",
|
|
30
|
+
h: "32px",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
justifyContent: "center",
|
|
33
|
+
color: "a4",
|
|
34
|
+
fontSize: "14px",
|
|
35
|
+
px: '16px',
|
|
36
|
+
fontWeight: "500",
|
|
37
|
+
cursor: "pointer",
|
|
38
|
+
bg: "b1",
|
|
39
|
+
_hover: {
|
|
40
|
+
bg: "a6",
|
|
41
|
+
},
|
|
42
|
+
_disabled: {
|
|
43
|
+
_hover: {
|
|
44
|
+
bg: 'a6 !important',
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
const submit = defineStyle({
|
|
50
|
+
w: "200px",
|
|
51
|
+
// flexGrow: "1",
|
|
52
|
+
borderRadius: "4px",
|
|
53
|
+
h: "44px",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
justifyContent: "center",
|
|
56
|
+
color: "a4",
|
|
57
|
+
fontSize: "16px",
|
|
58
|
+
px: '16px',
|
|
59
|
+
fontWeight: "600",
|
|
60
|
+
cursor: "pointer",
|
|
61
|
+
bg: "b6",
|
|
62
|
+
_hover: {
|
|
63
|
+
bg: "#A69AFF",
|
|
64
|
+
},
|
|
65
|
+
_disabled: {
|
|
66
|
+
opacity: '1',
|
|
67
|
+
bg: '#E7E7E7',
|
|
68
|
+
color: 'b1',
|
|
69
|
+
_hover: {
|
|
70
|
+
bg: 'c8 !important'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const close = defineStyle({
|
|
77
|
+
w: "240px",
|
|
78
|
+
borderRadius: "4px",
|
|
79
|
+
h: "44px",
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
color: "b1",
|
|
83
|
+
fontSize: "14px",
|
|
84
|
+
px: '16px',
|
|
85
|
+
fontWeight: "600",
|
|
86
|
+
cursor: "pointer",
|
|
87
|
+
bg: "#E7E7E7",
|
|
88
|
+
_hover: {
|
|
89
|
+
bg: "c8",
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export const buttonTheme = defineStyleConfig({
|
|
94
|
+
variants: {
|
|
95
|
+
base: base,
|
|
96
|
+
add,
|
|
97
|
+
submit,
|
|
98
|
+
close,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { checkboxAnatomy } from '@chakra-ui/anatomy'
|
|
2
|
+
import { createMultiStyleConfigHelpers } from '@chakra-ui/react'
|
|
3
|
+
|
|
4
|
+
const { definePartsStyle, defineMultiStyleConfig } = createMultiStyleConfigHelpers(checkboxAnatomy.keys)
|
|
5
|
+
|
|
6
|
+
const coinDexTheme = definePartsStyle({
|
|
7
|
+
control: {
|
|
8
|
+
boxSize: '12px',
|
|
9
|
+
border: '1px solid',
|
|
10
|
+
'& svg': {
|
|
11
|
+
w: '10px',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
label: {
|
|
15
|
+
fontSize: '12px',
|
|
16
|
+
ml: '4px',
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const checkboxTheme = defineMultiStyleConfig({
|
|
21
|
+
variants: {
|
|
22
|
+
coinDex: coinDexTheme,
|
|
23
|
+
},
|
|
24
|
+
})
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { drawerAnatomy } from '@chakra-ui/anatomy'
|
|
2
|
+
import { createMultiStyleConfigHelpers } from '@chakra-ui/react'
|
|
3
|
+
|
|
4
|
+
const { definePartsStyle, defineMultiStyleConfig } = createMultiStyleConfigHelpers(drawerAnatomy.keys)
|
|
5
|
+
const coinDex = definePartsStyle({
|
|
6
|
+
overlay: {
|
|
7
|
+
opacity: '0.7 !important',
|
|
8
|
+
bg: '#030407',
|
|
9
|
+
},
|
|
10
|
+
dialog: {
|
|
11
|
+
bg: 'a4',
|
|
12
|
+
borderRadius: '12px 12px 0 0',
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
borderBottom: 'none',
|
|
16
|
+
p: '16px',
|
|
17
|
+
textAlign: 'center',
|
|
18
|
+
fontSize: '16px',
|
|
19
|
+
lineHeight: 1,
|
|
20
|
+
fontWeight: 500,
|
|
21
|
+
},
|
|
22
|
+
body: {
|
|
23
|
+
p: '15px 16px 25px',
|
|
24
|
+
},
|
|
25
|
+
footer: {
|
|
26
|
+
p: '0 16px 16px',
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const base = definePartsStyle({
|
|
31
|
+
overlay: {
|
|
32
|
+
opacity: '0.8 !important',
|
|
33
|
+
bg: '#000',
|
|
34
|
+
},
|
|
35
|
+
dialog: {
|
|
36
|
+
bg: '#0E0E0E',
|
|
37
|
+
borderRadius: '12px 12px 0 0',
|
|
38
|
+
},
|
|
39
|
+
header: {
|
|
40
|
+
borderBottom: 'none',
|
|
41
|
+
p: '16px',
|
|
42
|
+
textAlign: 'center',
|
|
43
|
+
fontSize: '16px',
|
|
44
|
+
lineHeight: 1,
|
|
45
|
+
fontWeight: 600,
|
|
46
|
+
},
|
|
47
|
+
body: {
|
|
48
|
+
p: '15px 16px 25px',
|
|
49
|
+
},
|
|
50
|
+
footer: {
|
|
51
|
+
p: '0 16px 16px',
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
export const drawerTheme = defineMultiStyleConfig({
|
|
56
|
+
variants: {
|
|
57
|
+
coinDex,
|
|
58
|
+
base,
|
|
59
|
+
},
|
|
60
|
+
})
|