@matchain/matchid-sdk-react 0.1.48-alpha.7 → 0.1.48-alpha.9

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 (50) hide show
  1. package/dist/assets/icon/index.d.mts +1 -1
  2. package/dist/assets/icon/index.d.ts +1 -1
  3. package/dist/{chunk-2CK7JQWH.mjs → chunk-CI63DTB6.mjs} +240 -41
  4. package/dist/chunk-CI63DTB6.mjs.map +1 -0
  5. package/dist/{chunk-YXPWZXPT.mjs → chunk-T72FT5NB.mjs} +2 -2
  6. package/dist/components/index.d.mts +3 -3
  7. package/dist/components/index.d.ts +3 -3
  8. package/dist/components/index.js +3 -2
  9. package/dist/components/index.js.map +1 -1
  10. package/dist/components/index.mjs +1 -1
  11. package/dist/hooks/api/index.d.mts +2 -2
  12. package/dist/hooks/api/index.d.ts +2 -2
  13. package/dist/hooks/api/index.js +33 -2
  14. package/dist/hooks/api/index.js.map +1 -1
  15. package/dist/hooks/api/index.mjs +2 -2
  16. package/dist/hooks/index.d.mts +3 -2
  17. package/dist/hooks/index.d.ts +3 -2
  18. package/dist/hooks/index.js +299 -41
  19. package/dist/hooks/index.js.map +1 -1
  20. package/dist/hooks/index.mjs +1 -1
  21. package/dist/{index-B8DYrhSW.d.mts → index-B7A0lN0C.d.mts} +12 -4
  22. package/dist/{index-DCeOyAw8.d.ts → index-Bbn2Stvu.d.ts} +2 -2
  23. package/dist/index-Bz53bbI_.d.ts +3268 -0
  24. package/dist/{index-DbG5IjhP.d.mts → index-CB4j_ONH.d.mts} +1 -1
  25. package/dist/{index-B-s1k4Da.d.mts → index-CKyWWkzU.d.mts} +3 -2
  26. package/dist/{index-BZrddrq-.d.mts → index-C_S7k6z2.d.mts} +2 -2
  27. package/dist/{index-BHvCA7F9.d.ts → index-D-uNr-JV.d.ts} +2 -2
  28. package/dist/index-DDV4F9ka.d.mts +3268 -0
  29. package/dist/{index-DG_gyw1q.d.ts → index-DV_mRu4y.d.ts} +3 -2
  30. package/dist/{index-Bzcc-y8m.d.ts → index-DcxdJ0m2.d.ts} +1 -1
  31. package/dist/{index-BvLpvebq.d.mts → index-Dzvj-uGt.d.mts} +2 -2
  32. package/dist/{index-Cwx2p8th.d.ts → index-dhPbMbvL.d.ts} +12 -4
  33. package/dist/index.css +11 -0
  34. package/dist/index.d.mts +8 -7
  35. package/dist/index.d.ts +8 -7
  36. package/dist/index.js +244 -45
  37. package/dist/index.js.map +1 -1
  38. package/dist/index.mjs +2 -2
  39. package/dist/types/index.d.mts +1 -1
  40. package/dist/types/index.d.ts +1 -1
  41. package/dist/{types-CHkU0WHZ.d.mts → types-B4BYNw8B.d.mts} +13 -2
  42. package/dist/{types-CHkU0WHZ.d.ts → types-B4BYNw8B.d.ts} +13 -2
  43. package/dist/ui/index.d.mts +3 -3
  44. package/dist/ui/index.d.ts +3 -3
  45. package/example/src/pages/Wallet/components/MatchWallet.tsx +2 -1
  46. package/package.json +1 -1
  47. package/dist/chunk-2CK7JQWH.mjs.map +0 -1
  48. package/dist/index-DaEFoDv_.d.ts +0 -187
  49. package/dist/index-DktvxNJc.d.mts +0 -187
  50. /package/dist/{chunk-YXPWZXPT.mjs.map → chunk-T72FT5NB.mjs.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { A as AuthParams, C as ChainType, E as EmbeddedWalletsParams, R as RecoveryType } from './mpc-CTbBWHld.js';
2
- import { A as AnyObject, k as AppConfigType, l as BindInfoType, m as BindItemType, n as BindWalletParam, B as ButtonProps, C as CEXType, D as DeepPartial, o as DrawerProps, E as EmailModalProps, a as IEnvConfigType, p as IEnvName, q as ILoginWalletReq, I as IMatchEvents, g as ISocialLoginMethod, r as IconProps, s as InputProps, L as LocaleType, b as LoginBoxProps, i as LoginMethodType, f as LoginModalProps, e as LoginPanelProps, t as MessageType, u as MetaPageType, v as ModalProps, M as ModalWithHeaderProps, O as OtherLoginMethodType, h as OverviewInfo, w as PohItemType, x as PohZkpassParams, P as PopoverPositionType, y as PopoverProps, d as PopoverTypeType, R as RecommendLoginMethodType, T as ThemeType, z as UIProps, F as UserAssetToken, U as UserChainType, G as UserImportTokenType, H as UserPopoverProps, j as UserTransactionType, J as WalletAssetType, K as WalletChainType, W as WalletConfigType, N as WalletPanelProps, Q as WalletReceiveMessageType, c as WalletType } from './types-CHkU0WHZ.js';
2
+ import { A as AnyObject, k as AppConfigType, l as BindInfoType, m as BindItemType, n as BindWalletParam, B as ButtonProps, C as CEXType, D as DeepPartial, o as DrawerProps, E as EmailModalProps, a as IEnvConfigType, p as IEnvName, q as ILoginWalletReq, I as IMatchEvents, g as ISocialLoginMethod, r as IconProps, s as InputProps, L as LocaleType, b as LoginBoxProps, i as LoginMethodType, f as LoginModalProps, e as LoginPanelProps, t as MessageType, u as MetaPageType, v as ModalProps, M as ModalWithHeaderProps, O as OtherLoginMethodType, h as OverviewInfo, w as PohItemType, x as PohZkpassParams, P as PopoverPositionType, y as PopoverProps, d as PopoverTypeType, R as RecommendLoginMethodType, T as ThemeType, z as UIProps, F as UserAssetToken, U as UserChainType, G as UserImportTokenType, H as UserPopoverProps, j as UserTransactionType, J as WalletAssetType, K as WalletChainType, W as WalletConfigType, N as WalletNFTType, Q as WalletPanelProps, S as WalletReceiveMessageType, c as WalletType } from './types-B4BYNw8B.js';
3
3
 
4
4
  declare const index_AnyObject: typeof AnyObject;
5
5
  declare const index_AppConfigType: typeof AppConfigType;
@@ -49,11 +49,12 @@ declare const index_UserTransactionType: typeof UserTransactionType;
49
49
  declare const index_WalletAssetType: typeof WalletAssetType;
50
50
  declare const index_WalletChainType: typeof WalletChainType;
51
51
  declare const index_WalletConfigType: typeof WalletConfigType;
52
+ declare const index_WalletNFTType: typeof WalletNFTType;
52
53
  declare const index_WalletPanelProps: typeof WalletPanelProps;
53
54
  declare const index_WalletReceiveMessageType: typeof WalletReceiveMessageType;
54
55
  declare const index_WalletType: typeof WalletType;
55
56
  declare namespace index {
56
- export { index_AnyObject as AnyObject, index_AppConfigType as AppConfigType, index_AuthParams as AuthParams, index_BindInfoType as BindInfoType, index_BindItemType as BindItemType, index_BindWalletParam as BindWalletParam, index_ButtonProps as ButtonProps, index_CEXType as CEXType, index_ChainType as ChainType, index_DeepPartial as DeepPartial, index_DrawerProps as DrawerProps, index_EmailModalProps as EmailModalProps, index_EmbeddedWalletsParams as EmbeddedWalletsParams, index_IEnvConfigType as IEnvConfigType, index_IEnvName as IEnvName, index_ILoginWalletReq as ILoginWalletReq, index_IMatchEvents as IMatchEvents, index_ISocialLoginMethod as ISocialLoginMethod, index_IconProps as IconProps, index_InputProps as InputProps, index_LocaleType as LocaleType, index_LoginBoxProps as LoginBoxProps, index_LoginMethodType as LoginMethodType, index_LoginModalProps as LoginModalProps, index_LoginPanelProps as LoginPanelProps, index_MessageType as MessageType, index_MetaPageType as MetaPageType, index_ModalProps as ModalProps, index_ModalWithHeaderProps as ModalWithHeaderProps, index_OtherLoginMethodType as OtherLoginMethodType, index_OverviewInfo as OverviewInfo, index_PohItemType as PohItemType, index_PohZkpassParams as PohZkpassParams, index_PopoverPositionType as PopoverPositionType, index_PopoverProps as PopoverProps, index_PopoverTypeType as PopoverTypeType, index_RecommendLoginMethodType as RecommendLoginMethodType, index_RecoveryType as RecoveryType, index_ThemeType as ThemeType, index_UIProps as UIProps, index_UserAssetToken as UserAssetToken, index_UserChainType as UserChainType, index_UserImportTokenType as UserImportTokenType, index_UserPopoverProps as UserPopoverProps, index_UserTransactionType as UserTransactionType, index_WalletAssetType as WalletAssetType, index_WalletChainType as WalletChainType, index_WalletConfigType as WalletConfigType, index_WalletPanelProps as WalletPanelProps, index_WalletReceiveMessageType as WalletReceiveMessageType, index_WalletType as WalletType };
57
+ export { index_AnyObject as AnyObject, index_AppConfigType as AppConfigType, index_AuthParams as AuthParams, index_BindInfoType as BindInfoType, index_BindItemType as BindItemType, index_BindWalletParam as BindWalletParam, index_ButtonProps as ButtonProps, index_CEXType as CEXType, index_ChainType as ChainType, index_DeepPartial as DeepPartial, index_DrawerProps as DrawerProps, index_EmailModalProps as EmailModalProps, index_EmbeddedWalletsParams as EmbeddedWalletsParams, index_IEnvConfigType as IEnvConfigType, index_IEnvName as IEnvName, index_ILoginWalletReq as ILoginWalletReq, index_IMatchEvents as IMatchEvents, index_ISocialLoginMethod as ISocialLoginMethod, index_IconProps as IconProps, index_InputProps as InputProps, index_LocaleType as LocaleType, index_LoginBoxProps as LoginBoxProps, index_LoginMethodType as LoginMethodType, index_LoginModalProps as LoginModalProps, index_LoginPanelProps as LoginPanelProps, index_MessageType as MessageType, index_MetaPageType as MetaPageType, index_ModalProps as ModalProps, index_ModalWithHeaderProps as ModalWithHeaderProps, index_OtherLoginMethodType as OtherLoginMethodType, index_OverviewInfo as OverviewInfo, index_PohItemType as PohItemType, index_PohZkpassParams as PohZkpassParams, index_PopoverPositionType as PopoverPositionType, index_PopoverProps as PopoverProps, index_PopoverTypeType as PopoverTypeType, index_RecommendLoginMethodType as RecommendLoginMethodType, index_RecoveryType as RecoveryType, index_ThemeType as ThemeType, index_UIProps as UIProps, index_UserAssetToken as UserAssetToken, index_UserChainType as UserChainType, index_UserImportTokenType as UserImportTokenType, index_UserPopoverProps as UserPopoverProps, index_UserTransactionType as UserTransactionType, index_WalletAssetType as WalletAssetType, index_WalletChainType as WalletChainType, index_WalletConfigType as WalletConfigType, index_WalletNFTType as WalletNFTType, index_WalletPanelProps as WalletPanelProps, index_WalletReceiveMessageType as WalletReceiveMessageType, index_WalletType as WalletType };
57
58
  }
58
59
 
59
60
  export { index as i };
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, PropsWithChildren } from 'react';
3
- import { s as InputProps, B as ButtonProps, v as ModalProps, M as ModalWithHeaderProps, y as PopoverProps } from './types-CHkU0WHZ.js';
3
+ import { s as InputProps, B as ButtonProps, v as ModalProps, M as ModalWithHeaderProps, y as PopoverProps } from './types-B4BYNw8B.js';
4
4
 
