@matchain/matchid-sdk-react 0.1.37-alpha.2 → 0.1.37-alpha.3

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 (60) hide show
  1. package/dist/assets/icon/index.d.mts +123 -0
  2. package/dist/assets/icon/index.d.ts +123 -0
  3. package/dist/assets/icon/index.js +1055 -0
  4. package/dist/assets/icon/index.js.map +1 -0
  5. package/dist/assets/icon/index.mjs +82 -0
  6. package/dist/assets/icon/index.mjs.map +1 -0
  7. package/dist/chunk-HYQ3T6WW.mjs +79 -0
  8. package/dist/chunk-HYQ3T6WW.mjs.map +1 -0
  9. package/dist/chunk-J5LGTIGS.mjs +10 -0
  10. package/dist/chunk-J5LGTIGS.mjs.map +1 -0
  11. package/dist/chunk-J6EA7OSJ.mjs +992 -0
  12. package/dist/chunk-J6EA7OSJ.mjs.map +1 -0
  13. package/dist/chunk-MZB76VOE.mjs +93 -0
  14. package/dist/chunk-MZB76VOE.mjs.map +1 -0
  15. package/dist/chunk-YCRZLAOS.mjs +3709 -0
  16. package/dist/chunk-YCRZLAOS.mjs.map +1 -0
  17. package/dist/components/index.d.mts +4 -0
  18. package/dist/components/index.d.ts +4 -0
  19. package/dist/components/index.js +3352 -0
  20. package/dist/components/index.js.map +1 -0
  21. package/dist/components/index.mjs +39 -0
  22. package/dist/components/index.mjs.map +1 -0
  23. package/dist/config/chains/index.d.mts +2 -0
  24. package/dist/config/chains/index.d.ts +2 -0
  25. package/dist/config/chains/index.js +94 -0
  26. package/dist/config/chains/index.js.map +1 -0
  27. package/dist/config/chains/index.mjs +10 -0
  28. package/dist/config/chains/index.mjs.map +1 -0
  29. package/dist/hooks/api/index.d.mts +5 -0
  30. package/dist/hooks/api/index.d.ts +5 -0
  31. package/dist/hooks/api/index.js +1010 -0
  32. package/dist/hooks/api/index.js.map +1 -0
  33. package/dist/hooks/api/index.mjs +14 -0
  34. package/dist/hooks/api/index.mjs.map +1 -0
  35. package/dist/hooks/index.d.mts +4 -0
  36. package/dist/hooks/index.d.ts +4 -0
  37. package/dist/hooks/index.js +1055 -0
  38. package/dist/hooks/index.js.map +1 -0
  39. package/dist/hooks/index.mjs +17 -0
  40. package/dist/hooks/index.mjs.map +1 -0
  41. package/dist/index-BFn-HCRJ.d.ts +64 -0
  42. package/dist/index-BTTka3Uo.d.mts +75 -0
  43. package/dist/index-BdeWio3u.d.mts +64 -0
  44. package/dist/index-CfipOX1C.d.ts +83 -0
  45. package/dist/index-DUCRzr-P.d.ts +75 -0
  46. package/dist/index-DXRGMAbv.d.mts +83 -0
  47. package/dist/index-DXRGMAbv.d.ts +83 -0
  48. package/dist/index-Dq1vYJ0E.d.mts +83 -0
  49. package/dist/index.css +7 -0
  50. package/dist/index.d.mts +12 -436
  51. package/dist/index.d.ts +12 -436
  52. package/dist/index.js +1185 -297
  53. package/dist/index.js.map +1 -1
  54. package/dist/index.mjs +13 -3682
  55. package/dist/index.mjs.map +1 -1
  56. package/dist/types.d-Cqt8ifXa.d.mts +176 -0
  57. package/dist/types.d-Cqt8ifXa.d.ts +176 -0
  58. package/example/src/config/index.ts +6 -1
  59. package/example/src/pages/User.tsx +12 -3
  60. package/package.json +23 -2
