@matchain/matchid-sdk-react 0.1.11 → 0.1.13

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.d.mts CHANGED
@@ -1,12 +1,17 @@
1
1
  import React$1, { PropsWithChildren, CSSProperties, ReactNode } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as viem from 'viem';
4
- import { SignableMessage, Hex, TransactionSerializable } from 'viem';
4
+ import { SignableMessage, Hex, TransactionSerializable, Account } from 'viem';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { UseQueryOptions } from '@tanstack/react-query/src/types';
7
7
 
8
8
  type LoginMethodType = 'wallet' | 'email' | 'google' | 'X' | 'telegram'
9
- type IEnvName = 'main' | 'dev' | 'test'
9
+ type IEnvConfigType = {
10
+ endpoints: {
11
+ back: string;
12
+ auth: string;
13
+ };
14
+ }
10
15
  type IMatchEvents = {
11
16
  onLogin?: (data: {
12
17
  mid?: string;
@@ -134,25 +139,20 @@ type PohZkpassParams = {
134
139
  }
135
140
 
136
141
  type MatchContextType = {
137
- env: IEnvName;
138
142
  appid: string;
139
- endpoints: {
140
- login: string;
141
- back: string;
142
- };
143
143
  events?: IMatchEvents;
144
144
  login: (data: {
145
145
  mid: string;
146
146
  token: string;
147
147
  }) => Promise<void>;
148
148
  theme: "light" | "dark";
149
- };
149
+ } & Partial<IEnvConfigType>;
150
150
  declare const MatchProvider: React$1.FC<{
151
151
  children: ReactNode;
152
152
  appid: string;
153
- env?: IEnvName;
154
153
  events?: IMatchEvents;
155
154
  theme?: "light" | "dark";
155
+ endpoints?: IEnvConfigType['endpoints'];
156
156
  }>;
157
157
  declare const useMatch: () => MatchContextType;
158
158
 
@@ -190,20 +190,20 @@ declare function PasswordModal({ title, isOpen, onSuccess, ...props }: ModalWith
190
190
  onSuccess?: () => void;
191
191
  }): react_jsx_runtime.JSX.Element;
192
192
 
193
- declare const index$2_Button: typeof Button;
194
- declare const index$2_EmailModal: typeof EmailModal;
195
- declare const index$2_Field: typeof Field;
196
- declare const index$2_Input: typeof Input;
197
- declare const index$2_LoginBox: typeof LoginBox;
198
- declare const index$2_LoginButton: typeof LoginButton;
199
- declare const index$2_LoginModal: typeof LoginModal;
200
- declare const index$2_LoginPanel: typeof LoginPanel;
201
- declare const index$2_Modal: typeof Modal;
202
- declare const index$2_ModalWithHeader: typeof ModalWithHeader;
203
- declare const index$2_PasswordModal: typeof PasswordModal;
204
- declare const index$2_UsernameModal: typeof UsernameModal;
205
- declare namespace index$2 {
206
- export { index$2_Button as Button, index$2_EmailModal as EmailModal, index$2_Field as Field, index$2_Input as Input, index$2_LoginBox as LoginBox, index$2_LoginButton as LoginButton, index$2_LoginModal as LoginModal, index$2_LoginPanel as LoginPanel, index$2_Modal as Modal, index$2_ModalWithHeader as ModalWithHeader, index$2_PasswordModal as PasswordModal, index$2_UsernameModal as UsernameModal };
193
+ declare const index$3_Button: typeof Button;
194
+ declare const index$3_EmailModal: typeof EmailModal;
195
+ declare const index$3_Field: typeof Field;
196
+ declare const index$3_Input: typeof Input;
197
+ declare const index$3_LoginBox: typeof LoginBox;
198
+ declare const index$3_LoginButton: typeof LoginButton;
199
+ declare const index$3_LoginModal: typeof LoginModal;
200
+ declare const index$3_LoginPanel: typeof LoginPanel;
201
+ declare const index$3_Modal: typeof Modal;
202
+ declare const index$3_ModalWithHeader: typeof ModalWithHeader;
203
+ declare const index$3_PasswordModal: typeof PasswordModal;
204
+ declare const index$3_UsernameModal: typeof UsernameModal;
205
+ declare namespace index$3 {
206
+ 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_UsernameModal as UsernameModal };
207
207
  }
208
208
 
209
209
  declare function useUserInfo(): {
@@ -227,6 +227,7 @@ declare function useUserInfo(): {
227
227
  bindWallet: () => Promise<void>;
228
228
  bindTelegram: () => Promise<void>;
229
229
  username: string;
230
+ auth: () => Promise<any>;
230
231
  };
231
232
 
232
233
  declare function useMatchEvents(handlers: IMatchEvents): void;
@@ -247,14 +248,17 @@ interface UseWalletReturnType {
247
248
  recoveryWallet: (chainType: ChainType | undefined, recoveryType: RecoveryType, userPasscode?: string) => Promise<void>;
248
249
  signMessage: (message: SignableMessage, type?: ChainType) => Promise<Hex>;
249
250
  signTransaction: (transaction: TransactionSerializable, type?: ChainType) => Promise<`0x02${string}` | `0x01${string}` | `0x03${string}` | `0x04${string}` | viem.TransactionSerializedLegacy>;
251
+ address: string;
252
+ evmAccount: Account | undefined;
253
+ recoverAfter: (func: (resolve: (value: any) => void, reject: (reason: string) => void) => Promise<any>) => Promise<any>;
250
254
  }
251
255
  declare function useWallet(): UseWalletReturnType;
252
256
 
253
- declare const index$1_useMatchEvents: typeof useMatchEvents;
254
- declare const index$1_useUserInfo: typeof useUserInfo;
255
- declare const index$1_useWallet: typeof useWallet;
256
- declare namespace index$1 {
257
- export { index$1_useMatchEvents as useMatchEvents, index$1_useUserInfo as useUserInfo, index$1_useWallet as useWallet };
257
+ declare const index$2_useMatchEvents: typeof useMatchEvents;
258
+ declare const index$2_useUserInfo: typeof useUserInfo;
259
+ declare const index$2_useWallet: typeof useWallet;
260
+ declare namespace index$2 {
261
+ export { index$2_useMatchEvents as useMatchEvents, index$2_useUserInfo as useUserInfo, index$2_useWallet as useWallet };
258
262
  }
259
263
 
260
264
  interface MyResponseType<T> {
@@ -278,6 +282,10 @@ declare const unBindWalletApi: ({ address }: {
278
282
  address: string;
279
283
  }) => Promise<MyResponseType<any>>;
280
284
  declare const verifyPohApi: ({ taskId, schemaId, publicFields, allocatorAddress, publicFieldsHash, allocatorSignature, uHash, validatorAddress, validatorSignature }: PohZkpassParams) => Promise<MyResponseType<any>>;
285
+ declare const chooseIdentityApi: ({ identity }: {
286
+ identity: string;
287
+ }) => Promise<MyResponseType<any>>;
288
+ declare const mintPassportNftApi: () => Promise<MyResponseType<any>>;
281
289
 
282
290
  declare function useBindList(options?: Omit<UseQueryOptions<BindItemType[]>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<BindItemType[], Error>;
283
291
  declare function useBindInfo(options?: Omit<UseQueryOptions<BindInfoType>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<BindInfoType, Error>;
@@ -299,10 +307,97 @@ declare namespace poh {
299
307
  export { poh_usePohList as usePohList, poh_verifyPohApi as verifyPohApi };
300
308
  }
301
309
 
302
- declare const index_bind: typeof bind;
303
- declare const index_poh: typeof poh;
310
+ declare const user_chooseIdentityApi: typeof chooseIdentityApi;
311
+ declare const user_mintPassportNftApi: typeof mintPassportNftApi;
312
+ declare namespace user {
313
+ export { user_chooseIdentityApi as chooseIdentityApi, user_mintPassportNftApi as mintPassportNftApi };
314
+ }
315
+
316
+ declare const index$1_bind: typeof bind;
317
+ declare const index$1_poh: typeof poh;
318
+ declare const index$1_user: typeof user;
319
+ declare namespace index$1 {
320
+ export { index$1_bind as bind, index$1_poh as poh, index$1_user as user };
321
+ }
322
+
323
+ declare const matchMain: {
324
+ blockExplorers: {
325
+ readonly default: {
326
+ readonly name: "Matchscan";
327
+ readonly url: "https://matchscan.io/";
328
+ readonly apiUrl: "https://matchscan.io/api";
329
+ };
330
+ };
331
+ contracts: {
332
+ readonly multicall3: {
333
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
334
+ };
335
+ };
336
+ id: 698;
337
+ name: "Matchain";
338
+ nativeCurrency: {
339
+ readonly name: "Match Coin";
340
+ readonly symbol: "BNB";
341
+ readonly decimals: 18;
342
+ };
343
+ rpcUrls: {
344
+ readonly default: {
345
+ readonly http: readonly ["https://rpc.matchain.io"];
346
+ };
347
+ };
348
+ sourceId?: number | undefined;
349
+ testnet?: boolean | undefined;
350
+ custom?: Record<string, unknown> | undefined;
351
+ fees?: viem.ChainFees<undefined> | undefined;
352
+ formatters?: undefined;
353
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
354
+ readonly iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png";
355
+ };
356
+
357
+ declare const matchTest: {
358
+ blockExplorers: {
359
+ readonly default: {
360
+ readonly name: "Matchscan";
361
+ readonly url: "https://testnet.matchscan.io/";
362
+ readonly apiUrl: "https://testnet.matchscan.io/api";
363
+ };
364
+ };
365
+ contracts: {
366
+ readonly multicall3: {
367
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
368
+ readonly blockCreated: 751532;
369
+ };
370
+ readonly ensRegistry: {
371
+ readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
372
+ };
373
+ readonly ensUniversalResolver: {
374
+ readonly address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC";
375
+ readonly blockCreated: 5317080;
376
+ };
377
+ };
378
+ id: 699;
379
+ name: "MatchTest";
380
+ nativeCurrency: {
381
+ readonly name: "Match Coin";
382
+ readonly symbol: "BNB";
383
+ readonly decimals: 18;
384
+ };
385
+ rpcUrls: {
386
+ readonly default: {
387
+ readonly http: readonly ["https://testnet-rpc.matchain.io"];
388
+ };
389
+ };
390
+ sourceId?: number | undefined;
391
+ testnet?: boolean | undefined;
392
+ custom?: Record<string, unknown> | undefined;
393
+ fees?: viem.ChainFees<undefined> | undefined;
394
+ formatters?: undefined;
395
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
396
+ readonly iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png";
397
+ };
398
+
304
399
  declare namespace index {
305
- export { index_bind as bind, index_poh as poh };
400
+ export { matchMain as MatchMain, matchTest as MatchTest };
306
401
  }
307
402
 
308
- export { index as Api, index$2 as Components, index$1 as Hooks, MatchProvider, useMatch };
403
+ export { index$1 as Api, index as Chains, index$3 as Components, index$2 as Hooks, MatchProvider, useMatch };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  import React$1, { PropsWithChildren, CSSProperties, ReactNode } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as viem from 'viem';
4
- import { SignableMessage, Hex, TransactionSerializable } from 'viem';
4
+ import { SignableMessage, Hex, TransactionSerializable, Account } from 'viem';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { UseQueryOptions } from '@tanstack/react-query/src/types';
7
7
 
8
8
  type LoginMethodType = 'wallet' | 'email' | 'google' | 'X' | 'telegram'
9
- type IEnvName = 'main' | 'dev' | 'test'
9
+ type IEnvConfigType = {
10
+ endpoints: {
11
+ back: string;
12
+ auth: string;
13
+ };
14
+ }
10
15
  type IMatchEvents = {
11
16
  onLogin?: (data: {
12
17
  mid?: string;
@@ -134,25 +139,20 @@ type PohZkpassParams = {
134
139
  }
135
140
 
136
141
  type MatchContextType = {
137
- env: IEnvName;
138
142
  appid: string;
139
- endpoints: {
140
- login: string;
141
- back: string;
142
- };
143
143
  events?: IMatchEvents;
144
144
  login: (data: {
145
145
  mid: string;
146
146
  token: string;
147
147
  }) => Promise<void>;
148
148
  theme: "light" | "dark";
149
- };
149
+ } & Partial<IEnvConfigType>;
150
150
  declare const MatchProvider: React$1.FC<{
151
151
  children: ReactNode;
152
152
  appid: string;
153
- env?: IEnvName;
154
153
  events?: IMatchEvents;
155
154
  theme?: "light" | "dark";
155
+ endpoints?: IEnvConfigType['endpoints'];
156
156
  }>;
157
157
  declare const useMatch: () => MatchContextType;
158
158
 
@@ -190,20 +190,20 @@ declare function PasswordModal({ title, isOpen, onSuccess, ...props }: ModalWith
190
190
  onSuccess?: () => void;
191
191
  }): react_jsx_runtime.JSX.Element;
192
192
 
193
- declare const index$2_Button: typeof Button;
194
- declare const index$2_EmailModal: typeof EmailModal;
195
- declare const index$2_Field: typeof Field;
196
- declare const index$2_Input: typeof Input;
197
- declare const index$2_LoginBox: typeof LoginBox;
198
- declare const index$2_LoginButton: typeof LoginButton;
199
- declare const index$2_LoginModal: typeof LoginModal;
200
- declare const index$2_LoginPanel: typeof LoginPanel;
201
- declare const index$2_Modal: typeof Modal;
202
- declare const index$2_ModalWithHeader: typeof ModalWithHeader;
203
- declare const index$2_PasswordModal: typeof PasswordModal;
204
- declare const index$2_UsernameModal: typeof UsernameModal;
205
- declare namespace index$2 {
206
- export { index$2_Button as Button, index$2_EmailModal as EmailModal, index$2_Field as Field, index$2_Input as Input, index$2_LoginBox as LoginBox, index$2_LoginButton as LoginButton, index$2_LoginModal as LoginModal, index$2_LoginPanel as LoginPanel, index$2_Modal as Modal, index$2_ModalWithHeader as ModalWithHeader, index$2_PasswordModal as PasswordModal, index$2_UsernameModal as UsernameModal };
193
+ declare const index$3_Button: typeof Button;
194
+ declare const index$3_EmailModal: typeof EmailModal;
195
+ declare const index$3_Field: typeof Field;
196
+ declare const index$3_Input: typeof Input;
197
+ declare const index$3_LoginBox: typeof LoginBox;
198
+ declare const index$3_LoginButton: typeof LoginButton;
199
+ declare const index$3_LoginModal: typeof LoginModal;
200
+ declare const index$3_LoginPanel: typeof LoginPanel;
201
+ declare const index$3_Modal: typeof Modal;
202
+ declare const index$3_ModalWithHeader: typeof ModalWithHeader;
203
+ declare const index$3_PasswordModal: typeof PasswordModal;
204
+ declare const index$3_UsernameModal: typeof UsernameModal;
205
+ declare namespace index$3 {
206
+ 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_UsernameModal as UsernameModal };
207
207
  }
208
208
 
209
209
  declare function useUserInfo(): {
@@ -227,6 +227,7 @@ declare function useUserInfo(): {
227
227
  bindWallet: () => Promise<void>;
228
228
  bindTelegram: () => Promise<void>;
229
229
  username: string;
230
+ auth: () => Promise<any>;
230
231
  };
231
232
 
232
233
  declare function useMatchEvents(handlers: IMatchEvents): void;
@@ -247,14 +248,17 @@ interface UseWalletReturnType {
247
248
  recoveryWallet: (chainType: ChainType | undefined, recoveryType: RecoveryType, userPasscode?: string) => Promise<void>;
248
249
  signMessage: (message: SignableMessage, type?: ChainType) => Promise<Hex>;
249
250
  signTransaction: (transaction: TransactionSerializable, type?: ChainType) => Promise<`0x02${string}` | `0x01${string}` | `0x03${string}` | `0x04${string}` | viem.TransactionSerializedLegacy>;
251
+ address: string;
252
+ evmAccount: Account | undefined;
253
+ recoverAfter: (func: (resolve: (value: any) => void, reject: (reason: string) => void) => Promise<any>) => Promise<any>;
250
254
  }
251
255
  declare function useWallet(): UseWalletReturnType;
252
256
 
253
- declare const index$1_useMatchEvents: typeof useMatchEvents;
254
- declare const index$1_useUserInfo: typeof useUserInfo;
255
- declare const index$1_useWallet: typeof useWallet;
256
- declare namespace index$1 {
257
- export { index$1_useMatchEvents as useMatchEvents, index$1_useUserInfo as useUserInfo, index$1_useWallet as useWallet };
257
+ declare const index$2_useMatchEvents: typeof useMatchEvents;
258
+ declare const index$2_useUserInfo: typeof useUserInfo;
259
+ declare const index$2_useWallet: typeof useWallet;
260
+ declare namespace index$2 {
261
+ export { index$2_useMatchEvents as useMatchEvents, index$2_useUserInfo as useUserInfo, index$2_useWallet as useWallet };
258
262
  }
259
263
 
260
264
  interface MyResponseType<T> {
@@ -278,6 +282,10 @@ declare const unBindWalletApi: ({ address }: {
278
282
  address: string;
279
283
  }) => Promise<MyResponseType<any>>;
280
284
  declare const verifyPohApi: ({ taskId, schemaId, publicFields, allocatorAddress, publicFieldsHash, allocatorSignature, uHash, validatorAddress, validatorSignature }: PohZkpassParams) => Promise<MyResponseType<any>>;
285
+ declare const chooseIdentityApi: ({ identity }: {
286
+ identity: string;
287
+ }) => Promise<MyResponseType<any>>;
288
+ declare const mintPassportNftApi: () => Promise<MyResponseType<any>>;
281
289
 
282
290
  declare function useBindList(options?: Omit<UseQueryOptions<BindItemType[]>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<BindItemType[], Error>;
283
291
  declare function useBindInfo(options?: Omit<UseQueryOptions<BindInfoType>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<BindInfoType, Error>;
@@ -299,10 +307,97 @@ declare namespace poh {
299
307
  export { poh_usePohList as usePohList, poh_verifyPohApi as verifyPohApi };
300
308
  }
301
309
 
302
- declare const index_bind: typeof bind;
303
- declare const index_poh: typeof poh;
310
+ declare const user_chooseIdentityApi: typeof chooseIdentityApi;
311
+ declare const user_mintPassportNftApi: typeof mintPassportNftApi;
312
+ declare namespace user {
313
+ export { user_chooseIdentityApi as chooseIdentityApi, user_mintPassportNftApi as mintPassportNftApi };
314
+ }
315
+
316
+ declare const index$1_bind: typeof bind;
317
+ declare const index$1_poh: typeof poh;
318
+ declare const index$1_user: typeof user;
319
+ declare namespace index$1 {
320
+ export { index$1_bind as bind, index$1_poh as poh, index$1_user as user };
321
+ }
322
+
323
+ declare const matchMain: {
324
+ blockExplorers: {
325
+ readonly default: {
326
+ readonly name: "Matchscan";
327
+ readonly url: "https://matchscan.io/";
328
+ readonly apiUrl: "https://matchscan.io/api";
329
+ };
330
+ };
331
+ contracts: {
332
+ readonly multicall3: {
333
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
334
+ };
335
+ };
336
+ id: 698;
337
+ name: "Matchain";
338
+ nativeCurrency: {
339
+ readonly name: "Match Coin";
340
+ readonly symbol: "BNB";
341
+ readonly decimals: 18;
342
+ };
343
+ rpcUrls: {
344
+ readonly default: {
345
+ readonly http: readonly ["https://rpc.matchain.io"];
346
+ };
347
+ };
348
+ sourceId?: number | undefined;
349
+ testnet?: boolean | undefined;
350
+ custom?: Record<string, unknown> | undefined;
351
+ fees?: viem.ChainFees<undefined> | undefined;
352
+ formatters?: undefined;
353
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
354
+ readonly iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png";
355
+ };
356
+
357
+ declare const matchTest: {
358
+ blockExplorers: {
359
+ readonly default: {
360
+ readonly name: "Matchscan";
361
+ readonly url: "https://testnet.matchscan.io/";
362
+ readonly apiUrl: "https://testnet.matchscan.io/api";
363
+ };
364
+ };
365
+ contracts: {
366
+ readonly multicall3: {
367
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
368
+ readonly blockCreated: 751532;
369
+ };
370
+ readonly ensRegistry: {
371
+ readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
372
+ };
373
+ readonly ensUniversalResolver: {
374
+ readonly address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC";
375
+ readonly blockCreated: 5317080;
376
+ };
377
+ };
378
+ id: 699;
379
+ name: "MatchTest";
380
+ nativeCurrency: {
381
+ readonly name: "Match Coin";
382
+ readonly symbol: "BNB";
383
+ readonly decimals: 18;
384
+ };
385
+ rpcUrls: {
386
+ readonly default: {
387
+ readonly http: readonly ["https://testnet-rpc.matchain.io"];
388
+ };
389
+ };
390
+ sourceId?: number | undefined;
391
+ testnet?: boolean | undefined;
392
+ custom?: Record<string, unknown> | undefined;
393
+ fees?: viem.ChainFees<undefined> | undefined;
394
+ formatters?: undefined;
395
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
396
+ readonly iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png";
397
+ };
398
+
304
399
  declare namespace index {
305
- export { index_bind as bind, index_poh as poh };
400
+ export { matchMain as MatchMain, matchTest as MatchTest };
306
401
  }
307
402
 
308
- export { index as Api, index$2 as Components, index$1 as Hooks, MatchProvider, useMatch };
403
+ export { index$1 as Api, index as Chains, index$3 as Components, index$2 as Hooks, MatchProvider, useMatch };