5
5
  declare function Field({ label, children, error, required, className }: {
6
6
  label: ReactNode;
@@ -1,6 +1,6 @@
1
- import { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from './index-DbG5IjhP.mjs';
1
+ import { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from './index-CB4j_ONH.mjs';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { o as DrawerProps, N as WalletPanelProps, z as UIProps } from './types-CHkU0WHZ.mjs';
3
+ import { o as DrawerProps, Q as WalletPanelProps, z as UIProps } from './types-B4BYNw8B.mjs';
4
4
  import { Hash, Chain } from 'viem';
5
5
  import { CSSProperties } from 'react';
6
6
 
@@ -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 { x as PohZkpassParams, j as UserTransactionType, J as WalletAssetType, u as MetaPageType, m as BindItemType, l as BindInfoType, w as PohItemType, U as UserChainType, F as UserAssetToken, G as UserImportTokenType, K as WalletChainType } from './types-CHkU0WHZ.js';
3
+ import { x as PohZkpassParams, j as UserTransactionType, J as WalletAssetType, u as MetaPageType, m as BindItemType, l as BindInfoType, w as PohItemType, U as UserChainType, F as UserAssetToken, G as UserImportTokenType, K as WalletChainType, N as WalletNFTType } from './types-B4BYNw8B.js';
4
4
 
5
5
  declare const isSuccess: (res: {
6
6
  code: number;
@@ -37,7 +37,7 @@ declare const userImportTokenApi: (data: {
37
37
  chain_id: string;
38
38
  symbol: string;
39
39
  address: string;
40
- decimals: number;
40
+ decimals: string;
41
41
  }) => Promise<MyResponseType<any>>;
42
42
  declare const getUserWalletTransactionsApi: (data: {
43
43
  chain_id: string;
@@ -51,7 +51,10 @@ declare const getUserWalletTransactionsApi: (data: {
51
51
  declare const getWalletAssetListApi: (data: {
52
52
  chain_id: string;
53
53
  address: string;
54
- }) => Promise<MyResponseType<WalletAssetType[]>>;
54
+ }) => Promise<MyResponseType<{
55
+ asset_list: WalletAssetType[];
56
+ asset_total_balance: string;
57
+ }>>;
55
58
  declare const getWalletListApi: (data: {
56
59
  page: number;
57
60
  page_size: number;
@@ -97,6 +100,10 @@ declare function useImportTokenListQuery({ chainId, ...options }: {
97
100
  chainId: number;
98
101
  } & Partial<Omit<UseQueryOptions<UserImportTokenType[]>, 'queryKey' | 'queryFn'>>): _tanstack_react_query.UseQueryResult<UserImportTokenType[], Error>;
99
102
  declare function useWalletChainListQuery(options?: Partial<Omit<UseQueryOptions<WalletChainType[]>, 'queryKey' | 'queryFn'>>): _tanstack_react_query.UseQueryResult<WalletChainType[], Error>;
103
+ declare function useWalletNftListQuery({ chainId, address, ...options }: {
104
+ chainId: string;
105
+ address: string;
106
+ } & Partial<Omit<UseQueryOptions<WalletNFTType[]>, 'queryKey' | 'queryFn'>>): _tanstack_react_query.UseQueryResult<WalletNFTType[], Error>;
100
107
 
101
108
  declare const wallet_getUserWalletTransactionsApi: typeof getUserWalletTransactionsApi;
102
109
  declare const wallet_getWalletAssetListApi: typeof getWalletAssetListApi;
@@ -105,9 +112,10 @@ declare const wallet_useAssetListQuery: typeof useAssetListQuery;
105
112
  declare const wallet_useChainListQuery: typeof useChainListQuery;
106
113
  declare const wallet_useImportTokenListQuery: typeof useImportTokenListQuery;
107
114
  declare const wallet_useWalletChainListQuery: typeof useWalletChainListQuery;
115
+ declare const wallet_useWalletNftListQuery: typeof useWalletNftListQuery;
108
116
  declare const wallet_userImportTokenApi: typeof userImportTokenApi;
109
117
  declare namespace wallet {
110
- export { wallet_getUserWalletTransactionsApi as getUserWalletTransactionsApi, wallet_getWalletAssetListApi as getWalletAssetListApi, wallet_getWalletListApi as getWalletListApi, wallet_useAssetListQuery as useAssetListQuery, wallet_useChainListQuery as useChainListQuery, wallet_useImportTokenListQuery as useImportTokenListQuery, wallet_useWalletChainListQuery as useWalletChainListQuery, wallet_userImportTokenApi as userImportTokenApi };
118
+ export { wallet_getUserWalletTransactionsApi as getUserWalletTransactionsApi, wallet_getWalletAssetListApi as getWalletAssetListApi, wallet_getWalletListApi as getWalletListApi, wallet_useAssetListQuery as useAssetListQuery, wallet_useChainListQuery as useChainListQuery, wallet_useImportTokenListQuery as useImportTokenListQuery, wallet_useWalletChainListQuery as useWalletChainListQuery, wallet_useWalletNftListQuery as useWalletNftListQuery, wallet_userImportTokenApi as userImportTokenApi };
111
119
  }
112
120
 
113
121
  declare const index_bind: typeof bind;
package/dist/index.css CHANGED
@@ -1278,3 +1278,14 @@ body {
1278
1278
  }
1279
1279
  }
1280
1280
  }
1281
+
1282
+ .matchid-import-token{
1283
+ display: flex;
1284
+ flex-direction: column;
1285
+ gap:48px;
1286
+ .matchid-import-token-form{
1287
+ display: flex;
1288
+ flex-direction: column;
1289
+ gap:24px
1290
+ }
1291
+ }
package/dist/index.d.mts CHANGED
@@ -1,17 +1,18 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-CHkU0WHZ.mjs';
3
- export { i as Components } from './index-BZrddrq-.mjs';
4
- export { i as UI } from './index-BvLpvebq.mjs';
5
- export { i as Hooks } from './index-DktvxNJc.mjs';
6
- export { i as Api } from './index-B8DYrhSW.mjs';
2
+ import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-B4BYNw8B.mjs';
3
+ export { i as Components } from './index-C_S7k6z2.mjs';
4
+ export { i as UI } from './index-Dzvj-uGt.mjs';
5
+ export { i as Hooks } from './index-DDV4F9ka.mjs';
6
+ export { i as Api } from './index-B7A0lN0C.mjs';
7
7
  export { i as Chains } from './index-DXRGMAbv.mjs';
8
- export { i as Types } from './index-B-s1k4Da.mjs';
8
+ export { i as Types } from './index-CKyWWkzU.mjs';
9
9
  import 'react/jsx-runtime';
10
- import './index-DbG5IjhP.mjs';
10
+ import './index-CB4j_ONH.mjs';
11
11
  import 'viem';
12
12
  import './mpc-CTbBWHld.mjs';
13
13
  import 'viem/types/misc';
14
14
  import 'abitype';
15
+ import 'viem/_types/actions/siwe/verifySiweMessage';
15
16
  import '@tanstack/react-query';
16
17
  import '@tanstack/react-query/src/types';
17
18
 
package/dist/index.d.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-CHkU0WHZ.js';
3
- export { i as Components } from './index-BHvCA7F9.js';
4
- export { i as UI } from './index-DCeOyAw8.js';
5
- export { i as Hooks } from './index-DaEFoDv_.js';
6
- export { i as Api } from './index-Cwx2p8th.js';
2
+ import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-B4BYNw8B.js';
3
+ export { i as Components } from './index-D-uNr-JV.js';
4
+ export { i as UI } from './index-Bbn2Stvu.js';
5
+ export { i as Hooks } from './index-Bz53bbI_.js';
6
+ export { i as Api } from './index-dhPbMbvL.js';
7
7
  export { i as Chains } from './index-DXRGMAbv.js';
8
- export { i as Types } from './index-DG_gyw1q.js';
8
+ export { i as Types } from './index-DV_mRu4y.js';
9
9
  import 'react/jsx-runtime';
10
- import './index-Bzcc-y8m.js';
10
+ import './index-DcxdJ0m2.js';
11
11
  import 'viem';
12
12
  import './mpc-CTbBWHld.js';
13
13
  import 'viem/types/misc';
14
14
  import 'abitype';
15
+ import 'viem/_types/actions/siwe/verifySiweMessage';
15
16
  import '@tanstack/react-query';
16
17
  import '@tanstack/react-query/src/types';
17
18
 
package/dist/index.js CHANGED
@@ -455,6 +455,13 @@ var getWalletChainListApi = () => {
455
455
  method: "POST"
456
456
  });
457
457
  };
458
+ var getWalletNftListApi = (data) => {
459
+ return request_default({
460
+ url: `/api/v1/wallet/nfts`,
461
+ method: "POST",
462
+ data
463
+ });
464
+ };
458
465
 
459
466
  // src/store/useLocalStore.ts
460
467
  var persistedState = (0, import_middleware.persist)(
@@ -2839,6 +2846,7 @@ __export(wallet_exports, {
2839
2846
  useChainListQuery: () => useChainListQuery,
2840
2847
  useImportTokenListQuery: () => useImportTokenListQuery,
2841
2848
  useWalletChainListQuery: () => useWalletChainListQuery,
2849
+ useWalletNftListQuery: () => useWalletNftListQuery,
2842
2850
  userImportTokenApi: () => userImportTokenApi
2843
2851
  });
2844
2852
  var import_react_query2 = require("@tanstack/react-query");
@@ -2908,9 +2916,32 @@ function useWalletChainListQuery(options) {
2908
2916
  ...options
2909
2917
  });
2910
2918
  }
2919
+ function useWalletNftListQuery({
2920
+ chainId,
2921
+ address: address2,
2922
+ ...options
2923
+ }) {
2924
+ const { isLogin, token } = useUserInfo();
2925
+ return (0, import_react_query2.useQuery)({
2926
+ queryKey: ["match-wallet-nft-list", token, chainId, address2],
2927
+ queryFn: async () => {
2928
+ const res = await getWalletNftListApi({
2929
+ chain_id: chainId.toString(),
2930
+ address: address2
2931
+ });
2932
+ if (!isSuccess(res)) {
2933
+ return [];
2934
+ }
2935
+ return res.data;
2936
+ },
2937
+ enabled: isLogin,
2938
+ ...options
2939
+ });
2940
+ }
2911
2941
 
2912
2942
  // src/hooks/useMatchChain.tsx
2913
2943
  var import_react13 = require("react");
2944
+ var import_viem5 = require("viem");
2914
2945
  var import_jsx_runtime62 = require("react/jsx-runtime");
2915
2946
  function useMatchChain() {
2916
2947
  const chainListQuery = useChainListQuery();
@@ -2970,13 +3001,23 @@ function useMatchChain() {
2970
3001
  content: ChangeNetwork
2971
3002
  });
2972
3003
  };
3004
+ const publicClient = (0, import_react13.useMemo)(() => {
3005
+ if (!chain) {
3006
+ return null;
3007
+ }
3008
+ return (0, import_viem5.createPublicClient)({
3009
+ chain,
3010
+ transport: (0, import_viem5.http)()
3011
+ });
3012
+ }, [chain]);
2973
3013
  return {
2974
3014
  list: chainListQuery.data,
2975
3015
  chainId,
2976
3016
  setChainId,
2977
3017
  chain,
2978
3018
  explorerLink,
2979
- showChangeNetwork
3019
+ showChangeNetwork,
3020
+ publicClient
2980
3021
  };
2981
3022
  }
2982
3023
 
@@ -4874,50 +4915,210 @@ var address = "0x4143e29770fd63e24bb1f32d50bf8a590e34de4b";
4874
4915
 
4875
4916
  // src/hooks/useMatchWallet.tsx
4876
4917
  var import_jsx_runtime79 = require("react/jsx-runtime");
4877
- function useMatchWallet() {
4878
- const modal = useModal();
4879
- const { address: address2 } = useWallet();
4918
+ var ReceiveModal = () => {
4880
4919
  const chain = useMatchChain();
4920
+ const { address: address2 } = useWallet();
4881
4921
  const [copied, setCopied] = useCopyClipboard();
4882
4922
  const toast = useToast();
4883
4923
  const onCopy = () => {
4884
4924
  setCopied(address2);
4885
4925
  toast.success("Copied!");
4886
4926
  };
4927
+ const chainLink = chain.explorerLink("address/" + address2);
4928
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: `matchid-receive-modal`, children: [
4929
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "matchid-receive-container", children: [
4930
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: `matchid-receive-text`, children: "Receive by scanning the QR code" }),
4931
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4932
+ import_react_qrcode.QRCode,
4933
+ {
4934
+ margin: "0",
4935
+ className: `matchid-qr-code`,
4936
+ value: address2
4937
+ }
4938
+ ) }),
4939
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4940
+ "a",
4941
+ {
4942
+ href: chainLink,
4943
+ target: "_blank",
4944
+ className: `matchid-receive-link`,
4945
+ children: address2
4946
+ }
4947
+ )
4948
+ ] }),
4949
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: "Copy Address" })
4950
+ ] });
4951
+ };
4952
+ var ImportTokenModal = ({ close }) => {
4953
+ const [address2, setAddress] = (0, import_react29.useState)("");
4954
+ const [symbol, setSymbol] = (0, import_react29.useState)("");
4955
+ const [decimals, setDecimals] = (0, import_react29.useState)("");
4956
+ const [error, setError] = (0, import_react29.useState)({});
4957
+ const { publicClient, chainId } = useMatchChain();
4958
+ const getContractInfo = async () => {
4959
+ if (!publicClient) return;
4960
+ const erc20Abi = [
4961
+ {
4962
+ name: "decimals",
4963
+ type: "function",
4964
+ stateMutability: "view",
4965
+ inputs: [],
4966
+ outputs: [{ name: "decimals", type: "uint8" }]
4967
+ },
4968
+ {
4969
+ name: "symbol",
4970
+ type: "function",
4971
+ stateMutability: "view",
4972
+ inputs: [],
4973
+ outputs: [{ name: "symbol", type: "string" }]
4974
+ }
4975
+ ];
4976
+ const calls = [
4977
+ {
4978
+ address: address2,
4979
+ abi: erc20Abi,
4980
+ functionName: "symbol",
4981
+ args: []
4982
+ },
4983
+ {
4984
+ address: address2,
4985
+ abi: erc20Abi,
4986
+ functionName: "decimals",
4987
+ args: []
4988
+ }
4989
+ ];
4990
+ try {
4991
+ const results = await publicClient.multicall({ contracts: calls });
4992
+ console.log("results", results);
4993
+ if (!symbol && results[0]?.status == "success") {
4994
+ setSymbol(results[0]?.result);
4995
+ }
4996
+ if (!decimals && results[1]?.status == "success") {
4997
+ setDecimals((results[1]?.result).toString());
4998
+ }
4999
+ } catch (error2) {
5000
+ setError({
5001
+ address: error2.message
5002
+ });
5003
+ }
5004
+ };
5005
+ (0, import_react29.useEffect)(() => {
5006
+ if (address2.length === 42) {
5007
+ const reg = /^0x[0-9a-fA-F]{40}$/;
5008
+ if (!reg.test(address2)) {
5009
+ setError({
5010
+ ...error,
5011
+ address: "Invalid address"
5012
+ });
5013
+ } else {
5014
+ setError({
5015
+ ...error,
5016
+ address: ""
5017
+ });
5018
+ publicClient && getContractInfo();
5019
+ }
5020
+ }
5021
+ }, [address2, publicClient]);
5022
+ const [loading, setLoading] = (0, import_react29.useState)(false);
5023
+ const toast = useToast();
5024
+ const onImport = async () => {
5025
+ setLoading(true);
5026
+ try {
5027
+ const res = await userImportTokenApi({
5028
+ chain_id: chainId?.toString() || "",
5029
+ symbol,
5030
+ address: address2,
5031
+ decimals
5032
+ });
5033
+ if (isSuccess(res)) {
5034
+ toast.success("Imported successfully");
5035
+ close();
5036
+ } else {
5037
+ toast.error(res.message);
5038
+ }
5039
+ } catch (error2) {
5040
+ toast.error(error2.message);
5041
+ } finally {
5042
+ setLoading(false);
5043
+ }
5044
+ };
5045
+ const canImport = (0, import_react29.useMemo)(() => {
5046
+ if (!address2) {
5047
+ return false;
5048
+ }
5049
+ if (!symbol) {
5050
+ return false;
5051
+ }
5052
+ if (decimals.length === 0) {
5053
+ return false;
5054
+ }
5055
+ const reg = /^0x[0-9a-fA-F]{40}$/;
5056
+ if (!reg.test(address2)) {
5057
+ return false;
5058
+ }
5059
+ return true;
5060
+ }, [error, address2, symbol, decimals]);
5061
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: `matchid-import-token`, children: [
5062
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "matchid-import-token-form", children: [
5063
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Field, { label: "Token Smart Contract", error: error.address, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5064
+ Input,
5065
+ {
5066
+ placeholder: "Enter the Token Smart Contract",
5067
+ value: address2,
5068
+ onChange: (e) => setAddress(e.target.value),
5069
+ maxLength: 42
5070
+ }
5071
+ ) }),
5072
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Field, { label: "Token Symbol", error: error.symbol, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5073
+ Input,
5074
+ {
5075
+ placeholder: "Enter the Token Symbol",
5076
+ value: symbol,
5077
+ onChange: (e) => setSymbol(e.target.value),
5078
+ maxLength: 16
5079
+ }
5080
+ ) }),
5081
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Field, { label: "Decimals", error: error.decimals, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5082
+ Input,
5083
+ {
5084
+ placeholder: "Enter the Decimals",
5085
+ type: "number",
5086
+ value: decimals,
5087
+ onChange: (e) => setDecimals(e.target.value)
5088
+ }
5089
+ ) })
5090
+ ] }),
5091
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5092
+ Button,
5093
+ {
5094
+ size: "lg",
5095
+ onClick: onImport,
5096
+ block: true,
5097
+ loading,
5098
+ disabled: !canImport,
5099
+ highlight: true,
5100
+ children: "Import"
5101
+ }
5102
+ )
5103
+ ] });
5104
+ };
5105
+ function useMatchWallet() {
5106
+ const modal = useModal();
4887
5107
  const showReceiveModal = () => {
4888
- const chainLink = chain.explorerLink("address/" + address2);
4889
- const ReceiveModal = () => {
4890
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: `matchid-receive-modal`, children: [
4891
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "matchid-receive-container", children: [
4892
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: `matchid-receive-text`, children: "Receive by scanning the QR code" }),
4893
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4894
- import_react_qrcode.QRCode,
4895
- {
4896
- margin: "0",
4897
- className: `matchid-qr-code`,
4898
- value: address2
4899
- }
4900
- ) }),
4901
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4902
- "a",
4903
- {
4904
- href: chainLink,
4905
- target: "_blank",
4906
- className: `matchid-receive-link`,
4907
- children: address2
4908
- }
4909
- )
4910
- ] }),
4911
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: "Copy Address" })
4912
- ] });
4913
- };
4914
5108
  modal.open({
4915
5109
  title: "Receive",
4916
5110
  content: ReceiveModal
4917
5111
  });
