@matchain/matchid-sdk-react 0.1.10 → 0.1.12
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 +107 -24
- package/dist/index.d.ts +107 -24
- package/dist/index.js +127 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -57
- package/dist/index.mjs.map +1 -1
- package/example/package.json +1 -0
- package/example/src/App.tsx +7 -3
- package/example/src/components/Login/index.tsx +73 -0
- package/example/src/components/RoutePrivate/index.tsx +9 -0
- package/example/src/pages/{Login.tsx → User.tsx} +7 -86
- package/example/src/pages/Wallet.tsx +130 -0
- package/example/tsconfig.json +5 -1
- package/example/vite.config.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
|
@@ -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$
|
|
194
|
-
declare const index$
|
|
195
|
-
declare const index$
|
|
196
|
-
declare const index$
|
|
197
|
-
declare const index$
|
|
198
|
-
declare const index$
|
|
199
|
-
declare const index$
|
|
200
|
-
declare const index$
|
|
201
|
-
declare const index$
|
|
202
|
-
declare const index$
|
|
203
|
-
declare const index$
|
|
204
|
-
declare const index$
|
|
205
|
-
declare namespace index$
|
|
206
|
-
export { index$
|
|
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(): {
|
|
@@ -247,14 +247,17 @@ interface UseWalletReturnType {
|
|
|
247
247
|
recoveryWallet: (chainType: ChainType | undefined, recoveryType: RecoveryType, userPasscode?: string) => Promise<void>;
|
|
248
248
|
signMessage: (message: SignableMessage, type?: ChainType) => Promise<Hex>;
|
|
249
249
|
signTransaction: (transaction: TransactionSerializable, type?: ChainType) => Promise<`0x02${string}` | `0x01${string}` | `0x03${string}` | `0x04${string}` | viem.TransactionSerializedLegacy>;
|
|
250
|
+
address: string;
|
|
251
|
+
evmAccount: Account | undefined;
|
|
252
|
+
recoverAfter: (func: (resolve: (value: any) => void, reject: (reason: string) => void) => Promise<any>) => Promise<any>;
|
|
250
253
|
}
|
|
251
254
|
declare function useWallet(): UseWalletReturnType;
|
|
252
255
|
|
|
253
|
-
declare const index$
|
|
254
|
-
declare const index$
|
|
255
|
-
declare const index$
|
|
256
|
-
declare namespace index$
|
|
257
|
-
export { index$
|
|
256
|
+
declare const index$2_useMatchEvents: typeof useMatchEvents;
|
|
257
|
+
declare const index$2_useUserInfo: typeof useUserInfo;
|
|
258
|
+
declare const index$2_useWallet: typeof useWallet;
|
|
259
|
+
declare namespace index$2 {
|
|
260
|
+
export { index$2_useMatchEvents as useMatchEvents, index$2_useUserInfo as useUserInfo, index$2_useWallet as useWallet };
|
|
258
261
|
}
|
|
259
262
|
|
|
260
263
|
interface MyResponseType<T> {
|
|
@@ -299,10 +302,90 @@ declare namespace poh {
|
|
|
299
302
|
export { poh_usePohList as usePohList, poh_verifyPohApi as verifyPohApi };
|
|
300
303
|
}
|
|
301
304
|
|
|
302
|
-
declare const
|
|
303
|
-
declare const
|
|
305
|
+
declare const index$1_bind: typeof bind;
|
|
306
|
+
declare const index$1_poh: typeof poh;
|
|
307
|
+
declare namespace index$1 {
|
|
308
|
+
export { index$1_bind as bind, index$1_poh as poh };
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare const matchMain: {
|
|
312
|
+
blockExplorers: {
|
|
313
|
+
readonly default: {
|
|
314
|
+
readonly name: "Matchscan";
|
|
315
|
+
readonly url: "https://matchscan.io/";
|
|
316
|
+
readonly apiUrl: "https://matchscan.io/api";
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
contracts: {
|
|
320
|
+
readonly multicall3: {
|
|
321
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
id: 698;
|
|
325
|
+
name: "Matchain";
|
|
326
|
+
nativeCurrency: {
|
|
327
|
+
readonly name: "Match Coin";
|
|
328
|
+
readonly symbol: "BNB";
|
|
329
|
+
readonly decimals: 18;
|
|
330
|
+
};
|
|
331
|
+
rpcUrls: {
|
|
332
|
+
readonly default: {
|
|
333
|
+
readonly http: readonly ["https://rpc.matchain.io"];
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
sourceId?: number | undefined;
|
|
337
|
+
testnet?: boolean | undefined;
|
|
338
|
+
custom?: Record<string, unknown> | undefined;
|
|
339
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
340
|
+
formatters?: undefined;
|
|
341
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
342
|
+
readonly iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png";
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
declare const matchTest: {
|
|
346
|
+
blockExplorers: {
|
|
347
|
+
readonly default: {
|
|
348
|
+
readonly name: "Matchscan";
|
|
349
|
+
readonly url: "https://testnet.matchscan.io/";
|
|
350
|
+
readonly apiUrl: "https://testnet.matchscan.io/api";
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
contracts: {
|
|
354
|
+
readonly multicall3: {
|
|
355
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
356
|
+
readonly blockCreated: 751532;
|
|
357
|
+
};
|
|
358
|
+
readonly ensRegistry: {
|
|
359
|
+
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
360
|
+
};
|
|
361
|
+
readonly ensUniversalResolver: {
|
|
362
|
+
readonly address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC";
|
|
363
|
+
readonly blockCreated: 5317080;
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
id: 699;
|
|
367
|
+
name: "MatchTest";
|
|
368
|
+
nativeCurrency: {
|
|
369
|
+
readonly name: "Match Coin";
|
|
370
|
+
readonly symbol: "BNB";
|
|
371
|
+
readonly decimals: 18;
|
|
372
|
+
};
|
|
373
|
+
rpcUrls: {
|
|
374
|
+
readonly default: {
|
|
375
|
+
readonly http: readonly ["https://testnet-rpc.matchain.io"];
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
sourceId?: number | undefined;
|
|
379
|
+
testnet?: boolean | undefined;
|
|
380
|
+
custom?: Record<string, unknown> | undefined;
|
|
381
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
382
|
+
formatters?: undefined;
|
|
383
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
384
|
+
readonly iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png";
|
|
385
|
+
};
|
|
386
|
+
|
|
304
387
|
declare namespace index {
|
|
305
|
-
export {
|
|
388
|
+
export { matchMain as MatchMain, matchTest as MatchTest };
|
|
306
389
|
}
|
|
307
390
|
|
|
308
|
-
export { index as Api, index$
|
|
391
|
+
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,7 +1,7 @@
|
|
|
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
|
|
|
@@ -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$
|
|
194
|
-
declare const index$
|
|
195
|
-
declare const index$
|
|
196
|
-
declare const index$
|
|
197
|
-
declare const index$
|
|
198
|
-
declare const index$
|
|
199
|
-
declare const index$
|
|
200
|
-
declare const index$
|
|
201
|
-
declare const index$
|
|
202
|
-
declare const index$
|
|
203
|
-
declare const index$
|
|
204
|
-
declare const index$
|
|
205
|
-
declare namespace index$
|
|
206
|
-
export { index$
|
|
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(): {
|
|
@@ -247,14 +247,17 @@ interface UseWalletReturnType {
|
|
|
247
247
|
recoveryWallet: (chainType: ChainType | undefined, recoveryType: RecoveryType, userPasscode?: string) => Promise<void>;
|
|
248
248
|
signMessage: (message: SignableMessage, type?: ChainType) => Promise<Hex>;
|
|
249
249
|
signTransaction: (transaction: TransactionSerializable, type?: ChainType) => Promise<`0x02${string}` | `0x01${string}` | `0x03${string}` | `0x04${string}` | viem.TransactionSerializedLegacy>;
|
|
250
|
+
address: string;
|
|
251
|
+
evmAccount: Account | undefined;
|
|
252
|
+
recoverAfter: (func: (resolve: (value: any) => void, reject: (reason: string) => void) => Promise<any>) => Promise<any>;
|
|
250
253
|
}
|
|
251
254
|
declare function useWallet(): UseWalletReturnType;
|
|
252
255
|
|
|
253
|
-
declare const index$
|
|
254
|
-
declare const index$
|
|
255
|
-
declare const index$
|
|
256
|
-
declare namespace index$
|
|
257
|
-
export { index$
|
|
256
|
+
declare const index$2_useMatchEvents: typeof useMatchEvents;
|
|
257
|
+
declare const index$2_useUserInfo: typeof useUserInfo;
|
|
258
|
+
declare const index$2_useWallet: typeof useWallet;
|
|
259
|
+
declare namespace index$2 {
|
|
260
|
+
export { index$2_useMatchEvents as useMatchEvents, index$2_useUserInfo as useUserInfo, index$2_useWallet as useWallet };
|
|
258
261
|
}
|
|
259
262
|
|
|
260
263
|
interface MyResponseType<T> {
|
|
@@ -299,10 +302,90 @@ declare namespace poh {
|
|
|
299
302
|
export { poh_usePohList as usePohList, poh_verifyPohApi as verifyPohApi };
|
|
300
303
|
}
|
|
301
304
|
|
|
302
|
-
declare const
|
|
303
|
-
declare const
|
|
305
|
+
declare const index$1_bind: typeof bind;
|
|
306
|
+
declare const index$1_poh: typeof poh;
|
|
307
|
+
declare namespace index$1 {
|
|
308
|
+
export { index$1_bind as bind, index$1_poh as poh };
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare const matchMain: {
|
|
312
|
+
blockExplorers: {
|
|
313
|
+
readonly default: {
|
|
314
|
+
readonly name: "Matchscan";
|
|
315
|
+
readonly url: "https://matchscan.io/";
|
|
316
|
+
readonly apiUrl: "https://matchscan.io/api";
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
contracts: {
|
|
320
|
+
readonly multicall3: {
|
|
321
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
id: 698;
|
|
325
|
+
name: "Matchain";
|
|
326
|
+
nativeCurrency: {
|
|
327
|
+
readonly name: "Match Coin";
|
|
328
|
+
readonly symbol: "BNB";
|
|
329
|
+
readonly decimals: 18;
|
|
330
|
+
};
|
|
331
|
+
rpcUrls: {
|
|
332
|
+
readonly default: {
|
|
333
|
+
readonly http: readonly ["https://rpc.matchain.io"];
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
sourceId?: number | undefined;
|
|
337
|
+
testnet?: boolean | undefined;
|
|
338
|
+
custom?: Record<string, unknown> | undefined;
|
|
339
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
340
|
+
formatters?: undefined;
|
|
341
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
342
|
+
readonly iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png";
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
declare const matchTest: {
|
|
346
|
+
blockExplorers: {
|
|
347
|
+
readonly default: {
|
|
348
|
+
readonly name: "Matchscan";
|
|
349
|
+
readonly url: "https://testnet.matchscan.io/";
|
|
350
|
+
readonly apiUrl: "https://testnet.matchscan.io/api";
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
contracts: {
|
|
354
|
+
readonly multicall3: {
|
|
355
|
+
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
356
|
+
readonly blockCreated: 751532;
|
|
357
|
+
};
|
|
358
|
+
readonly ensRegistry: {
|
|
359
|
+
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
360
|
+
};
|
|
361
|
+
readonly ensUniversalResolver: {
|
|
362
|
+
readonly address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC";
|
|
363
|
+
readonly blockCreated: 5317080;
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
id: 699;
|
|
367
|
+
name: "MatchTest";
|
|
368
|
+
nativeCurrency: {
|
|
369
|
+
readonly name: "Match Coin";
|
|
370
|
+
readonly symbol: "BNB";
|
|
371
|
+
readonly decimals: 18;
|
|
372
|
+
};
|
|
373
|
+
rpcUrls: {
|
|
374
|
+
readonly default: {
|
|
375
|
+
readonly http: readonly ["https://testnet-rpc.matchain.io"];
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
sourceId?: number | undefined;
|
|
379
|
+
testnet?: boolean | undefined;
|
|
380
|
+
custom?: Record<string, unknown> | undefined;
|
|
381
|
+
fees?: viem.ChainFees<undefined> | undefined;
|
|
382
|
+
formatters?: undefined;
|
|
383
|
+
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
384
|
+
readonly iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png";
|
|
385
|
+
};
|
|
386
|
+
|
|
304
387
|
declare namespace index {
|
|
305
|
-
export {
|
|
388
|
+
export { matchMain as MatchMain, matchTest as MatchTest };
|
|
306
389
|
}
|
|
307
390
|
|
|
308
|
-
export { index as Api, index$
|
|
391
|
+
export { index$1 as Api, index as Chains, index$3 as Components, index$2 as Hooks, MatchProvider, useMatch };
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
Api: () => api_exports,
|
|
34
|
+
Chains: () => chains_exports,
|
|
34
35
|
Components: () => components_exports,
|
|
35
36
|
Hooks: () => hooks_exports,
|
|
36
37
|
MatchProvider: () => MatchProvider,
|
|
@@ -1017,13 +1018,14 @@ var useStore = (0, import_zustand2.create)((set) => ({
|
|
|
1017
1018
|
var useStore_default = useStore;
|
|
1018
1019
|
|
|
1019
1020
|
// src/hooks/useWallet.tsx
|
|
1021
|
+
var import_accounts = require("viem/accounts");
|
|
1020
1022
|
var AppClientId = "react-sdk-" + getVersion();
|
|
1021
1023
|
function useWallet() {
|
|
1022
|
-
const { appid, token, overview } = useLocalStore_default();
|
|
1024
|
+
const { appid, token, overview, address } = useLocalStore_default();
|
|
1023
1025
|
const { setRecoveryModal, closeRecoveryModal } = useStore_default();
|
|
1024
1026
|
const initWallet = ({
|
|
1025
1027
|
did,
|
|
1026
|
-
address
|
|
1028
|
+
address: address2
|
|
1027
1029
|
}) => {
|
|
1028
1030
|
return window.waitMatchUntilWalletMessage(
|
|
1029
1031
|
"initCore",
|
|
@@ -1032,7 +1034,7 @@ function useWallet() {
|
|
|
1032
1034
|
AppClientId,
|
|
1033
1035
|
UserId: did,
|
|
1034
1036
|
AccessToken: token,
|
|
1035
|
-
Address:
|
|
1037
|
+
Address: address2
|
|
1036
1038
|
}
|
|
1037
1039
|
);
|
|
1038
1040
|
};
|
|
@@ -1045,33 +1047,21 @@ function useWallet() {
|
|
|
1045
1047
|
userPasscode
|
|
1046
1048
|
}) => {
|
|
1047
1049
|
return await window.waitMatchUntilWalletMessage("generateWallet", {
|
|
1050
|
+
chainType: "ethereum",
|
|
1048
1051
|
recoveryType: "user_passcode_recovery_key",
|
|
1049
1052
|
userPasscode
|
|
1050
1053
|
});
|
|
1051
1054
|
};
|
|
1052
|
-
const
|
|
1055
|
+
const recoverAfter = async (func) => {
|
|
1053
1056
|
return new Promise(async (resolve, reject) => {
|
|
1054
1057
|
const res = await isRecovered();
|
|
1055
1058
|
matchlog_default.log("isRecovered", res);
|
|
1056
|
-
const getSign = async () => {
|
|
1057
|
-
try {
|
|
1058
|
-
const recoverRes = await window.waitMatchUntilWalletMessage("signMessage", {
|
|
1059
|
-
message,
|
|
1060
|
-
chainType: type
|
|
1061
|
-
});
|
|
1062
|
-
closeRecoveryModal();
|
|
1063
|
-
resolve(recoverRes);
|
|
1064
|
-
} catch (error) {
|
|
1065
|
-
console.error("qwe-sign-error", error);
|
|
1066
|
-
reject(error);
|
|
1067
|
-
}
|
|
1068
|
-
};
|
|
1069
1059
|
if (!res) {
|
|
1070
1060
|
setRecoveryModal({
|
|
1071
1061
|
open: true,
|
|
1072
1062
|
success: async () => {
|
|
1073
1063
|
matchlog_default.log("recover Success");
|
|
1074
|
-
await
|
|
1064
|
+
await func(resolve, reject);
|
|
1075
1065
|
},
|
|
1076
1066
|
close: async () => {
|
|
1077
1067
|
closeRecoveryModal();
|
|
@@ -1084,48 +1074,41 @@ function useWallet() {
|
|
|
1084
1074
|
});
|
|
1085
1075
|
} else {
|
|
1086
1076
|
await recoveryWallet("ethereum", "user_passcode_recovery_key");
|
|
1087
|
-
await
|
|
1077
|
+
await func(resolve, reject);
|
|
1088
1078
|
}
|
|
1089
1079
|
});
|
|
1090
1080
|
};
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
const recoverRes = await window.waitMatchUntilWalletMessage("signTransaction", {
|
|
1098
|
-
transaction,
|
|
1099
|
-
chainType: type
|
|
1100
|
-
});
|
|
1101
|
-
closeRecoveryModal();
|
|
1102
|
-
resolve(recoverRes);
|
|
1103
|
-
} catch (error) {
|
|
1104
|
-
console.error("qwe-sign-error", error);
|
|
1105
|
-
reject(error);
|
|
1106
|
-
}
|
|
1107
|
-
};
|
|
1108
|
-
if (!res) {
|
|
1109
|
-
setRecoveryModal({
|
|
1110
|
-
open: true,
|
|
1111
|
-
success: async () => {
|
|
1112
|
-
matchlog_default.log("recover Success");
|
|
1113
|
-
await getSign();
|
|
1114
|
-
},
|
|
1115
|
-
close: async () => {
|
|
1116
|
-
closeRecoveryModal();
|
|
1117
|
-
reject(new Error("recover modal close"));
|
|
1118
|
-
}
|
|
1081
|
+
const signMessage = async (message, type) => {
|
|
1082
|
+
const getSign = async (resolve, reject) => {
|
|
1083
|
+
try {
|
|
1084
|
+
const recoverRes = await window.waitMatchUntilWalletMessage("signMessage", {
|
|
1085
|
+
message,
|
|
1086
|
+
chainType: type
|
|
1119
1087
|
});
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1088
|
+
closeRecoveryModal();
|
|
1089
|
+
resolve(recoverRes);
|
|
1090
|
+
} catch (error) {
|
|
1091
|
+
console.error("qwe-sign-error", error);
|
|
1092
|
+
reject(error);
|
|
1093
|
+
}
|
|
1094
|
+
};
|
|
1095
|
+
return await recoverAfter(getSign);
|
|
1096
|
+
};
|
|
1097
|
+
const signTransaction = async (transaction, type) => {
|
|
1098
|
+
const getSign = async (resolve, reject) => {
|
|
1099
|
+
try {
|
|
1100
|
+
const recoverRes = await window.waitMatchUntilWalletMessage("signTransaction", {
|
|
1101
|
+
transaction,
|
|
1102
|
+
chainType: type
|
|
1123
1103
|
});
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1104
|
+
closeRecoveryModal();
|
|
1105
|
+
resolve(recoverRes);
|
|
1106
|
+
} catch (error) {
|
|
1107
|
+
console.error("qwe-sign-error", error);
|
|
1108
|
+
reject(error);
|
|
1127
1109
|
}
|
|
1128
|
-
}
|
|
1110
|
+
};
|
|
1111
|
+
return await recoverAfter(getSign);
|
|
1129
1112
|
};
|
|
1130
1113
|
const recoveryWallet = async (chainType, recoveryType, userPasscode) => {
|
|
1131
1114
|
return await window.waitMatchUntilWalletMessage("recoveryWallet", {
|
|
@@ -1134,13 +1117,32 @@ function useWallet() {
|
|
|
1134
1117
|
userPasscode
|
|
1135
1118
|
});
|
|
1136
1119
|
};
|
|
1120
|
+
const evmAccount = address ? (0, import_accounts.toAccount)({
|
|
1121
|
+
address,
|
|
1122
|
+
async signMessage({ message }) {
|
|
1123
|
+
return await signMessage(message);
|
|
1124
|
+
},
|
|
1125
|
+
async signTransaction(transaction, options) {
|
|
1126
|
+
const { account, ...restTransaction } = transaction;
|
|
1127
|
+
const sign = await signTransaction({
|
|
1128
|
+
...restTransaction
|
|
1129
|
+
});
|
|
1130
|
+
return sign;
|
|
1131
|
+
},
|
|
1132
|
+
async signTypedData(typedData) {
|
|
1133
|
+
return "0x";
|
|
1134
|
+
}
|
|
1135
|
+
}) : void 0;
|
|
1137
1136
|
return {
|
|
1137
|
+
evmAccount,
|
|
1138
|
+
address,
|
|
1138
1139
|
recoveryWallet,
|
|
1139
1140
|
initWallet,
|
|
1140
1141
|
generateWallet,
|
|
1141
1142
|
signMessage,
|
|
1142
1143
|
signTransaction,
|
|
1143
|
-
isRecovered
|
|
1144
|
+
isRecovered,
|
|
1145
|
+
recoverAfter
|
|
1144
1146
|
};
|
|
1145
1147
|
}
|
|
1146
1148
|
|
|
@@ -1399,8 +1401,6 @@ function useWalletInit({
|
|
|
1399
1401
|
if (existingIframe.src !== endpoints.login + "wallet") {
|
|
1400
1402
|
setWalletInited(false);
|
|
1401
1403
|
existingIframe.src = endpoints.login + "wallet";
|
|
1402
|
-
} else {
|
|
1403
|
-
setWalletInited(true);
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
1406
|
}
|
|
@@ -2137,9 +2137,79 @@ function usePohList(options) {
|
|
|
2137
2137
|
...options
|
|
2138
2138
|
});
|
|
2139
2139
|
}
|
|
2140
|
+
|
|
2141
|
+
// src/config/chains/index.ts
|
|
2142
|
+
var chains_exports = {};
|
|
2143
|
+
__export(chains_exports, {
|
|
2144
|
+
MatchMain: () => matchMain,
|
|
2145
|
+
MatchTest: () => matchTest
|
|
2146
|
+
});
|
|
2147
|
+
|
|
2148
|
+
// src/config/chains/MatchMain.ts
|
|
2149
|
+
var import_viem = require("viem");
|
|
2150
|
+
var matchMain = /* @__PURE__ */ (0, import_viem.defineChain)({
|
|
2151
|
+
//定义match链
|
|
2152
|
+
id: 698,
|
|
2153
|
+
name: "Matchain",
|
|
2154
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
2155
|
+
rpcUrls: {
|
|
2156
|
+
default: {
|
|
2157
|
+
http: ["https://rpc.matchain.io"]
|
|
2158
|
+
}
|
|
2159
|
+
},
|
|
2160
|
+
blockExplorers: {
|
|
2161
|
+
default: {
|
|
2162
|
+
name: "Matchscan",
|
|
2163
|
+
url: "https://matchscan.io/",
|
|
2164
|
+
apiUrl: "https://matchscan.io/api"
|
|
2165
|
+
}
|
|
2166
|
+
},
|
|
2167
|
+
iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png",
|
|
2168
|
+
contracts: {
|
|
2169
|
+
multicall3: {
|
|
2170
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11"
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
// testnet: true,
|
|
2174
|
+
});
|
|
2175
|
+
|
|
2176
|
+
// src/config/chains/MatchTest.ts
|
|
2177
|
+
var import_viem2 = require("viem");
|
|
2178
|
+
var matchTest = /* @__PURE__ */ (0, import_viem2.defineChain)({
|
|
2179
|
+
//定义matchTest链
|
|
2180
|
+
id: 699,
|
|
2181
|
+
name: "MatchTest",
|
|
2182
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
2183
|
+
rpcUrls: {
|
|
2184
|
+
default: {
|
|
2185
|
+
http: ["https://testnet-rpc.matchain.io"]
|
|
2186
|
+
}
|
|
2187
|
+
},
|
|
2188
|
+
blockExplorers: {
|
|
2189
|
+
default: {
|
|
2190
|
+
name: "Matchscan",
|
|
2191
|
+
url: "https://testnet.matchscan.io/",
|
|
2192
|
+
apiUrl: "https://testnet.matchscan.io/api"
|
|
2193
|
+
}
|
|
2194
|
+
},
|
|
2195
|
+
iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png",
|
|
2196
|
+
contracts: {
|
|
2197
|
+
multicall3: {
|
|
2198
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
2199
|
+
blockCreated: 751532
|
|
2200
|
+
},
|
|
2201
|
+
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
2202
|
+
ensUniversalResolver: {
|
|
2203
|
+
address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
|
|
2204
|
+
blockCreated: 5317080
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
// testnet: true,
|
|
2208
|
+
});
|
|
2140
2209
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2141
2210
|
0 && (module.exports = {
|
|
2142
2211
|
Api,
|
|
2212
|
+
Chains,
|
|
2143
2213
|
Components,
|
|
2144
2214
|
Hooks,
|
|
2145
2215
|
MatchProvider,
|