@matchain/matchid-sdk-react 0.1.50-alpha.0 → 0.1.51-alpha.0
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-P3WHQUXO.mjs → chunk-5P2AOB6Q.mjs} +14 -12
- package/dist/chunk-5P2AOB6Q.mjs.map +1 -0
- package/dist/{chunk-ZM2P5GEL.mjs → chunk-JJGSJGWC.mjs} +2 -2
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +1 -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.map +1 -1
- package/dist/hooks/api/index.mjs +2 -2
- package/dist/hooks/index.d.mts +2 -3
- package/dist/hooks/index.d.ts +2 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/{index-Bvc8cjpN.d.ts → index-BDoEk1EK.d.ts} +2 -2
- package/dist/{index-Cx2Lx_mh.d.ts → index-BU0r26-N.d.mts} +2 -3
- package/dist/{index-BcEreCxd.d.ts → index-BUj9mOrS.d.ts} +1 -1
- package/dist/{index-Cou96DpL.d.mts → index-B_o9HBS1.d.mts} +1 -1
- package/dist/{index-Bpmrd7mh.d.ts → index-Bmir-Wor.d.mts} +1 -2
- package/dist/{index-C_TiXUOB.d.mts → index-C3aFwrd4.d.ts} +2 -3
- package/dist/{index-D4ju2J_e.d.mts → index-CDqIk5k2.d.mts} +1 -1
- package/dist/{index-C9F6f2iz.d.mts → index-D5OzNRfu.d.mts} +2 -2
- package/dist/{index-BMsj8hJv.d.ts → index-DMUZQqNB.d.ts} +2 -2
- package/dist/{index-Cy3K-Yao.d.ts → index-DvM6x6e6.d.ts} +1 -1
- package/dist/{index-C9qYyRgt.d.mts → index-XzSw1Bym.d.mts} +2 -2
- package/dist/{index-BMfaixEx.d.mts → index-k2Uf0F94.d.ts} +1 -2
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/types/index.d.mts +1 -2
- package/dist/types/index.d.ts +1 -2
- package/dist/{types-DzVVzMYU.d.mts → types-Dd_ExpLx.d.mts} +21 -1
- package/dist/{types-DzVVzMYU.d.ts → types-Dd_ExpLx.d.ts} +21 -1
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/index.d.ts +1 -2
- package/example/package.json +2 -1
- package/example/src/App.tsx +19 -4
- package/example/src/main.tsx +2 -0
- package/example/src/pages/TgApp/index.tsx +44 -0
- package/example/src/pages/User/index.tsx +3 -1
- package/example/src/pages/Wallet/index.tsx +1 -1
- package/example/src/store/useLocalStore.ts +4 -0
- package/example/yarn.lock +5 -0
- package/package.json +1 -1
- package/dist/chunk-P3WHQUXO.mjs.map +0 -1
- package/dist/mpc-CTbBWHld.d.mts +0 -20
- package/dist/mpc-CTbBWHld.d.ts +0 -20
- /package/dist/{chunk-ZM2P5GEL.mjs.map → chunk-JJGSJGWC.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-JJGSJGWC.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-5P2AOB6Q.mjs";
|
|
18
18
|
import "./chunk-UA6XHZHX.mjs";
|
|
19
19
|
import {
|
|
20
20
|
ui_exports
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { A as AuthParams, C as ChainType, E as EmbeddedWalletsParams, R as RecoveryType } from '../
|
|
2
|
-
export { A as Address, k as AnyObject, o as AppConfigType, p as BindInfoType, q as BindItemType, r as BindWalletParam, B as ButtonProps, C as CEXType, D as DeepPartial, s as DrawerProps, E as EmailModalProps, H as Hash, a as IEnvConfigType, t as IEnvName, v as ILoginWalletReq, I as IMatchEvents, h as ISocialLoginMethod, w as IconProps, x as InputProps, L as LocaleType, b as LoginBoxProps, j as LoginMethodType, f as LoginModalProps, e as LoginPanelProps, y as MessageType, z as MetaPageType, F as ModalProps, M as ModalWithHeaderProps, O as OtherLoginMethodType, i as OverviewInfo, G as PohItemType, J as PohZkpassParams, P as PopoverPositionType, K as PopoverProps, d as PopoverTypeType, R as RecommendLoginMethodType, T as ThemeType, N as UIProps, n as UserAssetToken, U as UserChainType, m as UserImportTokenType, Q as UserPopoverProps, S as UserTransactionNextPageParams, V as UserTransactionRecordType, l as UserTransactionType, g as WalletAssetMergeType, X as WalletAssetType, Y as WalletChainType, W as WalletConfigType, Z as WalletNFTType, _ as WalletPanelProps, $ as WalletReceiveMessageType, c as WalletType, u as useMatchWalletAssetsProps } from '../types-DzVVzMYU.mjs';
|
|
1
|
+
export { A as Address, l as AnyObject, p as AppConfigType, q as AuthParams, r as BindInfoType, s as BindItemType, t as BindWalletParam, B as ButtonProps, C as CEXType, k as ChainType, D as DeepPartial, v as DrawerProps, E as EmailModalProps, w as EmbeddedWalletsParams, H as Hash, a as IEnvConfigType, x as IEnvName, y as ILoginWalletReq, I as IMatchEvents, h as ISocialLoginMethod, z as IconProps, F as InputProps, L as LocaleType, b as LoginBoxProps, j as LoginMethodType, f as LoginModalProps, e as LoginPanelProps, G as MessageType, J as MetaPageType, K as ModalProps, M as ModalWithHeaderProps, O as OtherLoginMethodType, i as OverviewInfo, N as PohItemType, Q as PohZkpassParams, P as PopoverPositionType, S as PopoverProps, d as PopoverTypeType, R as RecommendLoginMethodType, T as RecoveryType, V as ThemeType, X as UIProps, o as UserAssetToken, U as UserChainType, n as UserImportTokenType, Y as UserPopoverProps, Z as UserTransactionNextPageParams, _ as UserTransactionRecordType, m as UserTransactionType, g as WalletAssetMergeType, $ as WalletAssetType, a0 as WalletChainType, W as WalletConfigType, a1 as WalletNFTType, a2 as WalletPanelProps, a3 as WalletReceiveMessageType, c as WalletType, u as useMatchWalletAssetsProps } from '../types-Dd_ExpLx.mjs';
|
|
3
2
|
import 'react';
|
|
4
3
|
import '@tanstack/react-query/src/types';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { A as AuthParams, C as ChainType, E as EmbeddedWalletsParams, R as RecoveryType } from '../
|
|
2
|
-
export { A as Address, k as AnyObject, o as AppConfigType, p as BindInfoType, q as BindItemType, r as BindWalletParam, B as ButtonProps, C as CEXType, D as DeepPartial, s as DrawerProps, E as EmailModalProps, H as Hash, a as IEnvConfigType, t as IEnvName, v as ILoginWalletReq, I as IMatchEvents, h as ISocialLoginMethod, w as IconProps, x as InputProps, L as LocaleType, b as LoginBoxProps, j as LoginMethodType, f as LoginModalProps, e as LoginPanelProps, y as MessageType, z as MetaPageType, F as ModalProps, M as ModalWithHeaderProps, O as OtherLoginMethodType, i as OverviewInfo, G as PohItemType, J as PohZkpassParams, P as PopoverPositionType, K as PopoverProps, d as PopoverTypeType, R as RecommendLoginMethodType, T as ThemeType, N as UIProps, n as UserAssetToken, U as UserChainType, m as UserImportTokenType, Q as UserPopoverProps, S as UserTransactionNextPageParams, V as UserTransactionRecordType, l as UserTransactionType, g as WalletAssetMergeType, X as WalletAssetType, Y as WalletChainType, W as WalletConfigType, Z as WalletNFTType, _ as WalletPanelProps, $ as WalletReceiveMessageType, c as WalletType, u as useMatchWalletAssetsProps } from '../types-DzVVzMYU.js';
|
|
1
|
+
export { A as Address, l as AnyObject, p as AppConfigType, q as AuthParams, r as BindInfoType, s as BindItemType, t as BindWalletParam, B as ButtonProps, C as CEXType, k as ChainType, D as DeepPartial, v as DrawerProps, E as EmailModalProps, w as EmbeddedWalletsParams, H as Hash, a as IEnvConfigType, x as IEnvName, y as ILoginWalletReq, I as IMatchEvents, h as ISocialLoginMethod, z as IconProps, F as InputProps, L as LocaleType, b as LoginBoxProps, j as LoginMethodType, f as LoginModalProps, e as LoginPanelProps, G as MessageType, J as MetaPageType, K as ModalProps, M as ModalWithHeaderProps, O as OtherLoginMethodType, i as OverviewInfo, N as PohItemType, Q as PohZkpassParams, P as PopoverPositionType, S as PopoverProps, d as PopoverTypeType, R as RecommendLoginMethodType, T as RecoveryType, V as ThemeType, X as UIProps, o as UserAssetToken, U as UserChainType, n as UserImportTokenType, Y as UserPopoverProps, Z as UserTransactionNextPageParams, _ as UserTransactionRecordType, m as UserTransactionType, g as WalletAssetMergeType, $ as WalletAssetType, a0 as WalletChainType, W as WalletConfigType, a1 as WalletNFTType, a2 as WalletPanelProps, a3 as WalletReceiveMessageType, c as WalletType, u as useMatchWalletAssetsProps } from '../types-Dd_ExpLx.js';
|
|
3
2
|
import 'react';
|
|
4
3
|
import '@tanstack/react-query/src/types';
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import { UseQueryOptions } from '@tanstack/react-query/src/types';
|
|
3
3
|
|
|
4
|
+
interface AuthParams {
|
|
5
|
+
AppId: string;
|
|
6
|
+
AppClientId: string;
|
|
7
|
+
UserId: string;
|
|
8
|
+
AccessToken: string;
|
|
9
|
+
Address?: string;
|
|
10
|
+
}
|
|
11
|
+
interface EmbeddedWalletsParams {
|
|
12
|
+
Url: string;
|
|
13
|
+
}
|
|
14
|
+
declare enum ChainType {
|
|
15
|
+
Ethereum = "ethereum",
|
|
16
|
+
Solana = "solana"
|
|
17
|
+
}
|
|
18
|
+
declare enum RecoveryType {
|
|
19
|
+
Base = "base_generated_recovery_key",
|
|
20
|
+
UserPasscode = "user_passcode_recovery_key"
|
|
21
|
+
}
|
|
22
|
+
|
|
4
23
|
type ISocialLoginMethod = 'google' | 'twitter' | 'discord' | 'github' | 'telegram' | 'linkedin' | 'facebook' | 'youtube';
|
|
5
24
|
type WalletType = 'evm' | 'sol' | 'tron' | 'btc' | 'ton';
|
|
6
25
|
type LoginMethodType = WalletType | 'email' | ISocialLoginMethod;
|
|
@@ -61,6 +80,7 @@ type OverviewInfo = {
|
|
|
61
80
|
username?: string;
|
|
62
81
|
max_level: number;
|
|
63
82
|
user_level: number;
|
|
83
|
+
recover_type: `${RecoveryType}`;
|
|
64
84
|
};
|
|
65
85
|
type AnyObject = {
|
|
66
86
|
[key: string]: any;
|
|
@@ -400,4 +420,4 @@ type useMatchWalletAssetsProps = {
|
|
|
400
420
|
assetListOptions?: Partial<Omit<UseQueryOptions<UserAssetToken[]>, 'queryKey' | 'queryFn'>>;
|
|
401
421
|
};
|
|
402
422
|
|
|
403
|
-
export type
|
|
423
|
+
export { type WalletAssetType as $, type Address as A, type ButtonProps as B, type CEXType as C, type DeepPartial as D, type EmailModalProps as E, type InputProps as F, type MessageType as G, type Hash as H, type IMatchEvents as I, type MetaPageType as J, type ModalProps as K, type LocaleType as L, type ModalWithHeaderProps as M, type PohItemType as N, type OtherLoginMethodType as O, type PopoverPositionType as P, type PohZkpassParams as Q, type RecommendLoginMethodType as R, type PopoverProps as S, RecoveryType as T, type UserChainType as U, type ThemeType as V, type WalletConfigType as W, type UIProps as X, type UserPopoverProps as Y, type UserTransactionNextPageParams as Z, type UserTransactionRecordType as _, type IEnvConfigType as a, type WalletChainType as a0, type WalletNFTType as a1, type WalletPanelProps as a2, type WalletReceiveMessageType as a3, type LoginBoxProps as b, type WalletType as c, type PopoverTypeType as d, type LoginPanelProps as e, type LoginModalProps as f, type WalletAssetMergeType as g, type ISocialLoginMethod as h, type OverviewInfo as i, type LoginMethodType as j, ChainType as k, type AnyObject as l, type UserTransactionType as m, type UserImportTokenType as n, type UserAssetToken as o, type AppConfigType as p, type AuthParams as q, type BindInfoType as r, type BindItemType as s, type BindWalletParam as t, type useMatchWalletAssetsProps as u, type DrawerProps as v, type EmbeddedWalletsParams as w, type IEnvName as x, type ILoginWalletReq as y, type IconProps as z };
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import { UseQueryOptions } from '@tanstack/react-query/src/types';
|
|
3
3
|
|
|
4
|
+
interface AuthParams {
|
|
5
|
+
AppId: string;
|
|
6
|
+
AppClientId: string;
|
|
7
|
+
UserId: string;
|
|
8
|
+
AccessToken: string;
|
|
9
|
+
Address?: string;
|
|
10
|
+
}
|
|
11
|
+
interface EmbeddedWalletsParams {
|
|
12
|
+
Url: string;
|
|
13
|
+
}
|
|
14
|
+
declare enum ChainType {
|
|
15
|
+
Ethereum = "ethereum",
|
|
16
|
+
Solana = "solana"
|
|
17
|
+
}
|
|
18
|
+
declare enum RecoveryType {
|
|
19
|
+
Base = "base_generated_recovery_key",
|
|
20
|
+
UserPasscode = "user_passcode_recovery_key"
|
|
21
|
+
}
|
|
22
|
+
|
|
4
23
|
type ISocialLoginMethod = 'google' | 'twitter' | 'discord' | 'github' | 'telegram' | 'linkedin' | 'facebook' | 'youtube';
|
|
5
24
|
type WalletType = 'evm' | 'sol' | 'tron' | 'btc' | 'ton';
|
|
6
25
|
type LoginMethodType = WalletType | 'email' | ISocialLoginMethod;
|
|
@@ -61,6 +80,7 @@ type OverviewInfo = {
|
|
|
61
80
|
username?: string;
|
|
62
81
|
max_level: number;
|
|
63
82
|
user_level: number;
|
|
83
|
+
recover_type: `${RecoveryType}`;
|
|
64
84
|
};
|
|
65
85
|
type AnyObject = {
|
|
66
86
|
[key: string]: any;
|
|
@@ -400,4 +420,4 @@ type useMatchWalletAssetsProps = {
|
|
|
400
420
|
assetListOptions?: Partial<Omit<UseQueryOptions<UserAssetToken[]>, 'queryKey' | 'queryFn'>>;
|
|
401
421
|
};
|
|
402
422
|
|
|
403
|
-
export type
|
|
423
|
+
export { type WalletAssetType as $, type Address as A, type ButtonProps as B, type CEXType as C, type DeepPartial as D, type EmailModalProps as E, type InputProps as F, type MessageType as G, type Hash as H, type IMatchEvents as I, type MetaPageType as J, type ModalProps as K, type LocaleType as L, type ModalWithHeaderProps as M, type PohItemType as N, type OtherLoginMethodType as O, type PopoverPositionType as P, type PohZkpassParams as Q, type RecommendLoginMethodType as R, type PopoverProps as S, RecoveryType as T, type UserChainType as U, type ThemeType as V, type WalletConfigType as W, type UIProps as X, type UserPopoverProps as Y, type UserTransactionNextPageParams as Z, type UserTransactionRecordType as _, type IEnvConfigType as a, type WalletChainType as a0, type WalletNFTType as a1, type WalletPanelProps as a2, type WalletReceiveMessageType as a3, type LoginBoxProps as b, type WalletType as c, type PopoverTypeType as d, type LoginPanelProps as e, type LoginModalProps as f, type WalletAssetMergeType as g, type ISocialLoginMethod as h, type OverviewInfo as i, type LoginMethodType as j, ChainType as k, type AnyObject as l, type UserTransactionType as m, type UserImportTokenType as n, type UserAssetToken as o, type AppConfigType as p, type AuthParams as q, type BindInfoType as r, type BindItemType as s, type BindWalletParam as t, type useMatchWalletAssetsProps as u, type DrawerProps as v, type EmbeddedWalletsParams as w, type IEnvName as x, type ILoginWalletReq as y, type IconProps as z };
|
package/dist/ui/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-
|
|
2
|
-
export { A as AlphaAvatar, D as Drawer, e as HashPanel, M as ModalDrawer, R as Radio, S as Switch } from '../index-
|
|
1
|
+
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-B_o9HBS1.mjs';
|
|
2
|
+
export { A as AlphaAvatar, D as Drawer, e as HashPanel, M as ModalDrawer, R as Radio, S as Switch } from '../index-D5OzNRfu.mjs';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-Dd_ExpLx.mjs';
|
|
6
6
|
import '@tanstack/react-query/src/types';
|
|
7
7
|
import 'viem';
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-
|
|
2
|
-
export { A as AlphaAvatar, D as Drawer, e as HashPanel, M as ModalDrawer, R as Radio, S as Switch } from '../index-
|
|
1
|
+
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-BUj9mOrS.js';
|
|
2
|
+
export { A as AlphaAvatar, D as Drawer, e as HashPanel, M as ModalDrawer, R as Radio, S as Switch } from '../index-DMUZQqNB.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-Dd_ExpLx.js';
|
|
6
6
|
import '@tanstack/react-query/src/types';
|
|
7
7
|
import 'viem';
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -22,6 +22,5 @@ interface NumberFormatterProps {
|
|
|
22
22
|
declare const NumberFormatter: React.FC<NumberFormatterProps>;
|
|
23
23
|
declare function formatAddress(address: string, pre?: number, after?: number): string;
|
|
24
24
|
declare const formatDate: (value: any, formatString?: string) => string;
|
|
25
|
-
declare const isInTgApp: () => boolean;
|
|
26
25
|
|
|
27
|
-
export { NumberFormatter, decodeBase64, deepMerge, encodeBase64, firstUpperCase, formatAddress, formatDate, getAppClientId, getVersion,
|
|
26
|
+
export { NumberFormatter, decodeBase64, deepMerge, encodeBase64, firstUpperCase, formatAddress, formatDate, getAppClientId, getVersion, isValidEmail, isValidUsername, truncateAddress };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -22,6 +22,5 @@ interface NumberFormatterProps {
|
|
|
22
22
|
declare const NumberFormatter: React.FC<NumberFormatterProps>;
|
|
23
23
|
declare function formatAddress(address: string, pre?: number, after?: number): string;
|
|
24
24
|
declare const formatDate: (value: any, formatString?: string) => string;
|
|
25
|
-
declare const isInTgApp: () => boolean;
|
|
26
25
|
|
|
27
|
-
export { NumberFormatter, decodeBase64, deepMerge, encodeBase64, firstUpperCase, formatAddress, formatDate, getAppClientId, getVersion,
|
|
26
|
+
export { NumberFormatter, decodeBase64, deepMerge, encodeBase64, firstUpperCase, formatAddress, formatDate, getAppClientId, getVersion, isValidEmail, isValidUsername, truncateAddress };
|
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/>
|
|
@@ -63,7 +69,7 @@ function Nav() {
|
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
function RouterApp() {
|
|
66
|
-
const {appid, setAppid, locale, setLocale, endpoints, setEndpoints} = useLocalStore()
|
|
72
|
+
const {appid, setAppid, locale, setLocale, endpoints, setEndpoints, setWalletType,walletType} = useLocalStore()
|
|
67
73
|
|
|
68
74
|
return <Router>
|
|
69
75
|
<div className={`mb-2 p-2 flex gap-2 flex-col`}>
|
|
@@ -94,12 +100,21 @@ function RouterApp() {
|
|
|
94
100
|
{LocaleList.map((item) => <option key={item} value={item}>{item}</option>)}
|
|
95
101
|
</select>
|
|
96
102
|
</div>
|
|
103
|
+
<div>
|
|
104
|
+
<label>WalletType:</label>
|
|
105
|
+
<select onChange={(ele) => {
|
|
106
|
+
setWalletType(ele.target.value as any)
|
|
107
|
+
}} value={walletType}>
|
|
108
|
+
{['Base','UserPasscode'].map((item) => <option key={item} value={item}>{item}</option>)}
|
|
109
|
+
</select>
|
|
110
|
+
</div>
|
|
97
111
|
</div>
|
|
98
112
|
<Nav/>
|
|
99
113
|
<div className={`p-4`}>
|
|
100
114
|
<Routes>
|
|
101
115
|
<Route path="/" element={<Home/>}/>
|
|
102
116
|
<Route path="/ui" element={<UI/>}/>
|
|
117
|
+
<Route path="/tgapp" element={<TgApp/>}/>
|
|
103
118
|
<Route element={<RoutePrivate/>}>
|
|
104
119
|
<Route path="/user" element={<User/>}/>
|
|
105
120
|
<Route path="/wallet" element={<Wallet/>}/>
|
|
@@ -110,7 +125,7 @@ function RouterApp() {
|
|
|
110
125
|
}
|
|
111
126
|
|
|
112
127
|
function App() {
|
|
113
|
-
const {appid, locale, endpoints} = useLocalStore()
|
|
128
|
+
const {appid, locale, endpoints,walletType} = useLocalStore()
|
|
114
129
|
|
|
115
130
|
return <MatchProvider
|
|
116
131
|
appid={appid}
|
|
@@ -125,7 +140,7 @@ function App() {
|
|
|
125
140
|
}
|
|
126
141
|
}}
|
|
127
142
|
wallet={{
|
|
128
|
-
type:
|
|
143
|
+
type: walletType
|
|
129
144
|
}}
|
|
130
145
|
>
|
|
131
146
|
<RouterApp/>
|
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
|
+
}
|
|
@@ -23,7 +23,8 @@ function LoginContent() {
|
|
|
23
23
|
bind,
|
|
24
24
|
auth,
|
|
25
25
|
bindCex,
|
|
26
|
-
getAuthInfo
|
|
26
|
+
getAuthInfo,
|
|
27
|
+
overview
|
|
27
28
|
} = useUserInfo();
|
|
28
29
|
const [usernameOpen, setUsernameOpen] = useState(false)
|
|
29
30
|
const [modal, setModal] = useState<'bindList' | 'pohList' | ''>('')
|
|
@@ -45,6 +46,7 @@ function LoginContent() {
|
|
|
45
46
|
<h1 className={`text-2xl`}>You are already logged in</h1>
|
|
46
47
|
<div className={`text-ellipsis break-words`}>token:{token}</div>
|
|
47
48
|
<div className={`text-ellipsis break-words`}>username:{username}</div>
|
|
49
|
+
<div className={`text-ellipsis break-words`}>recover_type:{overview?.recover_type}</div>
|
|
48
50
|
<div className={`text-ellipsis break-words`}>did:{did}</div>
|
|
49
51
|
<div className={`text-ellipsis break-words`}>address:{address}</div>
|
|
50
52
|
|
|
@@ -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)
|
|
@@ -9,6 +9,8 @@ interface StoreState {
|
|
|
9
9
|
auth: string;
|
|
10
10
|
}
|
|
11
11
|
locale: LocaleType;
|
|
12
|
+
walletType:"Base" | "UserPasscode";
|
|
13
|
+
setWalletType: (walletType: "Base" | "UserPasscode") => void;
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
setAppid: (appid: string) => void;
|
|
@@ -34,6 +36,8 @@ const persistedState = persist<StoreState>(
|
|
|
34
36
|
setAppid: (appid: string) => set({appid: appid}),
|
|
35
37
|
setEndpoints: (endpoints: StoreState['endpoints']) => set({endpoints}),
|
|
36
38
|
setLocale: (locale: LocaleType) => set({locale}),
|
|
39
|
+
walletType: "UserPasscode",
|
|
40
|
+
setWalletType: (walletType: "Base" | "UserPasscode") => set({walletType}),
|
|
37
41
|
|
|
38
42
|
initChainId:1,
|
|
39
43
|
setInitChainId: (initChainId: number) => set({initChainId}),
|
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"
|