@matchain/matchid-sdk-react 0.1.38 → 0.1.40-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-IHRQKSSO.mjs → chunk-75ZLGQV7.mjs} +2 -2
- package/dist/{chunk-F5CJROWH.mjs → chunk-XMGJLSI2.mjs} +46 -25
- package/dist/chunk-XMGJLSI2.mjs.map +1 -0
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +5 -2
- 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 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/{index-DUCRzr-P.d.ts → index-BPveUnst.d.ts} +1 -1
- package/dist/{index-CAvsdgJw.d.mts → index-ClQl2MMF.d.mts} +1 -1
- package/dist/{index-B89X65ox.d.ts → index-CvCSpU8m.d.ts} +1 -1
- package/dist/{index-BICt0DjJ.d.ts → index-DlrDrTMk.d.ts} +1 -1
- package/dist/{index-BTTka3Uo.d.mts → index-Dm5o2w2J.d.mts} +1 -1
- package/dist/{index-CzAaZV-2.d.mts → index-mEK7Lcps.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +42 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/{types.d-Cqt8ifXa.d.mts → types.d-IS3DBl3p.d.mts} +1 -1
- package/dist/{types.d-Cqt8ifXa.d.ts → types.d-IS3DBl3p.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-F5CJROWH.mjs.map +0 -1
- /package/dist/{chunk-IHRQKSSO.mjs.map → chunk-75ZLGQV7.mjs.map} +0 -0
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as ISocialLoginMethod, j as OverviewInfo, C as CEXType, k as LoginMethodType, I as IMatchEvents } from './types.d-IS3DBl3p.js';
|
|
2
2
|
import * as viem from 'viem';
|
|
3
3
|
import { SignableMessage, Hex, TransactionSerializable, Account } from 'viem';
|
|
4
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { E as EmailModalProps,
|
|
2
|
+
import { E as EmailModalProps, b as InputProps, B as ButtonProps, M as ModalProps, c as ModalWithHeaderProps, P as PopoverProps, d as LoginBoxProps, O as OtherLoginMethodType, R as RecommendLoginMethodType, W as WalletType, e as PopoverPositionType, f as PopoverTypeType, g as LoginPanelProps, h as LoginModalProps } from './types.d-IS3DBl3p.mjs';
|
|
3
3
|
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function EmailModal({ isOpen, width, onClose, onBack, onLogin }: EmailModalProps): react_jsx_runtime.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { E as EmailModalProps,
|
|
2
|
+
import { E as EmailModalProps, b as InputProps, B as ButtonProps, M as ModalProps, c as ModalWithHeaderProps, P as PopoverProps, d as LoginBoxProps, O as OtherLoginMethodType, R as RecommendLoginMethodType, W as WalletType, e as PopoverPositionType, f as PopoverTypeType, g as LoginPanelProps, h as LoginModalProps } from './types.d-IS3DBl3p.js';
|
|
3
3
|
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function EmailModal({ isOpen, width, onClose, onBack, onLogin }: EmailModalProps): react_jsx_runtime.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { UseQueryOptions } from '@tanstack/react-query/src/types';
|
|
3
|
-
import { m as PohZkpassParams, n as BindItemType, o as BindInfoType, p as PohItemType } from './types.d-
|
|
3
|
+
import { m as PohZkpassParams, n as BindItemType, o as BindInfoType, p as PohItemType } from './types.d-IS3DBl3p.js';
|
|
4
4
|
|
|
5
5
|
interface MyResponseType<T> {
|
|
6
6
|
code: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as ISocialLoginMethod, j as OverviewInfo, C as CEXType, k as LoginMethodType, I as IMatchEvents } from './types.d-IS3DBl3p.mjs';
|
|
2
2
|
import * as viem from 'viem';
|
|
3
3
|
import { SignableMessage, Hex, TransactionSerializable, Account } from 'viem';
|
|
4
4
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { UseQueryOptions } from '@tanstack/react-query/src/types';
|
|
3
|
-
import { m as PohZkpassParams, n as BindItemType, o as BindInfoType, p as PohItemType } from './types.d-
|
|
3
|
+
import { m as PohZkpassParams, n as BindItemType, o as BindInfoType, p as PohItemType } from './types.d-IS3DBl3p.mjs';
|
|
4
4
|
|
|
5
5
|
interface MyResponseType<T> {
|
|
6
6
|
code: number;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType } from './types.d-
|
|
3
|
-
export { i as Components } from './index-
|
|
4
|
-
export { i as Hooks } from './index-
|
|
5
|
-
export { i as Api } from './index-
|
|
2
|
+
import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType } from './types.d-IS3DBl3p.mjs';
|
|
3
|
+
export { i as Components } from './index-ClQl2MMF.mjs';
|
|
4
|
+
export { i as Hooks } from './index-Dm5o2w2J.mjs';
|
|
5
|
+
export { i as Api } from './index-mEK7Lcps.mjs';
|
|
6
6
|
export { i as Chains } from './index-DXRGMAbv.mjs';
|
|
7
7
|
import 'react/jsx-runtime';
|
|
8
8
|
import 'viem';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType } from './types.d-
|
|
3
|
-
export { i as Components } from './index-
|
|
4
|
-
export { i as Hooks } from './index-
|
|
5
|
-
export { i as Api } from './index-
|
|
2
|
+
import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType } from './types.d-IS3DBl3p.js';
|
|
3
|
+
export { i as Components } from './index-CvCSpU8m.js';
|
|
4
|
+
export { i as Hooks } from './index-BPveUnst.js';
|
|
5
|
+
export { i as Api } from './index-DlrDrTMk.js';
|
|
6
6
|
export { i as Chains } from './index-DXRGMAbv.js';
|
|
7
7
|
import 'react/jsx-runtime';
|
|
8
8
|
import 'viem';
|
package/dist/index.js
CHANGED
|
@@ -2502,9 +2502,12 @@ function LoginBox({
|
|
|
2502
2502
|
],
|
|
2503
2503
|
methods = [
|
|
2504
2504
|
"telegram",
|
|
2505
|
-
"twitter"
|
|
2505
|
+
"twitter",
|
|
2506
|
+
"github",
|
|
2507
|
+
"linkedin",
|
|
2508
|
+
"discord"
|
|
2506
2509
|
],
|
|
2507
|
-
walletMethods = ["evm", "sol"],
|
|
2510
|
+
walletMethods = ["evm", "sol", "btc", "tron"],
|
|
2508
2511
|
inModal = false
|
|
2509
2512
|
}) {
|
|
2510
2513
|
const [emailOpen, setEmailOpen] = (0, import_react12.useState)(false);
|
|
@@ -3871,6 +3874,9 @@ function CEXBindModal({
|
|
|
3871
3874
|
const [key, setKey] = (0, import_react22.useState)("");
|
|
3872
3875
|
const [secret, setSecret] = (0, import_react22.useState)("");
|
|
3873
3876
|
const [error, setError] = (0, import_react22.useState)("");
|
|
3877
|
+
const needPassphrase = (0, import_react22.useMemo)(() => {
|
|
3878
|
+
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
3879
|
+
}, [type]);
|
|
3874
3880
|
(0, import_react22.useEffect)(() => {
|
|
3875
3881
|
if (isOpen) {
|
|
3876
3882
|
setSecret("");
|
|
@@ -3887,7 +3893,7 @@ function CEXBindModal({
|
|
|
3887
3893
|
cex: type,
|
|
3888
3894
|
api_key: key,
|
|
3889
3895
|
api_secret: secret,
|
|
3890
|
-
...
|
|
3896
|
+
...needPassphrase ? { api_passphrase: APIPassphrase } : {}
|
|
3891
3897
|
});
|
|
3892
3898
|
if (isSuccess(res)) {
|
|
3893
3899
|
await refreshOverview();
|
|
@@ -3939,7 +3945,7 @@ function CEXBindModal({
|
|
|
3939
3945
|
placeholder: "**** **** ****"
|
|
3940
3946
|
}
|
|
3941
3947
|
) }),
|
|
3942
|
-
|
|
3948
|
+
needPassphrase && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Field, { error, label: intl.formatMessage({
|
|
3943
3949
|
id: "CEXBindApiPassphrase"
|
|
3944
3950
|
}), children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
3945
3951
|
Input,
|
|
@@ -4048,6 +4054,13 @@ function useWalletInit({
|
|
|
4048
4054
|
const [walletInited, setWalletInited] = (0, import_react23.useState)(false);
|
|
4049
4055
|
const { appid, token, overview } = useLocalStore_default();
|
|
4050
4056
|
const { initWallet, generateWallet } = useWallet();
|
|
4057
|
+
const [iframeLoaded, setIframeLoaded] = (0, import_react23.useState)(false);
|
|
4058
|
+
(0, import_react23.useEffect)(() => {
|
|
4059
|
+
console.log("wallet status", {
|
|
4060
|
+
iframeLoaded,
|
|
4061
|
+
walletInited
|
|
4062
|
+
});
|
|
4063
|
+
}, [iframeLoaded, walletInited]);
|
|
4051
4064
|
(0, import_react23.useEffect)(() => {
|
|
4052
4065
|
if (endpoints.auth) {
|
|
4053
4066
|
if (!window.matchWalletMessageIdMap) {
|
|
@@ -4064,6 +4077,10 @@ function useWalletInit({
|
|
|
4064
4077
|
iframe.onerror = (e) => {
|
|
4065
4078
|
console.error("iframe error", e);
|
|
4066
4079
|
};
|
|
4080
|
+
iframe.addEventListener("load", () => {
|
|
4081
|
+
console.log("Iframe has loaded.");
|
|
4082
|
+
setIframeLoaded(true);
|
|
4083
|
+
});
|
|
4067
4084
|
document.body.insertBefore(iframe, document.body.firstChild);
|
|
4068
4085
|
window.sendMatchWalletMessage = (method, data) => {
|
|
4069
4086
|
const messageId = Date.now().toString() + Math.random().toString().slice(6);
|
|
@@ -4073,32 +4090,36 @@ function useWalletInit({
|
|
|
4073
4090
|
messageId,
|
|
4074
4091
|
source: "matchid"
|
|
4075
4092
|
};
|
|
4093
|
+
if (!iframeLoaded) {
|
|
4094
|
+
throw new Error("Wallet not ready");
|
|
4095
|
+
}
|
|
4096
|
+
if (!walletInited) {
|
|
4097
|
+
throw new Error("Wallet not inited");
|
|
4098
|
+
}
|
|
4076
4099
|
if (document.getElementById("match-wallet")) {
|
|
4077
4100
|
matchlog_default.log("matchid.sdk.sendMatchWalletMessage", message, endpoints.auth);
|
|
4078
4101
|
getWalletIframe()?.contentWindow?.postMessage(message, endpoints.auth);
|
|
4079
4102
|
return messageId;
|
|
4080
4103
|
}
|
|
4081
|
-
|
|
4082
|
-
return false;
|
|
4104
|
+
throw new Error("Wallet not found");
|
|
4083
4105
|
};
|
|
4084
4106
|
window.waitMatchUntilWalletMessage = async (method, data, timeout = 3e4) => {
|
|
4085
4107
|
return new Promise((resolve, reject) => {
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4108
|
+
try {
|
|
4109
|
+
const messageId = window.sendMatchWalletMessage(method, data);
|
|
4110
|
+
window.matchWalletMessageIdMap[messageId] = { resolve, reject };
|
|
4111
|
+
window.matchWalletMessageIdMap[messageId].timeout = setTimeout(() => {
|
|
4112
|
+
console.error("Get wallet result timeout", {
|
|
4113
|
+
messageId,
|
|
4114
|
+
method,
|
|
4115
|
+
data
|
|
4116
|
+
});
|
|
4117
|
+
delete window.matchWalletMessageIdMap[messageId];
|
|
4118
|
+
reject(new Error("Get wallet result timeout"));
|
|
4119
|
+
}, timeout);
|
|
4120
|
+
} catch (error) {
|
|
4121
|
+
reject(error);
|
|
4091
4122
|
}
|
|
4092
|
-
window.matchWalletMessageIdMap[messageId] = { resolve, reject };
|
|
4093
|
-
window.matchWalletMessageIdMap[messageId].timeout = setTimeout(() => {
|
|
4094
|
-
console.error("Get wallet result timeout", {
|
|
4095
|
-
messageId,
|
|
4096
|
-
method,
|
|
4097
|
-
data
|
|
4098
|
-
});
|
|
4099
|
-
delete window.matchWalletMessageIdMap[messageId];
|
|
4100
|
-
reject(new Error("Get wallet result timeout"));
|
|
4101
|
-
}, timeout);
|
|
4102
4123
|
});
|
|
4103
4124
|
};
|
|
4104
4125
|
} else {
|