@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
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useUserInfo,
|
|
12
12
|
verifyPohApi,
|
|
13
13
|
wallet_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WHZ3HI4R.mjs";
|
|
15
15
|
import {
|
|
16
16
|
__export
|
|
17
17
|
} from "./chunk-J5LGTIGS.mjs";
|
|
@@ -94,4 +94,4 @@ export {
|
|
|
94
94
|
user_exports,
|
|
95
95
|
api_exports
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-3UVHHJP6.mjs.map
|
|
@@ -750,12 +750,12 @@ import { devtools as devtools2, persist as persist2 } from "zustand/middleware";
|
|
|
750
750
|
var persistedState2 = persist2(
|
|
751
751
|
(set, get) => ({
|
|
752
752
|
transactions: {},
|
|
753
|
-
getTransactions: (chainId) => get().transactions[chainId] || [],
|
|
753
|
+
getTransactions: (chainId, address) => get().transactions[`${chainId}-${address}`] || [],
|
|
754
754
|
addTransaction: (data) => {
|
|
755
755
|
set((state) => {
|
|
756
756
|
const updatedTransactions = {
|
|
757
757
|
...state.transactions,
|
|
758
|
-
[data.chainId]: [data.info, ...state.transactions[data.chainId] || []]
|
|
758
|
+
[`${data.chainId}-${data.address}`]: [data.info, ...state.transactions[`${data.chainId}-${data.address}`] || []]
|
|
759
759
|
};
|
|
760
760
|
return { transactions: updatedTransactions };
|
|
761
761
|
});
|
|
@@ -764,7 +764,7 @@ var persistedState2 = persist2(
|
|
|
764
764
|
set((state) => {
|
|
765
765
|
const updatedTransactions = {
|
|
766
766
|
...state.transactions,
|
|
767
|
-
[data.chainId]: (state.transactions[data.chainId] || []).filter((tx) => tx.hash !== data.hash)
|
|
767
|
+
[`${data.chainId}-${data.address}`]: (state.transactions[`${data.chainId}-${data.address}`] || []).filter((tx) => tx.hash !== data.hash)
|
|
768
768
|
};
|
|
769
769
|
return { transactions: updatedTransactions };
|
|
770
770
|
});
|
|
@@ -945,7 +945,8 @@ function useWallet() {
|
|
|
945
945
|
timestamp: Math.floor(Date.now() / 1e3).toString(),
|
|
946
946
|
hash: txHash,
|
|
947
947
|
source: "local"
|
|
948
|
-
}
|
|
948
|
+
},
|
|
949
|
+
address: evmAccount.address
|
|
949
950
|
});
|
|
950
951
|
modal.show((props) => {
|
|
951
952
|
return /* @__PURE__ */ jsx3(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
|
|
@@ -1202,7 +1203,7 @@ function useWalletAssetListQuery({
|
|
|
1202
1203
|
|
|
1203
1204
|
// src/hooks/useMatchChain.tsx
|
|
1204
1205
|
import { useMemo as useMemo3, useState as useState6 } from "react";
|
|
1205
|
-
import { createPublicClient, formatUnits, http, parseUnits } from "viem";
|
|
1206
|
+
import { createPublicClient as createPublicClient2, formatUnits, http as http2, parseUnits } from "viem";
|
|
1206
1207
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1207
1208
|
function useMatchChain() {
|
|
1208
1209
|
const chainListQuery = useChainListQuery();
|
|
@@ -1266,9 +1267,9 @@ function useMatchChain() {
|
|
|
1266
1267
|
if (!chain) {
|
|
1267
1268
|
return null;
|
|
1268
1269
|
}
|
|
1269
|
-
return
|
|
1270
|
+
return createPublicClient2({
|
|
1270
1271
|
chain,
|
|
1271
|
-
transport:
|
|
1272
|
+
transport: http2()
|
|
1272
1273
|
});
|
|
1273
1274
|
}, [chain]);
|
|
1274
1275
|
return {
|
|
@@ -1699,22 +1700,27 @@ function useMatchWalletRecords() {
|
|
|
1699
1700
|
}, [chainId, address]);
|
|
1700
1701
|
const { getTransactions, removeTransaction } = useTransactionStore_default();
|
|
1701
1702
|
const localTransaction = useMemo4(() => {
|
|
1702
|
-
return getTransactions(chainId || 0) || [];
|
|
1703
|
+
return getTransactions(chainId || 0, address) || [];
|
|
1703
1704
|
}, [getTransactions, chainId]);
|
|
1704
1705
|
useEffect6(() => {
|
|
1705
1706
|
const removeList = localTransaction.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
1706
1707
|
removeList.forEach((item) => {
|
|
1707
1708
|
removeTransaction({
|
|
1708
1709
|
chainId: chainId || 0,
|
|
1709
|
-
hash: item.hash
|
|
1710
|
+
hash: item.hash,
|
|
1711
|
+
address
|
|
1710
1712
|
});
|
|
1711
1713
|
});
|
|
1712
1714
|
}, [localTransaction, items]);
|
|
1713
1715
|
return {
|
|
1714
1716
|
items: [
|
|
1715
|
-
...getTransactions(chainId || 0) || [],
|
|
1717
|
+
...getTransactions(chainId || 0, address) || [],
|
|
1716
1718
|
...items
|
|
1717
|
-
],
|
|
1719
|
+
].sort((a, b) => {
|
|
1720
|
+
const btimestamp = typeof b.timestamp === "string" ? parseInt(b.timestamp) : b.timestamp;
|
|
1721
|
+
const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
|
|
1722
|
+
return btimestamp - atimestamp;
|
|
1723
|
+
}),
|
|
1718
1724
|
fetchMoreData,
|
|
1719
1725
|
hasMore
|
|
1720
1726
|
};
|
|
@@ -1913,7 +1919,7 @@ function useMatchWalletAssetList({
|
|
|
1913
1919
|
// src/hooks/useReceipt.tsx
|
|
1914
1920
|
import { useState as useState8, useCallback as useCallback4, useEffect as useEffect7 } from "react";
|
|
1915
1921
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
1916
|
-
import { createPublicClient as
|
|
1922
|
+
import { createPublicClient as createPublicClient3, defineChain, http as http3 } from "viem";
|
|
1917
1923
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
1918
1924
|
var MAX_CACHE_SIZE = 500;
|
|
1919
1925
|
var STORAGE_KEY = "match_receipt_logs";
|
|
@@ -2030,9 +2036,9 @@ function useReceipt({
|
|
|
2030
2036
|
return cache.get(cacheKey);
|
|
2031
2037
|
}
|
|
2032
2038
|
try {
|
|
2033
|
-
const publicClient =
|
|
2039
|
+
const publicClient = createPublicClient3({
|
|
2034
2040
|
chain: defineChain(chain),
|
|
2035
|
-
transport:
|
|
2041
|
+
transport: http3()
|
|
2036
2042
|
});
|
|
2037
2043
|
const receipt = await publicClient.getTransactionReceipt({ hash });
|
|
2038
2044
|
if (!receipt) {
|
|
@@ -2057,7 +2063,7 @@ function useReceipt({
|
|
|
2057
2063
|
// src/hooks/useTransaction.tsx
|
|
2058
2064
|
import { useState as useState9, useCallback as useCallback5, useEffect as useEffect8 } from "react";
|
|
2059
2065
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
2060
|
-
import { createPublicClient as
|
|
2066
|
+
import { createPublicClient as createPublicClient4, defineChain as defineChain2, http as http4 } from "viem";
|
|
2061
2067
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
2062
2068
|
var MAX_CACHE_SIZE2 = 500;
|
|
2063
2069
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
@@ -2174,9 +2180,9 @@ function useTransaction({
|
|
|
2174
2180
|
return cache.get(cacheKey);
|
|
2175
2181
|
}
|
|
2176
2182
|
try {
|
|
2177
|
-
const publicClient =
|
|
2183
|
+
const publicClient = createPublicClient4({
|
|
2178
2184
|
chain: defineChain2(chain),
|
|
2179
|
-
transport:
|
|
2185
|
+
transport: http4()
|
|
2180
2186
|
});
|
|
2181
2187
|
const transaction = await publicClient.getTransaction({ hash });
|
|
2182
2188
|
if (!transaction) {
|
|
@@ -5788,7 +5794,7 @@ function WalletAsset({
|
|
|
5788
5794
|
|
|
5789
5795
|
// src/components/TokenSend/index.tsx
|
|
5790
5796
|
import { useEffect as useEffect23, useMemo as useMemo14, useState as useState25 } from "react";
|
|
5791
|
-
import { defineChain as defineChain3, encodeFunctionData as encodeFunctionData2, http as
|
|
5797
|
+
import { defineChain as defineChain3, encodeFunctionData as encodeFunctionData2, http as http5, parseUnits as parseUnits2 } from "viem";
|
|
5792
5798
|
import { FormattedMessage as FormattedMessage10, useIntl as useIntl15 } from "react-intl";
|
|
5793
5799
|
import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5794
5800
|
function Input2({
|
|
@@ -5832,7 +5838,7 @@ function TokenSend({
|
|
|
5832
5838
|
return createWalletClient2({
|
|
5833
5839
|
// @ts-ignore
|
|
5834
5840
|
chain: defineChain3(chain),
|
|
5835
|
-
transport:
|
|
5841
|
+
transport: http5()
|
|
5836
5842
|
});
|
|
5837
5843
|
}, [chain]);
|
|
5838
5844
|
const [amount, setAmount] = useState25("");
|
|
@@ -6065,7 +6071,7 @@ function TokenDetail({
|
|
|
6065
6071
|
chain?.iconUrl && /* @__PURE__ */ jsx30("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-token-chain` })
|
|
6066
6072
|
] }),
|
|
6067
6073
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-name`, children: [
|
|
6068
|
-
token.balance,
|
|
6074
|
+
/* @__PURE__ */ jsx30(NumberFormatter, { value: token.balance, tFixNum: 10 }),
|
|
6069
6075
|
" ",
|
|
6070
6076
|
token.symbol
|
|
6071
6077
|
] })
|
|
@@ -6197,13 +6203,8 @@ var Item = ({ data }) => {
|
|
|
6197
6203
|
//@ts-ignore
|
|
6198
6204
|
chain: defineChain4(chain),
|
|
6199
6205
|
refetchInterval: shouldRefetch ? 3e3 : false,
|
|
6200
|
-
enabled:
|
|
6206
|
+
enabled: shouldRefetch
|
|
6201
6207
|
});
|
|
6202
|
-
useEffect24(() => {
|
|
6203
|
-
if (hashQuery.data == 1 || hashQuery.data == -1) {
|
|
6204
|
-
setShouldRefetch(false);
|
|
6205
|
-
}
|
|
6206
|
-
}, [hashQuery.data]);
|
|
6207
6208
|
const status = useMemo15(() => {
|
|
6208
6209
|
if (data.source == "matchain") {
|
|
6209
6210
|
switch (data.extra.status) {
|
|
@@ -6231,6 +6232,9 @@ var Item = ({ data }) => {
|
|
|
6231
6232
|
}
|
|
6232
6233
|
return "loading";
|
|
6233
6234
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
6235
|
+
useEffect24(() => {
|
|
6236
|
+
setShouldRefetch(status == "loading");
|
|
6237
|
+
}, [status]);
|
|
6234
6238
|
const symbol = useMemo15(() => {
|
|
6235
6239
|
if (transferType == "erc20_transfer") {
|
|
6236
6240
|
return getContract(chainId || 0, data.to)?.symbol || getContract(chainId || 0, data.to)?.name || "unknown";
|
|
@@ -6334,4 +6338,4 @@ export {
|
|
|
6334
6338
|
MatchProvider,
|
|
6335
6339
|
useMatch
|
|
6336
6340
|
};
|
|
6337
|
-
//# sourceMappingURL=chunk-
|
|
6341
|
+
//# sourceMappingURL=chunk-WHZ3HI4R.mjs.map
|