@matchain/matchid-sdk-react 0.1.12 → 0.1.14
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/index.d.mts +21 -9
- package/dist/index.d.ts +21 -9
- package/dist/index.js +91 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -90
- package/dist/index.mjs.map +1 -1
- package/example/src/App.tsx +16 -12
- package/example/src/pages/User.tsx +13 -0
- package/example/src/pages/Wallet.tsx +1 -1
- package/package.json +1 -1
package/example/src/App.tsx
CHANGED
|
@@ -19,10 +19,12 @@ const getState = () => {
|
|
|
19
19
|
function App() {
|
|
20
20
|
const state = getState()
|
|
21
21
|
const [appid, setAppid] = useState(state?.appid || '')
|
|
22
|
-
const [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const [endpoints, setEndpoints] = useState<{
|
|
23
|
+
auth: string,
|
|
24
|
+
back: string
|
|
25
|
+
}>(state?.endpoints)
|
|
26
|
+
|
|
27
|
+
return <MatchProvider appid={appid} endpoints={endpoints} events={{
|
|
26
28
|
onLogin: (data) => {
|
|
27
29
|
console.log('events.onLogin', data)
|
|
28
30
|
},
|
|
@@ -37,14 +39,16 @@ function App() {
|
|
|
37
39
|
<input value={appid} placeholder={"Appid"} className={"border-solid border"} onChange={(ele) => {
|
|
38
40
|
setAppid(ele.target.value)
|
|
39
41
|
}}/>
|
|
40
|
-
<label>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
<label>AuthEndpoint:</label>
|
|
43
|
+
<input value={endpoints?.auth || ''} placeholder={"Auth Endpoint"} className={"border-solid border"}
|
|
44
|
+
onChange={(ele) => {
|
|
45
|
+
setEndpoints({...endpoints, auth: ele.target.value})
|
|
46
|
+
}}/>
|
|
47
|
+
<label>BackEndpoint:</label>
|
|
48
|
+
<input value={endpoints?.back || ''} placeholder={"Back Endpoint"} className={"border-solid border"}
|
|
49
|
+
onChange={(ele) => {
|
|
50
|
+
setEndpoints({...endpoints, back: ele.target.value})
|
|
51
|
+
}}/>
|
|
48
52
|
</div>
|
|
49
53
|
<nav className={`text-2xl mb-5 p-2 text-red-600 flex gap-10`}>
|
|
50
54
|
<Link to="/">Home</Link>
|
|
@@ -49,6 +49,7 @@ function LoginContent() {
|
|
|
49
49
|
address,
|
|
50
50
|
bindWallet,
|
|
51
51
|
bindTelegram,
|
|
52
|
+
auth
|
|
52
53
|
} = useUserInfo();
|
|
53
54
|
const [usernameOpen, setUsernameOpen] = React.useState(false)
|
|
54
55
|
const [passwordOpen, setPasswordOpen] = React.useState(false)
|
|
@@ -57,6 +58,15 @@ function LoginContent() {
|
|
|
57
58
|
alert('refreshed')
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
const onAuth = async () => {
|
|
62
|
+
try {
|
|
63
|
+
const res = await auth()
|
|
64
|
+
console.log('auth', res)
|
|
65
|
+
} catch (e) {
|
|
66
|
+
console.error('auth', e)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
60
70
|
return <div>
|
|
61
71
|
<h1 className={`text-2xl`}>You are already logged in</h1>
|
|
62
72
|
<div className={`text-ellipsis break-words`}>token:{token}</div>
|
|
@@ -91,6 +101,9 @@ function LoginContent() {
|
|
|
91
101
|
onClick={bindTelegram}>Bind telegram
|
|
92
102
|
</button>
|
|
93
103
|
</div>
|
|
104
|
+
<button className={`bg-gray-300 p-1 rounded mr-5`}
|
|
105
|
+
onClick={onAuth}>Third party auth
|
|
106
|
+
</button>
|
|
94
107
|
<button className={`bg-gray-300 p-1 rounded mr-5`}
|
|
95
108
|
onClick={refreshOv}>Refresh Overview
|
|
96
109
|
</button>
|
|
@@ -8,7 +8,7 @@ const {useWallet} = Hooks
|
|
|
8
8
|
|
|
9
9
|
export default function Wallet() {
|
|
10
10
|
const [message, setMessage] = useState('hello')
|
|
11
|
-
const [toAddress, setToAddress] = useState('
|
|
11
|
+
const [toAddress, setToAddress] = useState('')
|
|
12
12
|
const [toAmount, setToAmount] = useState('0.0001')
|
|
13
13
|
const [data, setToData] = useState('0x')
|
|
14
14
|
const {address, evmAccount} = useWallet()
|