@matchain/matchid-sdk-react 0.1.48 → 0.1.50-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/{chunk-5JHHHLG4.mjs → chunk-HLUFAIFV.mjs} +8 -4
- package/dist/chunk-HLUFAIFV.mjs.map +1 -0
- package/dist/{chunk-YSASIFLY.mjs → chunk-P3WHQUXO.mjs} +81 -6
- package/dist/{chunk-YSASIFLY.mjs.map → chunk-P3WHQUXO.mjs.map} +1 -1
- package/dist/{chunk-4I5WVXIN.mjs → chunk-ZM2P5GEL.mjs} +2 -2
- package/dist/components/index.js +45 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/api/index.js +47 -8
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +3 -3
- package/dist/hooks/index.d.mts +2 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.js +67 -29
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-DUHkH5t-.d.mts → index-C_TiXUOB.d.mts} +37 -29
- package/dist/{index-DcQm2dkr.d.ts → index-Cx2Lx_mh.d.ts} +37 -29
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +97 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +7 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +3 -1
- package/example/src/App.tsx +12 -8
- package/example/src/pages/Wallet/index.tsx +0 -1
- package/package.json +1 -1
- package/dist/chunk-5JHHHLG4.mjs.map +0 -1
- /package/dist/{chunk-4I5WVXIN.mjs.map → chunk-ZM2P5GEL.mjs.map} +0 -0
package/dist/hooks/index.mjs
CHANGED
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
useTransaction,
|
|
13
13
|
useUserInfo,
|
|
14
14
|
useWallet
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-P3WHQUXO.mjs";
|
|
16
16
|
import "../chunk-UA6XHZHX.mjs";
|
|
17
17
|
import {
|
|
18
18
|
useLayout_exports
|
|
19
19
|
} from "../chunk-FB5MHLWX.mjs";
|
|
20
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-HLUFAIFV.mjs";
|
|
21
21
|
import "../chunk-LHNKZISB.mjs";
|
|
22
22
|
import "../chunk-J5LGTIGS.mjs";
|
|
23
23
|
export {
|
|
@@ -4,10 +4,45 @@ import { Account, WalletClientConfig, createWalletClient, SignableMessage, Hex,
|
|
|
4
4
|
import { C as ChainType } from './mpc-CTbBWHld.mjs';
|
|
5
5
|
import { Hash } from 'viem/types/misc';
|
|
6
6
|
import { Abi } from 'abitype';
|
|
7
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
8
|
import React, { ReactNode } from 'react';
|
|
8
9
|
import * as viem__types_actions_siwe_verifySiweMessage from 'viem/_types/actions/siwe/verifySiweMessage';
|
|
9
10
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
10
11
|
|
|
12
|
+
interface ModalContextType {
|
|
13
|
+
show: (content: (props: {
|
|
14
|
+
close: () => void;
|
|
15
|
+
zIndex: number;
|
|
16
|
+
}) => ReactNode, index?: number) => void;
|
|
17
|
+
open: (props: {
|
|
18
|
+
title: ReactNode;
|
|
19
|
+
content: React.ComponentType<{
|
|
20
|
+
close: () => void;
|
|
21
|
+
zIndex: number;
|
|
22
|
+
}>;
|
|
23
|
+
index?: number;
|
|
24
|
+
}) => void;
|
|
25
|
+
}
|
|
26
|
+
declare function ModalProvider({ children }: {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare function useModal(): ModalContextType;
|
|
30
|
+
|
|
31
|
+
interface ToastContextType {
|
|
32
|
+
show: (options: {
|
|
33
|
+
icon?: ReactNode;
|
|
34
|
+
timeout?: number;
|
|
35
|
+
text: ReactNode;
|
|
36
|
+
}) => void;
|
|
37
|
+
success: (text: ReactNode, timeout?: number) => void;
|
|
38
|
+
error: (text: ReactNode, timeout?: number) => void;
|
|
39
|
+
}
|
|
40
|
+
declare function ToastProvider({ children, zIndex }: {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
zIndex?: number;
|
|
43
|
+
}): react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare function useToast(): ToastContextType;
|
|
45
|
+
|
|
11
46
|
declare const LOGIN_METHOD_MAP: {
|
|
12
47
|
email: string;
|
|
13
48
|
evm: string;
|
|
@@ -27,7 +62,7 @@ declare const LOGIN_METHOD_MAP: {
|
|
|
27
62
|
|
|
28
63
|
declare function useUserInfo(): {
|
|
29
64
|
loginByMethod: (method: ISocialLoginMethod) => Promise<Window | null>;
|
|
30
|
-
loginByTelegram: () => Promise<Window | null>;
|
|
65
|
+
loginByTelegram: () => Promise<Window | null | undefined>;
|
|
31
66
|
loginByTwitter: () => Promise<Window | null>;
|
|
32
67
|
loginByGoogle: () => Promise<Window | null>;
|
|
33
68
|
loginByWallet: () => Promise<Window | null>;
|
|
@@ -108,33 +143,6 @@ declare function useWallet(): UseWalletReturnType;
|
|
|
108
143
|
|
|
109
144
|
declare function useCopyClipboard(timeout?: number): [boolean, (toCopy: string) => void];
|
|
110
145
|
|
|
111
|
-
interface ModalContextType {
|
|
112
|
-
show: (content: (props: {
|
|
113
|
-
close: () => void;
|
|
114
|
-
zIndex: number;
|
|
115
|
-
}) => ReactNode, index?: number) => void;
|
|
116
|
-
open: (props: {
|
|
117
|
-
title: ReactNode;
|
|
118
|
-
content: React.ComponentType<{
|
|
119
|
-
close: () => void;
|
|
120
|
-
zIndex: number;
|
|
121
|
-
}>;
|
|
122
|
-
index?: number;
|
|
123
|
-
}) => void;
|
|
124
|
-
}
|
|
125
|
-
declare function useModal(): ModalContextType;
|
|
126
|
-
|
|
127
|
-
interface ToastContextType {
|
|
128
|
-
show: (options: {
|
|
129
|
-
icon?: ReactNode;
|
|
130
|
-
timeout?: number;
|
|
131
|
-
text: ReactNode;
|
|
132
|
-
}) => void;
|
|
133
|
-
success: (text: ReactNode, timeout?: number) => void;
|
|
134
|
-
error: (text: ReactNode, timeout?: number) => void;
|
|
135
|
-
}
|
|
136
|
-
declare function useToast(): ToastContextType;
|
|
137
|
-
|
|
138
146
|
declare function useMatchChain(): {
|
|
139
147
|
list: UserChainType[] | undefined;
|
|
140
148
|
chainId: number | null;
|
|
@@ -3314,4 +3322,4 @@ declare namespace index {
|
|
|
3314
3322
|
export { index_useCopyClipboard as useCopyClipboard, index_useLayout as useLayout, index_useMatchChain as useMatchChain, index_useMatchEvents as useMatchEvents, index_useMatchWallet as useMatchWallet, index_useMatchWalletAssetList as useMatchWalletAssetList, index_useMatchWalletAssets as useMatchWalletAssets, index_useMatchWalletRecords as useMatchWalletRecords, index_useModal as useModal, index_useReceipt as useReceipt, index_useToast as useToast, index_useTransaction as useTransaction, index_useUserInfo as useUserInfo, index_useWallet as useWallet };
|
|
3315
3323
|
}
|
|
3316
3324
|
|
|
3317
|
-
export { useMatchEvents as a, useWallet as b, useCopyClipboard as c, useModal as d, useToast as e, useMatchChain as f, useMatchWallet as g, useMatchWalletRecords as h, index as i, useMatchWalletAssets as j, useMatchWalletAssetList as k, useReceipt as l, useTransaction as m, useLayout as n, useUserInfo as u };
|
|
3325
|
+
export { ModalProvider as M, ToastProvider as T, useMatchEvents as a, useWallet as b, useCopyClipboard as c, useModal as d, useToast as e, useMatchChain as f, useMatchWallet as g, useMatchWalletRecords as h, index as i, useMatchWalletAssets as j, useMatchWalletAssetList as k, useReceipt as l, useTransaction as m, useLayout as n, useUserInfo as u };
|
|
@@ -4,10 +4,45 @@ import { Account, WalletClientConfig, createWalletClient, SignableMessage, Hex,
|
|
|
4
4
|
import { C as ChainType } from './mpc-CTbBWHld.js';
|
|
5
5
|
import { Hash } from 'viem/types/misc';
|
|
6
6
|
import { Abi } from 'abitype';
|
|
7
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
8
|
import React, { ReactNode } from 'react';
|
|
8
9
|
import * as viem__types_actions_siwe_verifySiweMessage from 'viem/_types/actions/siwe/verifySiweMessage';
|
|
9
10
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
10
11
|
|
|
12
|
+
interface ModalContextType {
|
|
13
|
+
show: (content: (props: {
|
|
14
|
+
close: () => void;
|
|
15
|
+
zIndex: number;
|
|
16
|
+
}) => ReactNode, index?: number) => void;
|
|
17
|
+
open: (props: {
|
|
18
|
+
title: ReactNode;
|
|
19
|
+
content: React.ComponentType<{
|
|
20
|
+
close: () => void;
|
|
21
|
+
zIndex: number;
|
|
22
|
+
}>;
|
|
23
|
+
index?: number;
|
|
24
|
+
}) => void;
|
|
25
|
+
}
|
|
26
|
+
declare function ModalProvider({ children }: {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare function useModal(): ModalContextType;
|
|
30
|
+
|
|
31
|
+
interface ToastContextType {
|
|
32
|
+
show: (options: {
|
|
33
|
+
icon?: ReactNode;
|
|
34
|
+
timeout?: number;
|
|
35
|
+
text: ReactNode;
|
|
36
|
+
}) => void;
|
|
37
|
+
success: (text: ReactNode, timeout?: number) => void;
|
|
38
|
+
error: (text: ReactNode, timeout?: number) => void;
|
|
39
|
+
}
|
|
40
|
+
declare function ToastProvider({ children, zIndex }: {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
zIndex?: number;
|
|
43
|
+
}): react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare function useToast(): ToastContextType;
|
|
45
|
+
|
|
11
46
|
declare const LOGIN_METHOD_MAP: {
|
|
12
47
|
email: string;
|
|
13
48
|
evm: string;
|
|
@@ -27,7 +62,7 @@ declare const LOGIN_METHOD_MAP: {
|
|
|
27
62
|
|
|
28
63
|
declare function useUserInfo(): {
|
|
29
64
|
loginByMethod: (method: ISocialLoginMethod) => Promise<Window | null>;
|
|
30
|
-
loginByTelegram: () => Promise<Window | null>;
|
|
65
|
+
loginByTelegram: () => Promise<Window | null | undefined>;
|
|
31
66
|
loginByTwitter: () => Promise<Window | null>;
|
|
32
67
|
loginByGoogle: () => Promise<Window | null>;
|
|
33
68
|
loginByWallet: () => Promise<Window | null>;
|
|
@@ -108,33 +143,6 @@ declare function useWallet(): UseWalletReturnType;
|
|
|
108
143
|
|
|
109
144
|
declare function useCopyClipboard(timeout?: number): [boolean, (toCopy: string) => void];
|
|
110
145
|
|
|
111
|
-
interface ModalContextType {
|
|
112
|
-
show: (content: (props: {
|
|
113
|
-
close: () => void;
|
|
114
|
-
zIndex: number;
|
|
115
|
-
}) => ReactNode, index?: number) => void;
|
|
116
|
-
open: (props: {
|
|
117
|
-
title: ReactNode;
|
|
118
|
-
content: React.ComponentType<{
|
|
119
|
-
close: () => void;
|
|
120
|
-
zIndex: number;
|
|
121
|
-
}>;
|
|
122
|
-
index?: number;
|
|
123
|
-
}) => void;
|
|
124
|
-
}
|
|
125
|
-
declare function useModal(): ModalContextType;
|
|
126
|
-
|
|
127
|
-
interface ToastContextType {
|
|
128
|
-
show: (options: {
|
|
129
|
-
icon?: ReactNode;
|
|
130
|
-
timeout?: number;
|
|
131
|
-
text: ReactNode;
|
|
132
|
-
}) => void;
|
|
133
|
-
success: (text: ReactNode, timeout?: number) => void;
|
|
134
|
-
error: (text: ReactNode, timeout?: number) => void;
|
|
135
|
-
}
|
|
136
|
-
declare function useToast(): ToastContextType;
|
|
137
|
-
|
|
138
146
|
declare function useMatchChain(): {
|
|
139
147
|
list: UserChainType[] | undefined;
|
|
140
148
|
chainId: number | null;
|
|
@@ -3314,4 +3322,4 @@ declare namespace index {
|
|
|
3314
3322
|
export { index_useCopyClipboard as useCopyClipboard, index_useLayout as useLayout, index_useMatchChain as useMatchChain, index_useMatchEvents as useMatchEvents, index_useMatchWallet as useMatchWallet, index_useMatchWalletAssetList as useMatchWalletAssetList, index_useMatchWalletAssets as useMatchWalletAssets, index_useMatchWalletRecords as useMatchWalletRecords, index_useModal as useModal, index_useReceipt as useReceipt, index_useToast as useToast, index_useTransaction as useTransaction, index_useUserInfo as useUserInfo, index_useWallet as useWallet };
|
|
3315
3323
|
}
|
|
3316
3324
|
|
|
3317
|
-
export { useMatchEvents as a, useWallet as b, useCopyClipboard as c, useModal as d, useToast as e, useMatchChain as f, useMatchWallet as g, useMatchWalletRecords as h, index as i, useMatchWalletAssets as j, useMatchWalletAssetList as k, useReceipt as l, useTransaction as m, useLayout as n, useUserInfo as u };
|
|
3325
|
+
export { ModalProvider as M, ToastProvider as T, useMatchEvents as a, useWallet as b, useCopyClipboard as c, useModal as d, useToast as e, useMatchChain as f, useMatchWallet as g, useMatchWalletRecords as h, index as i, useMatchWalletAssets as j, useMatchWalletAssetList as k, useReceipt as l, useTransaction as m, useLayout as n, useUserInfo as u };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-DzVVzMYU.mjs';
|
|
3
|
+
export { i as Hooks, M as ModalProvider, T as ToastProvider } from './index-C_TiXUOB.mjs';
|
|
3
4
|
export { i as Components } from './index-C9qYyRgt.mjs';
|
|
4
5
|
export { i as UI } from './index-C9F6f2iz.mjs';
|
|
5
|
-
export { i as Hooks } from './index-DUHkH5t-.mjs';
|
|
6
6
|
export { i as Api } from './index-D4ju2J_e.mjs';
|
|
7
7
|
export { i as Chains } from './index-DXRGMAbv.mjs';
|
|
8
8
|
export { i as Types } from './index-BMfaixEx.mjs';
|
|
9
9
|
import '@tanstack/react-query/src/types';
|
|
10
|
-
import 'react/jsx-runtime';
|
|
11
|
-
import './index-Cou96DpL.mjs';
|
|
12
10
|
import 'viem';
|
|
13
11
|
import './mpc-CTbBWHld.mjs';
|
|
14
12
|
import 'viem/types/misc';
|
|
15
13
|
import 'abitype';
|
|
14
|
+
import 'react/jsx-runtime';
|
|
16
15
|
import 'viem/_types/actions/siwe/verifySiweMessage';
|
|
17
16
|
import '@tanstack/react-query';
|
|
17
|
+
import './index-Cou96DpL.mjs';
|
|
18
18
|
|
|
19
19
|
type MatchContextType = {
|
|
20
20
|
appid: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-DzVVzMYU.js';
|
|
3
|
+
export { i as Hooks, M as ModalProvider, T as ToastProvider } from './index-Cx2Lx_mh.js';
|
|
3
4
|
export { i as Components } from './index-Bvc8cjpN.js';
|
|
4
5
|
export { i as UI } from './index-BMsj8hJv.js';
|
|
5
|
-
export { i as Hooks } from './index-DcQm2dkr.js';
|
|
6
6
|
export { i as Api } from './index-Cy3K-Yao.js';
|
|
7
7
|
export { i as Chains } from './index-DXRGMAbv.js';
|
|
8
8
|
export { i as Types } from './index-Bpmrd7mh.js';
|
|
9
9
|
import '@tanstack/react-query/src/types';
|
|
10
|
-
import 'react/jsx-runtime';
|
|
11
|
-
import './index-BcEreCxd.js';
|
|
12
10
|
import 'viem';
|
|
13
11
|
import './mpc-CTbBWHld.js';
|
|
14
12
|
import 'viem/types/misc';
|
|
15
13
|
import 'abitype';
|
|
14
|
+
import 'react/jsx-runtime';
|
|
16
15
|
import 'viem/_types/actions/siwe/verifySiweMessage';
|
|
17
16
|
import '@tanstack/react-query';
|
|
17
|
+
import './index-BcEreCxd.js';
|
|
18
18
|
|
|
19
19
|
type MatchContextType = {
|
|
20
20
|
appid: string;
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,8 @@ __export(src_exports, {
|
|
|
35
35
|
Components: () => components_exports,
|
|
36
36
|
Hooks: () => hooks_exports,
|
|
37
37
|
MatchProvider: () => MatchProvider,
|
|
38
|
+
ModalProvider: () => ModalProvider,
|
|
39
|
+
ToastProvider: () => ToastProvider,
|
|
38
40
|
Types: () => types_exports,
|
|
39
41
|
UI: () => ui_exports,
|
|
40
42
|
useMatch: () => useMatch
|
|
@@ -464,6 +466,19 @@ var getWalletNftListApi = (data) => {
|
|
|
464
466
|
data
|
|
465
467
|
});
|
|
466
468
|
};
|
|
469
|
+
var tgAppLoginInitApi = () => {
|
|
470
|
+
return retryRequest({
|
|
471
|
+
url: `/api/v1/tgapp/login/init`,
|
|
472
|
+
method: "GET"
|
|
473
|
+
});
|
|
474
|
+
};
|
|
475
|
+
var getTgAppLoginStatus = (data) => {
|
|
476
|
+
return retryRequest({
|
|
477
|
+
url: `/api/v1/tgapp/login/status`,
|
|
478
|
+
method: "POST",
|
|
479
|
+
data
|
|
480
|
+
});
|
|
481
|
+
};
|
|
467
482
|
|
|
468
483
|
// src/store/useLocalStore.ts
|
|
469
484
|
var persistedState = (0, import_middleware.persist)(
|
|
@@ -618,7 +633,7 @@ var NumberFormatter = ({
|
|
|
618
633
|
}
|
|
619
634
|
}
|
|
620
635
|
if (zeroCount < tFixNum) {
|
|
621
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className, children: [
|
|
622
637
|
prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
623
638
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: intClassName, children: intFormat }),
|
|
624
639
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: decimalClassName, children: [
|
|
@@ -628,7 +643,7 @@ var NumberFormatter = ({
|
|
|
628
643
|
suffix
|
|
629
644
|
] });
|
|
630
645
|
}
|
|
631
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className, children: [
|
|
632
647
|
prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
633
648
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: intClassName, children: intFormat }),
|
|
634
649
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: decimalClassName, children: [
|
|
@@ -654,6 +669,9 @@ var formatDate = (value, formatString = "YYYY-MM-DD HH:mm:ss") => {
|
|
|
654
669
|
}
|
|
655
670
|
return "--";
|
|
656
671
|
};
|
|
672
|
+
var isInTgApp = () => {
|
|
673
|
+
return !!window.TelegramWebviewProxy;
|
|
674
|
+
};
|
|
657
675
|
|
|
658
676
|
// src/store/useModalStore.ts
|
|
659
677
|
var import_zustand2 = require("zustand");
|
|
@@ -1907,6 +1925,16 @@ var useWalletModalStore = (0, import_zustand2.create)((set) => ({
|
|
|
1907
1925
|
close: () => set({ isOpen: false })
|
|
1908
1926
|
}));
|
|
1909
1927
|
|
|
1928
|
+
// src/store/useStore.ts
|
|
1929
|
+
var import_zustand3 = require("zustand");
|
|
1930
|
+
var useStore = (0, import_zustand3.create)((set) => ({
|
|
1931
|
+
walletReady: false,
|
|
1932
|
+
setWalletReady: (inited) => set({ walletReady: inited }),
|
|
1933
|
+
tgAppAuthCode: "",
|
|
1934
|
+
setTgAppAuthCode: (code) => set({ tgAppAuthCode: code })
|
|
1935
|
+
}));
|
|
1936
|
+
var useStore_default = useStore;
|
|
1937
|
+
|
|
1910
1938
|
// src/hooks/useUserInfo.tsx
|
|
1911
1939
|
function useUserInfo() {
|
|
1912
1940
|
const {
|
|
@@ -1922,6 +1950,7 @@ function useUserInfo() {
|
|
|
1922
1950
|
locale,
|
|
1923
1951
|
refreshOverview
|
|
1924
1952
|
} = useLocalStore_default();
|
|
1953
|
+
const { setTgAppAuthCode } = useStore_default();
|
|
1925
1954
|
const { events, login } = useMatch();
|
|
1926
1955
|
const { open: SOLOpen } = useSOLModalStore();
|
|
1927
1956
|
const { open: TRONOpen } = useTRONModalStore();
|
|
@@ -1960,6 +1989,31 @@ function useUserInfo() {
|
|
|
1960
1989
|
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
1961
1990
|
};
|
|
1962
1991
|
const loginByTelegram = async () => {
|
|
1992
|
+
if (isInTgApp()) {
|
|
1993
|
+
try {
|
|
1994
|
+
const res = await tgAppLoginInitApi();
|
|
1995
|
+
if (!isSuccess(res)) {
|
|
1996
|
+
throw new Error(res.message);
|
|
1997
|
+
}
|
|
1998
|
+
setTgAppAuthCode(res.data.code);
|
|
1999
|
+
const link = res.data.login_url + `?startapp=${res.data.code}_${appid}_${locale}`;
|
|
2000
|
+
console.log("tgAppLoginInitLink", link);
|
|
2001
|
+
if (window.TelegramWebviewProxy) {
|
|
2002
|
+
console.log("in telegram webview");
|
|
2003
|
+
if (!window.Telegram) {
|
|
2004
|
+
throw new Error("Please import telegram-web-app.js first");
|
|
2005
|
+
}
|
|
2006
|
+
window.Telegram.WebApp.openTelegramLink(link);
|
|
2007
|
+
return;
|
|
2008
|
+
}
|
|
2009
|
+
console.log("not in telegram webview");
|
|
2010
|
+
window.open(link);
|
|
2011
|
+
return;
|
|
2012
|
+
} catch (e) {
|
|
2013
|
+
console.error("tgAppLoginInitApi", e);
|
|
2014
|
+
throw e;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
1963
2017
|
return window.open(
|
|
1964
2018
|
`${endpoints.auth}login/telegram?appid=${appid}&locale=${locale}`,
|
|
1965
2019
|
// Replace with the actual authorization URL
|
|
@@ -2182,14 +2236,6 @@ function useMatchEvents(handlers) {
|
|
|
2182
2236
|
// src/hooks/useWallet.tsx
|
|
2183
2237
|
var import_viem2 = require("viem");
|
|
2184
2238
|
|
|
2185
|
-
// src/store/useStore.ts
|
|
2186
|
-
var import_zustand3 = require("zustand");
|
|
2187
|
-
var useStore = (0, import_zustand3.create)((set) => ({
|
|
2188
|
-
walletReady: false,
|
|
2189
|
-
setWalletReady: (inited) => set({ walletReady: inited })
|
|
2190
|
-
}));
|
|
2191
|
-
var useStore_default = useStore;
|
|
2192
|
-
|
|
2193
2239
|
// src/types/mpc.ts
|
|
2194
2240
|
var ChainType = /* @__PURE__ */ ((ChainType2) => {
|
|
2195
2241
|
ChainType2["Ethereum"] = "ethereum";
|
|
@@ -6805,6 +6851,7 @@ function CEXBindModal({
|
|
|
6805
6851
|
}
|
|
6806
6852
|
|
|
6807
6853
|
// src/context/BusinessProvider.tsx
|
|
6854
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
6808
6855
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
6809
6856
|
function BusinessProvider({ children }) {
|
|
6810
6857
|
const { overview, token } = useUserInfo();
|
|
@@ -6814,10 +6861,31 @@ function BusinessProvider({ children }) {
|
|
|
6814
6861
|
const { type: BTCType, isOpen: BTCIsOpen, close: BTCClose } = useBTCModalStore();
|
|
6815
6862
|
const { type: CEXType, isOpen: CEXIsOpen, close: CEXClose } = useCEXBindModalStore();
|
|
6816
6863
|
const WalletModalStore = useWalletModalStore();
|
|
6864
|
+
const { tgAppAuthCode, setTgAppAuthCode } = useStore_default();
|
|
6865
|
+
const { login } = useMatch();
|
|
6817
6866
|
const walletModalClose = (func) => {
|
|
6818
6867
|
WalletModalStore.close();
|
|
6819
6868
|
func();
|
|
6820
6869
|
};
|
|
6870
|
+
(0, import_react_query9.useQuery)({
|
|
6871
|
+
queryKey: ["matchid-tgapp-login", tgAppAuthCode],
|
|
6872
|
+
queryFn: async () => {
|
|
6873
|
+
const res = await getTgAppLoginStatus({
|
|
6874
|
+
code: tgAppAuthCode
|
|
6875
|
+
});
|
|
6876
|
+
if (isSuccess(res)) {
|
|
6877
|
+
setTgAppAuthCode("");
|
|
6878
|
+
await login({
|
|
6879
|
+
mid: "",
|
|
6880
|
+
token: `${res.data.token_type} ${res.data.access_token}`
|
|
6881
|
+
});
|
|
6882
|
+
return true;
|
|
6883
|
+
}
|
|
6884
|
+
return false;
|
|
6885
|
+
},
|
|
6886
|
+
enabled: !!tgAppAuthCode,
|
|
6887
|
+
refetchInterval: 1e3 * 5
|
|
6888
|
+
});
|
|
6821
6889
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
6822
6890
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6823
6891
|
SOLModal,
|
|
@@ -7240,7 +7308,7 @@ function useInit({
|
|
|
7240
7308
|
}
|
|
7241
7309
|
|
|
7242
7310
|
// src/MatchContext.tsx
|
|
7243
|
-
var
|
|
7311
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
7244
7312
|
var import_react_intl21 = require("react-intl");
|
|
7245
7313
|
|
|
7246
7314
|
// src/i18n/en.json
|
|
@@ -7978,7 +8046,7 @@ var messages = {
|
|
|
7978
8046
|
|
|
7979
8047
|
// src/MatchContext.tsx
|
|
7980
8048
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
7981
|
-
var queryClient = new
|
|
8049
|
+
var queryClient = new import_react_query10.QueryClient();
|
|
7982
8050
|
var MatchContext = (0, import_react40.createContext)(void 0);
|
|
7983
8051
|
var MatchProvider = ({
|
|
7984
8052
|
children,
|
|
@@ -7999,7 +8067,16 @@ var MatchProvider = ({
|
|
|
7999
8067
|
useWalletInit({
|
|
8000
8068
|
config: wallet
|
|
8001
8069
|
});
|
|
8002
|
-
|
|
8070
|
+
(0, import_react40.useEffect)(() => {
|
|
8071
|
+
const script = document.createElement("script");
|
|
8072
|
+
script.src = "https://telegram.org/js/telegram-web-app.js?56";
|
|
8073
|
+
script.async = true;
|
|
8074
|
+
document.body.appendChild(script);
|
|
8075
|
+
return () => {
|
|
8076
|
+
document.body.removeChild(script);
|
|
8077
|
+
};
|
|
8078
|
+
}, []);
|
|
8079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.IntlProvider, { locale: realLocale, messages: messages[realLocale], children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_query10.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
8003
8080
|
MatchContext.Provider,
|
|
8004
8081
|
{
|
|
8005
8082
|
value: {
|
|
@@ -8041,10 +8118,10 @@ __export(bind_exports, {
|
|
|
8041
8118
|
useBindInfo: () => useBindInfo,
|
|
8042
8119
|
useBindList: () => useBindList
|
|
8043
8120
|
});
|
|
8044
|
-
var
|
|
8121
|
+
var import_react_query11 = require("@tanstack/react-query");
|
|
8045
8122
|
function useBindList(options) {
|
|
8046
8123
|
const { isLogin } = useUserInfo();
|
|
8047
|
-
return (0,
|
|
8124
|
+
return (0, import_react_query11.useQuery)({
|
|
8048
8125
|
queryKey: ["bindList"],
|
|
8049
8126
|
enabled: isLogin,
|
|
8050
8127
|
queryFn: async () => {
|
|
@@ -8056,7 +8133,7 @@ function useBindList(options) {
|
|
|
8056
8133
|
}
|
|
8057
8134
|
function useBindInfo(options) {
|
|
8058
8135
|
const { isLogin } = useUserInfo();
|
|
8059
|
-
return (0,
|
|
8136
|
+
return (0, import_react_query11.useQuery)({
|
|
8060
8137
|
queryKey: ["bindInfo"],
|
|
8061
8138
|
enabled: isLogin,
|
|
8062
8139
|
queryFn: async () => {
|
|
@@ -8073,10 +8150,10 @@ __export(poh_exports, {
|
|
|
8073
8150
|
usePohList: () => usePohList,
|
|
8074
8151
|
verifyPohApi: () => verifyPohApi
|
|
8075
8152
|
});
|
|
8076
|
-
var
|
|
8153
|
+
var import_react_query12 = require("@tanstack/react-query");
|
|
8077
8154
|
function usePohList(options) {
|
|
8078
8155
|
const { isLogin } = useUserInfo();
|
|
8079
|
-
return (0,
|
|
8156
|
+
return (0, import_react_query12.useQuery)({
|
|
8080
8157
|
queryKey: ["pohList"],
|
|
8081
8158
|
enabled: isLogin,
|
|
8082
8159
|
queryFn: async () => {
|
|
@@ -8176,6 +8253,8 @@ __export(types_exports, {
|
|
|
8176
8253
|
Components,
|
|
8177
8254
|
Hooks,
|
|
8178
8255
|
MatchProvider,
|
|
8256
|
+
ModalProvider,
|
|
8257
|
+
ToastProvider,
|
|
8179
8258
|
Types,
|
|
8180
8259
|
UI,
|
|
8181
8260
|
useMatch
|