@matchain/matchid-sdk-react 0.1.42-alpha.2 → 0.1.42-alpha.3
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-2YN5Y3SM.mjs → chunk-AIYRR4YQ.mjs} +2 -2
- package/dist/chunk-KCESOJHY.mjs +4645 -0
- package/dist/chunk-KCESOJHY.mjs.map +1 -0
- package/dist/chunk-SQIJR7RA.mjs +29 -0
- package/dist/chunk-SQIJR7RA.mjs.map +1 -0
- package/dist/components/index.d.mts +3 -2
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +647 -452
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +4 -1
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +113 -76
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +3 -2
- package/dist/hooks/index.d.mts +5 -2
- package/dist/hooks/index.d.ts +5 -2
- package/dist/hooks/index.js +321 -151
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -1
- package/dist/{index-CxY3u9Rv.d.ts → index--yBVwkf9.d.ts} +13 -4
- package/dist/index-BxS06a5O.d.ts +50 -0
- package/dist/{index-DCReY5T2.d.mts → index-CGpyQlbI.d.mts} +13 -4
- package/dist/{index-GcpJCj6O.d.ts → index-Ca9nh_8s.d.ts} +1 -1
- package/dist/{index-DbjibQ5d.d.mts → index-DFZpfAfc.d.mts} +1 -1
- package/dist/index-DKMrpRJC.d.ts +137 -0
- package/dist/index-q5XDobUF.d.mts +50 -0
- package/dist/index-sOVSnYF4.d.mts +137 -0
- package/dist/index.css +84 -4
- package/dist/index.d.mts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +1033 -618
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/mpc-CTbBWHld.d.mts +20 -0
- package/dist/mpc-CTbBWHld.d.ts +20 -0
- package/dist/types/index.d.mts +3 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +44 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +10 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types-CVwZEgQ0.d.mts +244 -0
- package/dist/types-CVwZEgQ0.d.ts +244 -0
- package/example/package.json +1 -0
- package/example/src/App.tsx +54 -28
- package/example/src/components/ButtonGroup/index.tsx +10 -0
- package/example/src/components/Login/index.tsx +2 -2
- package/example/src/components/RoutePrivate/index.tsx +4 -3
- package/example/src/config/chains/index.ts +2 -0
- package/example/src/config/chains/matchMain.ts +27 -0
- package/example/src/config/chains/matchTest.ts +33 -0
- package/example/src/config/index.ts +6 -2
- package/example/src/pages/User/components/BindListModal.tsx +10 -0
- package/example/src/pages/User/components/PohListModal.tsx +10 -0
- package/example/src/pages/User/components/QueryDisplay.tsx +25 -0
- package/example/src/pages/{User.tsx → User/index.tsx} +55 -84
- package/example/src/pages/Wallet.tsx +133 -44
- package/example/src/store/useLocalStore.ts +45 -0
- package/package.json +7 -2
- package/dist/chunk-PZPEWHBV.mjs +0 -4251
- package/dist/chunk-PZPEWHBV.mjs.map +0 -1
- package/dist/index-B4YpKSY3.d.ts +0 -94
- package/dist/index-_k6h9w0P.d.mts +0 -94
- package/dist/types.d-DwF-Pkvh.d.mts +0 -179
- package/dist/types.d-DwF-Pkvh.d.ts +0 -179
- /package/dist/{chunk-2YN5Y3SM.mjs.map → chunk-AIYRR4YQ.mjs.map} +0 -0
package/example/src/App.tsx
CHANGED
|
@@ -1,32 +1,57 @@
|
|
|
1
|
-
import React, {useEffect, useState} from "react";
|
|
1
|
+
import React, {useEffect, useMemo, useState} from "react";
|
|
2
2
|
import {MatchProvider} from "@matchain/matchid-sdk-react";
|
|
3
|
-
import {BrowserRouter as Router, Routes, Route, Link} from 'react-router-dom';
|
|
3
|
+
import {BrowserRouter as Router, Routes, Route, Link, useLocation} 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";
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
|
|
16
|
+
function Nav() {
|
|
17
|
+
const {isLogin} = useUserInfo()
|
|
18
|
+
const location = useLocation()
|
|
19
|
+
const menus = useMemo(() => {
|
|
20
|
+
const list: {
|
|
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>
|
|
17
51
|
}
|
|
18
52
|
|
|
19
53
|
function App() {
|
|
20
|
-
const
|
|
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)
|
|
54
|
+
const {appid, setAppid,locale,setLocale,endpoints, setEndpoints}= useLocalStore()
|
|
30
55
|
|
|
31
56
|
return <MatchProvider appid={appid} endpoints={endpoints} locale={locale} events={{
|
|
32
57
|
onLogin: (data) => {
|
|
@@ -37,7 +62,7 @@ function App() {
|
|
|
37
62
|
}
|
|
38
63
|
}}
|
|
39
64
|
wallet={{
|
|
40
|
-
type:"
|
|
65
|
+
type:"UserPasscode"
|
|
41
66
|
}}
|
|
42
67
|
>
|
|
43
68
|
<Router>
|
|
@@ -63,21 +88,22 @@ function App() {
|
|
|
63
88
|
</div>
|
|
64
89
|
<div>
|
|
65
90
|
<label>Locale:</label>
|
|
66
|
-
<select onChange={(ele) => {
|
|
67
|
-
|
|
91
|
+
<select onChange={(ele) => {
|
|
92
|
+
setLocale(ele.target.value as LocaleType)
|
|
93
|
+
}} value={locale}>
|
|
94
|
+
{LocaleList.map((item) => <option key={item} value={item}>{item}</option>)}
|
|
68
95
|
</select>
|
|
69
96
|
</div>
|
|
70
97
|
</div>
|
|
71
|
-
<
|
|
72
|
-
<Link to="/">Home</Link>
|
|
73
|
-
<Link to="/user">User</Link>
|
|
74
|
-
<Link to="/wallet">Wallet</Link>
|
|
75
|
-
</nav>
|
|
98
|
+
<Nav/>
|
|
76
99
|
<div className={`p-4`}>
|
|
77
100
|
<Routes>
|
|
78
101
|
<Route path="/" element={<Home/>}/>
|
|
79
|
-
|
|
80
|
-
<Route
|
|
102
|
+
|
|
103
|
+
<Route element={<RoutePrivate/>}>
|
|
104
|
+
<Route path="/user" element={<User/>}/>
|
|
105
|
+
<Route path="/wallet" element={<Wallet/>}/>
|
|
106
|
+
</Route>
|
|
81
107
|
</Routes>
|
|
82
108
|
</div>
|
|
83
109
|
</Router>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {PropsWithChildren} from "react";
|
|
2
|
+
|
|
3
|
+
export default function ButtonGroup({children,title}: PropsWithChildren&{
|
|
4
|
+
title?: string
|
|
5
|
+
}) {
|
|
6
|
+
return <div className={`flex gap-[16px] flex-wrap items-center`}>
|
|
7
|
+
{title&&<div className={`text-xl`}>{title}</div>}
|
|
8
|
+
{children}
|
|
9
|
+
</div>
|
|
10
|
+
}
|
|
@@ -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, WalletList} 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={WalletList} onClose={() => setLoginOpen(false)} methods={[
|
|
42
42
|
'telegram',
|
|
43
43
|
'twitter',
|
|
44
44
|
'discord',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import Login from "../Login";
|
|
3
3
|
import {Hooks} from "@matchain/matchid-sdk-react";
|
|
4
|
+
import { Outlet} from 'react-router-dom';
|
|
4
5
|
|
|
5
|
-
export default function RoutePrivate(
|
|
6
|
+
export default function RoutePrivate() {
|
|
6
7
|
const {isLogin} = Hooks.useUserInfo()
|
|
7
8
|
|
|
8
|
-
return isLogin ?
|
|
9
|
+
return isLogin ? <Outlet/> : <Login/>
|
|
9
10
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {defineChain} from "viem";
|
|
2
|
+
|
|
3
|
+
export const matchMain = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 698,
|
|
5
|
+
name: "Matchain",
|
|
6
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
7
|
+
rpcUrls: {
|
|
8
|
+
default: {
|
|
9
|
+
http: ["https://rpc.matchain.io"],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
blockExplorers: {
|
|
13
|
+
default: {
|
|
14
|
+
name: "Matchscan",
|
|
15
|
+
url: "https://matchscan.io/",
|
|
16
|
+
apiUrl: "https://matchscan.io/api",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png",
|
|
20
|
+
contracts: {
|
|
21
|
+
multicall3: {
|
|
22
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
// testnet: true,
|
|
26
|
+
});
|
|
27
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineChain } from "viem"
|
|
3
|
+
|
|
4
|
+
export const matchTest = /*#__PURE__*/ defineChain({
|
|
5
|
+
id: 699,
|
|
6
|
+
name: "MatchTest",
|
|
7
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
8
|
+
rpcUrls: {
|
|
9
|
+
default: {
|
|
10
|
+
http: ["https://testnet-rpc.matchain.io"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
blockExplorers: {
|
|
14
|
+
default: {
|
|
15
|
+
name: "Matchscan",
|
|
16
|
+
url: "https://testnet.matchscan.io/",
|
|
17
|
+
apiUrl: "https://testnet.matchscan.io/api",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png",
|
|
21
|
+
contracts: {
|
|
22
|
+
multicall3: {
|
|
23
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
24
|
+
blockCreated: 751532,
|
|
25
|
+
},
|
|
26
|
+
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
27
|
+
ensUniversalResolver: {
|
|
28
|
+
address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
|
|
29
|
+
blockCreated: 5_317_080,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
// testnet: true,
|
|
33
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {WalletType} from "
|
|
1
|
+
import {LoginMethodType, WalletType,RecommendLoginMethodType,OtherLoginMethodType} from "@matchain/matchid-sdk-react/types";
|
|
2
2
|
|
|
3
3
|
export const LoginMethod = [
|
|
4
4
|
'evm',
|
|
@@ -22,8 +22,12 @@ export const LocaleList = [
|
|
|
22
22
|
export const CEXList = [
|
|
23
23
|
"Gate", "Coinbase", "Kucoin", 'Bitget', 'OKX', 'Bybit', 'Binance']
|
|
24
24
|
|
|
25
|
-
export const
|
|
25
|
+
export const WalletList:WalletType[] = [
|
|
26
|
+
'btc', 'sol', 'evm', 'tron',"ton"
|
|
27
|
+
]
|
|
28
|
+
export const LoginMethodList : OtherLoginMethodType[] = ['twitter' , 'discord', 'github', 'telegram' ,'linkedin' , 'facebook' ,'youtube']
|
|
26
29
|
|
|
30
|
+
export const RecommendLoginMethodList:RecommendLoginMethodType[] = ["wallet","email","google"]
|
|
27
31
|
|
|
28
32
|
export const LOGIN_METHOD_MAP = {
|
|
29
33
|
email: 'Email',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModalWithHeader } from '@matchain/matchid-sdk-react/components';
|
|
2
|
+
import React from "react";
|
|
3
|
+
import QueryDisplay from "@/pages/User/components/QueryDisplay";
|
|
4
|
+
import {Api} from "@matchain/matchid-sdk-react/index";
|
|
5
|
+
export default function BindListModal({isOpen, onClose}: {isOpen: boolean, onClose: () => void}) {
|
|
6
|
+
const bindListQuery = Api.bind.useBindList()
|
|
7
|
+
return <ModalWithHeader isOpen={isOpen} onClose={onClose} title={"BindListQuery"}>
|
|
8
|
+
<QueryDisplay query={bindListQuery} />
|
|
9
|
+
</ModalWithHeader>
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModalWithHeader } from '@matchain/matchid-sdk-react/components';
|
|
2
|
+
import React from "react";
|
|
3
|
+
import QueryDisplay from "@/pages/User/components/QueryDisplay";
|
|
4
|
+
import {Api} from "@matchain/matchid-sdk-react/index";
|
|
5
|
+
export default function PohListModal({isOpen, onClose}: {isOpen: boolean, onClose: () => void}) {
|
|
6
|
+
const pohListQuery = Api.poh.usePohList()
|
|
7
|
+
return <ModalWithHeader isOpen={isOpen} onClose={onClose} title={"PohListQuery"}>
|
|
8
|
+
<QueryDisplay query={pohListQuery} />
|
|
9
|
+
</ModalWithHeader>
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {Button} from "@matchain/matchid-sdk-react/components";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export default function QueryDisplay(
|
|
5
|
+
{
|
|
6
|
+
query
|
|
7
|
+
}: {
|
|
8
|
+
query: any
|
|
9
|
+
}
|
|
10
|
+
) {
|
|
11
|
+
const keys = Object.keys(query)
|
|
12
|
+
return <div className={`max-h-[60vw] overflow-scroll`}>
|
|
13
|
+
{keys.map((key) => {
|
|
14
|
+
return <div key={key} className={`flex gap-[12px]`}>
|
|
15
|
+
<div className={"w-[110px] break-all"}>{key}</div>
|
|
16
|
+
<div className={`flex-1 flex-wrap break-all`}>{
|
|
17
|
+
typeof query[key] === 'function' ? <Button size="sm" onClick={() => {
|
|
18
|
+
query[key]()
|
|
19
|
+
}}>Run</Button> :
|
|
20
|
+
JSON.stringify(query[key])}</div>
|
|
21
|
+
</div>
|
|
22
|
+
})}
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -1,47 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const {useMatchEvents, useUserInfo, useWallet} = Hooks
|
|
8
|
-
const {
|
|
1
|
+
import React, {useState} from "react";
|
|
2
|
+
import {CEXList, LOGIN_METHOD_MAP, LoginMethod, LoginMethodList, RecommendLoginMethodList, WalletList} from "@/config";
|
|
3
|
+
import {CEXType, LoginMethodType} from "@matchain/matchid-sdk-react/types";
|
|
4
|
+
import {useMatchEvents, useUserInfo, useWallet} from "@matchain/matchid-sdk-react/hooks";
|
|
5
|
+
import {
|
|
9
6
|
LoginButton,
|
|
10
7
|
UsernameModal,
|
|
11
8
|
PasswordModal,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
name,
|
|
18
|
-
query
|
|
19
|
-
}: {
|
|
20
|
-
name: string
|
|
21
|
-
query: any
|
|
22
|
-
}
|
|
23
|
-
) {
|
|
24
|
-
const keys = Object.keys(query)
|
|
25
|
-
return <div>
|
|
26
|
-
<div className={`font-bold text-lg`}>{name}</div>
|
|
27
|
-
{keys.map((key) => {
|
|
28
|
-
return <div key={key} className={`flex gap-[20px]`}>
|
|
29
|
-
<div className={"w-[200px]"}>{key}</div>
|
|
30
|
-
<div className={`flex-1 flex-wrap break-all`}>{
|
|
31
|
-
typeof query[key] === 'function' ? <Button size="sm" onClick={() => {
|
|
32
|
-
query[key]()
|
|
33
|
-
}}>Run</Button> :
|
|
34
|
-
JSON.stringify(query[key])}</div>
|
|
35
|
-
</div>
|
|
36
|
-
})}
|
|
37
|
-
</div>
|
|
9
|
+
} from "@matchain/matchid-sdk-react/components";
|
|
10
|
+
import BindListModal from "@/pages/User/components/BindListModal";
|
|
11
|
+
import PohListModal from "@/pages/User/components/PohListModal";
|
|
12
|
+
import ButtonGroup from "@/components/ButtonGroup";
|
|
38
13
|
|
|
39
|
-
}
|
|
40
14
|
|
|
41
15
|
function LoginContent() {
|
|
42
|
-
const bindListQuery = Api.bind.useBindList()
|
|
43
|
-
const pohListQuery = Api.poh.usePohList()
|
|
44
|
-
|
|
45
16
|
const {
|
|
46
17
|
token,
|
|
47
18
|
logout,
|
|
@@ -54,8 +25,9 @@ function LoginContent() {
|
|
|
54
25
|
bindCex,
|
|
55
26
|
getAuthInfo
|
|
56
27
|
} = useUserInfo();
|
|
57
|
-
const [usernameOpen, setUsernameOpen] =
|
|
58
|
-
const [passwordOpen, setPasswordOpen] =
|
|
28
|
+
const [usernameOpen, setUsernameOpen] = useState(false)
|
|
29
|
+
const [passwordOpen, setPasswordOpen] = useState(false)
|
|
30
|
+
const [modal, setModal] = useState<'bindList' | 'pohList' | ''>('')
|
|
59
31
|
const refreshOv = async () => {
|
|
60
32
|
await refreshOverview()
|
|
61
33
|
alert('refreshed')
|
|
@@ -70,25 +42,30 @@ function LoginContent() {
|
|
|
70
42
|
}
|
|
71
43
|
}
|
|
72
44
|
|
|
73
|
-
const onGetInfo = async (method: string) => {
|
|
74
|
-
try {
|
|
75
|
-
const res = await getAuthInfo(method)
|
|
76
|
-
console.log('getAuthInfo', res)
|
|
77
|
-
} catch (e) {
|
|
78
|
-
console.error('getAuthInfo', e)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
45
|
return <div className={`flex flex-col gap-[10px]`}>
|
|
83
46
|
<h1 className={`text-2xl`}>You are already logged in</h1>
|
|
84
47
|
<div className={`text-ellipsis break-words`}>token:{token}</div>
|
|
85
48
|
<div className={`text-ellipsis break-words`}>username:{username}</div>
|
|
86
49
|
<div className={`text-ellipsis break-words`}>did:{did}</div>
|
|
87
50
|
<div className={`text-ellipsis break-words`}>address:{address}</div>
|
|
88
|
-
|
|
51
|
+
|
|
52
|
+
<ButtonGroup title={"User"}>
|
|
89
53
|
<button className={`bg-gray-300 p-1 rounded`}
|
|
90
54
|
onClick={() => setUsernameOpen(true)}>Set username
|
|
91
55
|
</button>
|
|
56
|
+
|
|
57
|
+
<button className={`bg-gray-300 p-1 rounded mr-5`}
|
|
58
|
+
onClick={() => setPasswordOpen(true)}>Set Password
|
|
59
|
+
</button>
|
|
60
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
61
|
+
onClick={onAuth}>Third party auth
|
|
62
|
+
</button>
|
|
63
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
64
|
+
onClick={refreshOv}>Refresh Overview
|
|
65
|
+
</button>
|
|
66
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
67
|
+
onClick={logout}>Logout
|
|
68
|
+
</button>
|
|
92
69
|
<UsernameModal isOpen={usernameOpen} onClose={() => setUsernameOpen(false)} onBack={() => {
|
|
93
70
|
console.log('set username modal back event')
|
|
94
71
|
setUsernameOpen(false)
|
|
@@ -96,9 +73,6 @@ function LoginContent() {
|
|
|
96
73
|
alert('set username success')
|
|
97
74
|
setUsernameOpen(false)
|
|
98
75
|
}}/>
|
|
99
|
-
<button className={`bg-gray-300 p-1 rounded mr-5`}
|
|
100
|
-
onClick={() => setPasswordOpen(true)}>Set Password
|
|
101
|
-
</button>
|
|
102
76
|
<PasswordModal isOpen={passwordOpen} onClose={() => setPasswordOpen(false)} onBack={() => {
|
|
103
77
|
console.log('set password modal back event')
|
|
104
78
|
setPasswordOpen(false)
|
|
@@ -106,11 +80,8 @@ function LoginContent() {
|
|
|
106
80
|
alert('set password success')
|
|
107
81
|
setPasswordOpen(false)
|
|
108
82
|
}}/>
|
|
109
|
-
</
|
|
110
|
-
<
|
|
111
|
-
<div>
|
|
112
|
-
Bind
|
|
113
|
-
</div>
|
|
83
|
+
</ButtonGroup>
|
|
84
|
+
<ButtonGroup title={"Bind"}>
|
|
114
85
|
{
|
|
115
86
|
LoginMethod.map((method) => {
|
|
116
87
|
return <button key={method} className={`bg-gray-300 p-1 capitalize rounded`}
|
|
@@ -118,41 +89,37 @@ function LoginContent() {
|
|
|
118
89
|
</button>
|
|
119
90
|
})
|
|
120
91
|
}
|
|
121
|
-
</
|
|
122
|
-
<
|
|
123
|
-
<div>
|
|
124
|
-
GetAuthInfo
|
|
125
|
-
</div>
|
|
92
|
+
</ButtonGroup>
|
|
93
|
+
<ButtonGroup title={"Bind CEX"}>
|
|
126
94
|
{
|
|
127
|
-
|
|
128
|
-
return <button key={method} className={`bg-gray-300 p-1 rounded`}
|
|
129
|
-
onClick={
|
|
95
|
+
CEXList.map((method) => {
|
|
96
|
+
return <button key={method} className={`bg-gray-300 p-1 capitalize rounded`}
|
|
97
|
+
onClick={() => bindCex(method as CEXType)}>CEX {method}
|
|
98
|
+
</button>
|
|
130
99
|
})
|
|
131
100
|
}
|
|
132
|
-
</
|
|
133
|
-
<
|
|
101
|
+
</ButtonGroup>
|
|
102
|
+
<ButtonGroup title={"getAuthInfo"}>
|
|
134
103
|
{
|
|
135
|
-
|
|
104
|
+
Object.keys(LOGIN_METHOD_MAP).map((method) => {
|
|
136
105
|
return <button key={method} className={`bg-gray-300 p-1 capitalize rounded`}
|
|
137
|
-
onClick={() =>
|
|
106
|
+
onClick={() => getAuthInfo(method as keyof typeof LOGIN_METHOD_MAP)}>{LOGIN_METHOD_MAP[method as keyof typeof LOGIN_METHOD_MAP]}
|
|
138
107
|
</button>
|
|
139
108
|
})
|
|
140
109
|
}
|
|
141
|
-
</
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
onClick={onAuth}>Third party auth
|
|
145
|
-
</button>
|
|
110
|
+
</ButtonGroup>
|
|
111
|
+
|
|
112
|
+
<ButtonGroup title={"QueryList"}>
|
|
146
113
|
<button className={`bg-gray-300 p-1 rounded`}
|
|
147
|
-
onClick={
|
|
114
|
+
onClick={() => setModal('bindList')}>BindList
|
|
148
115
|
</button>
|
|
149
116
|
<button className={`bg-gray-300 p-1 rounded`}
|
|
150
|
-
onClick={
|
|
117
|
+
onClick={() => setModal('pohList')}>PohList
|
|
151
118
|
</button>
|
|
152
|
-
</
|
|
119
|
+
</ButtonGroup>
|
|
153
120
|
|
|
154
|
-
<
|
|
155
|
-
<
|
|
121
|
+
<BindListModal isOpen={modal == 'bindList'} onClose={() => setModal('')}/>
|
|
122
|
+
<PohListModal isOpen={modal == 'pohList'} onClose={() => setModal('')}/>
|
|
156
123
|
</div>
|
|
157
124
|
|
|
158
125
|
}
|
|
@@ -174,11 +141,15 @@ export default function User() {
|
|
|
174
141
|
<div className={`font-bold text-lg`}>LoginButton</div>
|
|
175
142
|
|
|
176
143
|
<div className={`bg-gray-100 p-5 mt-5`}>
|
|
177
|
-
<LoginButton
|
|
144
|
+
<LoginButton
|
|
145
|
+
methods={LoginMethodList}
|
|
146
|
+
recommendMethods={RecommendLoginMethodList}
|
|
147
|
+
popoverPosition={"left"}
|
|
148
|
+
walletMethods={WalletList}
|
|
149
|
+
/>
|
|
178
150
|
</div>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
</RoutePrivate>
|
|
151
|
+
|
|
152
|
+
<LoginContent/>
|
|
182
153
|
|
|
183
154
|
|
|
184
155
|
</div>
|