@matchain/matchid-sdk-react 0.1.42-alpha.17 → 0.1.42-alpha.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/dist/assets/icon/index.d.mts +1 -1
- package/dist/assets/icon/index.d.ts +1 -1
- package/dist/{chunk-L3G6YN2D.mjs → chunk-2YN5Y3SM.mjs} +2 -2
- package/dist/chunk-PZPEWHBV.mjs +4251 -0
- package/dist/chunk-PZPEWHBV.mjs.map +1 -0
- package/dist/components/index.d.mts +2 -3
- package/dist/components/index.d.ts +2 -3
- package/dist/components/index.js +486 -770
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -8
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +78 -137
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +2 -3
- package/dist/hooks/index.d.mts +2 -5
- package/dist/hooks/index.d.ts +2 -5
- package/dist/hooks/index.js +158 -362
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -2
- package/dist/index-B4YpKSY3.d.ts +94 -0
- package/dist/{index-CLvQH5gM.d.ts → index-CxY3u9Rv.d.ts} +12 -32
- package/dist/{index-DlhAHm_s.d.mts → index-DCReY5T2.d.mts} +12 -32
- package/dist/{index-Ca9nh_8s.d.ts → index-DbjibQ5d.d.mts} +1 -1
- package/dist/{index-DFZpfAfc.d.mts → index-GcpJCj6O.d.ts} +1 -1
- package/dist/index-_k6h9w0P.d.mts +94 -0
- package/dist/index.css +4 -84
- package/dist/index.d.mts +5 -9
- package/dist/index.d.ts +5 -9
- package/dist/index.js +679 -1203
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -6
- package/dist/types.d-DwF-Pkvh.d.mts +179 -0
- package/dist/types.d-DwF-Pkvh.d.ts +179 -0
- package/example/package.json +0 -1
- package/example/src/App.tsx +28 -54
- package/example/src/components/Login/index.tsx +2 -2
- package/example/src/components/RoutePrivate/index.tsx +3 -4
- package/example/src/config/index.ts +2 -7
- package/example/src/pages/{User/index.tsx → User.tsx} +84 -55
- package/example/src/pages/Wallet.tsx +43 -258
- package/example/tsconfig.json +0 -1
- package/package.json +2 -7
- package/dist/chunk-KITTHHSR.mjs +0 -4757
- package/dist/chunk-KITTHHSR.mjs.map +0 -1
- package/dist/chunk-SQIJR7RA.mjs +0 -29
- package/dist/chunk-SQIJR7RA.mjs.map +0 -1
- package/dist/index-Bluim2ZP.d.mts +0 -143
- package/dist/index-BxS06a5O.d.ts +0 -50
- package/dist/index-EqksEEto.d.ts +0 -143
- package/dist/index-q5XDobUF.d.mts +0 -50
- package/dist/mpc-CTbBWHld.d.mts +0 -20
- package/dist/mpc-CTbBWHld.d.ts +0 -20
- package/dist/types/index.d.mts +0 -3
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.js +0 -44
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -10
- package/dist/types/index.mjs.map +0 -1
- package/dist/types-CVwZEgQ0.d.mts +0 -244
- package/dist/types-CVwZEgQ0.d.ts +0 -244
- package/example/src/abi/erc20.json +0 -222
- package/example/src/components/ButtonGroup/index.tsx +0 -10
- package/example/src/config/chains/index.ts +0 -2
- package/example/src/config/chains/matchMain.ts +0 -27
- package/example/src/config/chains/matchTest.ts +0 -33
- package/example/src/pages/User/components/BindListModal.tsx +0 -10
- package/example/src/pages/User/components/PohListModal.tsx +0 -10
- package/example/src/pages/User/components/QueryDisplay.tsx +0 -25
- package/example/src/store/useLocalStore.ts +0 -51
- /package/dist/{chunk-L3G6YN2D.mjs.map → chunk-2YN5Y3SM.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -3,16 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-HYQ3T6WW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
api_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2YN5Y3SM.mjs";
|
|
7
7
|
import {
|
|
8
8
|
MatchProvider,
|
|
9
9
|
components_exports,
|
|
10
10
|
hooks_exports,
|
|
11
11
|
useMatch
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
types_exports
|
|
15
|
-
} from "./chunk-SQIJR7RA.mjs";
|
|
12
|
+
} from "./chunk-PZPEWHBV.mjs";
|
|
16
13
|
import "./chunk-DPXMCLYK.mjs";
|
|
17
14
|
import "./chunk-J5LGTIGS.mjs";
|
|
18
15
|
export {
|
|
@@ -21,7 +18,6 @@ export {
|
|
|
21
18
|
components_exports as Components,
|
|
22
19
|
hooks_exports as Hooks,
|
|
23
20
|
MatchProvider,
|
|
24
|
-
types_exports as Types,
|
|
25
21
|
useMatch
|
|
26
22
|
};
|
|
27
23
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type ISocialLoginMethod =
|
|
4
|
+
'google'
|
|
5
|
+
| 'twitter'
|
|
6
|
+
| 'discord'
|
|
7
|
+
| 'github'
|
|
8
|
+
| 'telegram'
|
|
9
|
+
| 'linkedin'
|
|
10
|
+
| 'facebook'
|
|
11
|
+
| 'youtube'
|
|
12
|
+
type WalletType = 'evm' | 'sol' | 'tron' | 'btc' | 'ton'
|
|
13
|
+
type LoginMethodType = WalletType | 'email' | ISocialLoginMethod
|
|
14
|
+
type CEXType = "Gate" | "Coinbase" | "Kucoin" | 'Bitget' | 'OKX' | 'Bybit' | 'Binance'
|
|
15
|
+
type OtherLoginMethodType = 'email' | ISocialLoginMethod
|
|
16
|
+
type RecommendLoginMethodType = 'wallet' | 'email' | ISocialLoginMethod
|
|
17
|
+
type IEnvConfigType = {
|
|
18
|
+
endpoints: {
|
|
19
|
+
back: string;
|
|
20
|
+
auth: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
type IMatchEvents = {
|
|
24
|
+
onLogin?: (data: {
|
|
25
|
+
mid?: string;
|
|
26
|
+
token: string;
|
|
27
|
+
did: string
|
|
28
|
+
}) => void
|
|
29
|
+
onLogout?: () => void,
|
|
30
|
+
onBind?: (data: {
|
|
31
|
+
type: string
|
|
32
|
+
}) => void
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type OverviewInfo = {
|
|
36
|
+
score: number,
|
|
37
|
+
total_assets: number,
|
|
38
|
+
wallets: number,
|
|
39
|
+
followers: number,
|
|
40
|
+
sbt: number,
|
|
41
|
+
is_kyc: boolean,
|
|
42
|
+
is_poh: boolean,
|
|
43
|
+
mid: string
|
|
44
|
+
user_identity: string
|
|
45
|
+
identities: { [key: string]: string }
|
|
46
|
+
did: string
|
|
47
|
+
address: string
|
|
48
|
+
username?: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type IconProps = {
|
|
52
|
+
color?: string,
|
|
53
|
+
size?: number | string,
|
|
54
|
+
width?: number | string,
|
|
55
|
+
height?: number | string,
|
|
56
|
+
style?: CSSProperties
|
|
57
|
+
className?: string
|
|
58
|
+
onClick?: (e?: any) => void
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type ModalProps = PropsWithChildren & {
|
|
62
|
+
isOpen: boolean,
|
|
63
|
+
width?: number
|
|
64
|
+
className?: string
|
|
65
|
+
zIndex?: number
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type ModalWithHeaderProps = ModalProps & {
|
|
69
|
+
onBack?: () => void,
|
|
70
|
+
onClose?: () => void,
|
|
71
|
+
title?: string
|
|
72
|
+
showClose?: boolean
|
|
73
|
+
showBorder?: boolean
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type InputProps = {
|
|
77
|
+
placeholder?: string,
|
|
78
|
+
value?: string,
|
|
79
|
+
onChange?: (e?: any) => void,
|
|
80
|
+
disabled?: boolean,
|
|
81
|
+
readonly?: boolean
|
|
82
|
+
type?: string
|
|
83
|
+
maxLength?: number
|
|
84
|
+
className?: string
|
|
85
|
+
after?: React.ReactNode
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
type LoginBoxProps = {
|
|
89
|
+
methods?: OtherLoginMethodType[],
|
|
90
|
+
inModal?: boolean
|
|
91
|
+
recommendMethods?: RecommendLoginMethodType[]
|
|
92
|
+
walletMethods?: WalletType[]
|
|
93
|
+
}
|
|
94
|
+
type LoginPanelProps = {
|
|
95
|
+
header?: React.ReactNode
|
|
96
|
+
onClose?: () => void
|
|
97
|
+
} & LoginBoxProps
|
|
98
|
+
type LoginModalProps = LoginPanelProps & ModalProps
|
|
99
|
+
type EmailModalProps = ModalProps & {
|
|
100
|
+
onClose?: () => void,
|
|
101
|
+
onBack?: () => void,
|
|
102
|
+
onLogin?: () => void
|
|
103
|
+
}
|
|
104
|
+
type ButtonProps = {
|
|
105
|
+
size?: 'sm' | 'df' | 'lg',
|
|
106
|
+
type?: "button" | "submit" | "reset",
|
|
107
|
+
rounded?: boolean,
|
|
108
|
+
block?: boolean,
|
|
109
|
+
disabled?: boolean,
|
|
110
|
+
loading?: boolean,
|
|
111
|
+
children?: React.ReactNode,
|
|
112
|
+
onClick?: () => void,
|
|
113
|
+
highlight?: boolean,
|
|
114
|
+
style?: CSSProperties
|
|
115
|
+
className?: string
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type BindItemType = {
|
|
119
|
+
type: string,
|
|
120
|
+
type_sort: string,
|
|
121
|
+
platform_name: string,
|
|
122
|
+
platform_id: number,
|
|
123
|
+
platform_uid: string,
|
|
124
|
+
platform_nickname: string,
|
|
125
|
+
platform_status: number
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
type PohItemType = {
|
|
129
|
+
user_id: number,
|
|
130
|
+
poh_market_id: number,
|
|
131
|
+
image_type: string,
|
|
132
|
+
category: string,
|
|
133
|
+
name: string,
|
|
134
|
+
app_id: string,
|
|
135
|
+
schema_id: string,
|
|
136
|
+
active: boolean,
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
type BindInfoType = {
|
|
140
|
+
progress_count: number,
|
|
141
|
+
progress_current: number,
|
|
142
|
+
total_assets: number,
|
|
143
|
+
wallet_count: number,
|
|
144
|
+
wallet_current: number,
|
|
145
|
+
cex_count: number,
|
|
146
|
+
cex_current: number,
|
|
147
|
+
social_count: number,
|
|
148
|
+
social_current: number,
|
|
149
|
+
others_count: number,
|
|
150
|
+
others_current: number,
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
type PohZkpassParams = {
|
|
154
|
+
taskId: string,
|
|
155
|
+
schemaId: string,
|
|
156
|
+
publicFields: any,
|
|
157
|
+
allocatorAddress: string,
|
|
158
|
+
publicFieldsHash: string,
|
|
159
|
+
allocatorSignature: string,
|
|
160
|
+
uHash: string,
|
|
161
|
+
validatorAddress: string,
|
|
162
|
+
validatorSignature: string,
|
|
163
|
+
}
|
|
164
|
+
type PopoverPositionType = "center" | "left" | "right"
|
|
165
|
+
type PopoverTypeType = "hover" | "click"
|
|
166
|
+
type PopoverProps = PropsWithChildren & {
|
|
167
|
+
position?: PopoverPositionType
|
|
168
|
+
type?: PopoverTypeType
|
|
169
|
+
content: ReactNode,
|
|
170
|
+
className?: string,
|
|
171
|
+
gap?: number | string
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
type LocaleType = "en" | "zh" | "tw" | "fr" | "ja" | "ko" | "vi" | "es" | "pt"
|
|
175
|
+
type WalletConfigType = {
|
|
176
|
+
type:"Base"|"UserPasscode"
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export type { ButtonProps as B, CEXType as C, EmailModalProps as E, IMatchEvents as I, LocaleType as L, ModalProps as M, OtherLoginMethodType as O, PopoverProps as P, RecommendLoginMethodType as R, WalletConfigType as W, IEnvConfigType as a, InputProps as b, ModalWithHeaderProps as c, LoginBoxProps as d, WalletType as e, PopoverPositionType as f, PopoverTypeType as g, LoginPanelProps as h, LoginModalProps as i, ISocialLoginMethod as j, OverviewInfo as k, LoginMethodType as l, IconProps as m, PohZkpassParams as n, BindItemType as o, BindInfoType as p, PohItemType as q };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type ISocialLoginMethod =
|
|
4
|
+
'google'
|
|
5
|
+
| 'twitter'
|
|
6
|
+
| 'discord'
|
|
7
|
+
| 'github'
|
|
8
|
+
| 'telegram'
|
|
9
|
+
| 'linkedin'
|
|
10
|
+
| 'facebook'
|
|
11
|
+
| 'youtube'
|
|
12
|
+
type WalletType = 'evm' | 'sol' | 'tron' | 'btc' | 'ton'
|
|
13
|
+
type LoginMethodType = WalletType | 'email' | ISocialLoginMethod
|
|
14
|
+
type CEXType = "Gate" | "Coinbase" | "Kucoin" | 'Bitget' | 'OKX' | 'Bybit' | 'Binance'
|
|
15
|
+
type OtherLoginMethodType = 'email' | ISocialLoginMethod
|
|
16
|
+
type RecommendLoginMethodType = 'wallet' | 'email' | ISocialLoginMethod
|
|
17
|
+
type IEnvConfigType = {
|
|
18
|
+
endpoints: {
|
|
19
|
+
back: string;
|
|
20
|
+
auth: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
type IMatchEvents = {
|
|
24
|
+
onLogin?: (data: {
|
|
25
|
+
mid?: string;
|
|
26
|
+
token: string;
|
|
27
|
+
did: string
|
|
28
|
+
}) => void
|
|
29
|
+
onLogout?: () => void,
|
|
30
|
+
onBind?: (data: {
|
|
31
|
+
type: string
|
|
32
|
+
}) => void
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type OverviewInfo = {
|
|
36
|
+
score: number,
|
|
37
|
+
total_assets: number,
|
|
38
|
+
wallets: number,
|
|
39
|
+
followers: number,
|
|
40
|
+
sbt: number,
|
|
41
|
+
is_kyc: boolean,
|
|
42
|
+
is_poh: boolean,
|
|
43
|
+
mid: string
|
|
44
|
+
user_identity: string
|
|
45
|
+
identities: { [key: string]: string }
|
|
46
|
+
did: string
|
|
47
|
+
address: string
|
|
48
|
+
username?: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type IconProps = {
|
|
52
|
+
color?: string,
|
|
53
|
+
size?: number | string,
|
|
54
|
+
width?: number | string,
|
|
55
|
+
height?: number | string,
|
|
56
|
+
style?: CSSProperties
|
|
57
|
+
className?: string
|
|
58
|
+
onClick?: (e?: any) => void
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type ModalProps = PropsWithChildren & {
|
|
62
|
+
isOpen: boolean,
|
|
63
|
+
width?: number
|
|
64
|
+
className?: string
|
|
65
|
+
zIndex?: number
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type ModalWithHeaderProps = ModalProps & {
|
|
69
|
+
onBack?: () => void,
|
|
70
|
+
onClose?: () => void,
|
|
71
|
+
title?: string
|
|
72
|
+
showClose?: boolean
|
|
73
|
+
showBorder?: boolean
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type InputProps = {
|
|
77
|
+
placeholder?: string,
|
|
78
|
+
value?: string,
|
|
79
|
+
onChange?: (e?: any) => void,
|
|
80
|
+
disabled?: boolean,
|
|
81
|
+
readonly?: boolean
|
|
82
|
+
type?: string
|
|
83
|
+
maxLength?: number
|
|
84
|
+
className?: string
|
|
85
|
+
after?: React.ReactNode
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
type LoginBoxProps = {
|
|
89
|
+
methods?: OtherLoginMethodType[],
|
|
90
|
+
inModal?: boolean
|
|
91
|
+
recommendMethods?: RecommendLoginMethodType[]
|
|
92
|
+
walletMethods?: WalletType[]
|
|
93
|
+
}
|
|
94
|
+
type LoginPanelProps = {
|
|
95
|
+
header?: React.ReactNode
|
|
96
|
+
onClose?: () => void
|
|
97
|
+
} & LoginBoxProps
|
|
98
|
+
type LoginModalProps = LoginPanelProps & ModalProps
|
|
99
|
+
type EmailModalProps = ModalProps & {
|
|
100
|
+
onClose?: () => void,
|
|
101
|
+
onBack?: () => void,
|
|
102
|
+
onLogin?: () => void
|
|
103
|
+
}
|
|
104
|
+
type ButtonProps = {
|
|
105
|
+
size?: 'sm' | 'df' | 'lg',
|
|
106
|
+
type?: "button" | "submit" | "reset",
|
|
107
|
+
rounded?: boolean,
|
|
108
|
+
block?: boolean,
|
|
109
|
+
disabled?: boolean,
|
|
110
|
+
loading?: boolean,
|
|
111
|
+
children?: React.ReactNode,
|
|
112
|
+
onClick?: () => void,
|
|
113
|
+
highlight?: boolean,
|
|
114
|
+
style?: CSSProperties
|
|
115
|
+
className?: string
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type BindItemType = {
|
|
119
|
+
type: string,
|
|
120
|
+
type_sort: string,
|
|
121
|
+
platform_name: string,
|
|
122
|
+
platform_id: number,
|
|
123
|
+
platform_uid: string,
|
|
124
|
+
platform_nickname: string,
|
|
125
|
+
platform_status: number
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
type PohItemType = {
|
|
129
|
+
user_id: number,
|
|
130
|
+
poh_market_id: number,
|
|
131
|
+
image_type: string,
|
|
132
|
+
category: string,
|
|
133
|
+
name: string,
|
|
134
|
+
app_id: string,
|
|
135
|
+
schema_id: string,
|
|
136
|
+
active: boolean,
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
type BindInfoType = {
|
|
140
|
+
progress_count: number,
|
|
141
|
+
progress_current: number,
|
|
142
|
+
total_assets: number,
|
|
143
|
+
wallet_count: number,
|
|
144
|
+
wallet_current: number,
|
|
145
|
+
cex_count: number,
|
|
146
|
+
cex_current: number,
|
|
147
|
+
social_count: number,
|
|
148
|
+
social_current: number,
|
|
149
|
+
others_count: number,
|
|
150
|
+
others_current: number,
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
type PohZkpassParams = {
|
|
154
|
+
taskId: string,
|
|
155
|
+
schemaId: string,
|
|
156
|
+
publicFields: any,
|
|
157
|
+
allocatorAddress: string,
|
|
158
|
+
publicFieldsHash: string,
|
|
159
|
+
allocatorSignature: string,
|
|
160
|
+
uHash: string,
|
|
161
|
+
validatorAddress: string,
|
|
162
|
+
validatorSignature: string,
|
|
163
|
+
}
|
|
164
|
+
type PopoverPositionType = "center" | "left" | "right"
|
|
165
|
+
type PopoverTypeType = "hover" | "click"
|
|
166
|
+
type PopoverProps = PropsWithChildren & {
|
|
167
|
+
position?: PopoverPositionType
|
|
168
|
+
type?: PopoverTypeType
|
|
169
|
+
content: ReactNode,
|
|
170
|
+
className?: string,
|
|
171
|
+
gap?: number | string
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
type LocaleType = "en" | "zh" | "tw" | "fr" | "ja" | "ko" | "vi" | "es" | "pt"
|
|
175
|
+
type WalletConfigType = {
|
|
176
|
+
type:"Base"|"UserPasscode"
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export type { ButtonProps as B, CEXType as C, EmailModalProps as E, IMatchEvents as I, LocaleType as L, ModalProps as M, OtherLoginMethodType as O, PopoverProps as P, RecommendLoginMethodType as R, WalletConfigType as W, IEnvConfigType as a, InputProps as b, ModalWithHeaderProps as c, LoginBoxProps as d, WalletType as e, PopoverPositionType as f, PopoverTypeType as g, LoginPanelProps as h, LoginModalProps as i, ISocialLoginMethod as j, OverviewInfo as k, LoginMethodType as l, IconProps as m, PohZkpassParams as n, BindItemType as o, BindInfoType as p, PohItemType as q };
|
package/example/package.json
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"react": "../node_modules/react",
|
|
18
18
|
"react-dom": "../node_modules/react-dom/profiling",
|
|
19
19
|
"axios": "../node_modules/axios",
|
|
20
|
-
"zustand": "../node_modules/zustand",
|
|
21
20
|
"react-router-dom": "../node_modules/react-router-dom",
|
|
22
21
|
"@types/react-router-dom": "../node_modules/@types/react-router-dom"
|
|
23
22
|
},
|
package/example/src/App.tsx
CHANGED
|
@@ -1,57 +1,32 @@
|
|
|
1
|
-
import React, {useEffect,
|
|
1
|
+
import React, {useEffect, useState} from "react";
|
|
2
2
|
import {MatchProvider} from "@matchain/matchid-sdk-react";
|
|
3
|
-
import {BrowserRouter as Router, Routes, Route, Link
|
|
3
|
+
import {BrowserRouter as Router, Routes, Route, Link} from 'react-router-dom';
|
|
4
4
|
import Home from "./pages/Home";
|
|
5
5
|
import './app.css'
|
|
6
6
|
import User from "./pages/User";
|
|
7
7
|
import "@matchain/matchid-sdk-react/index.css"
|
|
8
8
|
import Wallet from "@/pages/Wallet";
|
|
9
9
|
import {LocaleList} from "@/config";
|
|
10
|
-
import {LocaleType} from "@matchain/matchid-sdk-react/types";
|
|
11
|
-
import {useUserInfo} from "@matchain/matchid-sdk-react/hooks";
|
|
12
|
-
import RoutePrivate from "@/components/RoutePrivate";
|
|
13
|
-
import useLocalStore from "@/store/useLocalStore";
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
name: string,
|
|
22
|
-
url: string
|
|
23
|
-
onActive: boolean
|
|
24
|
-
hidden?: boolean
|
|
25
|
-
}[] = [
|
|
26
|
-
{
|
|
27
|
-
name: 'Home',
|
|
28
|
-
url: '/',
|
|
29
|
-
onActive: location.pathname === '/'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: 'User',
|
|
33
|
-
url: '/user',
|
|
34
|
-
onActive: location.pathname === '/user'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: 'Wallet',
|
|
38
|
-
url: '/wallet',
|
|
39
|
-
onActive: location.pathname === '/wallet',
|
|
40
|
-
hidden: !isLogin
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
return list
|
|
44
|
-
}, [location.pathname, isLogin])
|
|
45
|
-
return <nav className={`text-2xl mb-5 p-2 text-red-600 flex gap-10`}>
|
|
46
|
-
{menus.map((menu) => {
|
|
47
|
-
return <Link key={menu.url} to={menu.url}
|
|
48
|
-
className={`text-2xl ${menu.onActive ? 'text-red-600' : 'text-gray-400'}`}>{menu.name}</Link>
|
|
49
|
-
})}
|
|
50
|
-
</nav>
|
|
11
|
+
const getState = () => {
|
|
12
|
+
if (window.localStorage.getItem('match-local')) {
|
|
13
|
+
const state = JSON.parse(window.localStorage.getItem('match-local') as string)
|
|
14
|
+
return state.state
|
|
15
|
+
}
|
|
16
|
+
return null
|
|
51
17
|
}
|
|
52
18
|
|
|
53
19
|
function App() {
|
|
54
|
-
const
|
|
20
|
+
const state = getState()
|
|
21
|
+
const [appid, setAppid] = useState(state?.appid || '')
|
|
22
|
+
const [locale,setLocale] = useState(window.localStorage.getItem('locale')||'en')
|
|
23
|
+
useEffect(()=>{
|
|
24
|
+
window.localStorage.setItem('locale',locale)
|
|
25
|
+
},[locale])
|
|
26
|
+
const [endpoints, setEndpoints] = useState<{
|
|
27
|
+
auth: string,
|
|
28
|
+
back: string
|
|
29
|
+
}>(state?.endpoints)
|
|
55
30
|
|
|
56
31
|
return <MatchProvider appid={appid} endpoints={endpoints} locale={locale} events={{
|
|
57
32
|
onLogin: (data) => {
|
|
@@ -62,7 +37,7 @@ function App() {
|
|
|
62
37
|
}
|
|
63
38
|
}}
|
|
64
39
|
wallet={{
|
|
65
|
-
type:"
|
|
40
|
+
type:"Base"
|
|
66
41
|
}}
|
|
67
42
|
>
|
|
68
43
|
<Router>
|
|
@@ -88,22 +63,21 @@ function App() {
|
|
|
88
63
|
</div>
|
|
89
64
|
<div>
|
|
90
65
|
<label>Locale:</label>
|
|
91
|
-
<select onChange={(ele) => {
|
|
92
|
-
|
|
93
|
-
}} value={locale}>
|
|
94
|
-
{LocaleList.map((item) => <option key={item} value={item}>{item}</option>)}
|
|
66
|
+
<select onChange={(ele) => {setLocale(ele.target.value)}} value={locale}>
|
|
67
|
+
{LocaleList.map((item)=><option key={item} value={item}>{item}</option>)}
|
|
95
68
|
</select>
|
|
96
69
|
</div>
|
|
97
70
|
</div>
|
|
98
|
-
<
|
|
71
|
+
<nav className={`text-2xl mb-5 p-2 text-red-600 flex gap-10`}>
|
|
72
|
+
<Link to="/">Home</Link>
|
|
73
|
+
<Link to="/user">User</Link>
|
|
74
|
+
<Link to="/wallet">Wallet</Link>
|
|
75
|
+
</nav>
|
|
99
76
|
<div className={`p-4`}>
|
|
100
77
|
<Routes>
|
|
101
78
|
<Route path="/" element={<Home/>}/>
|
|
102
|
-
|
|
103
|
-
<Route element={<
|
|
104
|
-
<Route path="/user" element={<User/>}/>
|
|
105
|
-
<Route path="/wallet" element={<Wallet/>}/>
|
|
106
|
-
</Route>
|
|
79
|
+
<Route path="/user" element={<User/>}/>
|
|
80
|
+
<Route path="/wallet" element={<Wallet/>}/>
|
|
107
81
|
</Routes>
|
|
108
82
|
</div>
|
|
109
83
|
</Router>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {Hooks,Components} from "@matchain/matchid-sdk-react";
|
|
3
|
-
import {LoginMethod,
|
|
3
|
+
import {LoginMethod, WalletMethod} from "@/config";
|
|
4
4
|
import {LoginMethodType} from "../../../../src/types/types";
|
|
5
5
|
const { useUserInfo} = Hooks
|
|
6
6
|
const {EmailModal,LoginModal,LoginBox,LoginPanel} = Components
|
|
@@ -38,7 +38,7 @@ export default function Login(){
|
|
|
38
38
|
}}/>
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
<LoginModal isOpen={loginOpen} walletMethods={
|
|
41
|
+
<LoginModal isOpen={loginOpen} walletMethods={WalletMethod} onClose={() => setLoginOpen(false)} methods={[
|
|
42
42
|
'telegram',
|
|
43
43
|
'twitter',
|
|
44
44
|
'discord',
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {PropsWithChildren} from "react";
|
|
2
2
|
import Login from "../Login";
|
|
3
3
|
import {Hooks} from "@matchain/matchid-sdk-react";
|
|
4
|
-
import { Outlet} from 'react-router-dom';
|
|
5
4
|
|
|
6
|
-
export default function RoutePrivate() {
|
|
5
|
+
export default function RoutePrivate({children}: PropsWithChildren) {
|
|
7
6
|
const {isLogin} = Hooks.useUserInfo()
|
|
8
7
|
|
|
9
|
-
return isLogin ?
|
|
8
|
+
return isLogin ? <>{children}</> : <Login/>
|
|
10
9
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {WalletType} from "../../../src/types/types";
|
|
2
2
|
|
|
3
3
|
export const LoginMethod = [
|
|
4
|
-
"wallet",
|
|
5
4
|
'evm',
|
|
6
5
|
'sol',
|
|
7
6
|
'tron',
|
|
@@ -23,12 +22,8 @@ export const LocaleList = [
|
|
|
23
22
|
export const CEXList = [
|
|
24
23
|
"Gate", "Coinbase", "Kucoin", 'Bitget', 'OKX', 'Bybit', 'Binance']
|
|
25
24
|
|
|
26
|
-
export const
|
|
27
|
-
'btc', 'sol', 'evm', 'tron',"ton"
|
|
28
|
-
]
|
|
29
|
-
export const LoginMethodList : OtherLoginMethodType[] = ['twitter' , 'discord', 'github', 'telegram' ,'linkedin' , 'facebook' ,'youtube']
|
|
25
|
+
export const WalletMethod:WalletType[] = ["evm","sol","btc","tron","ton"]
|
|
30
26
|
|
|
31
|
-
export const RecommendLoginMethodList:RecommendLoginMethodType[] = ["wallet","email","google"]
|
|
32
27
|
|
|
33
28
|
export const LOGIN_METHOD_MAP = {
|
|
34
29
|
email: 'Email',
|