@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.
- package/dist/{chunk-CVBMC54N.mjs → chunk-3UVHHJP6.mjs} +2 -2
- package/dist/{chunk-OFPCHQMQ.mjs → chunk-WHZ3HI4R.mjs} +31 -27
- package/dist/chunk-WHZ3HI4R.mjs.map +1 -0
- package/dist/components/index.js +19 -15
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/api/index.js +3 -3
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +2 -2
- package/dist/hooks/index.js +14 -8
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.css +2 -1
- package/dist/index.js +19 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/example/src/pages/Wallet/index.tsx +2 -1
- package/package.json +1 -1
- package/dist/chunk-OFPCHQMQ.mjs.map +0 -1
- /package/dist/{chunk-CVBMC54N.mjs.map → chunk-3UVHHJP6.mjs.map} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -2198,12 +2198,12 @@ var import_middleware2 = require("zustand/middleware");
|
|
|
2198
2198
|
var persistedState2 = (0, import_middleware2.persist)(
|
|
2199
2199
|
(set, get) => ({
|
|
2200
2200
|
transactions: {},
|
|
2201
|
-
getTransactions: (chainId) => get().transactions[chainId] || [],
|
|
2201
|
+
getTransactions: (chainId, address) => get().transactions[`${chainId}-${address}`] || [],
|
|
2202
2202
|
addTransaction: (data) => {
|
|
2203
2203
|
set((state) => {
|
|
2204
2204
|
const updatedTransactions = {
|
|
2205
2205
|
...state.transactions,
|
|
2206
|
-
[data.chainId]: [data.info, ...state.transactions[data.chainId] || []]
|
|
2206
|
+
[`${data.chainId}-${data.address}`]: [data.info, ...state.transactions[`${data.chainId}-${data.address}`] || []]
|
|
2207
2207
|
};
|
|
2208
2208
|
return { transactions: updatedTransactions };
|
|
2209
2209
|
});
|
|
@@ -2212,7 +2212,7 @@ var persistedState2 = (0, import_middleware2.persist)(
|
|
|
2212
2212
|
set((state) => {
|
|
2213
2213
|
const updatedTransactions = {
|
|
2214
2214
|
...state.transactions,
|
|
2215
|
-
[data.chainId]: (state.transactions[data.chainId] || []).filter((tx) => tx.hash !== data.hash)
|
|
2215
|
+
[`${data.chainId}-${data.address}`]: (state.transactions[`${data.chainId}-${data.address}`] || []).filter((tx) => tx.hash !== data.hash)
|
|
2216
2216
|
};
|
|
2217
2217
|
return { transactions: updatedTransactions };
|
|
2218
2218
|
});
|
|
@@ -2393,7 +2393,8 @@ function useWallet() {
|
|
|
2393
2393
|
timestamp: Math.floor(Date.now() / 1e3).toString(),
|
|
2394
2394
|
hash: txHash,
|
|
2395
2395
|
source: "local"
|
|
2396
|
-
}
|
|
2396
|
+
},
|
|
2397
|
+
address: evmAccount.address
|
|
2397
2398
|
});
|
|
2398
2399
|
modal.show((props) => {
|
|
2399
2400
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
|
|
@@ -2780,22 +2781,27 @@ function useMatchWalletRecords() {
|
|
|
2780
2781
|
}, [chainId, address]);
|
|
2781
2782
|
const { getTransactions, removeTransaction } = useTransactionStore_default();
|
|
2782
2783
|
const localTransaction = (0, import_react14.useMemo)(() => {
|
|
2783
|
-
return getTransactions(chainId || 0) || [];
|
|
2784
|
+
return getTransactions(chainId || 0, address) || [];
|
|
2784
2785
|
}, [getTransactions, chainId]);
|
|
2785
2786
|
(0, import_react14.useEffect)(() => {
|
|
2786
2787
|
const removeList = localTransaction.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
2787
2788
|
removeList.forEach((item) => {
|
|
2788
2789
|
removeTransaction({
|
|
2789
2790
|
chainId: chainId || 0,
|
|
2790
|
-
hash: item.hash
|
|
2791
|
+
hash: item.hash,
|
|
2792
|
+
address
|
|
2791
2793
|
});
|
|
2792
2794
|
});
|
|
2793
2795
|
}, [localTransaction, items]);
|
|
2794
2796
|
return {
|
|
2795
2797
|
items: [
|
|
2796
|
-
...getTransactions(chainId || 0) || [],
|
|
2798
|
+
...getTransactions(chainId || 0, address) || [],
|
|
2797
2799
|
...items
|
|
2798
|
-
],
|
|
2800
|
+
].sort((a, b) => {
|
|
2801
|
+
const btimestamp = typeof b.timestamp === "string" ? parseInt(b.timestamp) : b.timestamp;
|
|
2802
|
+
const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
|
|
2803
|
+
return btimestamp - atimestamp;
|
|
2804
|
+
}),
|
|
2799
2805
|
fetchMoreData,
|
|
2800
2806
|
hasMore
|
|
2801
2807
|
};
|
|
@@ -5569,7 +5575,7 @@ function TokenDetail({
|
|
|
5569
5575
|
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-token-chain` })
|
|
5570
5576
|
] }),
|
|
5571
5577
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-token-name`, children: [
|
|
5572
|
-
token.balance,
|
|
5578
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10 }),
|
|
5573
5579
|
" ",
|
|
5574
5580
|
token.symbol
|
|
5575
5581
|
] })
|
|
@@ -5701,13 +5707,8 @@ var Item = ({ data }) => {
|
|
|
5701
5707
|
//@ts-ignore
|
|
5702
5708
|
chain: (0, import_viem10.defineChain)(chain),
|
|
5703
5709
|
refetchInterval: shouldRefetch ? 3e3 : false,
|
|
5704
|
-
enabled:
|
|
5710
|
+
enabled: shouldRefetch
|
|
5705
5711
|
});
|
|
5706
|
-
(0, import_react39.useEffect)(() => {
|
|
5707
|
-
if (hashQuery.data == 1 || hashQuery.data == -1) {
|
|
5708
|
-
setShouldRefetch(false);
|
|
5709
|
-
}
|
|
5710
|
-
}, [hashQuery.data]);
|
|
5711
5712
|
const status = (0, import_react39.useMemo)(() => {
|
|
5712
5713
|
if (data.source == "matchain") {
|
|
5713
5714
|
switch (data.extra.status) {
|
|
@@ -5735,6 +5736,9 @@ var Item = ({ data }) => {
|
|
|
5735
5736
|
}
|
|
5736
5737
|
return "loading";
|
|
5737
5738
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
5739
|
+
(0, import_react39.useEffect)(() => {
|
|
5740
|
+
setShouldRefetch(status == "loading");
|
|
5741
|
+
}, [status]);
|
|
5738
5742
|
const symbol = (0, import_react39.useMemo)(() => {
|
|
5739
5743
|
if (transferType == "erc20_transfer") {
|
|
5740
5744
|
return getContract(chainId || 0, data.to)?.symbol || getContract(chainId || 0, data.to)?.name || "unknown";
|