@matchain/matchid-sdk-react 0.1.48-alpha.20 → 0.1.48-alpha.21

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.
@@ -12,7 +12,7 @@ import {
12
12
  useTransaction,
13
13
  useUserInfo,
14
14
  useWallet
15
- } from "../chunk-WHZ3HI4R.mjs";
15
+ } from "../chunk-CHWBALAC.mjs";
16
16
  import "../chunk-UA6XHZHX.mjs";
17
17
  import {
18
18
  useLayout_exports
package/dist/index.js CHANGED
@@ -6188,11 +6188,9 @@ function useMatchWalletRecords() {
6188
6188
  }
6189
6189
  }, [chainId, address]);
6190
6190
  const { getTransactions, removeTransaction } = useTransactionStore_default();
6191
- const localTransaction = (0, import_react33.useMemo)(() => {
6192
- return getTransactions(chainId || 0, address) || [];
6193
- }, [getTransactions, chainId]);
6194
- (0, import_react33.useEffect)(() => {
6195
- const removeList = localTransaction.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
6191
+ const list = (0, import_react33.useMemo)(() => {
6192
+ const localTransactions = getTransactions(chainId || 0, address) || [];
6193
+ const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
6196
6194
  removeList.forEach((item) => {
6197
6195
  removeTransaction({
6198
6196
  chainId: chainId || 0,
@@ -6200,16 +6198,18 @@ function useMatchWalletRecords() {
6200
6198
  address
6201
6199
  });
6202
6200
  });
6203
- }, [localTransaction, items]);
6204
- return {
6205
- items: [
6206
- ...getTransactions(chainId || 0, address) || [],
6201
+ const saveList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) < 0);
6202
+ return [
6203
+ ...saveList,
6207
6204
  ...items
6208
6205
  ].sort((a, b) => {
6209
6206
  const btimestamp = typeof b.timestamp === "string" ? parseInt(b.timestamp) : b.timestamp;
6210
6207
  const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
6211
6208
  return btimestamp - atimestamp;
6212
- }),
6209
+ });
6210
+ }, [getTransactions, chainId, items, address]);
6211
+ return {
6212
+ items: list,
6213
6213
  fetchMoreData,
6214
6214
  hasMore
6215
6215
  };