package/dist/index.d.ts CHANGED
@@ -1,163 +1,13 @@
1
- import React$1, { PropsWithChildren, CSSProperties, ReactNode } from 'react';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import * as viem from 'viem';
4
- import { SignableMessage, Hex, TransactionSerializable, Account } from 'viem';
5
- import * as _tanstack_react_query from '@tanstack/react-query';
6
- import { UseQueryOptions } from '@tanstack/react-query/src/types';
7
-
8
- type ISocialLoginMethod = 'google' | 'twitter' | 'discord' | 'github' | 'telegram' | 'linkedin' | 'facebook'|'youtube'
9
- type LoginMethodType = 'evm' | 'sol' | 'email' | ISocialLoginMethod
10
- type OtherLoginMethodType = 'email' | ISocialLoginMethod
11
- type RecommendLoginMethodType = 'wallet' | 'email' | ISocialLoginMethod
12
- type WalletType ='evm'|'sol'
13
- type IEnvConfigType = {
14
- endpoints: {
15
- back: string;
16
- auth: string;
17
- };
18
- }
19
- type IMatchEvents = {
20
- onLogin?: (data: {
21
- mid?: string;
22
- token: string;
23
- did: string
24
- }) => void
25
- onLogout?: () => void,
26
- onBind?: (data: {
27
- type: string
28
- }) => void
29
- }
30
-
31
- type OverviewInfo = {
32
- score: number,
33
- total_assets: number,
34
- wallets: number,
35
- followers: number,
36
- sbt: number,
37
- is_kyc: boolean,
38
- is_poh: boolean,
39
- mid: string
40
- user_identity: string
41
- identities: { [key: string]: string }
42
- did: string
43
- address: string
44
- username?: string
45
- }
46
-
47
- type ModalProps = PropsWithChildren & {
48
- isOpen: boolean,
49
- width?: number
50
- className?: string
51
- zIndex?: number
52
- }
53
-
54
- type ModalWithHeaderProps = ModalProps & {
55
- onBack?: () => void,
56
- onClose?: () => void,
57
- title?: string
58
- showClose?: boolean
59
- showBorder?: boolean
60
- }
61
-
62
- type InputProps = {
63
- placeholder?: string,
64
- value?: string,
65
- onChange?: (e?: any) => void,
66
- disabled?: boolean,
67
- readonly?: boolean
68
- type?: string
69
- maxLength?: number
70
- className?: string
71
- after?: React.ReactNode
72
- }
73
-
74
- type LoginBoxProps = {
75
- methods?: OtherLoginMethodType[],
76
- inModal?: boolean
77
- recommendMethods?: RecommendLoginMethodType[]
78
- walletMethods?:WalletType[]
79
- }
80
- type LoginPanelProps = {
81
- header?: React.ReactNode
82
- onClose?: () => void
83
- } & LoginBoxProps
84
- type LoginModalProps = LoginPanelProps & ModalProps
85
- type EmailModalProps = ModalProps & {
86
- onClose?: () => void,
87
- onBack?: () => void,
88
- onLogin?: () => void
89
- }
90
- type ButtonProps = {
91
- size?: 'sm' | 'df' | 'lg',
92
- type?: "button" | "submit" | "reset",
93
- rounded?: boolean,
94
- block?: boolean,
95
- disabled?: boolean,
96
- loading?: boolean,
97
- children?: React.ReactNode,
98
- onClick?: () => void,
99
- highlight?: boolean,
100
- style?: CSSProperties
101
- className?: string
102
- }
103
-
104
- type BindItemType = {
105
- type: string,
106
- type_sort: string,
107
- platform_name: string,
108
- platform_id: number,
109
- platform_uid: string,
110
- platform_nickname: string,
111
- platform_status: number
112
- }
113
-
114
- type PohItemType = {
115
- user_id: number,
116
- poh_market_id: number,
117
- image_type: string,
118
- category: string,
119
- name: string,
120
- app_id: string,
121
- schema_id: string,
122
- active: boolean,
123
- }
124
-
125
- type BindInfoType = {
126
- progress_count: number,
127
- progress_current: number,
128
- total_assets: number,
129
- wallet_count: number,
130
- wallet_current: number,
131
- cex_count: number,
132
- cex_current: number,
133
- social_count: number,
134
- social_current: number,
135
- others_count: number,
136
- others_current: number,
137
- }
138
-
139
- type PohZkpassParams = {
140
- taskId: string,
141
- schemaId: string,
142
- publicFields: any,
143
- allocatorAddress: string,
144
- publicFieldsHash: string,
145
- allocatorSignature: string,
146
- uHash: string,
147
- validatorAddress: string,
148
- validatorSignature: string,
149
- }
150
- type PopoverPositionType = "center" | "left" | "right"
151
- type PopoverTypeType = "hover" | "click"
152
- type PopoverProps = PropsWithChildren & {
153
- position?: PopoverPositionType
154
- type?: PopoverTypeType
155
- content: ReactNode,
156
- className?: string,
157
- gap?: number | string
158
- }
159
-
160
- type LocaleType = "en" | "zh" | "tw" | "fr" | "ja" | "ko" | "vi" | "es" | "pt"
1
+ import React, { ReactNode } from 'react';
2
+ import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType } from './types.d-Cqt8ifXa.js';
3
+ export { i as Components } from './index-CfipOX1C.js';
4
+ export { i as Hooks } from './index-DUCRzr-P.js';
5
+ export { i as Api } from './index-BFn-HCRJ.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';
161
11
 
