@matchain/matchid-sdk-react 0.1.48-alpha.22 → 0.1.48-alpha.24
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-MUEDDGKX.mjs → chunk-EOT6XIVG.mjs} +2 -2
- package/dist/{chunk-WPXA4QPX.mjs → chunk-TSPOB4DT.mjs} +25 -47
- package/dist/chunk-TSPOB4DT.mjs.map +1 -0
- package/dist/components/index.js +13 -35
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/api/index.js +0 -1
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +3 -3
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +8 -27
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-Dhtyz0pT.d.mts → index-DUHkH5t-.d.mts} +11 -0
- package/dist/{index-CFKZWJVt.d.ts → index-DcQm2dkr.d.ts} +11 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/example/src/pages/Wallet/components/MatchWallet.tsx +24 -2
- package/package.json +1 -1
- package/dist/chunk-WPXA4QPX.mjs.map +0 -1
- /package/dist/{chunk-MUEDDGKX.mjs.map → chunk-EOT6XIVG.mjs.map} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -2198,7 +2198,6 @@ var import_middleware2 = require("zustand/middleware");
|
|
|
2198
2198
|
var persistedState2 = (0, import_middleware2.persist)(
|
|
2199
2199
|
(set, get) => ({
|
|
2200
2200
|
transactions: {},
|
|
2201
|
-
getTransactions: (chainId, address) => get().transactions[`${chainId}-${address}`] || [],
|
|
2202
2201
|
addTransaction: (data) => {
|
|
2203
2202
|
set((state) => {
|
|
2204
2203
|
const updatedTransactions = {
|
|
@@ -2788,9 +2787,9 @@ function useMatchWalletRecords() {
|
|
|
2788
2787
|
onInit();
|
|
2789
2788
|
}
|
|
2790
2789
|
}, [chainId, address]);
|
|
2791
|
-
const {
|
|
2790
|
+
const { transactions, removeTransaction } = useTransactionStore_default();
|
|
2792
2791
|
const list = (0, import_react15.useMemo)(() => {
|
|
2793
|
-
const localTransactions =
|
|
2792
|
+
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
2794
2793
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
2795
2794
|
removeList.forEach((item) => {
|
|
2796
2795
|
removeTransaction({
|
|
@@ -2808,7 +2807,7 @@ function useMatchWalletRecords() {
|
|
|
2808
2807
|
const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
|
|
2809
2808
|
return btimestamp - atimestamp;
|
|
2810
2809
|
});
|
|
2811
|
-
}, [
|
|
2810
|
+
}, [transactions, chainId, items, address]);
|
|
2812
2811
|
return {
|
|
2813
2812
|
items: list,
|
|
2814
2813
|
fetchMoreData,
|
|
@@ -2916,34 +2915,13 @@ function useMatchWalletAssetList({
|
|
|
2916
2915
|
// Retry up to 3 times if failed
|
|
2917
2916
|
});
|
|
2918
2917
|
const erc20Tokens = (0, import_react15.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
2919
|
-
const erc20Abi4 = [
|
|
2920
|
-
{
|
|
2921
|
-
"constant": true,
|
|
2922
|
-
"inputs": [
|
|
2923
|
-
{
|
|
2924
|
-
"name": "_owner",
|
|
2925
|
-
"type": "address"
|
|
2926
|
-
}
|
|
2927
|
-
],
|
|
2928
|
-
"name": "balanceOf",
|
|
2929
|
-
"outputs": [
|
|
2930
|
-
{
|
|
2931
|
-
"name": "balance",
|
|
2932
|
-
"type": "uint256"
|
|
2933
|
-
}
|
|
2934
|
-
],
|
|
2935
|
-
"payable": false,
|
|
2936
|
-
"stateMutability": "view",
|
|
2937
|
-
"type": "function"
|
|
2938
|
-
}
|
|
2939
|
-
];
|
|
2940
2918
|
const erc20BalanceQuery = (0, import_react_query4.useQuery)({
|
|
2941
2919
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
2942
2920
|
queryFn: async () => {
|
|
2943
2921
|
if (!erc20Tokens.length || !publicClient) return [];
|
|
2944
2922
|
const calls = erc20Tokens.map((token) => ({
|
|
2945
2923
|
address: token.address,
|
|
2946
|
-
abi:
|
|
2924
|
+
abi: import_viem7.erc20Abi,
|
|
2947
2925
|
functionName: "balanceOf",
|
|
2948
2926
|
args: [address]
|
|
2949
2927
|
}));
|
|
@@ -2959,7 +2937,7 @@ function useMatchWalletAssetList({
|
|
|
2959
2937
|
}
|
|
2960
2938
|
return balances;
|
|
2961
2939
|
},
|
|
2962
|
-
enabled:
|
|
2940
|
+
enabled: !!publicClient,
|
|
2963
2941
|
refetchInterval: 15e3,
|
|
2964
2942
|
// Refresh every 15 seconds
|
|
2965
2943
|
retry: 3
|
|
@@ -3001,6 +2979,9 @@ function useMatchWalletAssetList({
|
|
|
3001
2979
|
return {
|
|
3002
2980
|
list: assets,
|
|
3003
2981
|
isLoading: nativeBalanceQuery.isLoading || erc20BalanceQuery.isLoading,
|
|
2982
|
+
isFetched: nativeBalanceQuery.isFetched && erc20BalanceQuery.isFetched,
|
|
2983
|
+
nativeBalanceQuery,
|
|
2984
|
+
erc20BalanceQuery,
|
|
3004
2985
|
nativeBalance: nativeBalanceQuery.data,
|
|
3005
2986
|
erc20Balances: erc20BalanceQuery.data
|
|
3006
2987
|
};
|
|
@@ -5672,7 +5653,7 @@ var import_react_intl21 = require("react-intl");
|
|
|
5672
5653
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
5673
5654
|
var Item = ({ data }) => {
|
|
5674
5655
|
const { address } = useWallet();
|
|
5675
|
-
const isOut = data.from == address;
|
|
5656
|
+
const isOut = data.from.toLowerCase() == address.toLowerCase();
|
|
5676
5657
|
const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
|
|
5677
5658
|
const { getContract } = useContractStore_default();
|
|
5678
5659
|
const [shouldRefetch, setShouldRefetch] = (0, import_react40.useState)(true);
|
|
@@ -5707,11 +5688,6 @@ var Item = ({ data }) => {
|
|
|
5707
5688
|
}
|
|
5708
5689
|
return chainFormatUnits(BigInt(data.value));
|
|
5709
5690
|
}, [data.input, transferType, data.value, getContract, chainId, data.to]);
|
|
5710
|
-
(0, import_react40.useEffect)(() => {
|
|
5711
|
-
if (data.hash) {
|
|
5712
|
-
setShouldRefetch(true);
|
|
5713
|
-
}
|
|
5714
|
-
}, [data.hash]);
|
|
5715
5691
|
const hashQuery = useHash({
|
|
5716
5692
|
hash: data.hash,
|
|
5717
5693
|
//@ts-ignore
|
|
@@ -5747,8 +5723,10 @@ var Item = ({ data }) => {
|
|
|
5747
5723
|
return "loading";
|
|
5748
5724
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
5749
5725
|
(0, import_react40.useEffect)(() => {
|
|
5750
|
-
|
|
5751
|
-
|
|
5726
|
+
if (data.hash) {
|
|
5727
|
+
setShouldRefetch(status == "loading");
|
|
5728
|
+
}
|
|
5729
|
+
}, [status, data.hash]);
|
|
5752
5730
|
const symbol = (0, import_react40.useMemo)(() => {
|
|
5753
5731
|
if (transferType == "erc20_transfer") {
|
|
5754
5732
|
return getContract(chainId || 0, data.to)?.symbol || getContract(chainId || 0, data.to)?.name || "unknown";
|