@matchain/matchid-sdk-react 0.1.42-alpha.2 → 0.1.42-alpha.4

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.
Files changed (63) hide show
  1. package/dist/{chunk-2YN5Y3SM.mjs → chunk-FZUZ63FZ.mjs} +2 -2
  2. package/dist/chunk-GEM2V3W6.mjs +4638 -0
  3. package/dist/chunk-GEM2V3W6.mjs.map +1 -0
  4. package/dist/chunk-SQIJR7RA.mjs +29 -0
  5. package/dist/chunk-SQIJR7RA.mjs.map +1 -0
  6. package/dist/components/index.js +647 -452
  7. package/dist/components/index.js.map +1 -1
  8. package/dist/components/index.mjs +4 -1
  9. package/dist/hooks/api/index.js +113 -76
  10. package/dist/hooks/api/index.js.map +1 -1
  11. package/dist/hooks/api/index.mjs +3 -2
  12. package/dist/hooks/index.js +321 -151
  13. package/dist/hooks/index.js.map +1 -1
  14. package/dist/hooks/index.mjs +2 -1
  15. package/dist/index.css +84 -4
  16. package/dist/index.js +1033 -625
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +6 -2
  19. package/dist/types/index.js +44 -0
  20. package/dist/types/index.js.map +1 -0
  21. package/dist/types/index.mjs +10 -0
  22. package/dist/types/index.mjs.map +1 -0
  23. package/example/package.json +1 -0
  24. package/example/src/App.tsx +54 -28
  25. package/example/src/components/ButtonGroup/index.tsx +10 -0
  26. package/example/src/components/Login/index.tsx +2 -2
  27. package/example/src/components/RoutePrivate/index.tsx +4 -3
  28. package/example/src/config/chains/index.ts +2 -0
  29. package/example/src/config/chains/matchMain.ts +27 -0
  30. package/example/src/config/chains/matchTest.ts +33 -0
  31. package/example/src/config/index.ts +6 -2
  32. package/example/src/pages/User/components/BindListModal.tsx +10 -0
  33. package/example/src/pages/User/components/PohListModal.tsx +10 -0
  34. package/example/src/pages/User/components/QueryDisplay.tsx +25 -0
  35. package/example/src/pages/{User.tsx → User/index.tsx} +55 -84
  36. package/example/src/pages/Wallet.tsx +133 -44
  37. package/example/src/store/useLocalStore.ts +45 -0
  38. package/package.json +7 -2
  39. package/dist/assets/icon/index.d.mts +0 -133
  40. package/dist/assets/icon/index.d.ts +0 -133
  41. package/dist/chunk-PZPEWHBV.mjs +0 -4251
  42. package/dist/chunk-PZPEWHBV.mjs.map +0 -1
  43. package/dist/components/index.d.mts +0 -4
  44. package/dist/components/index.d.ts +0 -4
  45. package/dist/config/chains/index.d.mts +0 -2
  46. package/dist/config/chains/index.d.ts +0 -2
  47. package/dist/hooks/api/index.d.mts +0 -5
  48. package/dist/hooks/api/index.d.ts +0 -5
  49. package/dist/hooks/index.d.mts +0 -4
  50. package/dist/hooks/index.d.ts +0 -4
  51. package/dist/index-B4YpKSY3.d.ts +0 -94
  52. package/dist/index-CxY3u9Rv.d.ts +0 -89
  53. package/dist/index-DCReY5T2.d.mts +0 -89
  54. package/dist/index-DXRGMAbv.d.mts +0 -83
  55. package/dist/index-DXRGMAbv.d.ts +0 -83
  56. package/dist/index-DbjibQ5d.d.mts +0 -65
  57. package/dist/index-GcpJCj6O.d.ts +0 -65
  58. package/dist/index-_k6h9w0P.d.mts +0 -94
  59. package/dist/index.d.mts +0 -33
  60. package/dist/index.d.ts +0 -33
  61. package/dist/types.d-DwF-Pkvh.d.mts +0 -179
  62. package/dist/types.d-DwF-Pkvh.d.ts +0 -179
  63. /package/dist/{chunk-2YN5Y3SM.mjs.map → chunk-FZUZ63FZ.mjs.map} +0 -0
