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.
Files changed (70) hide show
  1. package/README.md +75 -0
  2. package/eslint.config.js +23 -0
  3. package/index.html +13 -0
  4. package/package.json +61 -0
  5. package/public/favicon.svg +1 -0
  6. package/public/icons.svg +24 -0
  7. package/src/App.css +184 -0
  8. package/src/App.tsx +35 -0
  9. package/src/assets/hero.png +0 -0
  10. package/src/assets/loading.png +0 -0
  11. package/src/assets/react.svg +1 -0
  12. package/src/assets/svg/close.svg +3 -0
  13. package/src/assets/svg/tick.svg +4 -0
  14. package/src/assets/vite.svg +1 -0
  15. package/src/assets/wallet/bitget.png +0 -0
  16. package/src/assets/wallet/coinbase.png +0 -0
  17. package/src/assets/wallet/endless.png +0 -0
  18. package/src/assets/wallet/luffa.png +0 -0
  19. package/src/assets/wallet/metamask.png +0 -0
  20. package/src/assets/wallet/okx.png +0 -0
  21. package/src/assets/wallet/phantom.png +0 -0
  22. package/src/assets/wallet/tron.png +0 -0
  23. package/src/assets/wallet/walletConnect.png +0 -0
  24. package/src/components/Button/index.tsx +9 -0
  25. package/src/components/ConnectModal/index.css +32 -0
  26. package/src/components/ConnectModal/index.tsx +77 -0
  27. package/src/components/ConnectModal/modal.tsx +261 -0
  28. package/src/components/ConnectModal/showConnectModal.tsx +20 -0
  29. package/src/components/ConnectModal/styles.ts +46 -0
  30. package/src/components/Modal.tsx +122 -0
  31. package/src/config/wallets.ts +98 -0
  32. package/src/contexts/Modal.tsx +33 -0
  33. package/src/contexts/Tables.tsx +32 -0
  34. package/src/hooks/store.ts +30 -0
  35. package/src/hooks/useIsMobile.ts +10 -0
  36. package/src/hooks/useSyncProvider.ts +4 -0
  37. package/src/hooks/useToast.tsx +163 -0
  38. package/src/hooks/useWallet.ts +66 -0
  39. package/src/index.css +111 -0
  40. package/src/index.ts +5 -0
  41. package/src/main.tsx +5 -0
  42. package/src/store/connectStore.ts +87 -0
  43. package/src/theme/components/Button.ts +100 -0
  44. package/src/theme/components/Checkbox.tsx +24 -0
  45. package/src/theme/components/Drawer.ts +60 -0
  46. package/src/theme/components/Input.ts +98 -0
  47. package/src/theme/components/Menu.ts +52 -0
  48. package/src/theme/components/Modal.ts +44 -0
  49. package/src/theme/components/NumberInput.ts +54 -0
  50. package/src/theme/components/Popover.ts +72 -0
  51. package/src/theme/components/Progress.ts +41 -0
  52. package/src/theme/components/Radio.tsx +66 -0
  53. package/src/theme/components/Switch.ts +30 -0
  54. package/src/theme/components/Table.ts +149 -0
  55. package/src/theme/components/Tabs.ts +90 -0
  56. package/src/theme/components/Tag.ts +21 -0
  57. package/src/theme/components/Textarea.ts +21 -0
  58. package/src/theme/components/Tooltip.ts +35 -0
  59. package/src/theme/index.ts +269 -0
  60. package/src/types/adapter.d.ts +43 -0
  61. package/src/types/global.d.ts +102 -0
  62. package/src/types/type.ts +100 -0
  63. package/src/web3/ethereum/index.ts +36 -0
  64. package/src/web3/index.ts +15 -0
  65. package/src/web3/solana/index.ts +104 -0
  66. package/src/web3/tron/index.ts +57 -0
  67. package/tsconfig.app.json +31 -0
  68. package/tsconfig.json +7 -0
  69. package/tsconfig.node.json +29 -0
  70. package/vite.config.ts +31 -0
