@taskon/widget-react 0.0.1-beta.2 → 0.0.1-beta.4
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/README.md +56 -17
- package/dist/CommunityTaskList.css +1593 -1741
- package/dist/EligibilityInfo.css +1275 -582
- package/dist/LeaderboardWidget.css +355 -152
- package/dist/PageBuilder.css +0 -2
- package/dist/Quest.css +1140 -903
- package/dist/TaskOnProvider.css +50 -31
- package/dist/UserCenterWidget.css +108 -237
- package/dist/UserCenterWidget2.css +2016 -711
- package/dist/chunks/{CommunityTaskList-BlH1Wdd5.js → CommunityTaskList-C9Gv8KOF.js} +962 -827
- package/dist/chunks/{EligibilityInfo-C7GZ2G5u.js → EligibilityInfo-D-Fuy9GE.js} +1137 -449
- package/dist/chunks/{LeaderboardWidget-CmYfDeHV.js → LeaderboardWidget-BV2D2q1N.js} +15 -10
- package/dist/chunks/{PageBuilder-Bw0zSkFh.js → PageBuilder-DQoU4Mwf.js} +5 -5
- package/dist/chunks/{Quest-DKFZ-pPU.js → Quest-B5NyVr3o.js} +516 -325
- package/dist/chunks/{TaskOnProvider-BD6Vp2x8.js → TaskOnProvider-93UxARFo.js} +2 -207
- package/dist/chunks/{ThemeProvider-wnSXrNQb.js → ThemeProvider-CPI_roeh.js} +249 -57
- package/dist/chunks/{UserCenterWidget-Cw6h_5hT.js → UserCenterWidget-BRtigY_S.js} +206 -1002
- package/dist/chunks/UserCenterWidget-cADBSVg7.js +8358 -0
- package/dist/chunks/{WidgetShell-D_5OjvNZ.js → dynamic-import-helper-DwXlQC0S.js} +607 -40
- package/dist/chunks/useToast-CaRkylKe.js +304 -0
- package/dist/chunks/{usercenter-ja-uu-XfVF9.js → usercenter-ja-B2465c1O.js} +4 -10
- package/dist/chunks/{usercenter-ko-DYgUOVzd.js → usercenter-ko-xAEYxqLg.js} +4 -10
- package/dist/community-task.d.ts +34 -3
- package/dist/community-task.js +1 -1
- package/dist/core.d.ts +40 -3
- package/dist/core.js +9 -10
- package/dist/dynamic-import-helper.css +596 -289
- package/dist/index.d.ts +207 -10
- package/dist/index.js +21 -19
- package/dist/leaderboard.d.ts +8 -1
- package/dist/leaderboard.js +2 -2
- package/dist/page-builder.js +1 -1
- package/dist/quest.d.ts +8 -2
- package/dist/quest.js +1 -1
- package/dist/user-center.d.ts +20 -136
- package/dist/user-center.js +19 -236
- package/package.json +10 -2
- package/dist/TipPopover.css +0 -210
- package/dist/WidgetShell.css +0 -182
- package/dist/chunks/TipPopover-BrW8jo71.js +0 -2926
- package/dist/chunks/UserCenterWidget-BE329iS7.js +0 -3546
- package/dist/chunks/dynamic-import-helper-DxEFwm31.js +0 -537
- package/dist/chunks/useToast-B-wyO5zL.js +0 -93
- package/dist/chunks/useWidgetLocale-JDelxtt8.js +0 -74
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { T as Table, u as usePagination, B as Button, _ as __variableDynamicImportRuntimeHelper } from "./dynamic-import-helper-
|
|
1
|
+
import { T as Table, u as usePagination, D as Dialog, B as Button, a as useResolvedWidgetConfig, W as WidgetShell, _ as __variableDynamicImportRuntimeHelper } from "./dynamic-import-helper-DwXlQC0S.js";
|
|
2
2
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useRef, useCallback, useLayoutEffect, useMemo, useEffect } from "react";
|
|
4
|
-
import { UserCenterRewardCardType, USER_CENTER_PAGE_SIZE, createUserCenterApi,
|
|
5
|
-
import {
|
|
6
|
-
import { L as LoadingState, E as EmptyState, P as Pagination,
|
|
7
|
-
import {
|
|
8
|
-
import { u as useWidgetLocale } from "./useWidgetLocale-JDelxtt8.js";
|
|
9
|
-
import { u as useChainMap, a as useBindSocialAccount, I as Input } from "./TipPopover-BrW8jo71.js";
|
|
10
|
-
import { u as useWallet, b as useToast } from "./useToast-B-wyO5zL.js";
|
|
4
|
+
import { UserCenterRewardCardType, USER_CENTER_PAGE_SIZE, createUserCenterApi, SnsType, createUserApi, VerifyCodeType, getChainName, truncateAddress, filterEnabledAccounts, filterEnabledWallets, USER_CENTER_REWARD_CARD_TYPES, RewardType, toWei, LockedType, filterEnabledTabs, UserCenterTabType } from "@taskon/core";
|
|
5
|
+
import { d as useTaskOnContext, b as useWidgetLocale } from "./ThemeProvider-CPI_roeh.js";
|
|
6
|
+
import { L as LoadingState, E as EmptyState, P as Pagination, e as formatDateTime, A as AssetImage, d as buildRewardCards, g as useBindSocialAccount, I as Input, a as useTokenAssets, u as useRewardDetails, c as usePointsHistory, W as WithdrawForm, h as PointsList, N as NftRewardContent, i as TokenRewardContent, j as enMessages } from "./UserCenterWidget-cADBSVg7.js";
|
|
7
|
+
import { u as useWallet, d as useToast } from "./useToast-CaRkylKe.js";
|
|
11
8
|
import '../UserCenterWidget.css';function Tabs({
|
|
12
9
|
items,
|
|
13
10
|
activeKey,
|
|
@@ -588,162 +585,6 @@ function XpLevelCard({
|
|
|
588
585
|
] })
|
|
589
586
|
] });
|
|
590
587
|
}
|
|
591
|
-
const DEFAULT_WHITELIST_IMAGE = "data:image/svg+xml,%3Csvg width='80' height='81' viewBox='0 0 80 81' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_7084_12942' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='80' height='81'%3E%3Crect y='0.00146484' width='80' height='80' rx='4' fill='%23CBFF01'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_7084_12942)'%3E%3Crect width='80' height='80' rx='4' fill='url(%23paint0_linear_7084_12942)'/%3E%3Cpath d='M19.416 20.3864C5.81087 25.7182 -0.895974 41.0695 4.4358 54.6746C9.76758 68.2797 25.119 74.9866 38.724 69.6548L60.3663 61.1733C73.9714 55.8415 80.6783 40.4901 75.3465 26.885C70.0147 13.2799 54.6634 6.57309 41.0583 11.9049L19.416 20.3864Z' fill='%2300FFA3'/%3E%3Cpath d='M53.1374 21.1072H26.6534C15.7884 21.1072 6.98047 29.915 6.98047 40.7801C6.98047 51.6451 15.7884 60.4529 26.6534 60.4529H53.1374C64.0025 60.4529 72.8104 51.6451 72.8104 40.7801C72.8104 29.915 64.0025 21.1072 53.1374 21.1072Z' fill='black'/%3E%3Cpath d='M17.5691 43.286L14.8984 34.8704H16.9994L18.9223 41.3513H18.0083L19.9074 34.8704H21.6048L23.504 41.3513H22.6019L24.5247 34.8704H26.6138L23.9313 43.286H22.222L20.3229 36.817H21.1775L19.2902 43.286H17.5691Z' fill='white'/%3E%3Cpath d='M31.1209 43.286V40.01C31.1209 39.7409 31.0418 39.5312 30.8836 39.3809C30.7253 39.2226 30.5235 39.1435 30.2782 39.1435C30.112 39.1435 29.9617 39.1791 29.8272 39.2503C29.7005 39.3215 29.6016 39.4205 29.5304 39.5471C29.4592 39.6737 29.4236 39.828 29.4236 40.01L28.6164 39.6302C28.6164 39.1633 28.7114 38.7637 28.9013 38.4313C29.0991 38.0911 29.3682 37.8299 29.7085 37.6479C30.0487 37.458 30.4444 37.363 30.8954 37.363C31.3623 37.363 31.7659 37.458 32.1061 37.6479C32.4543 37.8299 32.7194 38.0831 32.9014 38.4076C33.0913 38.732 33.1863 39.1079 33.1863 39.5352V43.286H31.1209ZM27.3583 43.286V34.633H29.4236V43.286H27.3583Z' fill='white'/%3E%3Cpath d='M34.2665 43.286V37.4817H36.3437V43.286H34.2665ZM35.2992 36.8052C34.9906 36.8052 34.7334 36.7023 34.5276 36.4966C34.3219 36.2829 34.219 36.0178 34.219 35.7013C34.219 35.3927 34.3219 35.1315 34.5276 34.9179C34.7334 34.7042 34.9906 34.5974 35.2992 34.5974C35.6236 34.5974 35.8847 34.7042 36.0826 34.9179C36.2883 35.1315 36.3912 35.3927 36.3912 35.7013C36.3912 36.0178 36.2883 36.2829 36.0826 36.4966C35.8847 36.7023 35.6236 36.8052 35.2992 36.8052Z' fill='white'/%3E%3Cpath d='M38.3424 43.286V35.0841H40.4078V43.286H38.3424ZM37.0605 39.2028V37.4817H41.6897V39.2028H37.0605Z' fill='white'/%3E%3Cpath d='M45.2547 43.4166C44.6058 43.4166 44.0321 43.29 43.5336 43.0368C43.035 42.7756 42.6433 42.4156 42.3585 41.9566C42.0736 41.4977 41.9312 40.9714 41.9312 40.3779C41.9312 39.7924 42.0696 39.2741 42.3466 38.823C42.6236 38.3641 42.9994 38.004 43.4742 37.7429C43.9569 37.4738 44.499 37.3393 45.1004 37.3393C45.6859 37.3393 46.2042 37.4659 46.6553 37.7191C47.1143 37.9644 47.4703 38.3087 47.7236 38.7518C47.9847 39.187 48.1153 39.6855 48.1153 40.2474C48.1153 40.3661 48.1073 40.4887 48.0915 40.6153C48.0836 40.734 48.0599 40.8725 48.0203 41.0308L42.9045 41.0545V39.7251L47.2013 39.6895L46.2755 40.2711C46.2675 39.9467 46.2201 39.6816 46.133 39.4758C46.046 39.2622 45.9194 39.1 45.7532 38.9892C45.587 38.8784 45.3773 38.823 45.1241 38.823C44.863 38.823 44.6374 38.8863 44.4475 39.0129C44.2576 39.1395 44.1112 39.3176 44.0084 39.5471C43.9055 39.7765 43.854 40.0535 43.854 40.3779C43.854 40.7103 43.9094 40.9952 44.0202 41.2326C44.131 41.462 44.2893 41.6361 44.495 41.7548C44.7008 41.8735 44.954 41.9329 45.2547 41.9329C45.5395 41.9329 45.7888 41.8854 46.0025 41.7904C46.224 41.6955 46.4219 41.5491 46.5959 41.3513L47.6761 42.4314C47.3912 42.7558 47.043 43.0011 46.6316 43.1673C46.228 43.3335 45.769 43.4166 45.2547 43.4166Z' fill='white'/%3E%3Cpath d='M48.8952 43.286V34.633H50.9606V43.286H48.8952Z' fill='white'/%3E%3Cpath d='M52.1637 43.286V37.4817H54.2409V43.286H52.1637ZM53.1964 36.8052C52.8878 36.8052 52.6306 36.7023 52.4249 36.4966C52.2191 36.2829 52.1163 36.0178 52.1163 35.7013C52.1163 35.3927 52.2191 35.1315 52.4249 34.9179C52.6306 34.7042 52.8878 34.5974 53.1964 34.5974C53.5208 34.5974 53.782 34.7042 53.9798 34.9179C54.1855 35.1315 54.2884 35.3927 54.2884 35.7013C54.2884 36.0178 54.1855 36.2829 53.9798 36.4966C53.782 36.7023 53.5208 36.8052 53.1964 36.8052Z' fill='white'/%3E%3Cpath d='M57.6522 43.4522C57.2961 43.4522 56.944 43.4047 56.5958 43.3098C56.2555 43.2148 55.935 43.0882 55.6343 42.9299C55.3415 42.7638 55.0923 42.5738 54.8865 42.3602L56.0142 41.2088C56.2041 41.4067 56.4296 41.561 56.6907 41.6717C56.9598 41.7825 57.2446 41.8379 57.5453 41.8379C57.7194 41.8379 57.85 41.8142 57.937 41.7667C58.032 41.7192 58.0795 41.652 58.0795 41.5649C58.0795 41.4383 58.0122 41.3433 57.8777 41.28C57.7511 41.2088 57.581 41.1495 57.3673 41.102C57.1616 41.0466 56.9439 40.9833 56.7145 40.9121C56.485 40.8329 56.2634 40.7301 56.0498 40.6035C55.8361 40.4769 55.662 40.2988 55.5275 40.0693C55.4009 39.8399 55.3376 39.5471 55.3376 39.191C55.3376 38.8191 55.4365 38.4946 55.6343 38.2177C55.8401 37.9328 56.1249 37.7112 56.4889 37.553C56.8529 37.3868 57.2803 37.3037 57.7709 37.3037C58.2694 37.3037 58.7442 37.3907 59.1952 37.5648C59.6463 37.731 60.0103 37.9842 60.2872 38.3245L59.1478 39.4758C58.9578 39.2622 58.7481 39.1158 58.5187 39.0367C58.2892 38.9496 58.0795 38.9061 57.8896 38.9061C57.7076 38.9061 57.577 38.9338 57.4979 38.9892C57.4187 39.0367 57.3792 39.1039 57.3792 39.191C57.3792 39.2938 57.4425 39.3769 57.5691 39.4402C57.7036 39.5035 57.8737 39.5629 58.0795 39.6183C58.2931 39.6658 58.5107 39.7291 58.7323 39.8082C58.9618 39.8873 59.1794 39.9981 59.3851 40.1406C59.5988 40.2751 59.7689 40.4571 59.8955 40.6866C60.0301 40.916 60.0973 41.2128 60.0973 41.5768C60.0973 42.1544 59.8758 42.6134 59.4326 42.9537C58.9895 43.286 58.396 43.4522 57.6522 43.4522Z' fill='white'/%3E%3Cpath d='M61.8268 43.286V35.0841H63.8921V43.286H61.8268ZM60.5449 39.2028V37.4817H65.174V39.2028H60.5449Z' fill='white'/%3E%3Cpath d='M47.7919 52.0511C47.7919 52.0511 44.2559 55.8169 39.894 55.8169C35.5321 55.8169 31.9961 52.0511 31.9961 52.0511C31.9961 52.0511 35.5321 48.2854 39.8938 48.2854C44.2556 48.2854 47.7919 52.0511 47.7919 52.0511Z' fill='%2300FFA3'/%3E%3Cpath d='M38.8667 54.9634L36.1367 52.2334L37.0466 51.3234L38.8667 53.1435L42.6369 49.3734L43.5468 50.2833L38.8667 54.9634Z' fill='black'/%3E%3C/g%3E%3Cdefs%3E%3ClinearGradient id='paint0_linear_7084_12942' x1='-5.83666e-07' y1='33.1271' x2='80.0095' y2='32.9475' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%2300FFA3'/%3E%3Cstop offset='1' stop-color='%23F2FFC1'/%3E%3C/linearGradient%3E%3C/defs%3E%3C/svg%3E";
|
|
592
|
-
function AssetImage({
|
|
593
|
-
src,
|
|
594
|
-
chain,
|
|
595
|
-
alt = "",
|
|
596
|
-
size = 60,
|
|
597
|
-
className = "",
|
|
598
|
-
useWhitelistDefault = false
|
|
599
|
-
}) {
|
|
600
|
-
const { chainMap } = useChainMap();
|
|
601
|
-
const chainInfo = chain ? chainMap[chain.toLowerCase()] : void 0;
|
|
602
|
-
const imageSrc = src || (useWhitelistDefault ? DEFAULT_WHITELIST_IMAGE : "");
|
|
603
|
-
return /* @__PURE__ */ jsxs(
|
|
604
|
-
"div",
|
|
605
|
-
{
|
|
606
|
-
className: `taskon-asset-image ${className}`,
|
|
607
|
-
style: { width: size, height: size },
|
|
608
|
-
children: [
|
|
609
|
-
imageSrc ? /* @__PURE__ */ jsx(
|
|
610
|
-
"img",
|
|
611
|
-
{
|
|
612
|
-
src: imageSrc,
|
|
613
|
-
alt,
|
|
614
|
-
className: "taskon-asset-image__main"
|
|
615
|
-
}
|
|
616
|
-
) : /* @__PURE__ */ jsx("div", { className: "taskon-asset-image__placeholder" }),
|
|
617
|
-
(chainInfo == null ? void 0 : chainInfo.icon) && /* @__PURE__ */ jsx(
|
|
618
|
-
"img",
|
|
619
|
-
{
|
|
620
|
-
src: chainInfo.icon,
|
|
621
|
-
alt: chainInfo.label || chain,
|
|
622
|
-
className: "taskon-asset-image__chain"
|
|
623
|
-
}
|
|
624
|
-
)
|
|
625
|
-
]
|
|
626
|
-
}
|
|
627
|
-
);
|
|
628
|
-
}
|
|
629
|
-
function NftTable({
|
|
630
|
-
data,
|
|
631
|
-
loading,
|
|
632
|
-
error,
|
|
633
|
-
pagination,
|
|
634
|
-
messages,
|
|
635
|
-
onClaim,
|
|
636
|
-
onTxClick
|
|
637
|
-
}) {
|
|
638
|
-
if (loading && data.length === 0) {
|
|
639
|
-
return /* @__PURE__ */ jsx(LoadingState, { message: messages.loading });
|
|
640
|
-
}
|
|
641
|
-
if (error && data.length === 0) {
|
|
642
|
-
return /* @__PURE__ */ jsx("div", { className: "taskon-user-center-error", children: /* @__PURE__ */ jsx("p", { className: "taskon-user-center-error__message", children: error.message }) });
|
|
643
|
-
}
|
|
644
|
-
if (!loading && data.length === 0) {
|
|
645
|
-
return /* @__PURE__ */ jsx(EmptyState, { message: messages.emptyNft });
|
|
646
|
-
}
|
|
647
|
-
const renderStatus = (item) => {
|
|
648
|
-
const nftValue = item.reward_value;
|
|
649
|
-
if (nftValue.tx_hash) {
|
|
650
|
-
return /* @__PURE__ */ jsx(
|
|
651
|
-
"button",
|
|
652
|
-
{
|
|
653
|
-
type: "button",
|
|
654
|
-
className: "taskon-reward-table__link",
|
|
655
|
-
onClick: (e) => {
|
|
656
|
-
e.stopPropagation();
|
|
657
|
-
onTxClick == null ? void 0 : onTxClick(item);
|
|
658
|
-
},
|
|
659
|
-
title: nftValue.tx_hash,
|
|
660
|
-
children: messages.claimedTxn
|
|
661
|
-
}
|
|
662
|
-
);
|
|
663
|
-
}
|
|
664
|
-
if (nftValue.claimable) {
|
|
665
|
-
return /* @__PURE__ */ jsx(
|
|
666
|
-
"button",
|
|
667
|
-
{
|
|
668
|
-
type: "button",
|
|
669
|
-
className: "taskon-reward-table__claim-btn",
|
|
670
|
-
onClick: (e) => {
|
|
671
|
-
e.stopPropagation();
|
|
672
|
-
onClaim == null ? void 0 : onClaim(item);
|
|
673
|
-
},
|
|
674
|
-
children: messages.claim
|
|
675
|
-
}
|
|
676
|
-
);
|
|
677
|
-
}
|
|
678
|
-
return /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__manual-drop", children: messages.manualDrop });
|
|
679
|
-
};
|
|
680
|
-
const columns = [
|
|
681
|
-
{
|
|
682
|
-
key: "nft",
|
|
683
|
-
title: messages.columnNft,
|
|
684
|
-
width: 100,
|
|
685
|
-
render: (_, row) => {
|
|
686
|
-
const nftValue = row.reward_value;
|
|
687
|
-
return /* @__PURE__ */ jsx(
|
|
688
|
-
AssetImage,
|
|
689
|
-
{
|
|
690
|
-
src: nftValue.collection_image,
|
|
691
|
-
chain: nftValue.chain,
|
|
692
|
-
alt: nftValue.collection_name,
|
|
693
|
-
size: 60
|
|
694
|
-
}
|
|
695
|
-
);
|
|
696
|
-
}
|
|
697
|
-
},
|
|
698
|
-
{
|
|
699
|
-
key: "detail",
|
|
700
|
-
title: messages.columnDetail,
|
|
701
|
-
render: (_, row) => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__campaign-name", children: row.campaign_name })
|
|
702
|
-
},
|
|
703
|
-
{
|
|
704
|
-
key: "time",
|
|
705
|
-
title: messages.columnTime,
|
|
706
|
-
width: 160,
|
|
707
|
-
render: (_, row) => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__time", children: formatDateTime(row.reward_time) })
|
|
708
|
-
},
|
|
709
|
-
{
|
|
710
|
-
key: "status",
|
|
711
|
-
title: messages.columnStatus,
|
|
712
|
-
width: 120,
|
|
713
|
-
align: "right",
|
|
714
|
-
render: (_, row) => renderStatus(row)
|
|
715
|
-
}
|
|
716
|
-
];
|
|
717
|
-
return /* @__PURE__ */ jsxs("div", { className: "taskon-reward-table", children: [
|
|
718
|
-
/* @__PURE__ */ jsx(
|
|
719
|
-
Table,
|
|
720
|
-
{
|
|
721
|
-
columns,
|
|
722
|
-
data,
|
|
723
|
-
rowConfig: {
|
|
724
|
-
getRowKey: (row, index) => `${row.campaign_id}-${row.reward_time}-${index}`
|
|
725
|
-
},
|
|
726
|
-
loading: loading && data.length > 0,
|
|
727
|
-
loadingText: messages.loading,
|
|
728
|
-
empty: {
|
|
729
|
-
title: messages.emptyNft
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
),
|
|
733
|
-
pagination.totalPages > 1 && /* @__PURE__ */ jsx(
|
|
734
|
-
Pagination,
|
|
735
|
-
{
|
|
736
|
-
page: pagination.page,
|
|
737
|
-
totalPages: pagination.totalPages,
|
|
738
|
-
onPrevious: pagination.goToPrevious,
|
|
739
|
-
onNext: pagination.goToNext,
|
|
740
|
-
hasPrevious: pagination.hasPrevious,
|
|
741
|
-
hasNext: pagination.hasNext,
|
|
742
|
-
messages
|
|
743
|
-
}
|
|
744
|
-
)
|
|
745
|
-
] });
|
|
746
|
-
}
|
|
747
588
|
function WhitelistTable({
|
|
748
589
|
data,
|
|
749
590
|
loading,
|
|
@@ -1063,276 +904,85 @@ function useUserRewards(options = {}) {
|
|
|
1063
904
|
refresh
|
|
1064
905
|
};
|
|
1065
906
|
}
|
|
1066
|
-
function
|
|
1067
|
-
const {
|
|
1068
|
-
userAddress,
|
|
1069
|
-
onSuccess,
|
|
1070
|
-
onCancel,
|
|
1071
|
-
onError,
|
|
1072
|
-
onConnect,
|
|
1073
|
-
pollingInterval = 3e3,
|
|
1074
|
-
maxPollingAttempts = 100
|
|
1075
|
-
} = options;
|
|
907
|
+
function useFrozenAssets(options) {
|
|
908
|
+
const { tokenId, pageSize = USER_CENTER_PAGE_SIZE, autoLoad = true } = options;
|
|
1076
909
|
const { client } = useTaskOnContext();
|
|
1077
|
-
const
|
|
1078
|
-
const
|
|
1079
|
-
const [
|
|
1080
|
-
const [tokens, setTokens] = useState([]);
|
|
910
|
+
const [data, setData] = useState([]);
|
|
911
|
+
const [total, setTotal] = useState(0);
|
|
912
|
+
const [loading, setLoading] = useState(false);
|
|
1081
913
|
const [error, setError] = useState(null);
|
|
1082
|
-
const [errorType, setErrorType] = useState(null);
|
|
1083
|
-
const [txHash, setTxHash] = useState(null);
|
|
1084
|
-
const [gasFreeRemaining, setGasFreeRemaining] = useState(null);
|
|
1085
|
-
const [gasFreeFetching, setGasFreeFetching] = useState(false);
|
|
1086
|
-
const [connectedAddress, setConnectedAddress] = useState(null);
|
|
1087
|
-
const pollingTimerRef = useRef(null);
|
|
1088
|
-
const pollingAttemptsRef = useRef(0);
|
|
1089
914
|
const api = useMemo(() => {
|
|
1090
915
|
if (!client) return null;
|
|
1091
916
|
return createUserCenterApi(client);
|
|
1092
917
|
}, [client]);
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
setGasFreeFetching(true);
|
|
1105
|
-
try {
|
|
1106
|
-
const times = await api.getTokenWithdrawGasFreeTimes({ chain });
|
|
1107
|
-
setGasFreeRemaining(times);
|
|
1108
|
-
} catch (err) {
|
|
1109
|
-
console.error("Failed to get gas free times:", err);
|
|
1110
|
-
} finally {
|
|
1111
|
-
setGasFreeFetching(false);
|
|
1112
|
-
}
|
|
1113
|
-
},
|
|
1114
|
-
[api]
|
|
1115
|
-
);
|
|
1116
|
-
const pollGasStationResult = useCallback(
|
|
1117
|
-
async (requestId) => {
|
|
1118
|
-
if (!api) return;
|
|
1119
|
-
pollingAttemptsRef.current += 1;
|
|
1120
|
-
try {
|
|
1121
|
-
const result = await api.getGasStationAirdropResult({
|
|
1122
|
-
gas_station_request_id: requestId
|
|
1123
|
-
});
|
|
1124
|
-
switch (result.gas_station_request_status) {
|
|
1125
|
-
case GasStationRequestStatus.Success:
|
|
1126
|
-
setTxHash(result.tx_hash);
|
|
1127
|
-
setStatus("success");
|
|
1128
|
-
onSuccess == null ? void 0 : onSuccess(result.tx_hash);
|
|
1129
|
-
break;
|
|
1130
|
-
case GasStationRequestStatus.Failed:
|
|
1131
|
-
const failError = new Error("Gas Station withdrawal failed");
|
|
1132
|
-
setError(failError);
|
|
1133
|
-
setErrorType(TxErrorType.TransactionFailed);
|
|
1134
|
-
setStatus("init");
|
|
1135
|
-
onError == null ? void 0 : onError(failError);
|
|
1136
|
-
break;
|
|
1137
|
-
case GasStationRequestStatus.Pending:
|
|
1138
|
-
case GasStationRequestStatus.Processing:
|
|
1139
|
-
if (pollingAttemptsRef.current >= maxPollingAttempts) {
|
|
1140
|
-
const timeoutError = new Error(
|
|
1141
|
-
"Withdrawal timeout, please check later"
|
|
1142
|
-
);
|
|
1143
|
-
setError(timeoutError);
|
|
1144
|
-
setErrorType(TxErrorType.TransactionFailed);
|
|
1145
|
-
setStatus("init");
|
|
1146
|
-
onError == null ? void 0 : onError(timeoutError);
|
|
1147
|
-
} else {
|
|
1148
|
-
pollingTimerRef.current = setTimeout(() => {
|
|
1149
|
-
pollGasStationResult(requestId);
|
|
1150
|
-
}, pollingInterval);
|
|
1151
|
-
}
|
|
1152
|
-
break;
|
|
1153
|
-
}
|
|
1154
|
-
} catch (err) {
|
|
1155
|
-
const pollError = err instanceof Error ? err : new Error("Failed to check status");
|
|
1156
|
-
setError(pollError);
|
|
1157
|
-
setErrorType(TxErrorType.TransactionFailed);
|
|
1158
|
-
setStatus("init");
|
|
1159
|
-
onError == null ? void 0 : onError(pollError);
|
|
1160
|
-
}
|
|
1161
|
-
},
|
|
1162
|
-
[api, maxPollingAttempts, pollingInterval, onSuccess, onError]
|
|
1163
|
-
);
|
|
1164
|
-
const initWithdraw = useCallback(
|
|
1165
|
-
(token) => {
|
|
1166
|
-
if (!token.can_withdraw) {
|
|
1167
|
-
setError(new Error("This token cannot be withdrawn"));
|
|
918
|
+
const pagination = usePagination({
|
|
919
|
+
total,
|
|
920
|
+
pageSize,
|
|
921
|
+
initialPage: 0,
|
|
922
|
+
mode: "pagination"
|
|
923
|
+
});
|
|
924
|
+
const skipNextPageEffectRef = useRef(false);
|
|
925
|
+
const fetchData = useCallback(
|
|
926
|
+
async (pageNo) => {
|
|
927
|
+
if (!api) {
|
|
928
|
+
setError(new Error("TaskOn client not initialized"));
|
|
1168
929
|
return;
|
|
1169
930
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
setErrorType(null);
|
|
1173
|
-
setTxHash(null);
|
|
1174
|
-
setConnectedAddress(null);
|
|
1175
|
-
setStatus("init");
|
|
1176
|
-
refreshGasFreeTimes(token.chain);
|
|
1177
|
-
},
|
|
1178
|
-
[refreshGasFreeTimes]
|
|
1179
|
-
);
|
|
1180
|
-
const initBatchWithdraw = useCallback(
|
|
1181
|
-
(tokenList) => {
|
|
1182
|
-
const withdrawableTokens = tokenList.filter((t) => t.can_withdraw);
|
|
1183
|
-
if (withdrawableTokens.length === 0) {
|
|
1184
|
-
setError(new Error("No tokens available for withdrawal"));
|
|
931
|
+
if (!tokenId) {
|
|
932
|
+
setError(new Error("Token ID is required"));
|
|
1185
933
|
return;
|
|
1186
934
|
}
|
|
1187
|
-
|
|
935
|
+
setLoading(true);
|
|
1188
936
|
setError(null);
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
937
|
+
try {
|
|
938
|
+
const response = await api.getLockedTokenList({
|
|
939
|
+
token_id: tokenId,
|
|
940
|
+
page: {
|
|
941
|
+
page_no: pageNo,
|
|
942
|
+
// API 使用 0-based 索引
|
|
943
|
+
size: pageSize
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
setData(response.data);
|
|
947
|
+
setTotal(response.total);
|
|
948
|
+
} catch (err) {
|
|
949
|
+
setError(
|
|
950
|
+
err instanceof Error ? err : new Error("Failed to fetch frozen assets")
|
|
951
|
+
);
|
|
952
|
+
} finally {
|
|
953
|
+
setLoading(false);
|
|
1196
954
|
}
|
|
1197
955
|
},
|
|
1198
|
-
[
|
|
956
|
+
[api, tokenId, pageSize]
|
|
1199
957
|
);
|
|
1200
|
-
const
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
if (!address) {
|
|
1204
|
-
address = await connectEvm();
|
|
1205
|
-
if (!address) {
|
|
1206
|
-
throw new TransactionError(
|
|
1207
|
-
TxErrorType.ConnectFailed,
|
|
1208
|
-
"Failed to connect wallet"
|
|
1209
|
-
);
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
setConnectedAddress(address);
|
|
1213
|
-
onConnect == null ? void 0 : onConnect(address);
|
|
1214
|
-
if (userAddress && !isSameAddress(address, userAddress)) {
|
|
1215
|
-
throw new TransactionError(
|
|
1216
|
-
TxErrorType.AccountMismatch,
|
|
1217
|
-
`Connected address ${address} does not match target address ${userAddress}`
|
|
1218
|
-
);
|
|
1219
|
-
}
|
|
1220
|
-
if (gasFreeRemaining !== null && gasFreeRemaining <= 0) {
|
|
1221
|
-
setError(new Error("No free withdrawal remaining"));
|
|
1222
|
-
return false;
|
|
1223
|
-
}
|
|
1224
|
-
setStatus("confirm");
|
|
1225
|
-
return true;
|
|
1226
|
-
} catch (err) {
|
|
1227
|
-
const errType = parseTxError(err);
|
|
1228
|
-
setError(err instanceof Error ? err : new Error("Connection failed"));
|
|
1229
|
-
setErrorType(errType);
|
|
1230
|
-
if (errType === TxErrorType.Canceled) {
|
|
1231
|
-
setStatus("cancel");
|
|
1232
|
-
} else {
|
|
1233
|
-
setStatus("init");
|
|
1234
|
-
}
|
|
1235
|
-
onError == null ? void 0 : onError(err instanceof Error ? err : new Error("Connection failed"));
|
|
1236
|
-
return false;
|
|
1237
|
-
}
|
|
1238
|
-
}, [evmAddress, connectEvm, userAddress, gasFreeRemaining, onConnect, onError]);
|
|
1239
|
-
const confirmWithdraw = useCallback(async () => {
|
|
1240
|
-
if (!api) {
|
|
1241
|
-
setError(new Error("TaskOn client not initialized"));
|
|
1242
|
-
return;
|
|
1243
|
-
}
|
|
1244
|
-
if (!connectedAddress) {
|
|
1245
|
-
setError(new Error("Wallet not connected"));
|
|
1246
|
-
return;
|
|
958
|
+
const refresh = useCallback(async () => {
|
|
959
|
+
if (autoLoad && pagination.page !== 0) {
|
|
960
|
+
skipNextPageEffectRef.current = true;
|
|
1247
961
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
962
|
+
pagination.goToPage(0);
|
|
963
|
+
await fetchData(0);
|
|
964
|
+
}, [autoLoad, fetchData, pagination]);
|
|
965
|
+
const canResend = useCallback((item) => {
|
|
966
|
+
return item.type === "Withdraw" && Boolean(item.nonce) && Boolean(item.receiver_address);
|
|
967
|
+
}, []);
|
|
968
|
+
useEffect(() => {
|
|
969
|
+
if (!autoLoad || !tokenId) {
|
|
1250
970
|
return;
|
|
1251
971
|
}
|
|
1252
|
-
if (
|
|
1253
|
-
|
|
972
|
+
if (skipNextPageEffectRef.current) {
|
|
973
|
+
skipNextPageEffectRef.current = false;
|
|
1254
974
|
return;
|
|
1255
975
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
setErrorType(null);
|
|
1259
|
-
try {
|
|
1260
|
-
const firstToken = tokens[0];
|
|
1261
|
-
if (!firstToken) {
|
|
1262
|
-
throw new Error("No tokens provided");
|
|
1263
|
-
}
|
|
1264
|
-
const chainName = firstToken.chain;
|
|
1265
|
-
const tokenParams = tokens.map((t) => ({
|
|
1266
|
-
token_id: t.tokenId,
|
|
1267
|
-
amount: t.amount
|
|
1268
|
-
}));
|
|
1269
|
-
const requestId = await api.tokenWithdrawFromGasStation({
|
|
1270
|
-
chain: chainName,
|
|
1271
|
-
receiver_address: connectedAddress,
|
|
1272
|
-
tokens: tokenParams
|
|
1273
|
-
});
|
|
1274
|
-
setStatus("polling");
|
|
1275
|
-
pollingAttemptsRef.current = 0;
|
|
1276
|
-
pollGasStationResult(requestId);
|
|
1277
|
-
} catch (err) {
|
|
1278
|
-
const errType = parseTxError(err);
|
|
1279
|
-
const error2 = err instanceof Error ? err : new Error("Withdrawal failed");
|
|
1280
|
-
setError(error2);
|
|
1281
|
-
setErrorType(errType);
|
|
1282
|
-
if (errType === TxErrorType.Canceled) {
|
|
1283
|
-
setStatus("cancel");
|
|
1284
|
-
onCancel == null ? void 0 : onCancel();
|
|
1285
|
-
} else {
|
|
1286
|
-
setStatus("init");
|
|
1287
|
-
onError == null ? void 0 : onError(error2);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
}, [api, connectedAddress, tokens, gasFreeRemaining, pollGasStationResult, onCancel, onError]);
|
|
1291
|
-
const cancelWithdraw = useCallback(() => {
|
|
1292
|
-
if (pollingTimerRef.current) {
|
|
1293
|
-
clearTimeout(pollingTimerRef.current);
|
|
1294
|
-
pollingTimerRef.current = null;
|
|
1295
|
-
}
|
|
1296
|
-
setStatus("cancel");
|
|
1297
|
-
onCancel == null ? void 0 : onCancel();
|
|
1298
|
-
setTimeout(() => {
|
|
1299
|
-
setStatus("init");
|
|
1300
|
-
setTokens([]);
|
|
1301
|
-
setError(null);
|
|
1302
|
-
setErrorType(null);
|
|
1303
|
-
setConnectedAddress(null);
|
|
1304
|
-
}, 100);
|
|
1305
|
-
}, [onCancel]);
|
|
1306
|
-
const reset = useCallback(() => {
|
|
1307
|
-
if (pollingTimerRef.current) {
|
|
1308
|
-
clearTimeout(pollingTimerRef.current);
|
|
1309
|
-
pollingTimerRef.current = null;
|
|
1310
|
-
}
|
|
1311
|
-
setStatus("init");
|
|
1312
|
-
setTokens([]);
|
|
1313
|
-
setError(null);
|
|
1314
|
-
setErrorType(null);
|
|
1315
|
-
setTxHash(null);
|
|
1316
|
-
setConnectedAddress(null);
|
|
1317
|
-
pollingAttemptsRef.current = 0;
|
|
1318
|
-
}, []);
|
|
976
|
+
fetchData(pagination.page);
|
|
977
|
+
}, [autoLoad, tokenId, pagination.page, fetchData]);
|
|
1319
978
|
return {
|
|
1320
|
-
|
|
1321
|
-
|
|
979
|
+
data,
|
|
980
|
+
loading,
|
|
1322
981
|
error,
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
gasFreeFetching,
|
|
1328
|
-
connectedAddress,
|
|
1329
|
-
initWithdraw,
|
|
1330
|
-
initBatchWithdraw,
|
|
1331
|
-
checkAndConnect,
|
|
1332
|
-
confirmWithdraw,
|
|
1333
|
-
cancelWithdraw,
|
|
1334
|
-
reset,
|
|
1335
|
-
refreshGasFreeTimes
|
|
982
|
+
total,
|
|
983
|
+
pagination,
|
|
984
|
+
refresh,
|
|
985
|
+
canResend
|
|
1336
986
|
};
|
|
1337
987
|
}
|
|
1338
988
|
const SNS_TYPE_MAP = {
|
|
@@ -1442,7 +1092,7 @@ function useIdentityData() {
|
|
|
1442
1092
|
}
|
|
1443
1093
|
function useUnbindSocial(options = {}) {
|
|
1444
1094
|
const { onUnbindSuccess, onUnbindError } = options;
|
|
1445
|
-
const { client } = useTaskOnContext();
|
|
1095
|
+
const { client, refreshUserInfo } = useTaskOnContext();
|
|
1446
1096
|
const [unbindStatus, setUnbindStatus] = useState("idle");
|
|
1447
1097
|
const [error, setError] = useState(null);
|
|
1448
1098
|
const [processingType, setProcessingType] = useState(null);
|
|
@@ -1467,6 +1117,7 @@ function useUnbindSocial(options = {}) {
|
|
|
1467
1117
|
sns_type: type
|
|
1468
1118
|
});
|
|
1469
1119
|
if (result) {
|
|
1120
|
+
await refreshUserInfo();
|
|
1470
1121
|
setUnbindStatus("success");
|
|
1471
1122
|
onUnbindSuccess == null ? void 0 : onUnbindSuccess();
|
|
1472
1123
|
return true;
|
|
@@ -1487,7 +1138,7 @@ function useUnbindSocial(options = {}) {
|
|
|
1487
1138
|
setProcessingType(null);
|
|
1488
1139
|
}
|
|
1489
1140
|
},
|
|
1490
|
-
[api, onUnbindSuccess, onUnbindError]
|
|
1141
|
+
[api, refreshUserInfo, onUnbindSuccess, onUnbindError]
|
|
1491
1142
|
);
|
|
1492
1143
|
const reset = useCallback(() => {
|
|
1493
1144
|
setUnbindStatus("idle");
|
|
@@ -1508,7 +1159,7 @@ const SNS_BIND_DUPLICATE_ERROR = 10016;
|
|
|
1508
1159
|
const INVALID_EMAIL_VERIFY_CODE = 10017;
|
|
1509
1160
|
function useBindEmail(options = {}) {
|
|
1510
1161
|
const { onSendCodeSuccess, onSendCodeError, onBindSuccess, onBindError } = options;
|
|
1511
|
-
const { client } = useTaskOnContext();
|
|
1162
|
+
const { client, refreshUserInfo } = useTaskOnContext();
|
|
1512
1163
|
const [status, setStatus] = useState("idle");
|
|
1513
1164
|
const [countdown, setCountdown] = useState(0);
|
|
1514
1165
|
const [error, setError] = useState(null);
|
|
@@ -1634,6 +1285,7 @@ function useBindEmail(options = {}) {
|
|
|
1634
1285
|
sns_user_name: emailAddress
|
|
1635
1286
|
});
|
|
1636
1287
|
if (result.result) {
|
|
1288
|
+
await refreshUserInfo();
|
|
1637
1289
|
setStatus("success");
|
|
1638
1290
|
onBindSuccess == null ? void 0 : onBindSuccess(result);
|
|
1639
1291
|
return result;
|
|
@@ -1655,7 +1307,7 @@ function useBindEmail(options = {}) {
|
|
|
1655
1307
|
return null;
|
|
1656
1308
|
}
|
|
1657
1309
|
},
|
|
1658
|
-
[api, onBindSuccess, onBindError]
|
|
1310
|
+
[api, refreshUserInfo, onBindSuccess, onBindError]
|
|
1659
1311
|
);
|
|
1660
1312
|
const reset = useCallback(() => {
|
|
1661
1313
|
setStatus("idle");
|
|
@@ -1696,7 +1348,7 @@ function useBindWallet(options = {}) {
|
|
|
1696
1348
|
onUnbindSuccess,
|
|
1697
1349
|
onUnbindError
|
|
1698
1350
|
} = options;
|
|
1699
|
-
const { client } = useTaskOnContext();
|
|
1351
|
+
const { client, refreshUserInfo } = useTaskOnContext();
|
|
1700
1352
|
const {
|
|
1701
1353
|
connectEvm,
|
|
1702
1354
|
signEvmMessage,
|
|
@@ -1750,6 +1402,7 @@ function useBindWallet(options = {}) {
|
|
|
1750
1402
|
sig: signature
|
|
1751
1403
|
});
|
|
1752
1404
|
if (result) {
|
|
1405
|
+
await refreshUserInfo();
|
|
1753
1406
|
setBindStatus("success");
|
|
1754
1407
|
onBindSuccess == null ? void 0 : onBindSuccess();
|
|
1755
1408
|
return true;
|
|
@@ -1766,7 +1419,16 @@ function useBindWallet(options = {}) {
|
|
|
1766
1419
|
setProcessingChain(null);
|
|
1767
1420
|
}
|
|
1768
1421
|
},
|
|
1769
|
-
[
|
|
1422
|
+
[
|
|
1423
|
+
api,
|
|
1424
|
+
refreshUserInfo,
|
|
1425
|
+
connectEvm,
|
|
1426
|
+
signEvmMessage,
|
|
1427
|
+
connectedAddress,
|
|
1428
|
+
isConnected,
|
|
1429
|
+
onBindSuccess,
|
|
1430
|
+
onBindError
|
|
1431
|
+
]
|
|
1770
1432
|
);
|
|
1771
1433
|
const unbind = useCallback(
|
|
1772
1434
|
async (chainType, address) => {
|
|
@@ -1809,6 +1471,7 @@ function useBindWallet(options = {}) {
|
|
|
1809
1471
|
sig: signature
|
|
1810
1472
|
});
|
|
1811
1473
|
if (result) {
|
|
1474
|
+
await refreshUserInfo();
|
|
1812
1475
|
setUnbindStatus("success");
|
|
1813
1476
|
onUnbindSuccess == null ? void 0 : onUnbindSuccess();
|
|
1814
1477
|
return true;
|
|
@@ -1825,7 +1488,16 @@ function useBindWallet(options = {}) {
|
|
|
1825
1488
|
setProcessingChain(null);
|
|
1826
1489
|
}
|
|
1827
1490
|
},
|
|
1828
|
-
[
|
|
1491
|
+
[
|
|
1492
|
+
api,
|
|
1493
|
+
refreshUserInfo,
|
|
1494
|
+
connectEvm,
|
|
1495
|
+
signEvmMessage,
|
|
1496
|
+
connectedAddress,
|
|
1497
|
+
isConnected,
|
|
1498
|
+
onUnbindSuccess,
|
|
1499
|
+
onUnbindError
|
|
1500
|
+
]
|
|
1829
1501
|
);
|
|
1830
1502
|
const reset = useCallback(() => {
|
|
1831
1503
|
setBindStatus("idle");
|
|
@@ -2012,285 +1684,6 @@ function useDisableUnlink() {
|
|
|
2012
1684
|
isLastLoginMethod
|
|
2013
1685
|
};
|
|
2014
1686
|
}
|
|
2015
|
-
function getRewardId(item) {
|
|
2016
|
-
const rewardValue = item.reward_value;
|
|
2017
|
-
if (typeof rewardValue.reward_id === "number") {
|
|
2018
|
-
return rewardValue.reward_id;
|
|
2019
|
-
}
|
|
2020
|
-
if (typeof rewardValue.collection_id === "number") {
|
|
2021
|
-
return rewardValue.collection_id;
|
|
2022
|
-
}
|
|
2023
|
-
return void 0;
|
|
2024
|
-
}
|
|
2025
|
-
function checkNftClaimable(item) {
|
|
2026
|
-
if (item.reward_type !== RewardType.Nft && item.reward_type !== RewardType.Cap && item.reward_type !== RewardType.BMintedNft) {
|
|
2027
|
-
return {
|
|
2028
|
-
canClaim: false,
|
|
2029
|
-
error: new NftClaimError(
|
|
2030
|
-
NftClaimErrorType.NotClaimable,
|
|
2031
|
-
`Invalid reward type: ${item.reward_type}`
|
|
2032
|
-
)
|
|
2033
|
-
};
|
|
2034
|
-
}
|
|
2035
|
-
const rewardValue = item.reward_value;
|
|
2036
|
-
if (isNftClaimed(rewardValue)) {
|
|
2037
|
-
return {
|
|
2038
|
-
canClaim: false,
|
|
2039
|
-
error: new NftClaimError(
|
|
2040
|
-
NftClaimErrorType.AlreadyClaimed,
|
|
2041
|
-
"NFT has already been claimed"
|
|
2042
|
-
)
|
|
2043
|
-
};
|
|
2044
|
-
}
|
|
2045
|
-
if (!isNftClaimable(rewardValue)) {
|
|
2046
|
-
return {
|
|
2047
|
-
canClaim: false,
|
|
2048
|
-
error: new NftClaimError(
|
|
2049
|
-
NftClaimErrorType.NotClaimable,
|
|
2050
|
-
"NFT is not claimable (manual drop)"
|
|
2051
|
-
)
|
|
2052
|
-
};
|
|
2053
|
-
}
|
|
2054
|
-
const rewardId = getRewardId(item);
|
|
2055
|
-
if (rewardId === void 0) {
|
|
2056
|
-
return {
|
|
2057
|
-
canClaim: false,
|
|
2058
|
-
error: new NftClaimError(
|
|
2059
|
-
NftClaimErrorType.MissingRewardId,
|
|
2060
|
-
"Missing reward_id in reward data"
|
|
2061
|
-
)
|
|
2062
|
-
};
|
|
2063
|
-
}
|
|
2064
|
-
return { canClaim: true };
|
|
2065
|
-
}
|
|
2066
|
-
function useNftClaim(options = {}) {
|
|
2067
|
-
const { onSuccess, onError, onPendingFound } = options;
|
|
2068
|
-
const { client, userId } = useTaskOnContext();
|
|
2069
|
-
const {
|
|
2070
|
-
evmAdapter,
|
|
2071
|
-
evmAddress,
|
|
2072
|
-
evmChainId,
|
|
2073
|
-
isEvmConnected,
|
|
2074
|
-
connectEvm
|
|
2075
|
-
} = useWallet();
|
|
2076
|
-
const { chainMap } = useChainMap();
|
|
2077
|
-
const [status, setStatus] = useState("idle");
|
|
2078
|
-
const [error, setError] = useState(null);
|
|
2079
|
-
const [txHash, setTxHash] = useState(null);
|
|
2080
|
-
const [claimingNft, setClaimingNft] = useState(null);
|
|
2081
|
-
const api = useMemo(() => {
|
|
2082
|
-
if (!client) return null;
|
|
2083
|
-
return createNftClaimApi(client);
|
|
2084
|
-
}, [client]);
|
|
2085
|
-
const claimNft = useCallback(
|
|
2086
|
-
async (item) => {
|
|
2087
|
-
if (!api) {
|
|
2088
|
-
const err = new NftClaimError(
|
|
2089
|
-
NftClaimErrorType.ApiError,
|
|
2090
|
-
"TaskOn client not initialized"
|
|
2091
|
-
);
|
|
2092
|
-
setError(err);
|
|
2093
|
-
onError == null ? void 0 : onError(err, item);
|
|
2094
|
-
return;
|
|
2095
|
-
}
|
|
2096
|
-
if (!userId) {
|
|
2097
|
-
const err = new NftClaimError(
|
|
2098
|
-
NftClaimErrorType.ApiError,
|
|
2099
|
-
"User not logged in"
|
|
2100
|
-
);
|
|
2101
|
-
setError(err);
|
|
2102
|
-
onError == null ? void 0 : onError(err, item);
|
|
2103
|
-
return;
|
|
2104
|
-
}
|
|
2105
|
-
const { canClaim, error: checkError } = checkNftClaimable(item);
|
|
2106
|
-
if (!canClaim && checkError) {
|
|
2107
|
-
setError(checkError);
|
|
2108
|
-
onError == null ? void 0 : onError(checkError, item);
|
|
2109
|
-
return;
|
|
2110
|
-
}
|
|
2111
|
-
const rewardValue = item.reward_value;
|
|
2112
|
-
const nftType = getNftClaimType(rewardValue);
|
|
2113
|
-
const chainName = getNftChainName(rewardValue);
|
|
2114
|
-
const rewardId = getRewardId(item);
|
|
2115
|
-
const pendingKey = generatePendingKey(nftType, item.campaign_id, rewardId);
|
|
2116
|
-
setClaimingNft({
|
|
2117
|
-
item,
|
|
2118
|
-
nftType,
|
|
2119
|
-
chainName,
|
|
2120
|
-
pendingKey
|
|
2121
|
-
});
|
|
2122
|
-
try {
|
|
2123
|
-
setStatus("checking");
|
|
2124
|
-
setError(null);
|
|
2125
|
-
setTxHash(null);
|
|
2126
|
-
const pending = getPendingHash(userId, pendingKey);
|
|
2127
|
-
if (pending) {
|
|
2128
|
-
onPendingFound == null ? void 0 : onPendingFound(pendingKey, pending.hash, pending.chainName);
|
|
2129
|
-
throw new NftClaimError(
|
|
2130
|
-
NftClaimErrorType.PendingTransaction,
|
|
2131
|
-
`Transaction ${pending.hash} is pending`
|
|
2132
|
-
);
|
|
2133
|
-
}
|
|
2134
|
-
const chainInfo = chainMap[chainName.toLowerCase()];
|
|
2135
|
-
if (!chainInfo) {
|
|
2136
|
-
throw new NftClaimError(
|
|
2137
|
-
NftClaimErrorType.ChainNotFound,
|
|
2138
|
-
`Chain ${chainName} not found`
|
|
2139
|
-
);
|
|
2140
|
-
}
|
|
2141
|
-
const useGasStation = shouldUseGasStation(rewardValue);
|
|
2142
|
-
if (useGasStation) {
|
|
2143
|
-
setStatus("signing");
|
|
2144
|
-
await api.claimCampaignRewardFromGasStation({
|
|
2145
|
-
campaign_id: item.campaign_id,
|
|
2146
|
-
reward_id: rewardId
|
|
2147
|
-
});
|
|
2148
|
-
setStatus("success");
|
|
2149
|
-
onSuccess == null ? void 0 : onSuccess("", item);
|
|
2150
|
-
return;
|
|
2151
|
-
}
|
|
2152
|
-
setStatus("connecting");
|
|
2153
|
-
if (!(evmAdapter == null ? void 0 : evmAdapter.invokeContract)) {
|
|
2154
|
-
throw new NftClaimError(
|
|
2155
|
-
NftClaimErrorType.NoWallet,
|
|
2156
|
-
"Wallet adapter does not support contract invocation. Please provide a wallet adapter with invokeContract method."
|
|
2157
|
-
);
|
|
2158
|
-
}
|
|
2159
|
-
let walletAddress = evmAddress;
|
|
2160
|
-
if (!isEvmConnected || !walletAddress) {
|
|
2161
|
-
const connectResult = await connectEvm();
|
|
2162
|
-
if (!connectResult) {
|
|
2163
|
-
throw new NftClaimError(
|
|
2164
|
-
NftClaimErrorType.WalletRejected,
|
|
2165
|
-
"Failed to connect wallet"
|
|
2166
|
-
);
|
|
2167
|
-
}
|
|
2168
|
-
walletAddress = connectResult;
|
|
2169
|
-
}
|
|
2170
|
-
const receiverAddress = rewardValue.receiver_address;
|
|
2171
|
-
if (receiverAddress && walletAddress.toLowerCase() !== receiverAddress.toLowerCase()) {
|
|
2172
|
-
throw new NftClaimError(
|
|
2173
|
-
NftClaimErrorType.AddressMismatch,
|
|
2174
|
-
`Connected address ${walletAddress} does not match receiver address ${receiverAddress}`
|
|
2175
|
-
);
|
|
2176
|
-
}
|
|
2177
|
-
if (evmChainId !== chainInfo.id) {
|
|
2178
|
-
setStatus("switching");
|
|
2179
|
-
if (evmAdapter.switchNetwork) {
|
|
2180
|
-
try {
|
|
2181
|
-
await evmAdapter.switchNetwork(chainInfo.id);
|
|
2182
|
-
} catch (e) {
|
|
2183
|
-
throw new NftClaimError(
|
|
2184
|
-
NftClaimErrorType.NetworkSwitchFailed,
|
|
2185
|
-
`Failed to switch to ${chainInfo.name}`,
|
|
2186
|
-
e instanceof Error ? e : void 0
|
|
2187
|
-
);
|
|
2188
|
-
}
|
|
2189
|
-
} else {
|
|
2190
|
-
throw new NftClaimError(
|
|
2191
|
-
NftClaimErrorType.NetworkSwitchFailed,
|
|
2192
|
-
`Please switch to ${chainInfo.name} network manually`
|
|
2193
|
-
);
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
setStatus("signing");
|
|
2197
|
-
let hash;
|
|
2198
|
-
if (nftType === NftClaimType.Minted) {
|
|
2199
|
-
const sigRes = await api.getBMintNFTCampaignNftSig({
|
|
2200
|
-
campaign_reward_id: rewardId
|
|
2201
|
-
});
|
|
2202
|
-
setStatus("confirming");
|
|
2203
|
-
hash = await evmAdapter.invokeContract({
|
|
2204
|
-
contract: sigRes.entry_address,
|
|
2205
|
-
abi: bMintedNftAbi,
|
|
2206
|
-
method: "claim",
|
|
2207
|
-
params: [
|
|
2208
|
-
sigRes.nft_address,
|
|
2209
|
-
{
|
|
2210
|
-
dropId: BigInt(sigRes.distribute_id),
|
|
2211
|
-
userId: BigInt(sigRes.user_id),
|
|
2212
|
-
limit: BigInt(sigRes.limit),
|
|
2213
|
-
totalLimit: BigInt(sigRes.total_limit),
|
|
2214
|
-
amount: BigInt(1),
|
|
2215
|
-
nonce: BigInt(sigRes.nonce),
|
|
2216
|
-
uri: sigRes.token_uri
|
|
2217
|
-
},
|
|
2218
|
-
[sigRes.signature]
|
|
2219
|
-
],
|
|
2220
|
-
chainId: chainInfo.id
|
|
2221
|
-
});
|
|
2222
|
-
} else {
|
|
2223
|
-
const sigRes = await api.claimCampaignRewardNft({
|
|
2224
|
-
chain: chainName,
|
|
2225
|
-
campaign_id: item.campaign_id,
|
|
2226
|
-
reward_id: rewardId
|
|
2227
|
-
});
|
|
2228
|
-
setStatus("confirming");
|
|
2229
|
-
hash = await evmAdapter.invokeContract({
|
|
2230
|
-
contract: sigRes.contract_address,
|
|
2231
|
-
abi: capNftAbi,
|
|
2232
|
-
method: "mint",
|
|
2233
|
-
params: [
|
|
2234
|
-
walletAddress,
|
|
2235
|
-
BigInt(sigRes.campaign_id),
|
|
2236
|
-
sigRes.token_uri,
|
|
2237
|
-
BigInt(sigRes.total),
|
|
2238
|
-
sigRes.hash,
|
|
2239
|
-
sigRes.signature
|
|
2240
|
-
],
|
|
2241
|
-
chainId: chainInfo.id
|
|
2242
|
-
});
|
|
2243
|
-
}
|
|
2244
|
-
setPendingHash(userId, pendingKey, hash, chainName);
|
|
2245
|
-
setStatus("pending");
|
|
2246
|
-
setTxHash(hash);
|
|
2247
|
-
setStatus("success");
|
|
2248
|
-
onSuccess == null ? void 0 : onSuccess(hash, item);
|
|
2249
|
-
} catch (e) {
|
|
2250
|
-
const claimError = NftClaimError.fromUnknown(e);
|
|
2251
|
-
setError(claimError);
|
|
2252
|
-
setStatus("error");
|
|
2253
|
-
onError == null ? void 0 : onError(claimError, item);
|
|
2254
|
-
}
|
|
2255
|
-
},
|
|
2256
|
-
[
|
|
2257
|
-
api,
|
|
2258
|
-
userId,
|
|
2259
|
-
chainMap,
|
|
2260
|
-
evmAdapter,
|
|
2261
|
-
evmAddress,
|
|
2262
|
-
evmChainId,
|
|
2263
|
-
isEvmConnected,
|
|
2264
|
-
connectEvm,
|
|
2265
|
-
onSuccess,
|
|
2266
|
-
onError,
|
|
2267
|
-
onPendingFound
|
|
2268
|
-
]
|
|
2269
|
-
);
|
|
2270
|
-
const reset = useCallback(() => {
|
|
2271
|
-
setStatus("idle");
|
|
2272
|
-
setError(null);
|
|
2273
|
-
setTxHash(null);
|
|
2274
|
-
setClaimingNft(null);
|
|
2275
|
-
}, []);
|
|
2276
|
-
const clearPending = useCallback(
|
|
2277
|
-
(pendingKey) => {
|
|
2278
|
-
if (userId) {
|
|
2279
|
-
clearPendingHash(userId, pendingKey);
|
|
2280
|
-
}
|
|
2281
|
-
},
|
|
2282
|
-
[userId]
|
|
2283
|
-
);
|
|
2284
|
-
return {
|
|
2285
|
-
status,
|
|
2286
|
-
error,
|
|
2287
|
-
txHash,
|
|
2288
|
-
claimingNft,
|
|
2289
|
-
claimNft,
|
|
2290
|
-
reset,
|
|
2291
|
-
clearPending
|
|
2292
|
-
};
|
|
2293
|
-
}
|
|
2294
1687
|
const twitterIcon = new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH3SURBVHgBzZeNkYIwEIXjVYAdcB1QAtcBVqBWcFoBdgBWgB1YAtcBJUAHlrCXxxEnEzaQIMi9mR0zIT+fSd4GhDBERLGMTEZN86uSUcgIhU3yYdABvEuYK+AgKnq/KgXz0bGkMiLxfkXd3GJDf/tVi3X1hRVJzdrz+Sw2mw0b2+1WNE0jXHU8Htt+u91uqFkiiDkbj8eDoigi2YCCIKAwDNtAGXVxHDsdgMvl0rZHX4w5oFrYnlRV9ZwYZQWIQVGX5zkNCc8VRF3XNCYx9DDLst4/0gHLsmT7oV6tpgvEKAiEbcCgp9NpEFAJEyvQ+/1OrhoFsQ3MAaKt2ro0TclHoyAQAMylNgH18+ML4QwC4Z+bjtEBkyRpy/idImcQm2MUoKNNXweBdDdwlkbemCovEEg5BglPt7QJuDgI5GvpxUDUFplJjQNcDEQ/E+YK6Ja2Zd3ZQHSb7vf7nmWLopi0RV4g5m1qszQHOBuIDqFfZNwF53NLe4FwKV6XSmqw9BDgSyCut6l6kdIdwwFOAvG5TW2O4QC9QKbcplxSc7W0FWTqbaqSGveuO2RpgNRmpcdLb09orybm4nA4cN0qfNfkssG3WFc3gMSyUIp19fkhP35+ZOEq1tNVMjRtif7BR/hTHYxbPp5HeQ/CAApl3GiZFao7gNic9xdG16HkLDPmwQAAAABJRU5ErkJggg==", import.meta.url).href;
|
|
2295
1688
|
const discordIcon = new URL("data:image/svg+xml,%3csvg%20width='24'%20height='25'%20viewBox='0%200%2024%2025'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20y='0.187012'%20width='24'%20height='24.2243'%20rx='8'%20fill='%237870FF'/%3e%3cpath%20d='M18.7627%206.96988C16.7288%205.45184%2014.7966%205.34341%2014.4915%205.34341L14.2881%205.56027C16.6271%206.21086%2017.9492%207.4036%2018.0508%207.51203C14.3898%205.56027%2010.322%205.45184%206.66102%206.96988C6.15254%207.18674%205.84746%207.4036%205.74576%207.4036C5.94915%207.29517%207.16949%206.10243%209.71186%205.45184L9.50847%205.23498C9.50847%205.23498%207.47458%205.12655%205.23729%206.86145C5.23729%206.86145%203%2010.8734%203%2015.9697C3%2015.9697%204.32203%2018.2467%207.67797%2018.3551C7.67797%2018.3551%208.18644%2017.7046%208.69492%2017.054C6.9661%2016.5118%206.15254%2015.3191%206.05085%2015.2106L6.66102%2015.5359C8.49153%2016.2949%2010.4237%2017.3793%2013.9831%2016.7287C14.6949%2016.6202%2015.5085%2016.4034%2016.2203%2016.0781C16.7288%2015.7528%2017.339%2015.5359%2017.9492%2015.1022C17.8475%2015.2106%2017.0339%2016.4034%2015.2034%2016.9455C15.6102%2017.5961%2016.2203%2018.2467%2016.2203%2018.2467C19.678%2018.1383%2021%2015.8612%2021%2016.0781C21%2011.0903%2018.7627%206.96988%2018.7627%206.96988ZM9.20339%2014.3432C8.38983%2014.3432%207.67797%2013.5842%207.67797%2012.6083C7.67797%2011.6324%208.38983%2010.8734%209.20339%2010.8734C10.0169%2010.8734%2010.7288%2011.7408%2010.7288%2012.6083C10.7288%2013.5842%2010.0169%2014.3432%209.20339%2014.3432ZM14.7966%2014.3432C13.9831%2014.3432%2013.2712%2013.5842%2013.2712%2012.6083C13.2712%2011.6324%2013.9831%2010.8734%2014.7966%2010.8734C15.7119%2010.8734%2016.4237%2011.7408%2016.4237%2012.6083C16.4237%2013.5842%2015.7119%2014.3432%2014.7966%2014.3432Z'%20fill='white'/%3e%3c/svg%3e", import.meta.url).href;
|
|
2296
1689
|
const telegramIcon = new URL("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%3e%3crect%20y='0.000396729'%20width='24'%20height='24'%20rx='8'%20fill='%2354AEFF'/%3e%3cpath%20d='M18.9513%206.24633L16.5438%2017.617C16.377%2018.424%2015.8902%2018.6174%2015.21%2018.2439L11.542%2015.5296L9.76804%2017.2435C9.56797%2017.4436%209.40125%2017.617%209.03445%2017.617C8.55428%2017.617%208.63431%2017.4369%208.47425%2016.9835L7.20714%2012.8553L3.57252%2011.7216C2.78558%2011.4882%202.77891%2010.948%203.74592%2010.5545L17.9243%205.08592C18.5711%204.79915%2019.1914%205.24598%2018.9446%206.23966L18.9513%206.24633Z'%20fill='white'/%3e%3c/svg%3e", import.meta.url).href;
|
|
@@ -2331,11 +1724,12 @@ function SocialIcon({
|
|
|
2331
1724
|
fill: "none",
|
|
2332
1725
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2333
1726
|
className,
|
|
1727
|
+
style: { color: "var(--taskon-color-text-secondary)" },
|
|
2334
1728
|
children: /* @__PURE__ */ jsx(
|
|
2335
1729
|
"path",
|
|
2336
1730
|
{
|
|
2337
1731
|
d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1ZM8 13h8v-2H8v2Zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5Z",
|
|
2338
|
-
fill: "
|
|
1732
|
+
fill: "currentColor"
|
|
2339
1733
|
}
|
|
2340
1734
|
)
|
|
2341
1735
|
}
|
|
@@ -3288,303 +2682,20 @@ function IdentityContent({
|
|
|
3288
2682
|
isEmpty && /* @__PURE__ */ jsx("div", { className: "taskon-identity-empty", children: messages.noData ?? "No identity options configured" })
|
|
3289
2683
|
] });
|
|
3290
2684
|
}
|
|
3291
|
-
function LoadingSpinner() {
|
|
3292
|
-
return /* @__PURE__ */ jsx("div", { className: "taskon-claim-dialog-spinner", children: /* @__PURE__ */ jsx("div", { className: "taskon-claim-dialog-spinner__circle" }) });
|
|
3293
|
-
}
|
|
3294
|
-
function SuccessIcon() {
|
|
3295
|
-
return /* @__PURE__ */ jsxs(
|
|
3296
|
-
"svg",
|
|
3297
|
-
{
|
|
3298
|
-
className: "taskon-claim-dialog-icon taskon-claim-dialog-icon--success",
|
|
3299
|
-
viewBox: "0 0 24 24",
|
|
3300
|
-
fill: "none",
|
|
3301
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3302
|
-
children: [
|
|
3303
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2" }),
|
|
3304
|
-
/* @__PURE__ */ jsx(
|
|
3305
|
-
"path",
|
|
3306
|
-
{
|
|
3307
|
-
d: "M8 12L11 15L16 9",
|
|
3308
|
-
stroke: "currentColor",
|
|
3309
|
-
strokeWidth: "2",
|
|
3310
|
-
strokeLinecap: "round",
|
|
3311
|
-
strokeLinejoin: "round"
|
|
3312
|
-
}
|
|
3313
|
-
)
|
|
3314
|
-
]
|
|
3315
|
-
}
|
|
3316
|
-
);
|
|
3317
|
-
}
|
|
3318
|
-
function ErrorIcon() {
|
|
3319
|
-
return /* @__PURE__ */ jsxs(
|
|
3320
|
-
"svg",
|
|
3321
|
-
{
|
|
3322
|
-
className: "taskon-claim-dialog-icon taskon-claim-dialog-icon--error",
|
|
3323
|
-
viewBox: "0 0 24 24",
|
|
3324
|
-
fill: "none",
|
|
3325
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3326
|
-
children: [
|
|
3327
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2" }),
|
|
3328
|
-
/* @__PURE__ */ jsx(
|
|
3329
|
-
"path",
|
|
3330
|
-
{
|
|
3331
|
-
d: "M15 9L9 15M9 9L15 15",
|
|
3332
|
-
stroke: "currentColor",
|
|
3333
|
-
strokeWidth: "2",
|
|
3334
|
-
strokeLinecap: "round"
|
|
3335
|
-
}
|
|
3336
|
-
)
|
|
3337
|
-
]
|
|
3338
|
-
}
|
|
3339
|
-
);
|
|
3340
|
-
}
|
|
3341
|
-
function getStatusMessage(status, messages) {
|
|
3342
|
-
switch (status) {
|
|
3343
|
-
case "checking":
|
|
3344
|
-
return messages.claimingNft ?? "Claiming NFT...";
|
|
3345
|
-
case "connecting":
|
|
3346
|
-
return messages.claimConnectingWallet ?? "Connecting wallet...";
|
|
3347
|
-
case "switching":
|
|
3348
|
-
return messages.claimSwitchingNetwork ?? "Switching network...";
|
|
3349
|
-
case "signing":
|
|
3350
|
-
return messages.claimGettingSignature ?? "Getting signature...";
|
|
3351
|
-
case "confirming":
|
|
3352
|
-
return messages.claimConfirmInWallet ?? "Please confirm in your wallet";
|
|
3353
|
-
case "pending":
|
|
3354
|
-
return messages.claimTransactionPending ?? "Transaction pending...";
|
|
3355
|
-
case "success":
|
|
3356
|
-
return messages.claimSuccess ?? "Claim successful!";
|
|
3357
|
-
case "error":
|
|
3358
|
-
return messages.claimFailed ?? "Claim failed";
|
|
3359
|
-
default:
|
|
3360
|
-
return "";
|
|
3361
|
-
}
|
|
3362
|
-
}
|
|
3363
|
-
function formatTxHash(hash) {
|
|
3364
|
-
if (hash.length <= 16) return hash;
|
|
3365
|
-
return `${hash.slice(0, 10)}...${hash.slice(-6)}`;
|
|
3366
|
-
}
|
|
3367
|
-
function ClaimNftDialog({
|
|
3368
|
-
open,
|
|
3369
|
-
onClose,
|
|
3370
|
-
status,
|
|
3371
|
-
error,
|
|
3372
|
-
txHash,
|
|
3373
|
-
claimingNft,
|
|
3374
|
-
explorerUrl,
|
|
3375
|
-
messages,
|
|
3376
|
-
onRetry
|
|
3377
|
-
}) {
|
|
3378
|
-
const isLoading = [
|
|
3379
|
-
"checking",
|
|
3380
|
-
"connecting",
|
|
3381
|
-
"switching",
|
|
3382
|
-
"signing",
|
|
3383
|
-
"confirming",
|
|
3384
|
-
"pending"
|
|
3385
|
-
].includes(status);
|
|
3386
|
-
const canClose = status === "success" || status === "error" || status === "idle";
|
|
3387
|
-
const handleClose = () => {
|
|
3388
|
-
if (canClose) {
|
|
3389
|
-
onClose();
|
|
3390
|
-
}
|
|
3391
|
-
};
|
|
3392
|
-
const handleViewTx = () => {
|
|
3393
|
-
if (explorerUrl) {
|
|
3394
|
-
window.open(explorerUrl, "_blank", "noopener,noreferrer");
|
|
3395
|
-
}
|
|
3396
|
-
};
|
|
3397
|
-
return /* @__PURE__ */ jsx(
|
|
3398
|
-
Dialog,
|
|
3399
|
-
{
|
|
3400
|
-
open,
|
|
3401
|
-
onOpenChange: (isOpen) => {
|
|
3402
|
-
if (!isOpen && canClose) {
|
|
3403
|
-
onClose();
|
|
3404
|
-
}
|
|
3405
|
-
},
|
|
3406
|
-
title: messages.claimNft ?? "Claim NFT",
|
|
3407
|
-
showCloseButton: canClose,
|
|
3408
|
-
contentClassName: "taskon-claim-dialog",
|
|
3409
|
-
maxWidth: 400,
|
|
3410
|
-
children: /* @__PURE__ */ jsxs("div", { className: "taskon-claim-dialog-content", children: [
|
|
3411
|
-
claimingNft && /* @__PURE__ */ jsx("div", { className: "taskon-claim-dialog-nft", children: claimingNft.item.reward_value.collection_image && /* @__PURE__ */ jsx(
|
|
3412
|
-
"img",
|
|
3413
|
-
{
|
|
3414
|
-
src: claimingNft.item.reward_value.collection_image,
|
|
3415
|
-
alt: "NFT",
|
|
3416
|
-
className: "taskon-claim-dialog-nft__image"
|
|
3417
|
-
}
|
|
3418
|
-
) }),
|
|
3419
|
-
/* @__PURE__ */ jsxs("div", { className: "taskon-claim-dialog-status", children: [
|
|
3420
|
-
isLoading && /* @__PURE__ */ jsx(LoadingSpinner, {}),
|
|
3421
|
-
status === "success" && /* @__PURE__ */ jsx(SuccessIcon, {}),
|
|
3422
|
-
status === "error" && /* @__PURE__ */ jsx(ErrorIcon, {})
|
|
3423
|
-
] }),
|
|
3424
|
-
/* @__PURE__ */ jsx("p", { className: "taskon-claim-dialog-message", children: status === "error" && error ? error.message : getStatusMessage(status, messages) }),
|
|
3425
|
-
txHash && (status === "pending" || status === "success") && /* @__PURE__ */ jsxs("div", { className: "taskon-claim-dialog-tx", children: [
|
|
3426
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-claim-dialog-tx__label", children: "Tx:" }),
|
|
3427
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-claim-dialog-tx__hash", children: formatTxHash(txHash) })
|
|
3428
|
-
] }),
|
|
3429
|
-
/* @__PURE__ */ jsxs("div", { className: "taskon-claim-dialog-actions", children: [
|
|
3430
|
-
txHash && explorerUrl && /* @__PURE__ */ jsx(
|
|
3431
|
-
"button",
|
|
3432
|
-
{
|
|
3433
|
-
type: "button",
|
|
3434
|
-
className: "taskon-claim-dialog-btn taskon-claim-dialog-btn--secondary",
|
|
3435
|
-
onClick: handleViewTx,
|
|
3436
|
-
children: messages.viewOnExplorer ?? "View on Explorer"
|
|
3437
|
-
}
|
|
3438
|
-
),
|
|
3439
|
-
status === "error" && onRetry && /* @__PURE__ */ jsx(
|
|
3440
|
-
"button",
|
|
3441
|
-
{
|
|
3442
|
-
type: "button",
|
|
3443
|
-
className: "taskon-claim-dialog-btn taskon-claim-dialog-btn--primary",
|
|
3444
|
-
onClick: onRetry,
|
|
3445
|
-
children: messages.retry ?? "Retry"
|
|
3446
|
-
}
|
|
3447
|
-
),
|
|
3448
|
-
canClose && /* @__PURE__ */ jsx(
|
|
3449
|
-
"button",
|
|
3450
|
-
{
|
|
3451
|
-
type: "button",
|
|
3452
|
-
className: "taskon-claim-dialog-btn taskon-claim-dialog-btn--primary",
|
|
3453
|
-
onClick: handleClose,
|
|
3454
|
-
children: messages.close ?? "Close"
|
|
3455
|
-
}
|
|
3456
|
-
)
|
|
3457
|
-
] })
|
|
3458
|
-
] })
|
|
3459
|
-
}
|
|
3460
|
-
);
|
|
3461
|
-
}
|
|
3462
|
-
function NftRewardContent({
|
|
3463
|
-
nftList,
|
|
3464
|
-
loading,
|
|
3465
|
-
error,
|
|
3466
|
-
pagination,
|
|
3467
|
-
messages,
|
|
3468
|
-
onClaim: customOnClaim,
|
|
3469
|
-
onTxClick: customOnTxClick,
|
|
3470
|
-
onClaimSuccess,
|
|
3471
|
-
onClaimError
|
|
3472
|
-
}) {
|
|
3473
|
-
const { chainMap } = useChainMap();
|
|
3474
|
-
const [isClaimDialogOpen, setIsClaimDialogOpen] = useState(false);
|
|
3475
|
-
const {
|
|
3476
|
-
status: claimStatus,
|
|
3477
|
-
error: claimError,
|
|
3478
|
-
txHash: claimTxHash,
|
|
3479
|
-
claimingNft,
|
|
3480
|
-
claimNft,
|
|
3481
|
-
reset: resetClaim
|
|
3482
|
-
} = useNftClaim({
|
|
3483
|
-
onSuccess: (txHash, item) => {
|
|
3484
|
-
onClaimSuccess == null ? void 0 : onClaimSuccess(txHash, item);
|
|
3485
|
-
},
|
|
3486
|
-
onError: (err, item) => {
|
|
3487
|
-
onClaimError == null ? void 0 : onClaimError(err, item);
|
|
3488
|
-
},
|
|
3489
|
-
onPendingFound: (pendingKey, txHash, chainName) => {
|
|
3490
|
-
console.log("Pending transaction found:", pendingKey, txHash, chainName);
|
|
3491
|
-
}
|
|
3492
|
-
});
|
|
3493
|
-
const explorerUrl = useMemo(() => {
|
|
3494
|
-
if (!claimTxHash || !claimingNft) return void 0;
|
|
3495
|
-
const chainName = claimingNft.chainName;
|
|
3496
|
-
const chainInfo = chainMap[chainName.toLowerCase()];
|
|
3497
|
-
if (!chainInfo) return void 0;
|
|
3498
|
-
return getTxExplorerUrl(chainInfo, claimTxHash);
|
|
3499
|
-
}, [claimTxHash, claimingNft, chainMap]);
|
|
3500
|
-
const handleNftClaim = useCallback(
|
|
3501
|
-
(item) => {
|
|
3502
|
-
if (customOnClaim) {
|
|
3503
|
-
customOnClaim(item);
|
|
3504
|
-
return;
|
|
3505
|
-
}
|
|
3506
|
-
setIsClaimDialogOpen(true);
|
|
3507
|
-
claimNft(item);
|
|
3508
|
-
},
|
|
3509
|
-
[customOnClaim, claimNft]
|
|
3510
|
-
);
|
|
3511
|
-
const handleNftTxClick = useCallback(
|
|
3512
|
-
(item) => {
|
|
3513
|
-
if (customOnTxClick) {
|
|
3514
|
-
customOnTxClick(item);
|
|
3515
|
-
return;
|
|
3516
|
-
}
|
|
3517
|
-
const nftValue = item.reward_value;
|
|
3518
|
-
if (!nftValue.tx_hash) {
|
|
3519
|
-
console.warn("No tx_hash found for NFT item:", item);
|
|
3520
|
-
return;
|
|
3521
|
-
}
|
|
3522
|
-
const chainName = getNftChainName(nftValue);
|
|
3523
|
-
if (!chainName) {
|
|
3524
|
-
console.warn("No chain info found for NFT item:", item);
|
|
3525
|
-
return;
|
|
3526
|
-
}
|
|
3527
|
-
const chainInfo = chainMap[chainName.toLowerCase()];
|
|
3528
|
-
if (!chainInfo) {
|
|
3529
|
-
console.warn(`Chain info not found for: ${chainName}`);
|
|
3530
|
-
return;
|
|
3531
|
-
}
|
|
3532
|
-
const txUrl = getTxExplorerUrl(chainInfo, nftValue.tx_hash);
|
|
3533
|
-
openInNewTab(txUrl);
|
|
3534
|
-
},
|
|
3535
|
-
[customOnTxClick, chainMap]
|
|
3536
|
-
);
|
|
3537
|
-
const handleCloseDialog = useCallback(() => {
|
|
3538
|
-
setIsClaimDialogOpen(false);
|
|
3539
|
-
setTimeout(() => {
|
|
3540
|
-
resetClaim();
|
|
3541
|
-
}, 200);
|
|
3542
|
-
}, [resetClaim]);
|
|
3543
|
-
const handleRetry = useCallback(() => {
|
|
3544
|
-
if (claimingNft) {
|
|
3545
|
-
resetClaim();
|
|
3546
|
-
claimNft(claimingNft.item);
|
|
3547
|
-
}
|
|
3548
|
-
}, [claimingNft, resetClaim, claimNft]);
|
|
3549
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3550
|
-
/* @__PURE__ */ jsx(
|
|
3551
|
-
NftTable,
|
|
3552
|
-
{
|
|
3553
|
-
data: nftList,
|
|
3554
|
-
loading,
|
|
3555
|
-
error,
|
|
3556
|
-
pagination,
|
|
3557
|
-
messages,
|
|
3558
|
-
onClaim: handleNftClaim,
|
|
3559
|
-
onTxClick: handleNftTxClick
|
|
3560
|
-
}
|
|
3561
|
-
),
|
|
3562
|
-
/* @__PURE__ */ jsx(
|
|
3563
|
-
ClaimNftDialog,
|
|
3564
|
-
{
|
|
3565
|
-
open: isClaimDialogOpen,
|
|
3566
|
-
onClose: handleCloseDialog,
|
|
3567
|
-
status: claimStatus,
|
|
3568
|
-
error: claimError,
|
|
3569
|
-
txHash: claimTxHash,
|
|
3570
|
-
claimingNft,
|
|
3571
|
-
explorerUrl,
|
|
3572
|
-
messages,
|
|
3573
|
-
onRetry: handleRetry
|
|
3574
|
-
}
|
|
3575
|
-
)
|
|
3576
|
-
] });
|
|
3577
|
-
}
|
|
3578
2685
|
function MyRewardsContent({
|
|
3579
2686
|
messages,
|
|
3580
2687
|
defaultRewardCard,
|
|
3581
2688
|
defaultPointId
|
|
3582
2689
|
}) {
|
|
2690
|
+
const { toast } = useToast();
|
|
2691
|
+
const { client } = useTaskOnContext();
|
|
3583
2692
|
const [selectedPointsId, setSelectedPointsId] = useState(null);
|
|
3584
2693
|
const hasUserSelectedRef = useRef(false);
|
|
3585
2694
|
const appliedDefaultKeyRef = useRef(null);
|
|
3586
2695
|
const [showWithdrawForm, setShowWithdrawForm] = useState(false);
|
|
3587
2696
|
const [selectedTokenForWithdraw, setSelectedTokenForWithdraw] = useState(null);
|
|
2697
|
+
const [viewingFrozenToken, setViewingFrozenToken] = useState(null);
|
|
2698
|
+
const [resendParams, setResendParams] = useState(void 0);
|
|
3588
2699
|
const {
|
|
3589
2700
|
cards,
|
|
3590
2701
|
selectedCard,
|
|
@@ -3627,6 +2738,20 @@ function MyRewardsContent({
|
|
|
3627
2738
|
rewardType: RewardType.Token,
|
|
3628
2739
|
autoLoad: selectedCard === USER_CENTER_REWARD_CARD_TYPES.Token
|
|
3629
2740
|
});
|
|
2741
|
+
const {
|
|
2742
|
+
data: frozenAssets,
|
|
2743
|
+
loading: frozenAssetsLoading,
|
|
2744
|
+
error: frozenAssetsError,
|
|
2745
|
+
pagination: frozenAssetsPagination,
|
|
2746
|
+
canResend
|
|
2747
|
+
} = useFrozenAssets({
|
|
2748
|
+
tokenId: (viewingFrozenToken == null ? void 0 : viewingFrozenToken.token_id) ?? 0,
|
|
2749
|
+
autoLoad: selectedCard === USER_CENTER_REWARD_CARD_TYPES.Token && !!(viewingFrozenToken == null ? void 0 : viewingFrozenToken.token_id)
|
|
2750
|
+
});
|
|
2751
|
+
const userCenterApi = useMemo(() => {
|
|
2752
|
+
if (!client) return null;
|
|
2753
|
+
return createUserCenterApi(client);
|
|
2754
|
+
}, [client]);
|
|
3630
2755
|
const {
|
|
3631
2756
|
data: nftList,
|
|
3632
2757
|
loading: nftLoading,
|
|
@@ -3673,18 +2798,54 @@ function MyRewardsContent({
|
|
|
3673
2798
|
pointsId: (selectedXpLevelData == null ? void 0 : selectedXpLevelData.xpPointsId) ?? 0,
|
|
3674
2799
|
autoLoad: selectedCard === USER_CENTER_REWARD_CARD_TYPES.XpLevel && !!selectedXpLevelData
|
|
3675
2800
|
});
|
|
3676
|
-
useGasFreeWithdraw({
|
|
3677
|
-
onSuccess: () => refreshTokenAssets(),
|
|
3678
|
-
onError: (err) => console.error("Gas-free withdraw failed:", err)
|
|
3679
|
-
});
|
|
3680
2801
|
const handleWithdraw = (token) => {
|
|
2802
|
+
setResendParams(void 0);
|
|
3681
2803
|
setSelectedTokenForWithdraw(token);
|
|
3682
2804
|
setShowWithdrawForm(true);
|
|
3683
2805
|
};
|
|
3684
2806
|
const handleBatchWithdraw = () => {
|
|
2807
|
+
setResendParams(void 0);
|
|
3685
2808
|
setSelectedTokenForWithdraw(null);
|
|
3686
2809
|
setShowWithdrawForm(true);
|
|
3687
2810
|
};
|
|
2811
|
+
const handleViewFrozen = (token) => {
|
|
2812
|
+
setViewingFrozenToken(token);
|
|
2813
|
+
};
|
|
2814
|
+
const handleCloseFrozenAssets = () => {
|
|
2815
|
+
setViewingFrozenToken(null);
|
|
2816
|
+
};
|
|
2817
|
+
const handleResendFrozenAsset = async (item) => {
|
|
2818
|
+
if (!viewingFrozenToken || !userCenterApi) {
|
|
2819
|
+
return;
|
|
2820
|
+
}
|
|
2821
|
+
if (item.type !== LockedType.Withdraw) {
|
|
2822
|
+
return;
|
|
2823
|
+
}
|
|
2824
|
+
if (!item.nonce || !item.receiver_address) {
|
|
2825
|
+
toast.error(messages.error ?? "Missing resend payload");
|
|
2826
|
+
return;
|
|
2827
|
+
}
|
|
2828
|
+
try {
|
|
2829
|
+
const requests = await userCenterApi.getTokenWithdrawByNonce({
|
|
2830
|
+
chain: viewingFrozenToken.chain,
|
|
2831
|
+
nonce: item.nonce
|
|
2832
|
+
});
|
|
2833
|
+
const withdrawableRequests = requests.filter((request) => request.can_withdraw);
|
|
2834
|
+
if (withdrawableRequests.length === 0) {
|
|
2835
|
+
toast.error(messages.emptyToken ?? "No tokens available for resend");
|
|
2836
|
+
return;
|
|
2837
|
+
}
|
|
2838
|
+
setResendParams({
|
|
2839
|
+
nonce: item.nonce,
|
|
2840
|
+
receiverAddress: item.receiver_address,
|
|
2841
|
+
tokens: withdrawableRequests
|
|
2842
|
+
});
|
|
2843
|
+
setSelectedTokenForWithdraw(viewingFrozenToken);
|
|
2844
|
+
setShowWithdrawForm(true);
|
|
2845
|
+
} catch (error) {
|
|
2846
|
+
toast.error(error instanceof Error ? error.message : "Failed to load resend details");
|
|
2847
|
+
}
|
|
2848
|
+
};
|
|
3688
2849
|
const handleSelectCard = (type, pointsId) => {
|
|
3689
2850
|
hasUserSelectedRef.current = true;
|
|
3690
2851
|
selectCard(type);
|
|
@@ -3722,6 +2883,11 @@ function MyRewardsContent({
|
|
|
3722
2883
|
}
|
|
3723
2884
|
appliedDefaultKeyRef.current = applyKey;
|
|
3724
2885
|
}, [cards, defaultPointId, defaultRewardCard, selectCard]);
|
|
2886
|
+
useEffect(() => {
|
|
2887
|
+
if (selectedCard !== USER_CENTER_REWARD_CARD_TYPES.Token) {
|
|
2888
|
+
setViewingFrozenToken(null);
|
|
2889
|
+
}
|
|
2890
|
+
}, [selectedCard]);
|
|
3725
2891
|
if (rewardsLoading && cards.length === 0) {
|
|
3726
2892
|
return /* @__PURE__ */ jsx(LoadingState, { message: messages.loading });
|
|
3727
2893
|
}
|
|
@@ -3748,7 +2914,16 @@ function MyRewardsContent({
|
|
|
3748
2914
|
tokenHistoryPagination,
|
|
3749
2915
|
messages,
|
|
3750
2916
|
onWithdraw: handleWithdraw,
|
|
3751
|
-
onBatchWithdraw: handleBatchWithdraw
|
|
2917
|
+
onBatchWithdraw: handleBatchWithdraw,
|
|
2918
|
+
onViewFrozen: handleViewFrozen,
|
|
2919
|
+
showFrozenAssets: !!viewingFrozenToken,
|
|
2920
|
+
frozenAssets,
|
|
2921
|
+
frozenAssetsLoading,
|
|
2922
|
+
frozenAssetsError,
|
|
2923
|
+
frozenAssetsPagination,
|
|
2924
|
+
canResendFrozenAsset: canResend,
|
|
2925
|
+
onResendFrozenAsset: handleResendFrozenAsset,
|
|
2926
|
+
onCloseFrozenAssets: handleCloseFrozenAssets
|
|
3752
2927
|
}
|
|
3753
2928
|
);
|
|
3754
2929
|
case USER_CENTER_REWARD_CARD_TYPES.XpLevel:
|
|
@@ -3847,9 +3022,33 @@ function MyRewardsContent({
|
|
|
3847
3022
|
tokenAssetsLoading,
|
|
3848
3023
|
initialTokenId: selectedTokenForWithdraw == null ? void 0 : selectedTokenForWithdraw.token_id,
|
|
3849
3024
|
initialChain: selectedTokenForWithdraw == null ? void 0 : selectedTokenForWithdraw.chain,
|
|
3850
|
-
|
|
3025
|
+
resend: resendParams ? {
|
|
3026
|
+
nonce: resendParams.nonce,
|
|
3027
|
+
receiverAddress: resendParams.receiverAddress
|
|
3028
|
+
} : void 0,
|
|
3029
|
+
resendTokenItems: resendParams ? resendParams.tokens.map((request) => {
|
|
3030
|
+
const matchedToken = tokenAssets.find(
|
|
3031
|
+
(token) => token.token_id === request.token_id && token.chain.toLowerCase() === request.chain.toLowerCase()
|
|
3032
|
+
);
|
|
3033
|
+
return {
|
|
3034
|
+
tokenId: request.token_id,
|
|
3035
|
+
tokenSymbol: request.token_symbol,
|
|
3036
|
+
tokenIcon: (matchedToken == null ? void 0 : matchedToken.token_icon) ?? "",
|
|
3037
|
+
tokenAddress: request.token_address,
|
|
3038
|
+
tokenDecimals: request.token_decimals,
|
|
3039
|
+
chain: request.chain,
|
|
3040
|
+
chainLabel: (matchedToken == null ? void 0 : matchedToken.chain_label) ?? request.chain,
|
|
3041
|
+
amount: request.token_amount,
|
|
3042
|
+
amountInWei: toWei(request.token_amount, request.token_decimals)
|
|
3043
|
+
};
|
|
3044
|
+
}) : void 0,
|
|
3045
|
+
onClose: () => {
|
|
3046
|
+
setResendParams(void 0);
|
|
3047
|
+
setShowWithdrawForm(false);
|
|
3048
|
+
},
|
|
3851
3049
|
onSuccess: () => {
|
|
3852
3050
|
refreshTokenAssets();
|
|
3051
|
+
setResendParams(void 0);
|
|
3853
3052
|
setShowWithdrawForm(false);
|
|
3854
3053
|
}
|
|
3855
3054
|
}
|
|
@@ -3876,8 +3075,10 @@ function ActivityHistoryContent({
|
|
|
3876
3075
|
);
|
|
3877
3076
|
}
|
|
3878
3077
|
function mergeUserCenterConfig(props, cloud) {
|
|
3078
|
+
const resolved = props.config ?? cloud ?? null;
|
|
3079
|
+
const normalized = Array.isArray(resolved) && resolved.length > 0 ? resolved : null;
|
|
3879
3080
|
return {
|
|
3880
|
-
config:
|
|
3081
|
+
config: normalized
|
|
3881
3082
|
};
|
|
3882
3083
|
}
|
|
3883
3084
|
const TAB_LABEL_KEYS = {
|
|
@@ -3891,7 +3092,7 @@ const TAB_DEFAULT_LABELS = {
|
|
|
3891
3092
|
[UserCenterTabType.ActivityHistory]: "Activity History"
|
|
3892
3093
|
};
|
|
3893
3094
|
function UserCenterWidget(props) {
|
|
3894
|
-
const { widgetId } = props;
|
|
3095
|
+
const { widgetId, themeMode } = props;
|
|
3895
3096
|
const { functionConfig, cloudTheme, isConfigLoading, configError } = useResolvedWidgetConfig(widgetId);
|
|
3896
3097
|
const mergedConfig = useMemo(() => {
|
|
3897
3098
|
return mergeUserCenterConfig(
|
|
@@ -3899,26 +3100,29 @@ function UserCenterWidget(props) {
|
|
|
3899
3100
|
functionConfig ?? null
|
|
3900
3101
|
);
|
|
3901
3102
|
}, [props.config, functionConfig]);
|
|
3103
|
+
const resolvedConfig = mergedConfig.config;
|
|
3104
|
+
const isConfigured = Array.isArray(resolvedConfig) && resolvedConfig.length > 0;
|
|
3902
3105
|
return /* @__PURE__ */ jsx(
|
|
3903
3106
|
WidgetShell,
|
|
3904
3107
|
{
|
|
3905
3108
|
widgetId,
|
|
3906
3109
|
isConfigLoading,
|
|
3907
3110
|
cloudTheme,
|
|
3111
|
+
themeMode,
|
|
3908
3112
|
className: "taskon-user-center",
|
|
3909
|
-
errorMessage: configError ?? void 0,
|
|
3910
|
-
children: /* @__PURE__ */ jsx(
|
|
3113
|
+
errorMessage: configError ?? (!isConfigured ? "未配置" : void 0),
|
|
3114
|
+
children: Array.isArray(resolvedConfig) && resolvedConfig.length > 0 ? /* @__PURE__ */ jsx(
|
|
3911
3115
|
UserCenterWidgetInner,
|
|
3912
3116
|
{
|
|
3913
3117
|
...props,
|
|
3914
|
-
config:
|
|
3118
|
+
config: resolvedConfig
|
|
3915
3119
|
}
|
|
3916
|
-
)
|
|
3120
|
+
) : null
|
|
3917
3121
|
}
|
|
3918
3122
|
);
|
|
3919
3123
|
}
|
|
3920
3124
|
function UserCenterWidgetInner({
|
|
3921
|
-
config
|
|
3125
|
+
config,
|
|
3922
3126
|
defaultTab,
|
|
3923
3127
|
defaultRewardCard,
|
|
3924
3128
|
defaultPointId,
|
|
@@ -3931,7 +3135,7 @@ function UserCenterWidgetInner({
|
|
|
3931
3135
|
const { messages, isLoading: isLocaleLoading } = useWidgetLocale({
|
|
3932
3136
|
widgetId: "UserCenterWidget",
|
|
3933
3137
|
defaultMessages: enMessages,
|
|
3934
|
-
loadMessages: (locale) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./locales/en.json": () => import("./UserCenterWidget-
|
|
3138
|
+
loadMessages: (locale) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./locales/en.json": () => import("./UserCenterWidget-cADBSVg7.js").then((n) => n.w), "./locales/ja.json": () => import("./usercenter-ja-B2465c1O.js"), "./locales/ko.json": () => import("./usercenter-ko-xAEYxqLg.js") }), `./locales/${locale}.json`, 3)
|
|
3935
3139
|
});
|
|
3936
3140
|
const enabledTabs = useMemo(() => filterEnabledTabs(config), [config]);
|
|
3937
3141
|
const tabItems = useMemo(() => {
|
|
@@ -3980,7 +3184,7 @@ export {
|
|
|
3980
3184
|
AssetCard as a,
|
|
3981
3185
|
AssetCarousel as b,
|
|
3982
3186
|
useUserRewards as c,
|
|
3983
|
-
|
|
3187
|
+
useFrozenAssets as d,
|
|
3984
3188
|
useIdentityData as e,
|
|
3985
3189
|
useUnbindSocial as f,
|
|
3986
3190
|
useBindWallet as g,
|