@matchain/matchid-sdk-react 0.1.48-alpha.31 → 0.1.48-alpha.33

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 (46) 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-YJV23RET.mjs → chunk-4I5WVXIN.mjs} +2 -2
  4. package/dist/{chunk-KIVNILBF.mjs → chunk-YSASIFLY.mjs} +62 -58
  5. package/dist/chunk-YSASIFLY.mjs.map +1 -0
  6. package/dist/components/index.d.mts +3 -3
  7. package/dist/components/index.d.ts +3 -3
  8. package/dist/components/index.js +61 -57
  9. package/dist/components/index.js.map +1 -1
  10. package/dist/components/index.mjs +2 -2
  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 +6 -6
  14. package/dist/hooks/api/index.js.map +1 -1
  15. package/dist/hooks/api/index.mjs +3 -3
  16. package/dist/hooks/index.d.mts +2 -2
  17. package/dist/hooks/index.d.ts +2 -2
  18. package/dist/hooks/index.js +61 -57
  19. package/dist/hooks/index.js.map +1 -1
  20. package/dist/hooks/index.mjs +2 -2
  21. package/dist/{index-BcEreCxd.d.ts → index-3I6HO7pu.d.ts} +1 -1
  22. package/dist/{index-Bpmrd7mh.d.ts → index-BGhcUCaf.d.ts} +1 -1
  23. package/dist/{index-Cou96DpL.d.mts → index-BXUU8PRO.d.mts} +1 -1
  24. package/dist/{index-Cy3K-Yao.d.ts → index-C1SOElvD.d.ts} +1 -1
  25. package/dist/{index-C9F6f2iz.d.mts → index-CfNpZBzs.d.mts} +2 -2
  26. package/dist/{index-BMsj8hJv.d.ts → index-Cg9cddpr.d.ts} +2 -2
  27. package/dist/{index-BMfaixEx.d.mts → index-CiVpdQxz.d.mts} +1 -1
  28. package/dist/{index-DUHkH5t-.d.mts → index-CjCngqWS.d.mts} +1 -1
  29. package/dist/{index-DcQm2dkr.d.ts → index-GXwzr_ck.d.ts} +1 -1
  30. package/dist/{index-D4ju2J_e.d.mts → index-UiH7pXQW.d.mts} +1 -1
  31. package/dist/{index-Bvc8cjpN.d.ts → index-lY7YfVRh.d.ts} +2 -2
  32. package/dist/{index-C9qYyRgt.d.mts → index-u1AE9im5.d.mts} +2 -2
  33. package/dist/index.d.mts +7 -7
  34. package/dist/index.d.ts +7 -7
  35. package/dist/index.js +61 -57
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +8 -8
  38. package/dist/types/index.d.mts +1 -1
  39. package/dist/types/index.d.ts +1 -1
  40. package/dist/{types-DzVVzMYU.d.mts → types-pQHTwHLr.d.mts} +1 -1
  41. package/dist/{types-DzVVzMYU.d.ts → types-pQHTwHLr.d.ts} +1 -1
  42. package/dist/ui/index.d.mts +3 -3
  43. package/dist/ui/index.d.ts +3 -3
  44. package/package.json +1 -1
  45. package/dist/chunk-KIVNILBF.mjs.map +0 -1
  46. /package/dist/{chunk-YJV23RET.mjs.map → chunk-4I5WVXIN.mjs.map} +0 -0
@@ -2,15 +2,15 @@ import {
2
2
  bind_exports,
3
3
  poh_exports,
4
4
  user_exports
5
- } from "../../chunk-YJV23RET.mjs";
5
+ } from "../../chunk-4I5WVXIN.mjs";
6
6
  import {
7
7
  isSuccess,
8
8
  wallet_exports
9
- } from "../../chunk-KIVNILBF.mjs";
10
- import "../../chunk-UA6XHZHX.mjs";
9
+ } from "../../chunk-YSASIFLY.mjs";
11
10
  import "../../chunk-FB5MHLWX.mjs";
12
11
  import "../../chunk-5JHHHLG4.mjs";
13
12
  import "../../chunk-LHNKZISB.mjs";
13
+ import "../../chunk-UA6XHZHX.mjs";
14
14
  import "../../chunk-J5LGTIGS.mjs";
