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

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.
@@ -2,11 +2,11 @@ import {
2
2
  bind_exports,
3
3
  poh_exports,
4
4
  user_exports
5
- } from "../../chunk-CVBMC54N.mjs";
5
+ } from "../../chunk-3UVHHJP6.mjs";
6
6
  import {
7
7
  isSuccess,
8
8
  wallet_exports
9
- } from "../../chunk-OFPCHQMQ.mjs";
9
+ } from "../../chunk-WHZ3HI4R.mjs";
10
10
  import "../../chunk-UA6XHZHX.mjs";
11
11
  import "../../chunk-WXPVHKGJ.mjs";
12
12
  import "../../chunk-5JHHHLG4.mjs";
@@ -2114,12 +2114,12 @@ var import_middleware3 = require("zustand/middleware");
2114
2114
  var persistedState3 = (0, import_middleware3.persist)(
2115
2115
  (set, get) => ({
2116
2116
  transactions: {},
2117
- getTransactions: (chainId) => get().transactions[chainId] || [],
2117
+ getTransactions: (chainId, address) => get().transactions[`${chainId}-${address}`] || [],
2118
2118
  addTransaction: (data) => {
2119
2119
  set((state) => {
2120
2120
  const updatedTransactions = {
2121
2121
  ...state.transactions,
2122
- [data.chainId]: [data.info, ...state.transactions[data.chainId] || []]
2122
+ [`${data.chainId}-${data.address}`]: [data.info, ...state.transactions[`${data.chainId}-${data.address}`] || []]
2123
2123
  };
2124
2124
  return { transactions: updatedTransactions };
2125
2125
  });
@@ -2128,7 +2128,7 @@ var persistedState3 = (0, import_middleware3.persist)(
2128
2128
  set((state) => {
2129
2129
  const updatedTransactions = {
2130
2130
  ...state.transactions,
2131
- [data.chainId]: (state.transactions[data.chainId] || []).filter((tx) => tx.hash !== data.hash)
2131
+ [`${data.chainId}-${data.address}`]: (state.transactions[`${data.chainId}-${data.address}`] || []).filter((tx) => tx.hash !== data.hash)
2132
2132
  };
2133
2133
  return { transactions: updatedTransactions };
2134
2134
  });
@@ -2309,7 +2309,8 @@ function useWallet2() {
2309
2309
  timestamp: Math.floor(Date.now() / 1e3).toString(),
2310
2310
  hash: txHash,
2311
2311
  source: "local"
2312
- }
2312
+ },
2313
+ address: evmAccount.address
2313
2314
  });
2314
2315
  modal.show((props) => {
2315
2316
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
@@ -2875,22 +2876,27 @@ function useMatchWalletRecords() {
2875
2876
  }, [chainId, address]);
2876
2877
  const { getTransactions, removeTransaction } = useTransactionStore_default();
2877
2878
  const localTransaction = (0, import_react37.useMemo)(() => {
2878
- return getTransactions(chainId || 0) || [];
2879
+ return getTransactions(chainId || 0, address) || [];
2879
2880
  }, [getTransactions, chainId]);
2880
2881
  (0, import_react37.useEffect)(() => {
2881
2882
  const removeList = localTransaction.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
2882
2883
  removeList.forEach((item) => {
2883
2884
  removeTransaction({
2884
2885
  chainId: chainId || 0,
2885
- hash: item.hash
2886
+ hash: item.hash,
2887
+ address
2886
2888
  });
2887
2889
  });
2888
2890
  }, [localTransaction, items]);
2889
2891
  return {
2890
2892
  items: [
2891
- ...getTransactions(chainId || 0) || [],
2893
+ ...getTransactions(chainId || 0, address) || [],
2892
2894
  ...items
2893
- ],
2895
+ ].sort((a, b) => {
2896
+ const btimestamp = typeof b.timestamp === "string" ? parseInt(b.timestamp) : b.timestamp;
2897
+ const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
2898
+ return btimestamp - atimestamp;
2899
+ }),
2894
2900
  fetchMoreData,
2895
2901
  hasMore
2896
2902
  };