@@ -1,94 +0,0 @@
1
- import { j as ISocialLoginMethod, k as OverviewInfo, C as CEXType, l as LoginMethodType, I as IMatchEvents } from './types.d-DwF-Pkvh.mjs';
2
- import * as viem from 'viem';
3
- import { SignableMessage, Hex, TransactionSerializable, Account } from 'viem';
4
-
5
- declare const LOGIN_METHOD_MAP: {
6
- email: string;
7
- evm: string;
8
- sol: string;
9
- btc: string;
10
- ton: string;
11
- tron: string;
12
- google: string;
13
- facebook: string;
14
- x: string;
15
- telegram: string;
16
- github: string;
17
- discord: string;
18
- linkedin: string;
19
- youtube: string;
20
- };
21
-
22
- declare function useUserInfo(): {
23
- loginByMethod: (method: ISocialLoginMethod) => Promise<Window | null>;
24
- loginByTelegram: () => Promise<Window | null>;
25
- loginByTwitter: () => Promise<Window | null>;
26
- loginByGoogle: () => Promise<Window | null>;
27
- loginByWallet: () => Promise<Window | null>;
28
- loginByEmail: ({ email, code }: {
29
- email: string;
30
- code: string;
31
- }) => Promise<boolean>;
32
- bindWallet: () => Promise<Window | null>;
33
- bindTelegram: () => Promise<void>;
34
- token: string;
35
- mid: string;
36
- did: string;
37
- address: string;
38
- isLogin: boolean;
39
- logout: () => Promise<void>;
40
- getLoginEmailCode: (email: string) => Promise<string>;
41
- refreshOverview: () => Promise<void>;
42
- overview: OverviewInfo | null;
43
- bindCex: (type: CEXType) => void;
44
- username: string;
45
- auth: () => Promise<any>;
46
- login: (method: LoginMethodType) => Promise<void | Window | null>;
47
- bind: (method: LoginMethodType) => Promise<void | Window | null>;
48
- getAuthInfo: (method: keyof typeof LOGIN_METHOD_MAP) => Promise<unknown>;
49
- };
50
-
51
- declare function useMatchEvents(handlers: IMatchEvents): void;
52
-
53
- type ChainType = "ethereum" | "solana";
54
- type RecoveryType = "base_generated_recovery_key" | "user_passcode_recovery_key"
55
-
56
- interface UseWalletReturnType {
57
- initWallet: (params: {
58
- address: string;
59
- did: string;
60
- }) => Promise<void>;
61
- generateWallet: (params: {
62
- did: string;
63
- userPasscode: string;
64
- recoveryType?: RecoveryType;
65
- }) => Promise<string>;
66
- isRecovered: () => Promise<boolean>;
67
- recoveryWallet: (chainType: ChainType | undefined, recoveryType: RecoveryType, userPasscode?: string) => Promise<void>;
68
- signMessage: (message: SignableMessage, type?: ChainType) => Promise<Hex>;
69
- signTransaction: (transaction: TransactionSerializable, type?: ChainType) => Promise<`0x02${string}` | `0x01${string}` | `0x03${string}` | `0x04${string}` | viem.TransactionSerializedLegacy>;
70
- address: string;
71
- evmAccount: Account | undefined;
72
- recoverAfter: (func: (resolve: (value: any) => void, reject: (reason: string) => void) => Promise<any>) => Promise<any>;
73
- }
74
- declare function useWallet(): UseWalletReturnType;
75
-
76
- declare function useCopyClipboard(timeout?: number): [boolean, (toCopy: string) => void];
77
-
78
- declare function useDownMd(): boolean;
79
-
80
- declare const useLayout_useDownMd: typeof useDownMd;
81
- declare namespace useLayout {
82
- export { useLayout_useDownMd as useDownMd };
83
- }
84
-
85
- declare const index_useCopyClipboard: typeof useCopyClipboard;
86
- declare const index_useLayout: typeof useLayout;
87
- declare const index_useMatchEvents: typeof useMatchEvents;
88
- declare const index_useUserInfo: typeof useUserInfo;
89
- declare const index_useWallet: typeof useWallet;
90
- declare namespace index {
91
- export { index_useCopyClipboard as useCopyClipboard, index_useLayout as useLayout, index_useMatchEvents as useMatchEvents, index_useUserInfo as useUserInfo, index_useWallet as useWallet };
92
- }
93
-
94
- export { useMatchEvents as a, useWallet as b, useCopyClipboard as c, useLayout as d, index as i, useUserInfo as u };
package/dist/index.d.mts DELETED
@@ -1,33 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types.d-DwF-Pkvh.mjs';
3
- export { i as Components } from './index-DCReY5T2.mjs';
4
- export { i as Hooks } from './index-_k6h9w0P.mjs';
5
- export { i as Api } from './index-DbjibQ5d.mjs';
6
- export { i as Chains } from './index-DXRGMAbv.mjs';
7
- import 'react/jsx-runtime';
8
- import 'viem';
9
- import '@tanstack/react-query';
10
- import '@tanstack/react-query/src/types';
11
-
12
- type MatchContextType = {
13
- appid: string;
14
- events?: IMatchEvents;
15
- login: (data: {
16
- mid: string;
17
- token: string;
18
- }) => Promise<void>;
19
- theme: "light" | "dark";
20
- locale?: LocaleType;
21
- } & Partial<IEnvConfigType>;
22
- declare const MatchProvider: React.FC<{
23
- children: ReactNode;
24
- appid: string;
25
- events?: IMatchEvents;
26
- theme?: "light" | "dark";
27
- endpoints?: IEnvConfigType['endpoints'];
28
- locale?: LocaleType;
29
- wallet?: WalletConfigType;
30
- }>;
31
- declare const useMatch: () => MatchContextType;
32
-
33
- export { MatchProvider, useMatch };
package/dist/index.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types.d-DwF-Pkvh.js';
3
- export { i as Components } from './index-CxY3u9Rv.js';
4
- export { i as Hooks } from './index-B4YpKSY3.js';
5
- export { i as Api } from './index-GcpJCj6O.js';
6
- export { i as Chains } from './index-DXRGMAbv.js';
7
- import 'react/jsx-runtime';
8
- import 'viem';
9
- import '@tanstack/react-query';
10
- import '@tanstack/react-query/src/types';
11
-
12
- type MatchContextType = {
13
- appid: string;
14
- events?: IMatchEvents;
15
- login: (data: {
16
- mid: string;
17
- token: string;
18
- }) => Promise<void>;
19
- theme: "light" | "dark";
20
- locale?: LocaleType;
21
- } & Partial<IEnvConfigType>;
22
- declare const MatchProvider: React.FC<{
23
- children: ReactNode;
24
- appid: string;
25
- events?: IMatchEvents;
26
- theme?: "light" | "dark";
27
- endpoints?: IEnvConfigType['endpoints'];
28
- locale?: LocaleType;
29
- wallet?: WalletConfigType;
30
- }>;
31
- declare const useMatch: () => MatchContextType;
32
-
33
- export { MatchProvider, useMatch };
@@ -1,179 +0,0 @@
1
- import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
2
-
3
- type ISocialLoginMethod =
4
- 'google'
5
- | 'twitter'
6
- | 'discord'
7
- | 'github'
8
- | 'telegram'
9
- | 'linkedin'
10
- | 'facebook'
11
- | 'youtube'
12
- type WalletType = 'evm' | 'sol' | 'tron' | 'btc' | 'ton'
13
- type LoginMethodType = WalletType | 'email' | ISocialLoginMethod
14
- type CEXType = "Gate" | "Coinbase" | "Kucoin" | 'Bitget' | 'OKX' | 'Bybit' | 'Binance'
15
- type OtherLoginMethodType = 'email' | ISocialLoginMethod
16
- type RecommendLoginMethodType = 'wallet' | 'email' | ISocialLoginMethod
17
- type IEnvConfigType = {
18
- endpoints: {
19
- back: string;
20
- auth: string;
21
- };
22
- }
23
- type IMatchEvents = {
24
- onLogin?: (data: {
25
- mid?: string;
26
- token: string;
27
- did: string
28
- }) => void
29
- onLogout?: () => void,
30
- onBind?: (data: {
31
- type: string
32
- }) => void
33
- }
34
-
35
- type OverviewInfo = {
36
- score: number,
37
- total_assets: number,
38
- wallets: number,
39
- followers: number,
40
- sbt: number,
41
- is_kyc: boolean,
42
- is_poh: boolean,
43
- mid: string
44
- user_identity: string
45
- identities: { [key: string]: string }
46
- did: string
47
- address: string
48
- username?: string
49
- }
50
-
51
- type IconProps = {
52
- color?: string,
53
- size?: number | string,
54
- width?: number | string,
55
- height?: number | string,
56
- style?: CSSProperties
57
- className?: string
58
- onClick?: (e?: any) => void
59
- }
60
-
61
- type ModalProps = PropsWithChildren & {
62
- isOpen: boolean,
63
- width?: number
64
- className?: string
65
- zIndex?: number
66
- }
67
-
68
- type ModalWithHeaderProps = ModalProps & {
69
- onBack?: () => void,
70
- onClose?: () => void,
71
- title?: string
72
- showClose?: boolean
73
- showBorder?: boolean
74
- }
75
-
76
- type InputProps = {
77
- placeholder?: string,
78
- value?: string,
79
- onChange?: (e?: any) => void,
80
- disabled?: boolean,
81
- readonly?: boolean
82
- type?: string
83
- maxLength?: number
84
- className?: string
85
- after?: React.ReactNode
86
- }
87
-
88
- type LoginBoxProps = {
89
- methods?: OtherLoginMethodType[],
90
- inModal?: boolean
91
- recommendMethods?: RecommendLoginMethodType[]
92
- walletMethods?: WalletType[]
93
- }
94
- type LoginPanelProps = {
95
- header?: React.ReactNode
96
- onClose?: () => void
97
- } & LoginBoxProps
98
- type LoginModalProps = LoginPanelProps & ModalProps
99
- type EmailModalProps = ModalProps & {
100
- onClose?: () => void,
101
- onBack?: () => void,
102
- onLogin?: () => void
103
- }
104
- type ButtonProps = {
105
- size?: 'sm' | 'df' | 'lg',
106
- type?: "button" | "submit" | "reset",
107
- rounded?: boolean,
108
- block?: boolean,
109
- disabled?: boolean,
110
- loading?: boolean,
111
- children?: React.ReactNode,
112
- onClick?: () => void,
113
- highlight?: boolean,
114
- style?: CSSProperties
115
- className?: string
116
- }
117
-
118
- type BindItemType = {
119
- type: string,
120
- type_sort: string,
121
- platform_name: string,
122
- platform_id: number,
123
- platform_uid: string,
124
- platform_nickname: string,
125
- platform_status: number
126
- }
127
-
128
- type PohItemType = {
129
- user_id: number,
130
- poh_market_id: number,
131
- image_type: string,
132
- category: string,
133
- name: string,
134
- app_id: string,
135
- schema_id: string,
136
- active: boolean,
137
- }
138
-
139
- type BindInfoType = {
140
- progress_count: number,
141
- progress_current: number,
142
- total_assets: number,
143
- wallet_count: number,
144
- wallet_current: number,
145
- cex_count: number,
146
- cex_current: number,
147
- social_count: number,
148
- social_current: number,
149
- others_count: number,
150
- others_current: number,
151
- }
152
-
153
- type PohZkpassParams = {
154
- taskId: string,
155
- schemaId: string,
156
- publicFields: any,
157
- allocatorAddress: string,
158
- publicFieldsHash: string,
159
- allocatorSignature: string,
160
- uHash: string,
161
- validatorAddress: string,
162
- validatorSignature: string,
163
- }
164
- type PopoverPositionType = "center" | "left" | "right"
165
- type PopoverTypeType = "hover" | "click"
166
- type PopoverProps = PropsWithChildren & {
167
- position?: PopoverPositionType
168
- type?: PopoverTypeType
169
- content: ReactNode,
170
- className?: string,
171
- gap?: number | string
172
- }
173
-
174
- type LocaleType = "en" | "zh" | "tw" | "fr" | "ja" | "ko" | "vi" | "es" | "pt"
175
- type WalletConfigType = {
176
- type:"Base"|"UserPasscode"
177
- }
178
-
179
- export type { ButtonProps as B, CEXType as C, EmailModalProps as E, IMatchEvents as I, LocaleType as L, ModalProps as M, OtherLoginMethodType as O, PopoverProps as P, RecommendLoginMethodType as R, WalletConfigType as W, IEnvConfigType as a, InputProps as b, ModalWithHeaderProps as c, LoginBoxProps as d, WalletType as e, PopoverPositionType as f, PopoverTypeType as g, LoginPanelProps as h, LoginModalProps as i, ISocialLoginMethod as j, OverviewInfo as k, LoginMethodType as l, IconProps as m, PohZkpassParams as n, BindItemType as o, BindInfoType as p, PohItemType as q };
@@ -1,179 +0,0 @@
1
- import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
2
-
3
- type ISocialLoginMethod =
4
- 'google'
5
- | 'twitter'
6
- | 'discord'
7
- | 'github'
8
- | 'telegram'
9
- | 'linkedin'
10
- | 'facebook'
11
- | 'youtube'
12
- type WalletType = 'evm' | 'sol' | 'tron' | 'btc' | 'ton'
13
- type LoginMethodType = WalletType | 'email' | ISocialLoginMethod
14
- type CEXType = "Gate" | "Coinbase" | "Kucoin" | 'Bitget' | 'OKX' | 'Bybit' | 'Binance'
15
- type OtherLoginMethodType = 'email' | ISocialLoginMethod
16
- type RecommendLoginMethodType = 'wallet' | 'email' | ISocialLoginMethod
17
- type IEnvConfigType = {
18
- endpoints: {
19
- back: string;
20
- auth: string;
21
- };
22
- }
23
- type IMatchEvents = {
24
- onLogin?: (data: {
25
- mid?: string;
26
- token: string;
27
- did: string
28
- }) => void
29
- onLogout?: () => void,
30
- onBind?: (data: {
31
- type: string
32
- }) => void
33
- }
34
-
35
- type OverviewInfo = {
36
- score: number,
37
- total_assets: number,
38
- wallets: number,
39
- followers: number,
40
- sbt: number,
41
- is_kyc: boolean,
42
- is_poh: boolean,
43
- mid: string
44
- user_identity: string
45
- identities: { [key: string]: string }
46
- did: string
47
- address: string
48
- username?: string
49
- }
50
-
51
- type IconProps = {
52
- color?: string,
53
- size?: number | string,
54
- width?: number | string,
55
- height?: number | string,
56
- style?: CSSProperties
57
- className?: string
58
- onClick?: (e?: any) => void
59
- }
60
-
61
- type ModalProps = PropsWithChildren & {
62
- isOpen: boolean,
63
- width?: number
64
- className?: string
65
- zIndex?: number
66
- }
67
-
68
- type ModalWithHeaderProps = ModalProps & {
69
- onBack?: () => void,
70
- onClose?: () => void,
71
- title?: string
72
- showClose?: boolean
73
- showBorder?: boolean
74
- }
75
-
76
- type InputProps = {
77
- placeholder?: string,
78
- value?: string,
79
- onChange?: (e?: any) => void,
80
- disabled?: boolean,
81
- readonly?: boolean
82
- type?: string
83
- maxLength?: number
84
- className?: string
85
- after?: React.ReactNode
86
- }
87
-
88
- type LoginBoxProps = {
89
- methods?: OtherLoginMethodType[],
90
- inModal?: boolean
91
- recommendMethods?: RecommendLoginMethodType[]
92
- walletMethods?: WalletType[]
93
- }
94
- type LoginPanelProps = {
95
- header?: React.ReactNode
96
- onClose?: () => void
97
- } & LoginBoxProps
98
- type LoginModalProps = LoginPanelProps & ModalProps
99
- type EmailModalProps = ModalProps & {
100
- onClose?: () => void,
101
- onBack?: () => void,
102
- onLogin?: () => void
103
- }
104
- type ButtonProps = {
105
- size?: 'sm' | 'df' | 'lg',
106
- type?: "button" | "submit" | "reset",
107
- rounded?: boolean,
108
- block?: boolean,
109
- disabled?: boolean,
110
- loading?: boolean,
111
- children?: React.ReactNode,
112
- onClick?: () => void,
113
- highlight?: boolean,
114
- style?: CSSProperties
115
- className?: string
116
- }
117
-
118
- type BindItemType = {
119
- type: string,
120
- type_sort: string,
121
- platform_name: string,
122
- platform_id: number,
123
- platform_uid: string,
124
- platform_nickname: string,
125
- platform_status: number
126
- }
127
-
128
- type PohItemType = {
129
- user_id: number,
130
- poh_market_id: number,
131
- image_type: string,
132
- category: string,
133
- name: string,
134
- app_id: string,
135
- schema_id: string,
136
- active: boolean,
137
- }
138
-
139
- type BindInfoType = {
140
- progress_count: number,
141
- progress_current: number,
142
- total_assets: number,
143
- wallet_count: number,
144
- wallet_current: number,
145
- cex_count: number,
146
- cex_current: number,
147
- social_count: number,
148
- social_current: number,
149
- others_count: number,
150
- others_current: number,
151
- }
152
-
153
- type PohZkpassParams = {
154
- taskId: string,
155
- schemaId: string,
156
- publicFields: any,
157
- allocatorAddress: string,
158
- publicFieldsHash: string,
159
- allocatorSignature: string,
160
- uHash: string,
161
- validatorAddress: string,
162
- validatorSignature: string,
163
- }
164
- type PopoverPositionType = "center" | "left" | "right"
165
- type PopoverTypeType = "hover" | "click"
166
- type PopoverProps = PropsWithChildren & {
167
- position?: PopoverPositionType
168
- type?: PopoverTypeType
169
- content: ReactNode,
170
- className?: string,
171
- gap?: number | string
172
- }
173
-
174
- type LocaleType = "en" | "zh" | "tw" | "fr" | "ja" | "ko" | "vi" | "es" | "pt"
175
- type WalletConfigType = {
176
- type:"Base"|"UserPasscode"
177
- }
178
-
179
- export type { ButtonProps as B, CEXType as C, EmailModalProps as E, IMatchEvents as I, LocaleType as L, ModalProps as M, OtherLoginMethodType as O, PopoverProps as P, RecommendLoginMethodType as R, WalletConfigType as W, IEnvConfigType as a, InputProps as b, ModalWithHeaderProps as c, LoginBoxProps as d, WalletType as e, PopoverPositionType as f, PopoverTypeType as g, LoginPanelProps as h, LoginModalProps as i, ISocialLoginMethod as j, OverviewInfo as k, LoginMethodType as l, IconProps as m, PohZkpassParams as n, BindItemType as o, BindInfoType as p, PohItemType as q };