@matchain/matchid-sdk-react 0.1.7
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.css +461 -0
- package/dist/index.d.mts +211 -0
- package/dist/index.d.ts +211 -0
- package/dist/index.js +1990 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1956 -0
- package/dist/index.mjs.map +1 -0
- package/example/index.html +13 -0
- package/example/package-lock.json +2965 -0
- package/example/package.json +34 -0
- package/example/postcss.config.js +6 -0
- package/example/src/App.tsx +61 -0
- package/example/src/app.css +3 -0
- package/example/src/config/contract.ts +154 -0
- package/example/src/main.tsx +5 -0
- package/example/src/pages/Home.tsx +36 -0
- package/example/src/pages/Login.tsx +165 -0
- package/example/tailwind.config.js +11 -0
- package/example/tsconfig.json +17 -0
- package/example/vite.config.ts +13 -0
- package/example/yarn.lock +1373 -0
- package/package.json +58 -0
- package/readme.md +5 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"preview": "vite preview",
|
|
9
|
+
"sdk": "rm -rf node_modules && yarn install"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "matchain.io",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"description": "",
|
|
15
|
+
"alias": {
|
|
16
|
+
"react": "../node_modules/react",
|
|
17
|
+
"react-dom": "../node_modules/react-dom/profiling",
|
|
18
|
+
"axios": "../node_modules/axios",
|
|
19
|
+
"react-router-dom": "../node_modules/react-router-dom",
|
|
20
|
+
"@types/react-router-dom": "../node_modules/@types/react-router-dom"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@zerodev/webauthn-key": "5.3.3",
|
|
24
|
+
"@matchain/mid": "../dist"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^22.9.0",
|
|
28
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
29
|
+
"autoprefixer": "^10.4.20",
|
|
30
|
+
"postcss": "^8.4.47",
|
|
31
|
+
"tailwindcss": "^3.4.14",
|
|
32
|
+
"vite": "^5.4.10"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, {useState} from "react";
|
|
2
|
+
import {MatchProvider} from "@matchain/mid";
|
|
3
|
+
import {BrowserRouter as Router, Routes, Route, Link} from 'react-router-dom';
|
|
4
|
+
import Home from "./pages/Home";
|
|
5
|
+
import './app.css'
|
|
6
|
+
import Login from "./pages/Login";
|
|
7
|
+
import "@matchain/mid/index.css"
|
|
8
|
+
|
|
9
|
+
const getState = () => {
|
|
10
|
+
if (window.localStorage.getItem('match-local')) {
|
|
11
|
+
const state = JSON.parse(window.localStorage.getItem('match-local') as string)
|
|
12
|
+
return state.state
|
|
13
|
+
}
|
|
14
|
+
return null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function App() {
|
|
18
|
+
const state = getState()
|
|
19
|
+
const [appid, setAppid] = useState(state?.appid || '')
|
|
20
|
+
const [env, setEnv] = useState<"main" | "dev" | "test">(state?.env || 'main')
|
|
21
|
+
//matchain team will debug in dev env
|
|
22
|
+
const isMatchainTeam = !!window.localStorage.getItem("isMatchainTeam")
|
|
23
|
+
return <MatchProvider appid={appid} env={env} events={{
|
|
24
|
+
onLogin: (data) => {
|
|
25
|
+
console.log('events.onLogin', data)
|
|
26
|
+
},
|
|
27
|
+
onLogout: () => {
|
|
28
|
+
console.log('events.onLogout')
|
|
29
|
+
}
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<Router>
|
|
33
|
+
<div className={`mb-2 p-2 flex gap-2`}>
|
|
34
|
+
<label>Appid:</label>
|
|
35
|
+
<input value={appid} placeholder={"Appid"} className={"border-solid border"} onChange={(ele) => {
|
|
36
|
+
setAppid(ele.target.value)
|
|
37
|
+
}}/>
|
|
38
|
+
<label>Env:</label>
|
|
39
|
+
<select value={env} onChange={(ele) => {
|
|
40
|
+
setEnv(ele.target.value as any)
|
|
41
|
+
}}>
|
|
42
|
+
<option value="main">main</option>
|
|
43
|
+
<option value="test">test</option>
|
|
44
|
+
{isMatchainTeam && <option value="dev">dev</option>}
|
|
45
|
+
</select>
|
|
46
|
+
</div>
|
|
47
|
+
<nav className={`text-2xl mb-5 p-2 text-red-600 flex gap-10`}>
|
|
48
|
+
<Link to="/">Home</Link>
|
|
49
|
+
<Link to="/login">Login</Link>
|
|
50
|
+
</nav>
|
|
51
|
+
<div className={`p-4`}>
|
|
52
|
+
<Routes>
|
|
53
|
+
<Route path="/" element={<Home/>}/>
|
|
54
|
+
<Route path="/login" element={<Login/>}/>
|
|
55
|
+
</Routes>
|
|
56
|
+
</div>
|
|
57
|
+
</Router>
|
|
58
|
+
</MatchProvider>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default App;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
export const address = "0x4143e29770fd63e24bb1f32d50bf8a590e34de4b"
|
|
2
|
+
export const abi = [{"inputs": [], "stateMutability": "nonpayable", "type": "constructor"}, {
|
|
3
|
+
"anonymous": false,
|
|
4
|
+
"inputs": [{
|
|
5
|
+
"indexed": true,
|
|
6
|
+
"internalType": "address",
|
|
7
|
+
"name": "owner",
|
|
8
|
+
"type": "address"
|
|
9
|
+
}, {
|
|
10
|
+
"indexed": true,
|
|
11
|
+
"internalType": "address",
|
|
12
|
+
"name": "spender",
|
|
13
|
+
"type": "address"
|
|
14
|
+
}, {"indexed": false, "internalType": "uint256", "name": "value", "type": "uint256"}],
|
|
15
|
+
"name": "Approval",
|
|
16
|
+
"type": "event"
|
|
17
|
+
}, {
|
|
18
|
+
"anonymous": false,
|
|
19
|
+
"inputs": [{
|
|
20
|
+
"indexed": true,
|
|
21
|
+
"internalType": "address",
|
|
22
|
+
"name": "from",
|
|
23
|
+
"type": "address"
|
|
24
|
+
}, {"indexed": true, "internalType": "address", "name": "to", "type": "address"}, {
|
|
25
|
+
"indexed": false,
|
|
26
|
+
"internalType": "uint256",
|
|
27
|
+
"name": "value",
|
|
28
|
+
"type": "uint256"
|
|
29
|
+
}],
|
|
30
|
+
"name": "Transfer",
|
|
31
|
+
"type": "event"
|
|
32
|
+
}, {
|
|
33
|
+
"inputs": [{
|
|
34
|
+
"internalType": "address",
|
|
35
|
+
"name": "owner",
|
|
36
|
+
"type": "address"
|
|
37
|
+
}, {"internalType": "address", "name": "spender", "type": "address"}],
|
|
38
|
+
"name": "allowance",
|
|
39
|
+
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
40
|
+
"stateMutability": "view",
|
|
41
|
+
"type": "function"
|
|
42
|
+
}, {
|
|
43
|
+
"inputs": [{
|
|
44
|
+
"internalType": "address",
|
|
45
|
+
"name": "spender",
|
|
46
|
+
"type": "address"
|
|
47
|
+
}, {"internalType": "uint256", "name": "amount", "type": "uint256"}],
|
|
48
|
+
"name": "approve",
|
|
49
|
+
"outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
|
|
50
|
+
"stateMutability": "nonpayable",
|
|
51
|
+
"type": "function"
|
|
52
|
+
}, {
|
|
53
|
+
"inputs": [{"internalType": "address", "name": "account", "type": "address"}],
|
|
54
|
+
"name": "balanceOf",
|
|
55
|
+
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
56
|
+
"stateMutability": "view",
|
|
57
|
+
"type": "function"
|
|
58
|
+
}, {
|
|
59
|
+
"inputs": [],
|
|
60
|
+
"name": "decimals",
|
|
61
|
+
"outputs": [{"internalType": "uint8", "name": "", "type": "uint8"}],
|
|
62
|
+
"stateMutability": "view",
|
|
63
|
+
"type": "function"
|
|
64
|
+
}, {
|
|
65
|
+
"inputs": [{
|
|
66
|
+
"internalType": "address",
|
|
67
|
+
"name": "spender",
|
|
68
|
+
"type": "address"
|
|
69
|
+
}, {"internalType": "uint256", "name": "subtractedValue", "type": "uint256"}],
|
|
70
|
+
"name": "decreaseAllowance",
|
|
71
|
+
"outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
|
|
72
|
+
"stateMutability": "nonpayable",
|
|
73
|
+
"type": "function"
|
|
74
|
+
}, {
|
|
75
|
+
"inputs": [{
|
|
76
|
+
"internalType": "address",
|
|
77
|
+
"name": "spender",
|
|
78
|
+
"type": "address"
|
|
79
|
+
}, {"internalType": "uint256", "name": "addedValue", "type": "uint256"}],
|
|
80
|
+
"name": "increaseAllowance",
|
|
81
|
+
"outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
|
|
82
|
+
"stateMutability": "nonpayable",
|
|
83
|
+
"type": "function"
|
|
84
|
+
}, {
|
|
85
|
+
"inputs": [{
|
|
86
|
+
"internalType": "address",
|
|
87
|
+
"name": "account",
|
|
88
|
+
"type": "address"
|
|
89
|
+
}, {"internalType": "uint256", "name": "amount", "type": "uint256"}],
|
|
90
|
+
"name": "mint",
|
|
91
|
+
"outputs": [],
|
|
92
|
+
"stateMutability": "nonpayable",
|
|
93
|
+
"type": "function"
|
|
94
|
+
}, {
|
|
95
|
+
"inputs": [],
|
|
96
|
+
"name": "name",
|
|
97
|
+
"outputs": [{"internalType": "string", "name": "", "type": "string"}],
|
|
98
|
+
"stateMutability": "view",
|
|
99
|
+
"type": "function"
|
|
100
|
+
}, {
|
|
101
|
+
"inputs": [],
|
|
102
|
+
"name": "owner",
|
|
103
|
+
"outputs": [{"internalType": "address", "name": "", "type": "address"}],
|
|
104
|
+
"stateMutability": "view",
|
|
105
|
+
"type": "function"
|
|
106
|
+
}, {
|
|
107
|
+
"inputs": [],
|
|
108
|
+
"name": "symbol",
|
|
109
|
+
"outputs": [{"internalType": "string", "name": "", "type": "string"}],
|
|
110
|
+
"stateMutability": "view",
|
|
111
|
+
"type": "function"
|
|
112
|
+
}, {
|
|
113
|
+
"inputs": [],
|
|
114
|
+
"name": "token_name",
|
|
115
|
+
"outputs": [{"internalType": "string", "name": "", "type": "string"}],
|
|
116
|
+
"stateMutability": "view",
|
|
117
|
+
"type": "function"
|
|
118
|
+
}, {
|
|
119
|
+
"inputs": [],
|
|
120
|
+
"name": "token_ticker",
|
|
121
|
+
"outputs": [{"internalType": "string", "name": "", "type": "string"}],
|
|
122
|
+
"stateMutability": "view",
|
|
123
|
+
"type": "function"
|
|
124
|
+
}, {
|
|
125
|
+
"inputs": [],
|
|
126
|
+
"name": "totalSupply",
|
|
127
|
+
"outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],
|
|
128
|
+
"stateMutability": "view",
|
|
129
|
+
"type": "function"
|
|
130
|
+
}, {
|
|
131
|
+
"inputs": [{
|
|
132
|
+
"internalType": "address",
|
|
133
|
+
"name": "recipient",
|
|
134
|
+
"type": "address"
|
|
135
|
+
}, {"internalType": "uint256", "name": "amount", "type": "uint256"}],
|
|
136
|
+
"name": "transfer",
|
|
137
|
+
"outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
|
|
138
|
+
"stateMutability": "nonpayable",
|
|
139
|
+
"type": "function"
|
|
140
|
+
}, {
|
|
141
|
+
"inputs": [{
|
|
142
|
+
"internalType": "address",
|
|
143
|
+
"name": "from",
|
|
144
|
+
"type": "address"
|
|
145
|
+
}, {"internalType": "address", "name": "to", "type": "address"}, {
|
|
146
|
+
"internalType": "uint256",
|
|
147
|
+
"name": "amount",
|
|
148
|
+
"type": "uint256"
|
|
149
|
+
}],
|
|
150
|
+
"name": "transferFrom",
|
|
151
|
+
"outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
|
|
152
|
+
"stateMutability": "nonpayable",
|
|
153
|
+
"type": "function"
|
|
154
|
+
}]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {useMatch} from "@matchain/mid";
|
|
2
|
+
import {useMemo} from "react";
|
|
3
|
+
function DisplayConfig({
|
|
4
|
+
label,
|
|
5
|
+
value
|
|
6
|
+
}:{
|
|
7
|
+
label:string,
|
|
8
|
+
value:any
|
|
9
|
+
}){
|
|
10
|
+
const RenderValue = useMemo(()=>{
|
|
11
|
+
const type = typeof value;
|
|
12
|
+
if(type === "object"){
|
|
13
|
+
return JSON.stringify(value);
|
|
14
|
+
}
|
|
15
|
+
if(type==='function'){
|
|
16
|
+
return <span className={`text-green-500`}>function</span>
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
},[value])
|
|
20
|
+
|
|
21
|
+
return <div className={`grid grid-cols-12 gap-4`}>
|
|
22
|
+
<div className={`col-span-4 px-2`}>{label}</div>
|
|
23
|
+
<div className={`col-span-8 px-2 text-ellipsis`}>{RenderValue}</div>
|
|
24
|
+
</div>
|
|
25
|
+
}
|
|
26
|
+
export default function Home(){
|
|
27
|
+
const config = useMatch();
|
|
28
|
+
const keyList = Object.keys(config) as Array<keyof typeof config>;
|
|
29
|
+
return <div className={``}>
|
|
30
|
+
{
|
|
31
|
+
keyList.map((key)=>{
|
|
32
|
+
return <DisplayConfig key={key} label={key} value={config[key]}/>
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
</div>
|
|
36
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import {Hooks, Components} from "@matchain/mid"
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
const {useMatchEvents, useUserInfo, useWallet} = Hooks
|
|
5
|
+
const {LoginButton, LoginBox, LoginPanel, EmailModal, LoginModal, UsernameModal, PasswordModal} = Components
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function LoginContent() {
|
|
9
|
+
useMatchEvents({
|
|
10
|
+
onLogin: (data) => {
|
|
11
|
+
console.log('useMatchEvents.onLogin', data)
|
|
12
|
+
},
|
|
13
|
+
onLogout: () => {
|
|
14
|
+
console.log('useMatchEvents.onLogout')
|
|
15
|
+
},
|
|
16
|
+
onBind: (data) => {
|
|
17
|
+
console.log('useMatchEvents.onBind', data)
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
const {
|
|
21
|
+
loginByWallet,
|
|
22
|
+
isLogin,
|
|
23
|
+
token,
|
|
24
|
+
logout,
|
|
25
|
+
username,
|
|
26
|
+
loginByTwitter,
|
|
27
|
+
loginByGoogle,
|
|
28
|
+
loginByEmail,
|
|
29
|
+
getLoginEmailCode,
|
|
30
|
+
loginByTelegram,
|
|
31
|
+
refreshOverview,
|
|
32
|
+
did,
|
|
33
|
+
address,
|
|
34
|
+
bindWallet,
|
|
35
|
+
bindTelegram,
|
|
36
|
+
} = useUserInfo();
|
|
37
|
+
const {signMessage} = useWallet()
|
|
38
|
+
const [email, setEmail] = React.useState('')
|
|
39
|
+
const [code, setCode] = React.useState('')
|
|
40
|
+
const [emailOpen, setEmailOpen] = React.useState(false)
|
|
41
|
+
const [loginOpen, setLoginOpen] = React.useState(false)
|
|
42
|
+
const [usernameOpen, setUsernameOpen] = React.useState(false)
|
|
43
|
+
const [passwordOpen, setPasswordOpen] = React.useState(false)
|
|
44
|
+
const refreshOv = async () => {
|
|
45
|
+
await refreshOverview()
|
|
46
|
+
alert('refreshed')
|
|
47
|
+
}
|
|
48
|
+
const onSign = async () => {
|
|
49
|
+
const res = await signMessage('hello')
|
|
50
|
+
alert(res)
|
|
51
|
+
}
|
|
52
|
+
if (isLogin) {
|
|
53
|
+
return <div>
|
|
54
|
+
<h1 className={`text-2xl`}>You are already logged in</h1>
|
|
55
|
+
<div className={`text-ellipsis break-words`}>token:{token}</div>
|
|
56
|
+
<div className={`text-ellipsis break-words`}>username:{username}</div>
|
|
57
|
+
<div className={`text-ellipsis break-words`}>did:{did}</div>
|
|
58
|
+
<div className={`text-ellipsis break-words`}>address:{address}</div>
|
|
59
|
+
<div className={`flex gap-[20px]`}>
|
|
60
|
+
<button className={`bg-gray-300 p-1 rounded mr-5`}
|
|
61
|
+
onClick={bindWallet}>Bind wallet
|
|
62
|
+
</button>
|
|
63
|
+
<button className={`bg-gray-300 p-1 rounded mr-5`}
|
|
64
|
+
onClick={() => setUsernameOpen(true)}>Set username
|
|
65
|
+
</button>
|
|
66
|
+
<UsernameModal isOpen={usernameOpen} onClose={() => setUsernameOpen(false)} onBack={() => {
|
|
67
|
+
console.log('set username modal back event')
|
|
68
|
+
setUsernameOpen(false)
|
|
69
|
+
}} onSuccess={() => {
|
|
70
|
+
alert('set username success')
|
|
71
|
+
setUsernameOpen(false)
|
|
72
|
+
}}/>
|
|
73
|
+
<button className={`bg-gray-300 p-1 rounded mr-5`}
|
|
74
|
+
onClick={() => setPasswordOpen(true)}>Set Password
|
|
75
|
+
</button>
|
|
76
|
+
<PasswordModal isOpen={passwordOpen} onClose={() => setPasswordOpen(false)} onBack={() => {
|
|
77
|
+
console.log('set password modal back event')
|
|
78
|
+
setPasswordOpen(false)
|
|
79
|
+
}} onSuccess={() => {
|
|
80
|
+
alert('set password success')
|
|
81
|
+
setPasswordOpen(false)
|
|
82
|
+
}}/>
|
|
83
|
+
<button className={`bg-gray-300 p-1 rounded mr-5`}
|
|
84
|
+
onClick={bindTelegram}>Bind telegram
|
|
85
|
+
</button>
|
|
86
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
87
|
+
onClick={onSign}>Sign message
|
|
88
|
+
</button>
|
|
89
|
+
</div>
|
|
90
|
+
<button className={`bg-gray-300 p-1 rounded mr-5`}
|
|
91
|
+
onClick={refreshOv}>Refresh Overview
|
|
92
|
+
</button>
|
|
93
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
94
|
+
onClick={logout}>Logout
|
|
95
|
+
</button>
|
|
96
|
+
|
|
97
|
+
</div>
|
|
98
|
+
}
|
|
99
|
+
return (
|
|
100
|
+
<div className={`flex flex-col gap-10`}>
|
|
101
|
+
<div className={`flex gap-5`}>
|
|
102
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
103
|
+
onClick={loginByWallet}>Wallet
|
|
104
|
+
</button>
|
|
105
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
106
|
+
onClick={loginByTwitter}>Twitter
|
|
107
|
+
</button>
|
|
108
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
109
|
+
onClick={loginByGoogle}>Google
|
|
110
|
+
</button>
|
|
111
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
112
|
+
onClick={loginByTelegram}>Telegram
|
|
113
|
+
</button>
|
|
114
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
115
|
+
onClick={() => setEmailOpen(true)}>Email
|
|
116
|
+
</button>
|
|
117
|
+
<EmailModal isOpen={emailOpen} onClose={() => setEmailOpen(false)} onBack={() => {
|
|
118
|
+
console.log('input email modal back event')
|
|
119
|
+
setEmailOpen(false)
|
|
120
|
+
}}/>
|
|
121
|
+
|
|
122
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
123
|
+
onClick={() => setLoginOpen(true)}>Modal
|
|
124
|
+
</button>
|
|
125
|
+
<LoginModal isOpen={loginOpen} onClose={() => setLoginOpen(false)}/>
|
|
126
|
+
|
|
127
|
+
</div>
|
|
128
|
+
<div className={`flex gap-5`}>
|
|
129
|
+
<input type={"text"} className={`border`} placeholder={"email"}
|
|
130
|
+
onChange={(e) => setEmail(e.target.value)} value={email}/>
|
|
131
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
132
|
+
onClick={() => getLoginEmailCode(email)}>Send
|
|
133
|
+
</button>
|
|
134
|
+
</div>
|
|
135
|
+
<div className={`flex gap-5`}>
|
|
136
|
+
<input type={"text"} className={`border`} placeholder={"code"}
|
|
137
|
+
onChange={(e) => setCode(e.target.value)} value={code}/>
|
|
138
|
+
<button className={`bg-gray-300 p-1 rounded`}
|
|
139
|
+
onClick={() => loginByEmail({email, code})}>Login
|
|
140
|
+
</button>
|
|
141
|
+
</div>
|
|
142
|
+
<div className={`font-bold text-xl`}>Components</div>
|
|
143
|
+
<div className={`font-bold text-lg`}>LoginBox</div>
|
|
144
|
+
<div className={`bg-gray-100 p-10`}>
|
|
145
|
+
<div className={`bg-white`}><LoginBox/></div>
|
|
146
|
+
</div>
|
|
147
|
+
<div className={`font-bold text-lg`}>LoginPanel</div>
|
|
148
|
+
<div className={`bg-gray-100 p-10`}>
|
|
149
|
+
<div className={`bg-white`}><LoginPanel onClose={() => console.log('onLoginPanelClose')}/></div>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default function Login() {
|
|
156
|
+
return <div>
|
|
157
|
+
<LoginContent/>
|
|
158
|
+
<div className={`font-bold text-lg`}>LoginButton</div>
|
|
159
|
+
|
|
160
|
+
<div className={`bg-gray-100 p-5 mt-5`}>
|
|
161
|
+
<LoginButton methods={["wallet", "X", "email", "google"]}/>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
</div>
|
|
165
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationDir": "./dist",
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"jsx": "react-jsx", // 支持 JSX 语法
|
|
10
|
+
"moduleResolution": "node", // 使用 Node.js 风格的模块解析
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["src"]
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// example/vite.config.ts
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: {
|
|
10
|
+
'@matchain/mid': path.resolve(__dirname, '../dist'),
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|