4918
5112
  };
5113
+ const showImportTokenModal = () => {
5114
+ modal.open({
5115
+ title: "Customized Token",
5116
+ content: ImportTokenModal
5117
+ });
5118
+ };
4919
5119
  return {
4920
- showReceiveModal
5120
+ showReceiveModal,
5121
+ showImportTokenModal
4921
5122
  };
4922
5123
  }
4923
5124
  function useMatchWalletRecords({
@@ -4966,7 +5167,7 @@ function useMatchWalletRecords({
4966
5167
  // src/hooks/useReceipt.tsx
4967
5168
  var import_react30 = require("react");
4968
5169
  var import_react_query4 = require("@tanstack/react-query");
4969
- var import_viem5 = require("viem");
5170
+ var import_viem6 = require("viem");
4970
5171
  var CACHE_TTL = 86400 * 30 * 1e3;
4971
5172
  var MAX_CACHE_SIZE = 500;
4972
5173
  var STORAGE_KEY = "match_receipt_logs";
@@ -5083,10 +5284,9 @@ function useReceipt({
5083
5284
  return cache.get(cacheKey);
5084
5285
  }
5085
5286
  try {
5086
- const publicClient = (0, import_viem5.createPublicClient)({
5087
- //@ts-ignore
5088
- chain: (0, import_viem5.defineChain)(chain),
5089
- transport: (0, import_viem5.http)()
5287
+ const publicClient = (0, import_viem6.createPublicClient)({
5288
+ chain: (0, import_viem6.defineChain)(chain),
5289
+ transport: (0, import_viem6.http)()
5090
5290
  });
5091
5291
  const receipt = await publicClient.getTransactionReceipt({ hash });
5092
5292
  if (!receipt) {
@@ -5111,7 +5311,7 @@ function useReceipt({
5111
5311
  // src/hooks/useTransaction.tsx
5112
5312
  var import_react31 = require("react");
5113
5313
  var import_react_query5 = require("@tanstack/react-query");
5114
- var import_viem6 = require("viem");
5314
+ var import_viem7 = require("viem");
5115
5315
  var CACHE_TTL2 = 86400 * 30 * 1e3;
5116
5316
  var MAX_CACHE_SIZE2 = 500;
5117
5317
  var STORAGE_KEY2 = "match_transaction_logs";
@@ -5228,10 +5428,9 @@ function useTransaction({
5228
5428
  return cache.get(cacheKey);
5229
5429
  }
5230
5430
  try {
5231
- const publicClient = (0, import_viem6.createPublicClient)({
5232
- //@ts-ignore
5233
- chain: (0, import_viem6.defineChain)(chain),
5234
- transport: (0, import_viem6.http)()
5431
+ const publicClient = (0, import_viem7.createPublicClient)({
5432
+ chain: (0, import_viem7.defineChain)(chain),
5433
+ transport: (0, import_viem7.http)()
5235
5434
  });
5236
5435
  const transaction = await publicClient.getTransaction({ hash });
5237
5436
  if (!transaction) {
@@ -6414,8 +6613,8 @@ __export(chains_exports, {
6414
6613
  });
6415
6614
 
6416
6615
  // src/config/chains/MatchMain.ts
6417
- var import_viem7 = require("viem");
6418
- var matchMain = /* @__PURE__ */ (0, import_viem7.defineChain)({
6616
+ var import_viem8 = require("viem");
6617
+ var matchMain = /* @__PURE__ */ (0, import_viem8.defineChain)({
6419
6618
  //定义match链
6420
6619
  id: 698,
6421
6620
  name: "Matchain",
@@ -6442,8 +6641,8 @@ var matchMain = /* @__PURE__ */ (0, import_viem7.defineChain)({
6442
6641
  });
6443
6642
 
6444
6643
  // src/config/chains/MatchTest.ts
6445
- var import_viem8 = require("viem");
6446
- var matchTest = /* @__PURE__ */ (0, import_viem8.defineChain)({
6644
+ var import_viem9 = require("viem");
6645
+ var matchTest = /* @__PURE__ */ (0, import_viem9.defineChain)({
6447
6646
  //定义matchTest链
6448
6647
  id: 699,
6449
6648
  name: "MatchTest",