@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/index.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -6118,7 +6118,7 @@ function useMatchWalletRecords() {
|
|
|
6118
6118
|
const { address } = useWallet();
|
|
6119
6119
|
const hasMoreRef = (0, import_react34.useRef)(hasMore);
|
|
6120
6120
|
const nextPageParamsRef = (0, import_react34.useRef)(void 0);
|
|
6121
|
-
const {
|
|
6121
|
+
const { contracts, setContracts } = useContractStore_default();
|
|
6122
6122
|
const fetchMoreData = async () => {
|
|
6123
6123
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
6124
6124
|
if (!hasMoreRef.current || !chainIdStr) {
|
|
@@ -6130,55 +6130,6 @@ function useMatchWalletRecords() {
|
|
|
6130
6130
|
});
|
|
6131
6131
|
if (isSuccess(res)) {
|
|
6132
6132
|
if (res.data && res.data.transactions && res.data.transactions.length > 0) {
|
|
6133
|
-
const contractList = res.data.transactions.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
|
|
6134
|
-
const contractUnique = Array.from(new Set(contractList)).filter((item) => {
|
|
6135
|
-
const contract = getContract(chainId || 0, item);
|
|
6136
|
-
if (!contract) {
|
|
6137
|
-
return true;
|
|
6138
|
-
}
|
|
6139
|
-
if (!contract.symbol && !contract.name) {
|
|
6140
|
-
return true;
|
|
6141
|
-
}
|
|
6142
|
-
if (!contract.decimals) {
|
|
6143
|
-
return true;
|
|
6144
|
-
}
|
|
6145
|
-
return false;
|
|
6146
|
-
});
|
|
6147
|
-
const calls = [];
|
|
6148
|
-
for (const contract of contractUnique) {
|
|
6149
|
-
calls.push({
|
|
6150
|
-
address: contract,
|
|
6151
|
-
abi: import_viem11.erc20Abi,
|
|
6152
|
-
functionName: "symbol",
|
|
6153
|
-
args: []
|
|
6154
|
-
});
|
|
6155
|
-
calls.push({
|
|
6156
|
-
address: contract,
|
|
6157
|
-
abi: import_viem11.erc20Abi,
|
|
6158
|
-
functionName: "decimals",
|
|
6159
|
-
args: []
|
|
6160
|
-
});
|
|
6161
|
-
}
|
|
6162
|
-
const results = await publicClient?.multicall({ contracts: calls });
|
|
6163
|
-
if (results) {
|
|
6164
|
-
console.log("contract results", calls, results);
|
|
6165
|
-
const contractMap = [];
|
|
6166
|
-
for (let i = 0; i < contractUnique.length; i++) {
|
|
6167
|
-
const info = {};
|
|
6168
|
-
if (results[i * 2].status == "success") {
|
|
6169
|
-
info.symbol = results[i * 2].result;
|
|
6170
|
-
}
|
|
6171
|
-
if (results[i * 2 + 1].status == "success") {
|
|
6172
|
-
info.decimals = results[i * 2 + 1].result;
|
|
6173
|
-
}
|
|
6174
|
-
contractMap.push({
|
|
6175
|
-
chainId: chainId || 0,
|
|
6176
|
-
contractAddress: contractUnique[i],
|
|
6177
|
-
info
|
|
6178
|
-
});
|
|
6179
|
-
}
|
|
6180
|
-
setContracts(contractMap);
|
|
6181
|
-
}
|
|
6182
6133
|
setItems(items.concat(res.data.transactions || []));
|
|
6183
6134
|
}
|
|
6184
6135
|
hasMoreRef.current = res.data && res.data.transactions && res.data.transactions.length >= 50;
|
|
@@ -6199,6 +6150,56 @@ function useMatchWalletRecords() {
|
|
|
6199
6150
|
}
|
|
6200
6151
|
}, [chainId, address]);
|
|
6201
6152
|
const { transactions, removeTransaction } = useTransactionStore_default();
|
|
6153
|
+
const getContractInfoList = async (contractList) => {
|
|
6154
|
+
const contractUnique = Array.from(new Set(contractList)).filter((item) => {
|
|
6155
|
+
const contract = contracts[`${chainId}-${item.toLowerCase()}`];
|
|
6156
|
+
if (!contract) {
|
|
6157
|
+
return true;
|
|
6158
|
+
}
|
|
6159
|
+
if (!contract.symbol && !contract.name) {
|
|
6160
|
+
return true;
|
|
6161
|
+
}
|
|
6162
|
+
if (!contract.decimals) {
|
|
6163
|
+
return true;
|
|
6164
|
+
}
|
|
6165
|
+
return false;
|
|
6166
|
+
});
|
|
6167
|
+
const calls = [];
|
|
6168
|
+
for (const contract of contractUnique) {
|
|
6169
|
+
calls.push({
|
|
6170
|
+
address: contract,
|
|
6171
|
+
abi: import_viem11.erc20Abi,
|
|
6172
|
+
functionName: "symbol",
|
|
6173
|
+
args: []
|
|
6174
|
+
});
|
|
6175
|
+
calls.push({
|
|
6176
|
+
address: contract,
|
|
6177
|
+
abi: import_viem11.erc20Abi,
|
|
6178
|
+
functionName: "decimals",
|
|
6179
|
+
args: []
|
|
6180
|
+
});
|
|
6181
|
+
}
|
|
6182
|
+
const results = await publicClient?.multicall({ contracts: calls });
|
|
6183
|
+
if (results) {
|
|
6184
|
+
console.log("contract results", calls, results);
|
|
6185
|
+
const contractMap = [];
|
|
6186
|
+
for (let i = 0; i < contractUnique.length; i++) {
|
|
6187
|
+
const info = {};
|
|
6188
|
+
if (results[i * 2].status == "success") {
|
|
6189
|
+
info.symbol = results[i * 2].result;
|
|
6190
|
+
}
|
|
6191
|
+
if (results[i * 2 + 1].status == "success") {
|
|
6192
|
+
info.decimals = results[i * 2 + 1].result;
|
|
6193
|
+
}
|
|
6194
|
+
contractMap.push({
|
|
6195
|
+
chainId: chainId || 0,
|
|
6196
|
+
contractAddress: contractUnique[i],
|
|
6197
|
+
info
|
|
6198
|
+
});
|
|
6199
|
+
}
|
|
6200
|
+
setContracts(contractMap);
|
|
6201
|
+
}
|
|
6202
|
+
};
|
|
6202
6203
|
const list = (0, import_react34.useMemo)(() => {
|
|
6203
6204
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
6204
6205
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
@@ -6210,7 +6211,7 @@ function useMatchWalletRecords() {
|
|
|
6210
6211
|
});
|
|
6211
6212
|
});
|
|
6212
6213
|
const saveList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) < 0);
|
|
6213
|
-
|
|
6214
|
+
const list2 = [
|
|
6214
6215
|
...saveList,
|
|
6215
6216
|
...items
|
|
6216
6217
|
].sort((a, b) => {
|
|
@@ -6218,6 +6219,9 @@ function useMatchWalletRecords() {
|
|
|
6218
6219
|
const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
|
|
6219
6220
|
return btimestamp - atimestamp;
|
|
6220
6221
|
});
|
|
6222
|
+
const contractList = list2.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
|
|
6223
|
+
getContractInfoList(contractList);
|
|
6224
|
+
return list2;
|
|
6221
6225
|
}, [transactions, chainId, items, address]);
|
|
6222
6226
|
return {
|
|
6223
6227
|
items: list,
|