@matchain/matchid-sdk-react 0.1.48-alpha.32 → 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.
- package/dist/{chunk-7GBTBRSQ.mjs → chunk-4I5WVXIN.mjs} +2 -2
- package/dist/{chunk-5JUSQZS5.mjs → chunk-YSASIFLY.mjs} +56 -52
- package/dist/chunk-YSASIFLY.mjs.map +1 -0
- package/dist/components/index.js +55 -51
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +2 -2
- package/dist/hooks/index.js +55 -51
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.js +55 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-5JUSQZS5.mjs.map +0 -1
- /package/dist/{chunk-7GBTBRSQ.mjs.map → chunk-4I5WVXIN.mjs.map} +0 -0
package/dist/hooks/api/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
bind_exports,
|
|
3
3
|
poh_exports,
|
|
4
4
|
user_exports
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-4I5WVXIN.mjs";
|
|
6
6
|
import {
|
|
7
7
|
isSuccess,
|
|
8
8
|
wallet_exports
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-YSASIFLY.mjs";
|
|
10
10
|
import "../../chunk-FB5MHLWX.mjs";
|
|
11
11
|
import "../../chunk-5JHHHLG4.mjs";
|
|
12
12
|
import "../../chunk-LHNKZISB.mjs";
|
package/dist/hooks/index.js
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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,
|