@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.
@@ -12,7 +12,7 @@ import {
12
12
  useTransaction,
13
13
  useUserInfo,
14
14
  useWallet
15
- } from "../chunk-OFPCHQMQ.mjs";
15
+ } from "../chunk-WHZ3HI4R.mjs";
16
16
  import "../chunk-UA6XHZHX.mjs";
17
17
  import {
18
18
  useLayout_exports
package/dist/index.css CHANGED
@@ -1673,7 +1673,8 @@ body {
1673
1673
  flex-direction: column;
1674
1674
  justify-content: space-between;
1675
1675
  gap: 48px;
1676
- padding-bottom: 200px;
1676
+ overflow-y: scroll;
1677
+ max-height: 70vh;
1677
1678
 
1678
1679
  @media (max-width: 768px) {
1679
1680
  padding-bottom: 0px;
package/dist/index.js CHANGED
@@ -2754,12 +2754,12 @@ var import_middleware2 = require("zustand/middleware");
2754
2754
  var persistedState2 = (0, import_middleware2.persist)(
2755
2755
  (set, get) => ({
2756
2756
  transactions: {},
2757
- getTransactions: (chainId) => get().transactions[chainId] || [],
2757
+ getTransactions: (chainId, address) => get().transactions[`${chainId}-${address}`] || [],
2758
2758
  addTransaction: (data) => {
2759
2759
  set((state) => {
2760
2760
  const updatedTransactions = {
2761
2761
  ...state.transactions,
2762
- [data.chainId]: [data.info, ...state.transactions[data.chainId] || []]
2762
+ [`${data.chainId}-${data.address}`]: [data.info, ...state.transactions[`${data.chainId}-${data.address}`] || []]
2763
2763
  };
2764
2764
  return { transactions: updatedTransactions };
2765
2765
  });
@@ -2768,7 +2768,7 @@ var persistedState2 = (0, import_middleware2.persist)(
2768
2768
  set((state) => {
2769
2769
  const updatedTransactions = {
2770
2770
  ...state.transactions,
2771
- [data.chainId]: (state.transactions[data.chainId] || []).filter((tx) => tx.hash !== data.hash)
2771
+ [`${data.chainId}-${data.address}`]: (state.transactions[`${data.chainId}-${data.address}`] || []).filter((tx) => tx.hash !== data.hash)
2772
2772
  };
2773
2773
  return { transactions: updatedTransactions };
2774
2774
  });
@@ -2949,7 +2949,8 @@ function useWallet() {
2949
2949
  timestamp: Math.floor(Date.now() / 1e3).toString(),
2950
2950
  hash: txHash,
2951
2951
  source: "local"
2952
- }
2952
+ },
2953
+ address: evmAccount.address
2953
2954
  });
2954
2955
  modal.show((props) => {
2955
2956
  return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
@@ -5563,7 +5564,7 @@ function TokenDetail({
5563
5564
  chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-token-chain` })
5564
5565
  ] }),
5565
5566
  /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-name`, children: [
5566
- token.balance,
5567
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10 }),
5567
5568
  " ",
5568
5569
  token.symbol
5569
5570
  ] })
@@ -5753,13 +5754,8 @@ var Item = ({ data }) => {
5753
5754
  //@ts-ignore
5754
5755
  chain: (0, import_viem7.defineChain)(chain),
5755
5756
  refetchInterval: shouldRefetch ? 3e3 : false,
5756
- enabled: data.source == "local"
5757
+ enabled: shouldRefetch
5757
5758
  });
5758
- (0, import_react32.useEffect)(() => {
5759
- if (hashQuery.data == 1 || hashQuery.data == -1) {
5760
- setShouldRefetch(false);
5761
- }
5762
- }, [hashQuery.data]);
5763
5759
  const status = (0, import_react32.useMemo)(() => {
5764
5760
  if (data.source == "matchain") {
5765
5761
  switch (data.extra.status) {
@@ -5787,6 +5783,9 @@ var Item = ({ data }) => {
5787
5783
  }
5788
5784
  return "loading";
5789
5785
  }, [data.extra?.status, data.source, hashQuery.data]);
5786
+ (0, import_react32.useEffect)(() => {
5787
+ setShouldRefetch(status == "loading");
5788
+ }, [status]);
5790
5789
  const symbol = (0, import_react32.useMemo)(() => {
5791
5790
  if (transferType == "erc20_transfer") {
5792
5791
  return getContract(chainId || 0, data.to)?.symbol || getContract(chainId || 0, data.to)?.name || "unknown";
@@ -6190,22 +6189,27 @@ function useMatchWalletRecords() {
6190
6189
  }, [chainId, address]);
6191
6190
  const { getTransactions, removeTransaction } = useTransactionStore_default();
6192
6191
  const localTransaction = (0, import_react33.useMemo)(() => {
6193
- return getTransactions(chainId || 0) || [];
6192
+ return getTransactions(chainId || 0, address) || [];
6194
6193
  }, [getTransactions, chainId]);
6195
6194
  (0, import_react33.useEffect)(() => {
6196
6195
  const removeList = localTransaction.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
6197
6196
  removeList.forEach((item) => {
6198
6197
  removeTransaction({
6199
6198
  chainId: chainId || 0,
6200
- hash: item.hash
6199
+ hash: item.hash,
6200
+ address
6201
6201
  });
6202
6202
  });
6203
6203
  }, [localTransaction, items]);
6204
6204
  return {
6205
6205
  items: [
6206
- ...getTransactions(chainId || 0) || [],
6206
+ ...getTransactions(chainId || 0, address) || [],
6207
6207
  ...items
6208
- ],
6208
+ ].sort((a, b) => {
6209
+ const btimestamp = typeof b.timestamp === "string" ? parseInt(b.timestamp) : b.timestamp;
6210
+ const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
6211
+ return btimestamp - atimestamp;
6212
+ }),
6209
6213
  fetchMoreData,
6210
6214
  hasMore
6211
6215
  };