@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
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useUserInfo,
|
|
12
12
|
verifyPohApi,
|
|
13
13
|
wallet_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YSASIFLY.mjs";
|
|
15
15
|
import {
|
|
16
16
|
__export
|
|
17
17
|
} from "./chunk-J5LGTIGS.mjs";
|
|
@@ -94,4 +94,4 @@ export {
|
|
|
94
94
|
user_exports,
|
|
95
95
|
api_exports
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-4I5WVXIN.mjs.map
|
|
@@ -1653,7 +1653,7 @@ function useMatchWalletRecords() {
|
|
|
1653
1653
|
const { address } = useWallet();
|
|
1654
1654
|
const hasMoreRef = useRef(hasMore);
|
|
1655
1655
|
const nextPageParamsRef = useRef(void 0);
|
|
1656
|
-
const {
|
|
1656
|
+
const { contracts, setContracts } = useContractStore_default();
|
|
1657
1657
|
const fetchMoreData = async () => {
|
|
1658
1658
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
1659
1659
|
if (!hasMoreRef.current || !chainIdStr) {
|
|
@@ -1665,55 +1665,6 @@ function useMatchWalletRecords() {
|
|
|
1665
1665
|
});
|
|
1666
1666
|
if (isSuccess(res)) {
|
|
1667
1667
|
if (res.data && res.data.transactions && res.data.transactions.length > 0) {
|
|
1668
|
-
const contractList = res.data.transactions.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
|
|
1669
|
-
const contractUnique = Array.from(new Set(contractList)).filter((item) => {
|
|
1670
|
-
const contract = getContract(chainId || 0, item);
|
|
1671
|
-
if (!contract) {
|
|
1672
|
-
return true;
|
|
1673
|
-
}
|
|
1674
|
-
if (!contract.symbol && !contract.name) {
|
|
1675
|
-
return true;
|
|
1676
|
-
}
|
|
1677
|
-
if (!contract.decimals) {
|
|
1678
|
-
return true;
|
|
1679
|
-
}
|
|
1680
|
-
return false;
|
|
1681
|
-
});
|
|
1682
|
-
const calls = [];
|
|
1683
|
-
for (const contract of contractUnique) {
|
|
1684
|
-
calls.push({
|
|
1685
|
-
address: contract,
|
|
1686
|
-
abi: erc20Abi2,
|
|
1687
|
-
functionName: "symbol",
|
|
1688
|
-
args: []
|
|
1689
|
-
});
|
|
1690
|
-
calls.push({
|
|
1691
|
-
address: contract,
|
|
1692
|
-
abi: erc20Abi2,
|
|
1693
|
-
functionName: "decimals",
|
|
1694
|
-
args: []
|
|
1695
|
-
});
|
|
1696
|
-
}
|
|
1697
|
-
const results = await publicClient?.multicall({ contracts: calls });
|
|
1698
|
-
if (results) {
|
|
1699
|
-
console.log("contract results", calls, results);
|
|
1700
|
-
const contractMap = [];
|
|
1701
|
-
for (let i = 0; i < contractUnique.length; i++) {
|
|
1702
|
-
const info = {};
|
|
1703
|
-
if (results[i * 2].status == "success") {
|
|
1704
|
-
info.symbol = results[i * 2].result;
|
|
1705
|
-
}
|
|
1706
|
-
if (results[i * 2 + 1].status == "success") {
|
|
1707
|
-
info.decimals = results[i * 2 + 1].result;
|
|
1708
|
-
}
|
|
1709
|
-
contractMap.push({
|
|
1710
|
-
chainId: chainId || 0,
|
|
1711
|
-
contractAddress: contractUnique[i],
|
|
1712
|
-
info
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
setContracts(contractMap);
|
|
1716
|
-
}
|
|
1717
1668
|
setItems(items.concat(res.data.transactions || []));
|
|
1718
1669
|
}
|
|
1719
1670
|
hasMoreRef.current = res.data && res.data.transactions && res.data.transactions.length >= 50;
|
|
@@ -1734,6 +1685,56 @@ function useMatchWalletRecords() {
|
|
|
1734
1685
|
}
|
|
1735
1686
|
}, [chainId, address]);
|
|
1736
1687
|
const { transactions, removeTransaction } = useTransactionStore_default();
|
|
1688
|
+
const getContractInfoList = async (contractList) => {
|
|
1689
|
+
const contractUnique = Array.from(new Set(contractList)).filter((item) => {
|
|
1690
|
+
const contract = contracts[`${chainId}-${item.toLowerCase()}`];
|
|
1691
|
+
if (!contract) {
|
|
1692
|
+
return true;
|
|
1693
|
+
}
|
|
1694
|
+
if (!contract.symbol && !contract.name) {
|
|
1695
|
+
return true;
|
|
1696
|
+
}
|
|
1697
|
+
if (!contract.decimals) {
|
|
1698
|
+
return true;
|
|
1699
|
+
}
|
|
1700
|
+
return false;
|
|
1701
|
+
});
|
|
1702
|
+
const calls = [];
|
|
1703
|
+
for (const contract of contractUnique) {
|
|
1704
|
+
calls.push({
|
|
1705
|
+
address: contract,
|
|
1706
|
+
abi: erc20Abi2,
|
|
1707
|
+
functionName: "symbol",
|
|
1708
|
+
args: []
|
|
1709
|
+
});
|
|
1710
|
+
calls.push({
|
|
1711
|
+
address: contract,
|
|
1712
|
+
abi: erc20Abi2,
|
|
1713
|
+
functionName: "decimals",
|
|
1714
|
+
args: []
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
const results = await publicClient?.multicall({ contracts: calls });
|
|
1718
|
+
if (results) {
|
|
1719
|
+
console.log("contract results", calls, results);
|
|
1720
|
+
const contractMap = [];
|
|
1721
|
+
for (let i = 0; i < contractUnique.length; i++) {
|
|
1722
|
+
const info = {};
|
|
1723
|
+
if (results[i * 2].status == "success") {
|
|
1724
|
+
info.symbol = results[i * 2].result;
|
|
1725
|
+
}
|
|
1726
|
+
if (results[i * 2 + 1].status == "success") {
|
|
1727
|
+
info.decimals = results[i * 2 + 1].result;
|
|
1728
|
+
}
|
|
1729
|
+
contractMap.push({
|
|
1730
|
+
chainId: chainId || 0,
|
|
1731
|
+
contractAddress: contractUnique[i],
|
|
1732
|
+
info
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
setContracts(contractMap);
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1737
1738
|
const list = useMemo5(() => {
|
|
1738
1739
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
1739
1740
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
@@ -1745,7 +1746,7 @@ function useMatchWalletRecords() {
|
|
|
1745
1746
|
});
|
|
1746
1747
|
});
|
|
1747
1748
|
const saveList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) < 0);
|
|
1748
|
-
|
|
1749
|
+
const list2 = [
|
|
1749
1750
|
...saveList,
|
|
1750
1751
|
...items
|
|
1751
1752
|
].sort((a, b) => {
|
|
@@ -1753,6 +1754,9 @@ function useMatchWalletRecords() {
|
|
|
1753
1754
|
const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
|
|
1754
1755
|
return btimestamp - atimestamp;
|
|
1755
1756
|
});
|
|
1757
|
+
const contractList = list2.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
|
|
1758
|
+
getContractInfoList(contractList);
|
|
1759
|
+
return list2;
|
|
1756
1760
|
}, [transactions, chainId, items, address]);
|
|
1757
1761
|
return {
|
|
1758
1762
|
items: list,
|
|
@@ -6379,4 +6383,4 @@ export {
|
|
|
6379
6383
|
MatchProvider,
|
|
6380
6384
|
useMatch
|
|
6381
6385
|
};
|
|
6382
|
-
//# sourceMappingURL=chunk-
|
|
6386
|
+
//# sourceMappingURL=chunk-YSASIFLY.mjs.map
|