@matchain/matchid-sdk-react 0.1.50-alpha.0 → 0.1.50
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/{chunk-ZM2P5GEL.mjs → chunk-6KB4RLTC.mjs} +2 -2
- package/dist/{chunk-P3WHQUXO.mjs → chunk-JLQVDNWZ.mjs} +13 -11
- package/dist/chunk-JLQVDNWZ.mjs.map +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +2 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/example/package.json +2 -1
- package/example/src/App.tsx +8 -1
- package/example/src/main.tsx +2 -0
- package/example/src/pages/TgApp/index.tsx +44 -0
- package/example/src/pages/Wallet/index.tsx +1 -1
- package/example/yarn.lock +5 -0
- package/package.json +1 -1
- package/dist/chunk-P3WHQUXO.mjs.map +0 -1
- /package/dist/{chunk-ZM2P5GEL.mjs.map → chunk-6KB4RLTC.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-HBOS3RBL.mjs";
|
|
7
7
|
import {
|
|
8
8
|
api_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6KB4RLTC.mjs";
|
|
10
10
|
import {
|
|
11
11
|
MatchProvider,
|
|
12
12
|
ModalProvider,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
components_exports,
|
|
15
15
|
hooks_exports,
|
|
16
16
|
useMatch
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-JLQVDNWZ.mjs";
|
|
18
18
|
import "./chunk-UA6XHZHX.mjs";
|
|
19
19
|
import {
|
|
20
20
|
ui_exports
|
package/example/package.json
CHANGED
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
"@types/react-router-dom": "../node_modules/@types/react-router-dom"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@matchain/matchid-sdk-react": "../dist",
|
|
25
26
|
"@zerodev/webauthn-key": "5.3.3",
|
|
26
|
-
"
|
|
27
|
+
"eruda": "^3.4.1"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/node": "^22.9.0",
|
package/example/src/App.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import RoutePrivate from "@/components/RoutePrivate";
|
|
|
13
13
|
import useLocalStore from "@/store/useLocalStore";
|
|
14
14
|
import {LoginButton} from "@matchain/matchid-sdk-react/components";
|
|
15
15
|
import UI from "@/pages/UI";
|
|
16
|
+
import TgApp from "@/pages/TgApp";
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
function Nav() {
|
|
@@ -35,6 +36,11 @@ function Nav() {
|
|
|
35
36
|
url: '/ui',
|
|
36
37
|
onActive: location.pathname === '/ui'
|
|
37
38
|
},
|
|
39
|
+
{
|
|
40
|
+
name: 'TgApp',
|
|
41
|
+
url: '/tgapp',
|
|
42
|
+
onActive: location.pathname === '/tgapp'
|
|
43
|
+
},
|
|
38
44
|
{
|
|
39
45
|
name: 'User',
|
|
40
46
|
url: '/user',
|
|
@@ -53,7 +59,7 @@ function Nav() {
|
|
|
53
59
|
<nav className={`text-2xl mb-5 p-2 text-red-600 flex gap-10 flex-wrap`}>
|
|
54
60
|
{menus.map((menu) => {
|
|
55
61
|
return <Link key={menu.url} to={menu.url}
|
|
56
|
-
className={`text-2xl ${menu.onActive ? 'text-red-600' : 'text-gray-400'}`}>{menu.name}</Link>
|
|
62
|
+
className={`text-2xl ${menu.onActive ? 'text-red-600' : 'text-gray-400'} ${menu.hidden?'hidden' :''}`}>{menu.name}</Link>
|
|
57
63
|
})}
|
|
58
64
|
|
|
59
65
|
<LoginButton/>
|
|
@@ -100,6 +106,7 @@ function RouterApp() {
|
|
|
100
106
|
<Routes>
|
|
101
107
|
<Route path="/" element={<Home/>}/>
|
|
102
108
|
<Route path="/ui" element={<UI/>}/>
|
|
109
|
+
<Route path="/tgapp" element={<TgApp/>}/>
|
|
103
110
|
<Route element={<RoutePrivate/>}>
|
|
104
111
|
<Route path="/user" element={<User/>}/>
|
|
105
112
|
<Route path="/wallet" element={<Wallet/>}/>
|
package/example/src/main.tsx
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {Button} from "@matchain/matchid-sdk-react/ui";
|
|
2
|
+
import {useUserInfo, useWallet} from "@matchain/matchid-sdk-react/hooks";
|
|
3
|
+
import {useState} from "react";
|
|
4
|
+
|
|
5
|
+
export default function TgApp(){
|
|
6
|
+
const {login,isLogin,getAuthInfo} = useUserInfo()
|
|
7
|
+
const {address} = useWallet()
|
|
8
|
+
const [authInfo,setAuthInfo] = useState<any>()
|
|
9
|
+
const telegramLogin = async () => {
|
|
10
|
+
return login('telegram')
|
|
11
|
+
}
|
|
12
|
+
const telegramAuth = async () => {
|
|
13
|
+
try{
|
|
14
|
+
const res = await getAuthInfo('telegram')
|
|
15
|
+
setAuthInfo(JSON.stringify(res))
|
|
16
|
+
}catch(error:any){
|
|
17
|
+
setAuthInfo('error:'+error.message)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
return <div className={`flex flex-col gap-[10px]`}>
|
|
22
|
+
<div className={`flex`}>
|
|
23
|
+
<Button onClick={telegramLogin} disabled={isLogin}>1.Login by Telegram</Button>
|
|
24
|
+
</div>
|
|
25
|
+
<div className={"text-green-500"}>
|
|
26
|
+
Code: login('telegram')
|
|
27
|
+
</div>
|
|
28
|
+
<div className={`break-all`}>
|
|
29
|
+
2.Auto generate wallet:{address ||'-'}
|
|
30
|
+
</div>
|
|
31
|
+
<div>
|
|
32
|
+
<Button onClick={telegramAuth} disabled={!isLogin}>3.Get Telegram auth info</Button>
|
|
33
|
+
</div>
|
|
34
|
+
<div className={"text-green-500"}>
|
|
35
|
+
Code: getAuthInfo('telegram')
|
|
36
|
+
</div>
|
|
37
|
+
<div className={`break-all`}>
|
|
38
|
+
AuthResult:{authInfo||'-'}
|
|
39
|
+
</div>
|
|
40
|
+
<div className={`break-all`}>
|
|
41
|
+
4.Send auth result to server and verify.<a href={"https://docs.matchid.ai/api/method/auth/verify.html"} target={"_blank"} className={'text-red-600'}>Click here to read api</a>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
}
|
|
@@ -307,7 +307,7 @@ function ERC20() {
|
|
|
307
307
|
return formatUnits(balanceQuery.data,decimalsQuery.data)
|
|
308
308
|
},[balanceQuery.data,decimalsQuery.data])
|
|
309
309
|
|
|
310
|
-
console.log(balanceQuery,symbolQuery,decimalsQuery)
|
|
310
|
+
// console.log(balanceQuery,symbolQuery,decimalsQuery)
|
|
311
311
|
|
|
312
312
|
function Transfer(){
|
|
313
313
|
const [to, setTo] = useState(address)
|
package/example/yarn.lock
CHANGED
|
@@ -718,6 +718,11 @@ emoji-regex@^9.2.2:
|
|
|
718
718
|
resolved "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-9.2.2.tgz"
|
|
719
719
|
integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==
|
|
720
720
|
|
|
721
|
+
eruda@^3.4.1:
|
|
722
|
+
version "3.4.1"
|
|
723
|
+
resolved "https://registry.yarnpkg.com/eruda/-/eruda-3.4.1.tgz#5ff04fa2c55c3a5f4998e48c952adb759307b53f"
|
|
724
|
+
integrity sha512-RmaO5yD97URY/9Q0lye3cmmNPoXNKreeePIw7c/zllbscR92CjGFZFuQ70+0fLIvLcKW3Xha8DS8NFhmeNbEBQ==
|
|
725
|
+
|
|
721
726
|
esbuild@^0.21.3:
|
|
722
727
|
version "0.21.5"
|
|
723
728
|
resolved "https://registry.npmmirror.com/esbuild/-/esbuild-0.21.5.tgz"
|