@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.
@@ -11,7 +11,7 @@ import {
11
11
  useUserInfo,
12
12
  verifyPohApi,
13
13
  wallet_exports
14
- } from "./chunk-WPXA4QPX.mjs";
14
+ } from "./chunk-TSPOB4DT.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-MUEDDGKX.mjs.map
97
+ //# sourceMappingURL=chunk-EOT6XIVG.mjs.map
@@ -1,14 +1,3 @@
1
- import {
2
- NumberFormatter,
3
- encodeBase64,
4
- formatAddress,
5
- formatDate,
6
- getAppClientId,
7
- getVersion,
8
- isValidEmail,
9
- isValidUsername,
10
- truncateAddress
11
- } from "./chunk-5JHHHLG4.mjs";
12
1
  import {
13
2
  AlphaAvatar,
14
3
  Button,
@@ -28,6 +17,17 @@ import {
28
17
  useHash,
29
18
  useLayout_exports
30
19
  } from "./chunk-FB5MHLWX.mjs";
20
+ import {
21
+ NumberFormatter,
22
+ encodeBase64,
23
+ formatAddress,
24
+ formatDate,
25
+ getAppClientId,
26
+ getVersion,
27
+ isValidEmail,
28
+ isValidUsername,
29
+ truncateAddress
30
+ } from "./chunk-5JHHHLG4.mjs";
31
31
  import {
32
32
  ArrowDownIcon,
33
33
  ArrowRightIcon,
@@ -752,7 +752,6 @@ import { devtools as devtools2, persist as persist2 } from "zustand/middleware";
752
752
  var persistedState2 = persist2(
753
753
  (set, get) => ({
754
754
  transactions: {},
755
- getTransactions: (chainId, address) => get().transactions[`${chainId}-${address}`] || [],
756
755
  addTransaction: (data) => {
757
756
  set((state) => {
758
757
  const updatedTransactions = {
@@ -1703,9 +1702,9 @@ function useMatchWalletRecords() {
1703
1702
  onInit();
1704
1703
  }
1705
1704
  }, [chainId, address]);
1706
- const { getTransactions, removeTransaction } = useTransactionStore_default();
1705
+ const { transactions, removeTransaction } = useTransactionStore_default();
1707
1706
  const list = useMemo5(() => {
1708
- const localTransactions = getTransactions(chainId || 0, address) || [];
1707
+ const localTransactions = transactions[`${chainId}-${address}`] || [];
1709
1708
  const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
1710
1709
  removeList.forEach((item) => {
1711
1710
  removeTransaction({
@@ -1723,7 +1722,7 @@ function useMatchWalletRecords() {
1723
1722
  const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
1724
1723
  return btimestamp - atimestamp;
1725
1724
  });
1726
- }, [getTransactions, chainId, items, address]);
1725
+ }, [transactions, chainId, items, address]);
1727
1726
  return {
1728
1727
  items: list,
1729
1728
  fetchMoreData,
@@ -1831,34 +1830,13 @@ function useMatchWalletAssetList({
1831
1830
  // Retry up to 3 times if failed
1832
1831
  });
1833
1832
  const erc20Tokens = useMemo5(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
1834
- const erc20Abi4 = [
1835
- {
1836
- "constant": true,
1837
- "inputs": [
1838
- {
1839
- "name": "_owner",
1840
- "type": "address"
1841
- }
1842
- ],
1843
- "name": "balanceOf",
1844
- "outputs": [
1845
- {
1846
- "name": "balance",
1847
- "type": "uint256"
1848
- }
1849
- ],
1850
- "payable": false,
1851
- "stateMutability": "view",
1852
- "type": "function"
1853
- }
1854
- ];
1855
1833
  const erc20BalanceQuery = useQuery2({
1856
1834
  queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
1857
1835
  queryFn: async () => {
1858
1836
  if (!erc20Tokens.length || !publicClient) return [];
1859
1837
  const calls = erc20Tokens.map((token) => ({
1860
1838
  address: token.address,
1861
- abi: erc20Abi4,
1839
+ abi: erc20Abi2,
1862
1840
  functionName: "balanceOf",
1863
1841
  args: [address]
1864
1842
  }));
@@ -1874,7 +1852,7 @@ function useMatchWalletAssetList({
1874
1852
  }
1875
1853
  return balances;
1876
1854
  },
1877
- enabled: erc20Tokens.length > 0 && !!publicClient,
1855
+ enabled: !!publicClient,
1878
1856
  refetchInterval: 15e3,
1879
1857
  // Refresh every 15 seconds
1880
1858
  retry: 3
@@ -1916,6 +1894,9 @@ function useMatchWalletAssetList({
1916
1894
  return {
1917
1895
  list: assets,
1918
1896
  isLoading: nativeBalanceQuery.isLoading || erc20BalanceQuery.isLoading,
1897
+ isFetched: nativeBalanceQuery.isFetched && erc20BalanceQuery.isFetched,
1898
+ nativeBalanceQuery,
1899
+ erc20BalanceQuery,
1919
1900
  nativeBalance: nativeBalanceQuery.data,
1920
1901
  erc20Balances: erc20BalanceQuery.data
1921
1902
  };
@@ -6209,7 +6190,7 @@ import { FormattedMessage as FormattedMessage14 } from "react-intl";
6209
6190
  import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
6210
6191
  var Item = ({ data }) => {
6211
6192
  const { address } = useWallet();
6212
- const isOut = data.from == address;
6193
+ const isOut = data.from.toLowerCase() == address.toLowerCase();
6213
6194
  const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
6214
6195
  const { getContract } = useContractStore_default();
6215
6196
  const [shouldRefetch, setShouldRefetch] = useState28(true);
@@ -6244,11 +6225,6 @@ var Item = ({ data }) => {
6244
6225
  }
6245
6226
  return chainFormatUnits(BigInt(data.value));
6246
6227
  }, [data.input, transferType, data.value, getContract, chainId, data.to]);
6247
- useEffect25(() => {
6248
- if (data.hash) {
6249
- setShouldRefetch(true);
6250
- }
6251
- }, [data.hash]);
6252
6228
  const hashQuery = useHash({
6253
6229
  hash: data.hash,
6254
6230
  //@ts-ignore
@@ -6284,8 +6260,10 @@ var Item = ({ data }) => {
6284
6260
  return "loading";
6285
6261
  }, [data.extra?.status, data.source, hashQuery.data]);
6286
6262
  useEffect25(() => {
6287
- setShouldRefetch(status == "loading");
6288
- }, [status]);
6263
+ if (data.hash) {
6264
+ setShouldRefetch(status == "loading");
6265
+ }
6266
+ }, [status, data.hash]);
6289
6267
  const symbol = useMemo16(() => {
6290
6268
  if (transferType == "erc20_transfer") {
6291
6269
  return getContract(chainId || 0, data.to)?.symbol || getContract(chainId || 0, data.to)?.name || "unknown";
@@ -6389,4 +6367,4 @@ export {
6389
6367
  MatchProvider,
6390
6368
  useMatch
6391
6369
  };
6392
- //# sourceMappingURL=chunk-WPXA4QPX.mjs.map
6370
+ //# sourceMappingURL=chunk-TSPOB4DT.mjs.map