@matchain/matchid-sdk-react 0.1.48-alpha.31 → 0.1.48-alpha.33
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/assets/icon/index.d.mts +1 -1
- package/dist/assets/icon/index.d.ts +1 -1
- package/dist/{chunk-YJV23RET.mjs → chunk-4I5WVXIN.mjs} +2 -2
- package/dist/{chunk-KIVNILBF.mjs → chunk-YSASIFLY.mjs} +62 -58
- package/dist/chunk-YSASIFLY.mjs.map +1 -0
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +61 -57
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +6 -6
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +3 -3
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +61 -57
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-BcEreCxd.d.ts → index-3I6HO7pu.d.ts} +1 -1
- package/dist/{index-Bpmrd7mh.d.ts → index-BGhcUCaf.d.ts} +1 -1
- package/dist/{index-Cou96DpL.d.mts → index-BXUU8PRO.d.mts} +1 -1
- package/dist/{index-Cy3K-Yao.d.ts → index-C1SOElvD.d.ts} +1 -1
- package/dist/{index-C9F6f2iz.d.mts → index-CfNpZBzs.d.mts} +2 -2
- package/dist/{index-BMsj8hJv.d.ts → index-Cg9cddpr.d.ts} +2 -2
- package/dist/{index-BMfaixEx.d.mts → index-CiVpdQxz.d.mts} +1 -1
- package/dist/{index-DUHkH5t-.d.mts → index-CjCngqWS.d.mts} +1 -1
- package/dist/{index-DcQm2dkr.d.ts → index-GXwzr_ck.d.ts} +1 -1
- package/dist/{index-D4ju2J_e.d.mts → index-UiH7pXQW.d.mts} +1 -1
- package/dist/{index-Bvc8cjpN.d.ts → index-lY7YfVRh.d.ts} +2 -2
- package/dist/{index-C9qYyRgt.d.mts → index-u1AE9im5.d.mts} +2 -2
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +61 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-DzVVzMYU.d.mts → types-pQHTwHLr.d.mts} +1 -1
- package/dist/{types-DzVVzMYU.d.ts → types-pQHTwHLr.d.ts} +1 -1
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/chunk-KIVNILBF.mjs.map +0 -1
- /package/dist/{chunk-YJV23RET.mjs.map → chunk-4I5WVXIN.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { CSSProperties } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { t as IconProps$1 } from '../../types-pQHTwHLr.mjs';
|
|
4
4
|
import '@tanstack/react-query/src/types';
|
|
5
5
|
|
|
6
6
|
declare function BackIcon({ color, size, className, style }: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { CSSProperties } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { t as IconProps$1 } from '../../types-pQHTwHLr.js';
|
|
4
4
|
import '@tanstack/react-query/src/types';
|
|
5
5
|
|
|
6
6
|
declare function BackIcon({ color, size, className, style }: {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useUserInfo,
|
|
12
12
|
verifyPohApi,
|
|
13
13
|
wallet_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YSASIFLY.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-4I5WVXIN.mjs.map
|
|
@@ -1653,7 +1653,7 @@ function useMatchWalletRecords() {
|
|
|
1653
1653
|
const { address } = useWallet();
|
|
1654
1654
|
const hasMoreRef = useRef(hasMore);
|
|
1655
1655
|
const nextPageParamsRef = useRef(void 0);
|
|
1656
|
-
const {
|
|
1656
|
+
const { contracts, setContracts } = useContractStore_default();
|
|
1657
1657
|
const fetchMoreData = async () => {
|
|
1658
1658
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
1659
1659
|
if (!hasMoreRef.current || !chainIdStr) {
|
|
@@ -1665,55 +1665,6 @@ function useMatchWalletRecords() {
|
|
|
1665
1665
|
});
|
|
1666
1666
|
if (isSuccess(res)) {
|
|
1667
1667
|
if (res.data && res.data.transactions && res.data.transactions.length > 0) {
|
|
1668
|
-
const contractList = res.data.transactions.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
|
|
1669
|
-
const contractUnique = Array.from(new Set(contractList)).filter((item) => {
|
|
1670
|
-
const contract = getContract(chainId || 0, item);
|
|
1671
|
-
if (!contract) {
|
|
1672
|
-
return true;
|
|
1673
|
-
}
|
|
1674
|
-
if (!contract.symbol && !contract.name) {
|
|
1675
|
-
return true;
|
|
1676
|
-
}
|
|
1677
|
-
if (!contract.decimals) {
|
|
1678
|
-
return true;
|
|
1679
|
-
}
|
|
1680
|
-
return false;
|
|
1681
|
-
});
|
|
1682
|
-
const calls = [];
|
|
1683
|
-
for (const contract of contractUnique) {
|
|
1684
|
-
calls.push({
|
|
1685
|
-
address: contract,
|
|
1686
|
-
abi: erc20Abi2,
|
|
1687
|
-
functionName: "symbol",
|
|
1688
|
-
args: []
|
|
1689
|
-
});
|
|
1690
|
-
calls.push({
|
|
1691
|
-
address: contract,
|
|
1692
|
-
abi: erc20Abi2,
|
|
1693
|
-
functionName: "decimals",
|
|
1694
|
-
args: []
|
|
1695
|
-
});
|
|
1696
|
-
}
|
|
1697
|
-
const results = await publicClient?.multicall({ contracts: calls });
|
|
1698
|
-
if (results) {
|
|
1699
|
-
console.log("contract results", calls, results);
|
|
1700
|
-
const contractMap = [];
|
|
1701
|
-
for (let i = 0; i < contractUnique.length; i++) {
|
|
1702
|
-
const info = {};
|
|
1703
|
-
if (results[i * 2].status == "success") {
|
|
1704
|
-
info.symbol = results[i * 2].result;
|
|
1705
|
-
}
|
|
1706
|
-
if (results[i * 2 + 1].status == "success") {
|
|
1707
|
-
info.decimals = results[i * 2 + 1].result;
|
|
1708
|
-
}
|
|
1709
|
-
contractMap.push({
|
|
1710
|
-
chainId: chainId || 0,
|
|
1711
|
-
contractAddress: contractUnique[i],
|
|
1712
|
-
info
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
setContracts(contractMap);
|
|
1716
|
-
}
|
|
1717
1668
|
setItems(items.concat(res.data.transactions || []));
|
|
1718
1669
|
}
|
|
1719
1670
|
hasMoreRef.current = res.data && res.data.transactions && res.data.transactions.length >= 50;
|
|
@@ -1734,6 +1685,56 @@ function useMatchWalletRecords() {
|
|
|
1734
1685
|
}
|
|
1735
1686
|
}, [chainId, address]);
|
|
1736
1687
|
const { transactions, removeTransaction } = useTransactionStore_default();
|
|
1688
|
+
const getContractInfoList = async (contractList) => {
|
|
1689
|
+
const contractUnique = Array.from(new Set(contractList)).filter((item) => {
|
|
1690
|
+
const contract = contracts[`${chainId}-${item.toLowerCase()}`];
|
|
1691
|
+
if (!contract) {
|
|
1692
|
+
return true;
|
|
1693
|
+
}
|
|
1694
|
+
if (!contract.symbol && !contract.name) {
|
|
1695
|
+
return true;
|
|
1696
|
+
}
|
|
1697
|
+
if (!contract.decimals) {
|
|
1698
|
+
return true;
|
|
1699
|
+
}
|
|
1700
|
+
return false;
|
|
1701
|
+
});
|
|
1702
|
+
const calls = [];
|
|
1703
|
+
for (const contract of contractUnique) {
|
|
1704
|
+
calls.push({
|
|
1705
|
+
address: contract,
|
|
1706
|
+
abi: erc20Abi2,
|
|
1707
|
+
functionName: "symbol",
|
|
1708
|
+
args: []
|
|
1709
|
+
});
|
|
1710
|
+
calls.push({
|
|
1711
|
+
address: contract,
|
|
1712
|
+
abi: erc20Abi2,
|
|
1713
|
+
functionName: "decimals",
|
|
1714
|
+
args: []
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
const results = await publicClient?.multicall({ contracts: calls });
|
|
1718
|
+
if (results) {
|
|
1719
|
+
console.log("contract results", calls, results);
|
|
1720
|
+
const contractMap = [];
|
|
1721
|
+
for (let i = 0; i < contractUnique.length; i++) {
|
|
1722
|
+
const info = {};
|
|
1723
|
+
if (results[i * 2].status == "success") {
|
|
1724
|
+
info.symbol = results[i * 2].result;
|
|
1725
|
+
}
|
|
1726
|
+
if (results[i * 2 + 1].status == "success") {
|
|
1727
|
+
info.decimals = results[i * 2 + 1].result;
|
|
1728
|
+
}
|
|
1729
|
+
contractMap.push({
|
|
1730
|
+
chainId: chainId || 0,
|
|
1731
|
+
contractAddress: contractUnique[i],
|
|
1732
|
+
info
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
setContracts(contractMap);
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1737
1738
|
const list = useMemo5(() => {
|
|
1738
1739
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
1739
1740
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
@@ -1745,7 +1746,7 @@ function useMatchWalletRecords() {
|
|
|
1745
1746
|
});
|
|
1746
1747
|
});
|
|
1747
1748
|
const saveList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) < 0);
|
|
1748
|
-
|
|
1749
|
+
const list2 = [
|
|
1749
1750
|
...saveList,
|
|
1750
1751
|
...items
|
|
1751
1752
|
].sort((a, b) => {
|
|
@@ -1753,6 +1754,9 @@ function useMatchWalletRecords() {
|
|
|
1753
1754
|
const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
|
|
1754
1755
|
return btimestamp - atimestamp;
|
|
1755
1756
|
});
|
|
1757
|
+
const contractList = list2.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
|
|
1758
|
+
getContractInfoList(contractList);
|
|
1759
|
+
return list2;
|
|
1756
1760
|
}, [transactions, chainId, items, address]);
|
|
1757
1761
|
return {
|
|
1758
1762
|
items: list,
|
|
@@ -3688,11 +3692,11 @@ function useUserInfo() {
|
|
|
3688
3692
|
return loginByMethod("google");
|
|
3689
3693
|
};
|
|
3690
3694
|
const loginByWallet = async () => {
|
|
3691
|
-
return window.open(`${endpoints.auth}login/wallet?appid=${appid}`);
|
|
3695
|
+
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
3692
3696
|
};
|
|
3693
3697
|
const loginByTelegram = async () => {
|
|
3694
3698
|
return window.open(
|
|
3695
|
-
`${endpoints.auth}login/telegram?appid=${appid}`,
|
|
3699
|
+
`${endpoints.auth}login/telegram?appid=${appid}&locale=${locale}`,
|
|
3696
3700
|
// Replace with the actual authorization URL
|
|
3697
3701
|
"authWindow",
|
|
3698
3702
|
"width=800,height=600"
|
|
@@ -3703,7 +3707,7 @@ function useUserInfo() {
|
|
|
3703
3707
|
case "wallet":
|
|
3704
3708
|
return walletModalStore.open("login", extra?.methods);
|
|
3705
3709
|
case "evm":
|
|
3706
|
-
return window.open(`${endpoints.auth}login/wallet?appid=${appid}`);
|
|
3710
|
+
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
3707
3711
|
case "sol":
|
|
3708
3712
|
return SOLOpen("login");
|
|
3709
3713
|
case "tron":
|
|
@@ -3764,14 +3768,14 @@ function useUserInfo() {
|
|
|
3764
3768
|
if (!token) {
|
|
3765
3769
|
throw new Error("You must login first");
|
|
3766
3770
|
}
|
|
3767
|
-
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3771
|
+
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3768
3772
|
};
|
|
3769
3773
|
const bindTelegram = async () => {
|
|
3770
3774
|
if (!token) {
|
|
3771
3775
|
throw new Error("You must login first");
|
|
3772
3776
|
}
|
|
3773
3777
|
const authWindow = window.open(
|
|
3774
|
-
`${endpoints.auth}bind/telegram?appid=${appid}&st=` + encodeURIComponent(encodeBase64(token)),
|
|
3778
|
+
`${endpoints.auth}bind/telegram?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)),
|
|
3775
3779
|
// Replace with the actual authorization URL
|
|
3776
3780
|
"authWindow",
|
|
3777
3781
|
"width=800,height=600"
|
|
@@ -3792,7 +3796,7 @@ function useUserInfo() {
|
|
|
3792
3796
|
case "wallet":
|
|
3793
3797
|
return walletModalStore.open("bind", extra?.methods);
|
|
3794
3798
|
case "evm":
|
|
3795
|
-
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3799
|
+
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3796
3800
|
case "sol":
|
|
3797
3801
|
return SOLOpen("bind");
|
|
3798
3802
|
case "tron":
|
|
@@ -6379,4 +6383,4 @@ export {
|
|
|
6379
6383
|
MatchProvider,
|
|
6380
6384
|
useMatch
|
|
6381
6385
|
};
|
|
6382
|
-
//# sourceMappingURL=chunk-
|
|
6386
|
+
//# sourceMappingURL=chunk-YSASIFLY.mjs.map
|