15
15
  export {
16
16
  bind_exports as bind,
@@ -1,5 +1,5 @@
1
- export { c as useCopyClipboard, n as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, k as useMatchWalletAssetList, j as useMatchWalletAssets, h as useMatchWalletRecords, d as useModal, l as useReceipt, e as useToast, m as useTransaction, u as useUserInfo, b as useWallet } from '../index-DUHkH5t-.mjs';
2
- import '../types-DzVVzMYU.mjs';
1
+ export { c as useCopyClipboard, n as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, k as useMatchWalletAssetList, j as useMatchWalletAssets, h as useMatchWalletRecords, d as useModal, l as useReceipt, e as useToast, m as useTransaction, u as useUserInfo, b as useWallet } from '../index-CjCngqWS.mjs';
2
+ import '../types-pQHTwHLr.mjs';
3
3
  import 'react';
4
4
  import '@tanstack/react-query/src/types';
5
5
  import 'viem';
@@ -1,5 +1,5 @@
1
- export { c as useCopyClipboard, n as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, k as useMatchWalletAssetList, j as useMatchWalletAssets, h as useMatchWalletRecords, d as useModal, l as useReceipt, e as useToast, m as useTransaction, u as useUserInfo, b as useWallet } from '../index-DcQm2dkr.js';
2
- import '../types-DzVVzMYU.js';
1
+ export { c as useCopyClipboard, n as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, k as useMatchWalletAssetList, j as useMatchWalletAssets, h as useMatchWalletRecords, d as useModal, l as useReceipt, e as useToast, m as useTransaction, u as useUserInfo, b as useWallet } from '../index-GXwzr_ck.js';
2
+ import '../types-pQHTwHLr.js';
3
3
  import 'react';
4
4
  import '@tanstack/react-query/src/types';
5
5
  import 'viem';
@@ -1856,11 +1856,11 @@ function useUserInfo() {
1856
1856
  return loginByMethod("google");
1857
1857
  };
1858
1858
  const loginByWallet = async () => {
1859
- return window.open(`${endpoints.auth}login/wallet?appid=${appid}`);
1859
+ return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
1860
1860
  };
1861
1861
  const loginByTelegram = async () => {
1862
1862
  return window.open(
1863
- `${endpoints.auth}login/telegram?appid=${appid}`,
1863
+ `${endpoints.auth}login/telegram?appid=${appid}&locale=${locale}`,
1864
1864
  // Replace with the actual authorization URL
1865
1865
  "authWindow",
1866
1866
  "width=800,height=600"
@@ -1871,7 +1871,7 @@ function useUserInfo() {
1871
1871
  case "wallet":
1872
1872
  return walletModalStore.open("login", extra?.methods);
1873
1873
  case "evm":
1874
- return window.open(`${endpoints.auth}login/wallet?appid=${appid}`);
1874
+ return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
1875
1875
  case "sol":
1876
1876
  return SOLOpen("login");
1877
1877
  case "tron":
@@ -1932,14 +1932,14 @@ function useUserInfo() {
1932
1932
  if (!token) {
1933
1933
  throw new Error("You must login first");
1934
1934
  }
1935
- return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&st=` + encodeURIComponent(encodeBase64(token)));
1935
+ return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
1936
1936
  };
1937
1937
  const bindTelegram = async () => {
1938
1938
  if (!token) {
1939
1939
  throw new Error("You must login first");
1940
1940
  }
1941
1941
  const authWindow = window.open(
1942
- `${endpoints.auth}bind/telegram?appid=${appid}&st=` + encodeURIComponent(encodeBase64(token)),
1942
+ `${endpoints.auth}bind/telegram?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)),
1943
1943
  // Replace with the actual authorization URL
1944
1944
  "authWindow",
1945
1945
  "width=800,height=600"
@@ -1960,7 +1960,7 @@ function useUserInfo() {
1960
1960
  case "wallet":
1961
1961
  return walletModalStore.open("bind", extra?.methods);
1962
1962
  case "evm":
1963
- return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&st=` + encodeURIComponent(encodeBase64(token)));
1963
+ return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
1964
1964
  case "sol":
1965
1965
  return SOLOpen("bind");
1966
1966
  case "tron":
@@ -2804,7 +2804,7 @@ function useMatchWalletRecords() {
2804
2804
  const { address } = useWallet2();
2805
2805
  const hasMoreRef = (0, import_react38.useRef)(hasMore);
2806
2806
  const nextPageParamsRef = (0, import_react38.useRef)(void 0);
2807
- const { getContract, setContracts } = useContractStore_default();
2807
+ const { contracts, setContracts } = useContractStore_default();
2808
2808
  const fetchMoreData = async () => {
2809
2809
  const chainIdStr = chainId ? chainId.toString() : "";
2810
2810
  if (!hasMoreRef.current || !chainIdStr) {
@@ -2816,55 +2816,6 @@ function useMatchWalletRecords() {
2816
2816
  });
2817
2817
  if (isSuccess(res)) {
2818
2818
  if (res.data && res.data.transactions && res.data.transactions.length > 0) {
2819
- const contractList = res.data.transactions.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
2820
- const contractUnique = Array.from(new Set(contractList)).filter((item) => {
2821
- const contract = getContract(chainId || 0, item);
2822
- if (!contract) {
2823
- return true;
2824
- }
2825
- if (!contract.symbol && !contract.name) {
2826
- return true;
2827
- }
2828
- if (!contract.decimals) {
2829
- return true;
2830
- }
2831
- return false;
2832
- });
2833
- const calls = [];
2834
- for (const contract of contractUnique) {
2835
- calls.push({
2836
- address: contract,
2837
- abi: import_viem11.erc20Abi,
2838
- functionName: "symbol",
2839
- args: []
2840
- });
2841
- calls.push({
2842
- address: contract,
2843
- abi: import_viem11.erc20Abi,
2844
- functionName: "decimals",
2845
- args: []
2846
- });
2847
- }
2848
- const results = await publicClient?.multicall({ contracts: calls });
2849
- if (results) {
2850
- console.log("contract results", calls, results);
2851
- const contractMap = [];
2852
- for (let i = 0; i < contractUnique.length; i++) {
2853
- const info = {};
2854
- if (results[i * 2].status == "success") {
2855
- info.symbol = results[i * 2].result;
2856
- }
2857
- if (results[i * 2 + 1].status == "success") {
2858
- info.decimals = results[i * 2 + 1].result;
2859
- }
2860
- contractMap.push({
2861
- chainId: chainId || 0,
2862
- contractAddress: contractUnique[i],
2863
- info
2864
- });
2865
- }
2866
- setContracts(contractMap);
2867
- }
2868
2819
  setItems(items.concat(res.data.transactions || []));
2869
2820
  }
2870
2821
  hasMoreRef.current = res.data && res.data.transactions && res.data.transactions.length >= 50;
@@ -2885,6 +2836,56 @@ function useMatchWalletRecords() {
2885
2836
  }
2886
2837
  }, [chainId, address]);
2887
2838
  const { transactions, removeTransaction } = useTransactionStore_default();
2839
+ const getContractInfoList = async (contractList) => {
2840
+ const contractUnique = Array.from(new Set(contractList)).filter((item) => {
2841
+ const contract = contracts[`${chainId}-${item.toLowerCase()}`];
2842
+ if (!contract) {
2843
+ return true;
2844
+ }
2845
+ if (!contract.symbol && !contract.name) {
2846
+ return true;
2847
+ }
2848
+ if (!contract.decimals) {
2849
+ return true;
2850
+ }
2851
+ return false;
2852
+ });
2853
+ const calls = [];
2854
+ for (const contract of contractUnique) {
2855
+ calls.push({
2856
+ address: contract,
2857
+ abi: import_viem11.erc20Abi,
2858
+ functionName: "symbol",
2859
+ args: []
2860
+ });
2861
+ calls.push({
2862
+ address: contract,
2863
+ abi: import_viem11.erc20Abi,
2864
+ functionName: "decimals",
2865
+ args: []
2866
+ });
2867
+ }
2868
+ const results = await publicClient?.multicall({ contracts: calls });
2869
+ if (results) {
2870
+ console.log("contract results", calls, results);
2871
+ const contractMap = [];
2872
+ for (let i = 0; i < contractUnique.length; i++) {
2873
+ const info = {};
2874
+ if (results[i * 2].status == "success") {
2875
+ info.symbol = results[i * 2].result;
2876
+ }
2877
+ if (results[i * 2 + 1].status == "success") {
2878
+ info.decimals = results[i * 2 + 1].result;
2879
+ }
2880
+ contractMap.push({
2881
+ chainId: chainId || 0,
2882
+ contractAddress: contractUnique[i],
2883
+ info
2884
+ });
2885
+ }
2886
+ setContracts(contractMap);
2887
+ }
2888
+ };
2888
2889
  const list = (0, import_react38.useMemo)(() => {
2889
2890
  const localTransactions = transactions[`${chainId}-${address}`] || [];
2890
2891
  const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
@@ -2896,7 +2897,7 @@ function useMatchWalletRecords() {
2896
2897
  });
2897
2898
  });
2898
2899
  const saveList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) < 0);
2899
- return [
2900
+ const list2 = [
2900
2901
  ...saveList,
2901
2902
  ...items
2902
2903
  ].sort((a, b) => {
@@ -2904,6 +2905,9 @@ function useMatchWalletRecords() {
2904
2905
  const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
2905
2906
  return btimestamp - atimestamp;
2906
2907
  });
2908
+ const contractList = list2.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
2909
+ getContractInfoList(contractList);
2910
+ return list2;
2907
2911
  }, [transactions, chainId, items, address]);
2908
2912
  return {
2909
2913
  items: list,