@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
|
-
export { B as BTCModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, S as SOLModal, d as TONModal, T as TRONModal, f as TokenDetail, g as TokenSend, h as TokenSendList, j as TransactionList, U as UsernameModal, e as WalletAsset, W as WalletModal } from '../index-
|
|
2
|
-
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-
|
|
1
|
+
export { B as BTCModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, S as SOLModal, d as TONModal, T as TRONModal, f as TokenDetail, g as TokenSend, h as TokenSendList, j as TransactionList, U as UsernameModal, e as WalletAsset, W as WalletModal } from '../index-u1AE9im5.mjs';
|
|
2
|
+
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-BXUU8PRO.mjs';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-pQHTwHLr.mjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@tanstack/react-query/src/types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { B as BTCModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, S as SOLModal, d as TONModal, T as TRONModal, f as TokenDetail, g as TokenSend, h as TokenSendList, j as TransactionList, U as UsernameModal, e as WalletAsset, W as WalletModal } from '../index-
|
|
2
|
-
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-
|
|
1
|
+
export { B as BTCModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, S as SOLModal, d as TONModal, T as TRONModal, f as TokenDetail, g as TokenSend, h as TokenSendList, j as TransactionList, U as UsernameModal, e as WalletAsset, W as WalletModal } from '../index-lY7YfVRh.js';
|
|
2
|
+
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-3I6HO7pu.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-pQHTwHLr.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@tanstack/react-query/src/types';
|
package/dist/components/index.js
CHANGED
|
@@ -2713,7 +2713,7 @@ function useMatchWalletRecords() {
|
|
|
2713
2713
|
const { address } = useWallet();
|
|
2714
2714
|
const hasMoreRef = (0, import_react15.useRef)(hasMore);
|
|
2715
2715
|
const nextPageParamsRef = (0, import_react15.useRef)(void 0);
|
|
2716
|
-
const {
|
|
2716
|
+
const { contracts, setContracts } = useContractStore_default();
|
|
2717
2717
|
const fetchMoreData = async () => {
|
|
2718
2718
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
2719
2719
|
if (!hasMoreRef.current || !chainIdStr) {
|
|
@@ -2725,55 +2725,6 @@ function useMatchWalletRecords() {
|
|
|
2725
2725
|
});
|
|
2726
2726
|
if (isSuccess(res)) {
|
|
2727
2727
|
if (res.data && res.data.transactions && res.data.transactions.length > 0) {
|
|
2728
|
-
const contractList = res.data.transactions.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
|
|
2729
|
-
const contractUnique = Array.from(new Set(contractList)).filter((item) => {
|
|
2730
|
-
const contract = getContract(chainId || 0, item);
|
|
2731
|
-
if (!contract) {
|
|
2732
|
-
return true;
|
|
2733
|
-
}
|
|
2734
|
-
if (!contract.symbol && !contract.name) {
|
|
2735
|
-
return true;
|
|
2736
|
-
}
|
|
2737
|
-
if (!contract.decimals) {
|
|
2738
|
-
return true;
|
|
2739
|
-
}
|
|
2740
|
-
return false;
|
|
2741
|
-
});
|
|
2742
|
-
const calls = [];
|
|
2743
|
-
for (const contract of contractUnique) {
|
|
2744
|
-
calls.push({
|
|
2745
|
-
address: contract,
|
|
2746
|
-
abi: import_viem8.erc20Abi,
|
|
2747
|
-
functionName: "symbol",
|
|
2748
|
-
args: []
|
|
2749
|
-
});
|
|
2750
|
-
calls.push({
|
|
2751
|
-
address: contract,
|
|
2752
|
-
abi: import_viem8.erc20Abi,
|
|
2753
|
-
functionName: "decimals",
|
|
2754
|
-
args: []
|
|
2755
|
-
});
|
|
2756
|
-
}
|
|
2757
|
-
const results = await publicClient?.multicall({ contracts: calls });
|
|
2758
|
-
if (results) {
|
|
2759
|
-
console.log("contract results", calls, results);
|
|
2760
|
-
const contractMap = [];
|
|
2761
|
-
for (let i = 0; i < contractUnique.length; i++) {
|
|
2762
|
-
const info = {};
|
|
2763
|
-
if (results[i * 2].status == "success") {
|
|
2764
|
-
info.symbol = results[i * 2].result;
|
|
2765
|
-
}
|
|
2766
|
-
if (results[i * 2 + 1].status == "success") {
|
|
2767
|
-
info.decimals = results[i * 2 + 1].result;
|
|
2768
|
-
}
|
|
2769
|
-
contractMap.push({
|
|
2770
|
-
chainId: chainId || 0,
|
|
2771
|
-
contractAddress: contractUnique[i],
|
|
2772
|
-
info
|
|
2773
|
-
});
|
|
2774
|
-
}
|
|
2775
|
-
setContracts(contractMap);
|
|
2776
|
-
}
|
|
2777
2728
|
setItems(items.concat(res.data.transactions || []));
|
|
2778
2729
|
}
|
|
2779
2730
|
hasMoreRef.current = res.data && res.data.transactions && res.data.transactions.length >= 50;
|
|
@@ -2794,6 +2745,56 @@ function useMatchWalletRecords() {
|
|
|
2794
2745
|
}
|
|
2795
2746
|
}, [chainId, address]);
|
|
2796
2747
|
const { transactions, removeTransaction } = useTransactionStore_default();
|
|
2748
|
+
const getContractInfoList = async (contractList) => {
|
|
2749
|
+
const contractUnique = Array.from(new Set(contractList)).filter((item) => {
|
|
2750
|
+
const contract = contracts[`${chainId}-${item.toLowerCase()}`];
|
|
2751
|
+
if (!contract) {
|
|
2752
|
+
return true;
|
|
2753
|
+
}
|
|
2754
|
+
if (!contract.symbol && !contract.name) {
|
|
2755
|
+
return true;
|
|
2756
|
+
}
|
|
2757
|
+
if (!contract.decimals) {
|
|
2758
|
+
return true;
|
|
2759
|
+
}
|
|
2760
|
+
return false;
|
|
2761
|
+
});
|
|
2762
|
+
const calls = [];
|
|
2763
|
+
for (const contract of contractUnique) {
|
|
2764
|
+
calls.push({
|
|
2765
|
+
address: contract,
|
|
2766
|
+
abi: import_viem8.erc20Abi,
|
|
2767
|
+
functionName: "symbol",
|
|
2768
|
+
args: []
|
|
2769
|
+
});
|
|
2770
|
+
calls.push({
|
|
2771
|
+
address: contract,
|
|
2772
|
+
abi: import_viem8.erc20Abi,
|
|
2773
|
+
functionName: "decimals",
|
|
2774
|
+
args: []
|
|
2775
|
+
});
|
|
2776
|
+
}
|
|
2777
|
+
const results = await publicClient?.multicall({ contracts: calls });
|
|
2778
|
+
if (results) {
|
|
2779
|
+
console.log("contract results", calls, results);
|
|
2780
|
+
const contractMap = [];
|
|
2781
|
+
for (let i = 0; i < contractUnique.length; i++) {
|
|
2782
|
+
const info = {};
|
|
2783
|
+
if (results[i * 2].status == "success") {
|
|
2784
|
+
info.symbol = results[i * 2].result;
|
|
2785
|
+
}
|
|
2786
|
+
if (results[i * 2 + 1].status == "success") {
|
|
2787
|
+
info.decimals = results[i * 2 + 1].result;
|
|
2788
|
+
}
|
|
2789
|
+
contractMap.push({
|
|
2790
|
+
chainId: chainId || 0,
|
|
2791
|
+
contractAddress: contractUnique[i],
|
|
2792
|
+
info
|
|
2793
|
+
});
|
|
2794
|
+
}
|
|
2795
|
+
setContracts(contractMap);
|
|
2796
|
+
}
|
|
2797
|
+
};
|
|
2797
2798
|
const list = (0, import_react15.useMemo)(() => {
|
|
2798
2799
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
2799
2800
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
@@ -2805,7 +2806,7 @@ function useMatchWalletRecords() {
|
|
|
2805
2806
|
});
|
|
2806
2807
|
});
|
|
2807
2808
|
const saveList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) < 0);
|
|
2808
|
-
|
|
2809
|
+
const list2 = [
|
|
2809
2810
|
...saveList,
|
|
2810
2811
|
...items
|
|
2811
2812
|
].sort((a, b) => {
|
|
@@ -2813,6 +2814,9 @@ function useMatchWalletRecords() {
|
|
|
2813
2814
|
const atimestamp = typeof a.timestamp === "string" ? parseInt(a.timestamp) : a.timestamp;
|
|
2814
2815
|
return btimestamp - atimestamp;
|
|
2815
2816
|
});
|
|
2817
|
+
const contractList = list2.filter((item) => item.input.toLowerCase().substring(0, 10) == "0xa9059cbb").map((item) => item.to);
|
|
2818
|
+
getContractInfoList(contractList);
|
|
2819
|
+
return list2;
|
|
2816
2820
|
}, [transactions, chainId, items, address]);
|
|
2817
2821
|
return {
|
|
2818
2822
|
items: list,
|
|
@@ -3173,11 +3177,11 @@ function useUserInfo() {
|
|
|
3173
3177
|
return loginByMethod("google");
|
|
3174
3178
|
};
|
|
3175
3179
|
const loginByWallet = async () => {
|
|
3176
|
-
return window.open(`${endpoints.auth}login/wallet?appid=${appid}`);
|
|
3180
|
+
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
3177
3181
|
};
|
|
3178
3182
|
const loginByTelegram = async () => {
|
|
3179
3183
|
return window.open(
|
|
3180
|
-
`${endpoints.auth}login/telegram?appid=${appid}`,
|
|
3184
|
+
`${endpoints.auth}login/telegram?appid=${appid}&locale=${locale}`,
|
|
3181
3185
|
// Replace with the actual authorization URL
|
|
3182
3186
|
"authWindow",
|
|
3183
3187
|
"width=800,height=600"
|
|
@@ -3188,7 +3192,7 @@ function useUserInfo() {
|
|
|
3188
3192
|
case "wallet":
|
|
3189
3193
|
return walletModalStore.open("login", extra?.methods);
|
|
3190
3194
|
case "evm":
|
|
3191
|
-
return window.open(`${endpoints.auth}login/wallet?appid=${appid}`);
|
|
3195
|
+
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
3192
3196
|
case "sol":
|
|
3193
3197
|
return SOLOpen("login");
|
|
3194
3198
|
case "tron":
|
|
@@ -3249,14 +3253,14 @@ function useUserInfo() {
|
|
|
3249
3253
|
if (!token) {
|
|
3250
3254
|
throw new Error("You must login first");
|
|
3251
3255
|
}
|
|
3252
|
-
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3256
|
+
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3253
3257
|
};
|
|
3254
3258
|
const bindTelegram = async () => {
|
|
3255
3259
|
if (!token) {
|
|
3256
3260
|
throw new Error("You must login first");
|
|
3257
3261
|
}
|
|
3258
3262
|
const authWindow = window.open(
|
|
3259
|
-
`${endpoints.auth}bind/telegram?appid=${appid}&st=` + encodeURIComponent(encodeBase64(token)),
|
|
3263
|
+
`${endpoints.auth}bind/telegram?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)),
|
|
3260
3264
|
// Replace with the actual authorization URL
|
|
3261
3265
|
"authWindow",
|
|
3262
3266
|
"width=800,height=600"
|
|
@@ -3277,7 +3281,7 @@ function useUserInfo() {
|
|
|
3277
3281
|
case "wallet":
|
|
3278
3282
|
return walletModalStore.open("bind", extra?.methods);
|
|
3279
3283
|
case "evm":
|
|
3280
|
-
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3284
|
+
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3281
3285
|
case "sol":
|
|
3282
3286
|
return SOLOpen("bind");
|
|
3283
3287
|
case "tron":
|