@@ -0,0 +1,21 @@
1
+ import { tagAnatomy } from '@chakra-ui/anatomy'
2
+ import { createMultiStyleConfigHelpers } from '@chakra-ui/react'
3
+
4
+ const { definePartsStyle, defineMultiStyleConfig } = createMultiStyleConfigHelpers(tagAnatomy.keys)
5
+
6
+ const base = definePartsStyle({
7
+ container: {
8
+ bg: '#161616',
9
+ borderRadius: '8px',
10
+ p: '6px 16px',
11
+ h: '40px',
12
+ fontSize: '14px',
13
+ fontWeight: 600,
14
+ },
15
+ })
16
+
17
+ export const tagTheme = defineMultiStyleConfig({
18
+ variants: {
19
+ base,
20
+ },
21
+ })
@@ -0,0 +1,21 @@
1
+ import { defineStyle, defineStyleConfig } from '@chakra-ui/react'
2
+
3
+ const base = defineStyle({
4
+ h: '200px',
5
+ resize: 'none',
6
+ color: '#D1D4E2',
7
+ p: '12px',
8
+ bg: '#0A0C15',
9
+ borderRadius: '12px',
10
+ border:"1px solid rgba(223, 229, 243, 0.20)",
11
+ fontSize: '12px',
12
+ fontWeight: 500,
13
+ lineHeight: '1.4em',
14
+ _placeholder: {
15
+ color: '#D1D4E2',
16
+ },
17
+ })
18
+
19
+ export const textareaTheme = defineStyleConfig({
20
+ variants: { base },
21
+ })
@@ -0,0 +1,35 @@
1
+ import { defineStyle, defineStyleConfig } from '@chakra-ui/react'
2
+
3
+ const base = defineStyle(() => {
4
+ return {
5
+ w: 'fit-content',
6
+ maxW: '400px',
7
+ // p: '12px 20px',
8
+ bg: 'a4',
9
+ fontSize: '14px',
10
+ lineHeight: '1.4em',
11
+ color: 'a4',
12
+ borderRadius: '4px',
13
+ }
14
+ })
15
+
16
+ const warning = defineStyle(() => {
17
+ return {
18
+ w: 'fit-content',
19
+ maxW: '300px',
20
+ p: '12px 16px',
21
+ bg: '#271315',
22
+ fontSize: '14px',
23
+ lineHeight: '1.4em',
24
+ color: '#FFAEAE',
25
+ border: '1px solid #9A131B',
26
+ borderRadius: '8px',
27
+ }
28
+ })
29
+
30
+ const variants = {
31
+ base,
32
+ warning,
33
+ }
34
+
35
+ export const tooltipTheme = defineStyleConfig({ variants })
@@ -0,0 +1,269 @@
1
+ import { extendTheme, type ThemeConfig } from "@chakra-ui/react";
2
+ import { tabsTheme } from "./components/Tabs";
3
+ import { popoverTheme } from "./components/Popover";
4
+ import { inputTheme } from "./components/Input";
5
+ import { numberInputTheme } from "./components/NumberInput";
6
+ import { textareaTheme } from "./components/Textarea";
7
+ import { tableTheme } from "./components/Table";
8
+ import { drawerTheme } from "./components/Drawer";
9
+ import { modalTheme } from "./components/Modal";
10
+ import { radioTheme } from "./components/Radio";
11
+ import { menuTheme } from "./components/Menu";
12
+ import { buttonTheme } from "./components/Button";
13
+ import { checkboxTheme } from "./components/Checkbox";
14
+ import { tooltipTheme } from "./components/Tooltip";
15
+ import { switchTheme } from "./components/Switch";
16
+ import { progressTheme } from "./components/Progress";
17
+
18
+ const config: ThemeConfig = {
19
+ initialColorMode: "light",
20
+ useSystemColorMode: false,
21
+ };
22
+
23
+ export const headerHeight = {
24
+ sm: 52,
25
+ xl: 70,
26
+ };
27
+
28
+ export const breakpoints = {
29
+ sm: "0px",
30
+ xl: "891px",
31
+ "2xl": "1441px",
32
+ };
33
+
34
+ const space = {
35
+ px: "1px",
36
+ 0.5: "2px",
37
+ 1: "4px",
38
+ 1.5: "6px",
39
+ 2: "8px",
40
+ 2.5: "10px",
41
+ 3: "12px",
42
+ 3.5: "14px",
43
+ 4: "16px",
44
+ 5: "20px",
45
+ 6: "24px",
46
+ 7: "28px",
47
+ 8: "32px",
48
+ 9: "36px",
49
+ 10: "40px",
50
+ 12: "48px",
51
+ 14: "56px",
52
+ 16: "64px",
53
+ 20: "80px",
54
+ 24: "96px",
55
+ 28: "112px",
56
+ 32: "128px",
57
+ 36: "144px",
58
+ 40: "160px",
59
+ 44: "176px",
60
+ 48: "192px",
61
+ 52: "200px",
62
+ 56: "224px",
63
+ 60: "240px",
64
+ 64: "256px",
65
+ 72: "288px",
66
+ 80: "320px",
67
+ 96: "384px",
68
+ "3xs": "224px",
69
+ };
70
+
71
+ const sizes = {
72
+ ...space,
73
+ };
74
+
75
+ const radii = {
76
+ none: "0",
77
+ sm: "2px",
78
+ base: "4px",
79
+ md: "6px",
80
+ lg: "8px",
81
+ xl: "12px",
82
+ "2xl": "16px",
83
+ "3xl": "24px",
84
+ full: "9999px",
85
+ card: "12px",
86
+ };
87
+
88
+ const fontSizes = {
89
+ xs: "12px",
90
+ sm: "14px",
91
+ md: "16px",
92
+ lg: "18px",
93
+ xl: "20px",
94
+ "2xl": "24px",
95
+ "3xl": "30px",
96
+ "4xl": "36px",
97
+ "5xl": "48px",
98
+ "6xl": "60px",
99
+ "7xl": "88px",
100
+ "8xl": "96px",
101
+ "9xl": "128px",
102
+ };
103
+
104
+ const lineHeights = {
105
+ normal: "normal",
106
+ none: 1,
107
+ shorter: 1.25,
108
+ short: 1.375,
109
+ base: 1.5,
110
+ tall: 1.625,
111
+ taller: "2",
112
+ "3": "12px",
113
+ "4": "16px",
114
+ "5": "20px",
115
+ "6": "24px",
116
+ "7": "28px",
117
+ "8": "32px",
118
+ "9": "36px",
119
+ "10": "40px",
120
+ };
121
+
122
+ const colors = {
123
+ a1: "#F3F3F3",
124
+ a2: "#1B2032",
125
+ a3: "#F5F5F5",
126
+ a4: "#FFF",
127
+ a5: "#eee",
128
+ a6: "#222",
129
+ a7: "#000",
130
+ a8: "#666",
131
+ a9: "#121212",
132
+ b1: "#0A0A0A",
133
+ b2: "#EAEFF4",
134
+ b3: "#545454",
135
+ b4: "#999",
136
+ b5: "#9969FF",
137
+ b6: "#8473FF",
138
+ b7: "#F2F2F2",
139
+ b8: "#67A1FA",
140
+ b9: "#FF9E14",
141
+ b10: "#31CF2E",
142
+ b11: "#F66161",
143
+ b12: "#9969FF",
144
+ b13: "#F9F9F9",
145
+ b14: "#F31111",
146
+ b15: "#575757",
147
+ c1: "#FF59DC",
148
+ c2: "#0FC6FF",
149
+ c3: "#A954FF",
150
+ c4: "#F34D4E",
151
+ c5: "#FF9500",
152
+ c6: "#FFCC00",
153
+ c7: "#E1CD98",
154
+ c8: "#E5E5E5",
155
+ g1: "linear-gradient(180deg, rgba(0, 0, 0, 0.50) 44%, rgba(255, 255, 255, 0.50) 100%)",
156
+ g2: "linear-gradient(92deg, #FF3B10 1.82%, #FF5AE4 98.18%)",
157
+ g3: "linear-gradient(315deg, #F95151 0%, #FFCE22 100%)",
158
+ g4: "linear-gradient(315deg, #FF45A9 0%, #F95151 100%)",
159
+ g5: "linear-gradient(315deg, #9441FF 0%, #FF45A9 100%)",
160
+ g6: "linear-gradient(315deg, #1E6AFF 0%, #9441FF 100%)",
161
+ bodyBg: "var(--body-bg-color)",
162
+ font: "#fff",
163
+ subFont: "#72747E",
164
+ headerBg: "var(--header-bg-color)",
165
+ cardBg: "var(--body-bg-color)",
166
+ subCardBg: "var(--sub-card-bg-color)",
167
+ border: "var(--border-color)",
168
+ inputBorder: "#2D2D31",
169
+ up: "#0FD375",
170
+ upBg: "#132625",
171
+ down: "#D2334D",
172
+ downBg: "#281C1F",
173
+ error: "#ED303B",
174
+ };
175
+
176
+ const textStyles = {
177
+ textEllipsis: {
178
+ overflow: "hidden",
179
+ textOverflow: "ellipsis",
180
+ whiteSpace: "nowrap",
181
+ },
182
+ };
183
+
184
+ const layerStyles = {
185
+ card: {
186
+ bg: { sm: "initial", xl: "cardBg" },
187
+ borderRadius: { sm: "initial", xl: "card" },
188
+ p: { sm: "0", xl: "16px" },
189
+ },
190
+ contentBox: {
191
+ maxW: { sm: "3.43rem", xl: "12.54rem", "2xl": "16.8rem" },
192
+ mx: "auto",
193
+ },
194
+ userContentBox: {
195
+ maxW: { sm: "3.43rem", xl: "initial" },
196
+ mx: { sm: "auto", xl: "initial" },
197
+ },
198
+ hideScrollBar: {
199
+ "&::-webkit-scrollbar": {
200
+ display: "none",
201
+ },
202
+ },
203
+ };
204
+
205
+ const theme = extendTheme({
206
+ components: {
207
+ Tabs: tabsTheme,
208
+ Popover: popoverTheme,
209
+ Input: inputTheme,
210
+ NumberInput: numberInputTheme,
211
+ Textarea: textareaTheme,
212
+ Table: tableTheme,
213
+ Drawer: drawerTheme,
214
+ Modal: modalTheme,
215
+ Radio: radioTheme,
216
+ Menu: menuTheme,
217
+ Button: buttonTheme,
218
+ Checkbox: checkboxTheme,
219
+ Tooltip: tooltipTheme,
220
+ Switch: switchTheme,
221
+ Progress: progressTheme
222
+ },
223
+ styles: {
224
+ global: {
225
+ body: {
226
+ fontFamily: "PingFang SC; sans-serif",
227
+ fontSize: "16px",
228
+ bg: "bodyBg",
229
+ color: "a4",
230
+ lineHeight: 1,
231
+ minW: { sm: "320px", xl: "1200px" },
232
+ maxW: "100vw",
233
+ minH: "100vh",
234
+ overflowX: "hidden",
235
+ },
236
+ "::-webkit-scrollbar-track": {
237
+ boxShadow: "inset 0 0 6px rgba(0, 0, 0, 0.4)",
238
+ backgroundColor: "none",
239
+ },
240
+ "::-webkit-scrollbar": {
241
+ width: "6px",
242
+ height: "6px",
243
+ backgroundColor: "rgba(255, 255, 255, 0.4)",
244
+ },
245
+ "::-webkit-scrollbar-thumb": {
246
+ backgroundColor: "#1A1a1a",
247
+ borderRadius: "4px",
248
+ },
249
+ },
250
+ },
251
+ colors,
252
+ breakpoints,
253
+ space,
254
+ sizes,
255
+ config,
256
+ textStyles,
257
+ layerStyles,
258
+ radii,
259
+ fontSizes,
260
+ lineHeights,
261
+ zIndices: {
262
+ header: 60,
263
+ sticky: 9,
264
+ overlay: 999,
265
+ modal: 1000,
266
+ },
267
+ });
268
+
269
+ export default theme;
@@ -0,0 +1,43 @@
1
+ declare module 'adapter' {
2
+ const Button: React.ComponentType;
3
+ export default Button;
4
+
5
+ export const WalletEndNameEnum: {
6
+ readonly METAMASK: 'MetaMask';
7
+ readonly OKX: 'OKX Wallet';
8
+ readonly BITGET: 'Bitget Wallet';
9
+ readonly ENDLESS: 'Endless Wallet';
10
+ readonly LUFFA: 'Luffa Wallet';
11
+ readonly COINBASE: 'Coinbase Wallet';
12
+ readonly TRONLINK: 'TronLink';
13
+ readonly WC: 'Wallet Connect';
14
+ readonly PHANTOM: 'Phantom Wallet';
15
+ };
16
+
17
+ export type WalletEndNameEnum = typeof WalletEndNameEnum[keyof typeof WalletEndNameEnum];
18
+
19
+ export const WalletType: {
20
+ readonly PHANTOM: 1;
21
+ readonly OKX: 2;
22
+ readonly SOLFLARE: 3;
23
+ readonly BITGET: 4;
24
+ readonly COINBASE: 5;
25
+ readonly MATH: 6;
26
+ readonly BACKPACK: 7;
27
+ readonly GLOW: 8;
28
+ readonly TRONLINK: 9;
29
+ readonly WC: 10;
30
+ readonly METAMASK: 11;
31
+ readonly ENDLESS: 12;
32
+ readonly LUFFA: 13;
33
+ };
34
+
35
+ export type WalletType = typeof WalletType[keyof typeof WalletType];
36
+ }
37
+
38
+ // src/types/svg.d.ts
39
+ declare module "*.svg?react" {
40
+ import * as React from 'react';
41
+ const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
42
+ export default ReactComponent;
43
+ }
@@ -0,0 +1,102 @@
1
+ interface Window {
2
+ bw?: {
3
+ put: {
4
+ connect: (params: { session?: string }) => Promise<any>
5
+ disconnect: (params: { session: string }) => Promise<any>
6
+ signMessage: (params: { message: string; session: string; display?: 'utf8' | 'hex' }) => Promise<any>
7
+ signTransaction: (params: { transaction: string; session: string }) => Promise<any>
8
+ signAllTransactions: (params: { transactions: string[]; session: string }) => Promise<any>
9
+ signAndSendTransaction: (params: { transaction: string; session: string }) => Promise<any>
10
+ on: (event: string, callback: (params: any) => void) => void
11
+ removeAllListeners: () => void
12
+ }
13
+ solana: {
14
+ connect: () => Promise<any>
15
+ disconnect: () => Promise<any>
16
+ signMessage: (params: { message: string; display?: 'utf8' | 'hex' }) => Promise<any>
17
+ signTransaction: (params: { transaction: string }) => Promise<any>
18
+ signAllTransactions: (params: { transactions: string[] }) => Promise<any>
19
+ signAndSendTransaction: (params: { transaction: string }) => Promise<any>
20
+ on: (event: string, callback: (params: any) => void) => void
21
+ removeAllListeners: () => void
22
+ }
23
+ }
24
+ tron?: {
25
+ ready: boolean
26
+ tronWeb: any
27
+ request: (prams: { method: string; [key: string]: any }) => Promise<any>
28
+ removeAllListeners: () => void
29
+ }
30
+ tronLink?: {
31
+ ready: boolean
32
+ tronWeb: any
33
+ request: (prams: { method: string; [key: string]: any }) => Promise<any>
34
+ removeAllListeners: () => void
35
+ }
36
+ tronWeb?: {
37
+ request<T = { code: number; message: string }>(...params: any[]): Promise<T>
38
+ ready: boolean
39
+ defaultAddress: {
40
+ base58: string
41
+ hex: string
42
+ }
43
+ address: {
44
+ fromHex(key?: string): string
45
+ fromPrivateKey(key?: string): string
46
+ toHex(key?: string): string
47
+ }
48
+ contract(
49
+ ABI?: ContractInterface,
50
+ contractAddress?: string,
51
+ ): {
52
+ [key: string]: ContractFunction | any
53
+ loadAbi(ABI: ContractInterface): void
54
+ at(tokenAddress: string): Promise<{
55
+ balanceOf(address: string): contract
56
+ transfer(to: string, amount: string): contract
57
+ }>
58
+ }
59
+ transactionBuilder: {
60
+ sendToken<T = string>(
61
+ to: string,
62
+ amount: number,
63
+ tokenID: string,
64
+ from?: string,
65
+ permissionId?: number,
66
+ ): Promise<T>
67
+ sendTrx<T = string>(to: string, amount: number, from?: string, permissionId?: number): Promise<T>
68
+ }
69
+ trx: {
70
+ sign<T = string>(tx: any): Promise<T>
71
+ sendToken<T = string>(to: string, amount: number, tokenID: string): Promise<T>
72
+ sendTransaction(
73
+ to: string,
74
+ amount: string,
75
+ ): Promise<{
76
+ result: boolean
77
+ transaction: any
78
+ txid: string
79
+ }>
80
+ sendRawTransaction(signedTx: string): Promise<TronSendRawTransactionResponse>
81
+ multiSign(...params: any[]): Promise<string>
82
+ }
83
+ setAddress(addr: string): void
84
+ setDefaultBlock(block: string): void
85
+ }
86
+ TronWeb?: any
87
+ ethereum?: {
88
+ request: (prams: { method: string; [key: string]: any }) => Promise<any>
89
+ on: (event: string, callback: (params: any) => void) => void
90
+ removeAllListeners: () => void
91
+ isMetaMask: boolean
92
+ }
93
+ okxwallet?: {
94
+ request: (prams: { method: string; [key: string]: any }) => Promise<any>
95
+ on: (event: string, callback: (params: any) => void) => void
96
+ removeAllListeners: () => void
97
+ chainId: string
98
+ }
99
+ ethProviders?: any
100
+ endlessWallet: any
101
+ evmWallet?: any
102
+ }
@@ -0,0 +1,100 @@
1
+ export interface EIP6963ProviderInfo {
2
+ rdns: string
3
+ uuid: string
4
+ name: string
5
+ icon: string
6
+ }
7
+
8
+ export type EIP6963AnnounceProviderEvent = {
9
+ detail: {
10
+ info: EIP6963ProviderInfo
11
+ provider: Readonly<EIP1193Provider>
12
+ }
13
+ }
14
+
15
+
16
+ export interface EIP6963ProviderDetail {
17
+ info: EIP6963ProviderInfo
18
+ provider: EIP1193Provider
19
+ }
20
+
21
+
22
+ export interface EIP1193Provider {
23
+ isStatus?: boolean
24
+ host?: string
25
+ path?: string
26
+ connect: Function
27
+ getAccount: Function
28
+ sendAsync?: (
29
+ request: { method: string; params?: Array<unknown> },
30
+ callback: (error: Error | null, response: unknown) => void,
31
+ ) => void
32
+ send?: (
33
+ request: { method: string; params?: Array<unknown> },
34
+ callback: (error: Error | null, response: unknown) => void,
35
+ ) => void
36
+ request: (request: { method: string; params?: Array<unknown> }) => Promise<unknown>
37
+ on: (event: string, callback: (params: any) => void) => void
38
+ _initData?: any
39
+ }
40
+
41
+ export const WalletEndNameEnum = {
42
+ METAMASK: 'MetaMask',
43
+ OKX: 'OKX Wallet',
44
+ BITGET: 'Bitget Wallet',
45
+ ENDLESS: 'Endless Wallet',
46
+ LUFFA: 'Luffa Wallet',
47
+ COINBASE: 'Coinbase Wallet',
48
+ TRONLINK: 'TronLink',
49
+ WC: 'Wallet Connect',
50
+ PHANTOM: 'Phantom Wallet',
51
+ } as const
52
+
53
+ export type WalletEndNameEnum = typeof WalletEndNameEnum[keyof typeof WalletEndNameEnum]
54
+
55
+ export const WalletType = {
56
+ PHANTOM: 1,
57
+ OKX: 2,
58
+ SOLFLARE: 3,
59
+ BITGET: 4,
60
+ COINBASE: 5,
61
+ MATH: 6,
62
+ BACKPACK: 7,
63
+ GLOW: 8,
64
+ TRONLINK: 9,
65
+ WC: 10,
66
+ METAMASK: 11,
67
+ ENDLESS: 12,
68
+ LUFFA: 13,
69
+ } as const
70
+
71
+ export type WalletType = typeof WalletType[keyof typeof WalletType]
72
+
73
+ export const WalletLink = {
74
+ PHANTOM: 'https://phantom.app/',
75
+ OKX: 'https://www.okx.com/download',
76
+ SOLFLARE: 'https://solflare.com/',
77
+ BITGET: 'https://web3.bitget.com/en/wallet-download?type=2',
78
+ COINBASE: 'https://www.coinbase.com/wallet/download',
79
+ BACKPACK: 'https://www.backpack.app/downloads',
80
+ MATH: 'https://mathwallet.org/',
81
+ GLOW: 'https://glow.app/',
82
+ TRONLINK: 'https://www.tronlink.org/',
83
+ METAMASK: 'https://metamask.io/download/',
84
+ } as const
85
+
86
+ export type WalletLink = typeof WalletLink[keyof typeof WalletLink]
87
+
88
+ export const MethodName = {
89
+ PHANTOM: 'phantom',
90
+ OKX: 'okxwallet',
91
+ SOLFLARE: 'solflare',
92
+ BITGET: 'bitkeep',
93
+ COINBASE: 'coinbaseSolana',
94
+ BACKPACK: 'backpack',
95
+ GLOW: 'glow',
96
+ TRONLINK: 'tronLink',
97
+ METAMASK: 'ethereum',
98
+ } as const
99
+
100
+ export type MethodName = typeof MethodName[keyof typeof MethodName]
@@ -0,0 +1,36 @@
1
+ import useConnectStore from '../../store/connectStore'
2
+ import type { EIP6963ProviderDetail } from '../../types/type'
3
+ import { ethers } from 'ethers'
4
+
5
+ export const handleEvmConnect = async (providerWithInfo: EIP6963ProviderDetail, img: string) => {
6
+
7
+ try {
8
+ const accounts: any = await providerWithInfo.provider.request({
9
+ method: 'eth_requestAccounts',
10
+ })
11
+
12
+ const checksumAddress = ethers.getAddress(accounts[0])
13
+
14
+ let address: string = ''
15
+ let chainId: string = ''
16
+ // setSelectedWallet(providerWithInfo);
17
+ if (accounts) {
18
+ address = checksumAddress || ''
19
+ }
20
+ const curChainId = (await providerWithInfo.provider.request({
21
+ method: 'eth_chainId',
22
+ params: [],
23
+ })) as string
24
+ if (curChainId) {
25
+ chainId = curChainId || 'eip155:1'
26
+ }
27
+
28
+ useConnectStore.getState().setChain(chainId)
29
+ useConnectStore.getState().updateAddress(address)
30
+ useConnectStore.getState().updateWalletIcon(img)
31
+
32
+ } catch (error) {
33
+ return error
34
+ }
35
+ }
36
+
@@ -0,0 +1,15 @@
1
+ import { WalletType } from "../types/type";
2
+ import useConnectStore from "../store/connectStore";
3
+ import { getSolProvider } from "./solana";
4
+ import { getTronProvider } from "./tron";
5
+
6
+ export const getProvider = (walletType: WalletType) => {
7
+ if (walletType === WalletType.ENDLESS || walletType === WalletType.LUFFA) {
8
+ return useConnectStore.getState().jssdk;
9
+ } else if (walletType === WalletType.PHANTOM) {
10
+ return getSolProvider()
11
+ } else if (walletType === WalletType.TRONLINK) {
12
+ return getTronProvider()
13
+ }
14
+
15
+ }