162
12
  type MatchContextType = {
163
13
  appid: string;
@@ -169,7 +19,7 @@ type MatchContextType = {
169
19
  theme: "light" | "dark";
170
20
  locale?: LocaleType;
171
21
  } & Partial<IEnvConfigType>;
172
- declare const MatchProvider: React$1.FC<{
22
+ declare const MatchProvider: React.FC<{
173
23
  children: ReactNode;
174
24
  appid: string;
175
25
  events?: IMatchEvents;
@@ -179,278 +29,4 @@ declare const MatchProvider: React$1.FC<{
179
29
  }>;
180
30
  declare const useMatch: () => MatchContextType;
181
31
 
182
- declare function EmailModal({ isOpen, width, onClose, onBack, onLogin }: EmailModalProps): react_jsx_runtime.JSX.Element;
183
-
184
- declare function Field({ label, children, error, required, className }: {
185
- label: ReactNode;
186
- error?: ReactNode;
187
- required?: boolean;
188
- className?: string;
189
- } & PropsWithChildren): react_jsx_runtime.JSX.Element;
190
-
191
- declare function Input({ onChange, type, after, className, ...props }: InputProps): react_jsx_runtime.JSX.Element;
192
-
193
- declare function Button({ size, disabled, loading, children, onClick, highlight, block, type, rounded, className, style }: ButtonProps): react_jsx_runtime.JSX.Element;
194
-
195
- declare function Modal({ children, isOpen, width, zIndex, className }: ModalProps): react_jsx_runtime.JSX.Element;
196
- declare function ModalWithHeader({ children, onBack, onClose, title, showBorder, showClose, ...props }: ModalWithHeaderProps): react_jsx_runtime.JSX.Element;
197
-
198
- declare function Popover({ children, content, position, type, className, gap }: PopoverProps): react_jsx_runtime.JSX.Element;
199
-
200
- declare function LoginBox({ recommendMethods, methods, walletMethods, inModal }: LoginBoxProps): react_jsx_runtime.JSX.Element;
201
-
202
- declare function LoginButton({ loginRender, methods, recommendMethods, onLoginClick, popoverPosition, popoverType, popoverGap, walletMethods, ...props }: Omit<ButtonProps, 'onClick' | 'highlight'> & {
203
- loginRender?: ReactNode;
204
- methods?: OtherLoginMethodType[];
205
- recommendMethods?: RecommendLoginMethodType[];
206
- walletMethods?: WalletType[];
207
- onLoginClick?: () => void;
208
- popoverPosition?: PopoverPositionType;
209
- popoverType?: PopoverTypeType;
210
- popoverGap?: number | string;
211
- }): react_jsx_runtime.JSX.Element;
212
-
213
- declare function LoginPanel({ header, onClose, ...props }: LoginPanelProps): react_jsx_runtime.JSX.Element;
214
-
215
- declare function LoginModal({ isOpen, width, ...props }: LoginModalProps): react_jsx_runtime.JSX.Element;
216
-
217
- declare function UsernameModal({ title, isOpen, onSuccess, ...props }: ModalWithHeaderProps & {
218
- onSuccess?: () => void;
219
- }): react_jsx_runtime.JSX.Element;
220
-
221
- declare function PasswordModal({ title, isOpen, onSuccess, ...props }: ModalWithHeaderProps & {
222
- onSuccess?: () => void;
223
- }): react_jsx_runtime.JSX.Element;
224
-
225
- declare function SOLModal({ type, onSuccess, ...props }: ModalWithHeaderProps & {
226
- type?: 'login' | 'bind' | '';
227
- onSuccess?: () => void;
228
- }): react_jsx_runtime.JSX.Element;
229
-
230
- declare const index$3_Button: typeof Button;
231
- declare const index$3_EmailModal: typeof EmailModal;
232
- declare const index$3_Field: typeof Field;
233
- declare const index$3_Input: typeof Input;
234
- declare const index$3_LoginBox: typeof LoginBox;
235
- declare const index$3_LoginButton: typeof LoginButton;
236
- declare const index$3_LoginModal: typeof LoginModal;
237
- declare const index$3_LoginPanel: typeof LoginPanel;
238
- declare const index$3_Modal: typeof Modal;
239
- declare const index$3_ModalWithHeader: typeof ModalWithHeader;
240
- declare const index$3_PasswordModal: typeof PasswordModal;
241
- declare const index$3_Popover: typeof Popover;
242
- declare const index$3_SOLModal: typeof SOLModal;
243
- declare const index$3_UsernameModal: typeof UsernameModal;
244
- declare namespace index$3 {
245
- export { index$3_Button as Button, index$3_EmailModal as EmailModal, index$3_Field as Field, index$3_Input as Input, index$3_LoginBox as LoginBox, index$3_LoginButton as LoginButton, index$3_LoginModal as LoginModal, index$3_LoginPanel as LoginPanel, index$3_Modal as Modal, index$3_ModalWithHeader as ModalWithHeader, index$3_PasswordModal as PasswordModal, index$3_Popover as Popover, index$3_SOLModal as SOLModal, index$3_UsernameModal as UsernameModal };
246
- }
247
-
248
- declare function useUserInfo(): {
249
- loginByMethod: (method: ISocialLoginMethod) => Promise<Window | null>;
250
- loginByTelegram: () => Promise<Window | null>;
251
- loginByTwitter: () => Promise<Window | null>;
252
- loginByGoogle: () => Promise<Window | null>;
253
- loginByWallet: () => Promise<Window | null>;
254
- loginByEmail: ({ email, code }: {
255
- email: string;
256
- code: string;
257
- }) => Promise<boolean>;
258
- token: string;
259
- mid: string;
260
- did: string;
261
- address: string;
262
- isLogin: boolean;
263
- logout: () => Promise<void>;
264
- getLoginEmailCode: (email: string) => Promise<string>;
265
- refreshOverview: () => Promise<void>;
266
- overview: OverviewInfo | null;
267
- bindWallet: () => Promise<Window | null>;
268
- bindTelegram: () => Promise<void>;
269
- username: string;
270
- auth: () => Promise<any>;
271
- login: (method: LoginMethodType) => Promise<void | Window | null>;
272
- bind: (method: LoginMethodType) => Promise<void | Window | null>;
273
- };
274
-
275
- declare function useMatchEvents(handlers: IMatchEvents): void;
276
-
277
- type ChainType = "ethereum" | "solana";
278
- type RecoveryType = "base_generated_recovery_key" | "user_passcode_recovery_key"
279
-
280
- interface UseWalletReturnType {
281
- initWallet: (params: {
282
- address: string;
283
- did: string;
284
- }) => Promise<void>;
285
- generateWallet: (params: {
286
- did: string;
287
- userPasscode: string;
288
- }) => Promise<string>;
289
- isRecovered: () => Promise<boolean>;
290
- recoveryWallet: (chainType: ChainType | undefined, recoveryType: RecoveryType, userPasscode?: string) => Promise<void>;
291
- signMessage: (message: SignableMessage, type?: ChainType) => Promise<Hex>;
292
- signTransaction: (transaction: TransactionSerializable, type?: ChainType) => Promise<`0x02${string}` | `0x01${string}` | `0x03${string}` | `0x04${string}` | viem.TransactionSerializedLegacy>;
293
- address: string;
294
- evmAccount: Account | undefined;
295
- recoverAfter: (func: (resolve: (value: any) => void, reject: (reason: string) => void) => Promise<any>) => Promise<any>;
296
- }
297
- declare function useWallet(): UseWalletReturnType;
298
-
299
- declare function useCopyClipboard(timeout?: number): [boolean, (toCopy: string) => void];
300
-
301
- declare function useDownMd(): boolean;
302
-
303
- declare const useLayout_useDownMd: typeof useDownMd;
304
- declare namespace useLayout {
305
- export { useLayout_useDownMd as useDownMd };
306
- }
307
-
308
- declare const index$2_useCopyClipboard: typeof useCopyClipboard;
309
- declare const index$2_useLayout: typeof useLayout;
310
- declare const index$2_useMatchEvents: typeof useMatchEvents;
311
- declare const index$2_useUserInfo: typeof useUserInfo;
312
- declare const index$2_useWallet: typeof useWallet;
313
- declare namespace index$2 {
314
- export { index$2_useCopyClipboard as useCopyClipboard, index$2_useLayout as useLayout, index$2_useMatchEvents as useMatchEvents, index$2_useUserInfo as useUserInfo, index$2_useWallet as useWallet };
315
- }
316
-
317
- interface MyResponseType<T> {
318
- code: number;
319
- data: T;
320
- message: string;
321
- success: boolean;
322
- fail: boolean;
323
- result: T;
324
- }
325
-
326
- declare const bindCexApi: ({ cex, api_key, api_secret }: {
327
- cex: string;
328
- api_key: string;
329
- api_secret: string;
330
- }) => Promise<MyResponseType<any>>;
331
- declare const unBindApi: ({ type }: {
332
- type: string;
333
- }) => Promise<MyResponseType<any>>;
334
- declare const unBindWalletApi: ({ address }: {
335
- address: string;
336
- }) => Promise<MyResponseType<any>>;
337
- declare const verifyPohApi: ({ taskId, schemaId, publicFields, allocatorAddress, publicFieldsHash, allocatorSignature, uHash, validatorAddress, validatorSignature }: PohZkpassParams) => Promise<MyResponseType<any>>;
338
- declare const chooseIdentityApi: ({ identity }: {
339
- identity: string;
340
- }) => Promise<MyResponseType<any>>;
341
- declare const mintPassportNftApi: () => Promise<MyResponseType<any>>;
342
-
343
- declare function useBindList(options?: Omit<UseQueryOptions<BindItemType[]>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<BindItemType[], Error>;
344
- declare function useBindInfo(options?: Omit<UseQueryOptions<BindInfoType>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<BindInfoType, Error>;
345
-
346
- declare const bind_bindCexApi: typeof bindCexApi;
347
- declare const bind_unBindApi: typeof unBindApi;
348
- declare const bind_unBindWalletApi: typeof unBindWalletApi;
349
- declare const bind_useBindInfo: typeof useBindInfo;
350
- declare const bind_useBindList: typeof useBindList;
351
- declare namespace bind {
352
- export { bind_bindCexApi as bindCexApi, bind_unBindApi as unBindApi, bind_unBindWalletApi as unBindWalletApi, bind_useBindInfo as useBindInfo, bind_useBindList as useBindList };
353
- }
354
-
355
- declare function usePohList(options?: Omit<UseQueryOptions<PohItemType[]>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<PohItemType[], Error>;
356
-
357
- declare const poh_usePohList: typeof usePohList;
358
- declare const poh_verifyPohApi: typeof verifyPohApi;
359
- declare namespace poh {
360
- export { poh_usePohList as usePohList, poh_verifyPohApi as verifyPohApi };
361
- }
362
-
363
- declare const user_chooseIdentityApi: typeof chooseIdentityApi;
364
- declare const user_mintPassportNftApi: typeof mintPassportNftApi;
365
- declare namespace user {
366
- export { user_chooseIdentityApi as chooseIdentityApi, user_mintPassportNftApi as mintPassportNftApi };
367
- }
368
-
369
- declare const index$1_bind: typeof bind;
370
- declare const index$1_poh: typeof poh;
371
- declare const index$1_user: typeof user;
372
- declare namespace index$1 {
373
- export { index$1_bind as bind, index$1_poh as poh, index$1_user as user };
374
- }
375
-
376
- declare const matchMain: {
377
- blockExplorers: {
378
- readonly default: {
379
- readonly name: "Matchscan";
380
- readonly url: "https://matchscan.io/";
381
- readonly apiUrl: "https://matchscan.io/api";
382
- };
383
- };
384
- contracts: {
385
- readonly multicall3: {
386
- readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
387
- };
388
- };
389
- id: 698;
390
- name: "Matchain";
391
- nativeCurrency: {
392
- readonly name: "Match Coin";
393
- readonly symbol: "BNB";
394
- readonly decimals: 18;
395
- };
396
- rpcUrls: {
397
- readonly default: {
398
- readonly http: readonly ["https://rpc.matchain.io"];
399
- };
400
- };
401
- sourceId?: number | undefined;
402
- testnet?: boolean | undefined;
403
- custom?: Record<string, unknown> | undefined;
404
- fees?: viem.ChainFees<undefined> | undefined;
405
- formatters?: undefined;
406
- serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
407
- readonly iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png";
408
- };
409
-
410
- declare const matchTest: {
411
- blockExplorers: {
412
- readonly default: {
413
- readonly name: "Matchscan";
414
- readonly url: "https://testnet.matchscan.io/";
415
- readonly apiUrl: "https://testnet.matchscan.io/api";
416
- };
417
- };
418
- contracts: {
419
- readonly multicall3: {
420
- readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
421
- readonly blockCreated: 751532;
422
- };
423
- readonly ensRegistry: {
424
- readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
425
- };
426
- readonly ensUniversalResolver: {
427
- readonly address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC";
428
- readonly blockCreated: 5317080;
429
- };
430
- };
431
- id: 699;
432
- name: "MatchTest";
433
- nativeCurrency: {
434
- readonly name: "Match Coin";
435
- readonly symbol: "BNB";
436
- readonly decimals: 18;
437
- };
438
- rpcUrls: {
439
- readonly default: {
440
- readonly http: readonly ["https://testnet-rpc.matchain.io"];
441
- };
442
- };
443
- sourceId?: number | undefined;
444
- testnet?: boolean | undefined;
445
- custom?: Record<string, unknown> | undefined;
446
- fees?: viem.ChainFees<undefined> | undefined;
447
- formatters?: undefined;
448
- serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
449
- readonly iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png";
450
- };
451
-
452
- declare namespace index {
453
- export { matchMain as MatchMain, matchTest as MatchTest };
454
- }
455
-
456
- export { index$1 as Api, index as Chains, index$3 as Components, index$2 as Hooks, MatchProvider, useMatch };
32
+ export { MatchProvider, useMatch };