@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.
@@ -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 [env, setEnv] = useState<"main" | "dev" | "test">(state?.env || 'main')
23
- //matchain team will debug in dev env
24
- const isMatchainTeam = !!window.localStorage.getItem("isMatchainTeam")
25
- return <MatchProvider appid={appid} env={env} events={{
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>Env:</label>
41
- <select value={env} onChange={(ele) => {
42
- setEnv(ele.target.value as any)
43
- }}>
44
- <option value="main">main</option>
45
- <option value="test">test</option>
46
- {isMatchainTeam && <option value="dev">dev</option>}
47
- </select>
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('0xC47b00d62cA5e08C1bb4F07C7b23770B4807D073')
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()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matchain/matchid-sdk-react",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {