@taskon/widget-react 0.0.1-beta.7 → 0.0.2
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/EligibilityInfo.css +0 -148
- package/dist/ThemeProvider.css +4 -3
- package/dist/UserCenterWidget2.css +316 -0
- package/dist/chunks/{CommunityTaskList-D0uVD8wD.js → CommunityTaskList-2nFy6l6m.js} +2 -2
- package/dist/chunks/{EligibilityInfo-Cf6hx9-a.js → EligibilityInfo-CKTl_cdU.js} +2 -133
- package/dist/chunks/{PageBuilder-DoAFPm6-.js → PageBuilder-DHM3Il6f.js} +3 -3
- package/dist/chunks/{Quest-ySZlYd4u.js → Quest-Dqx4OCat.js} +2 -2
- package/dist/chunks/{UserCenterWidget-STq8kpV4.js → UserCenterWidget-SE5hqpnZ.js} +492 -303
- package/dist/chunks/{UserCenterWidget-BJsc_GSZ.js → UserCenterWidget-XL6LZRZM.js} +77 -64
- package/dist/community-task.js +1 -1
- package/dist/index.js +4 -4
- package/dist/page-builder.js +1 -1
- package/dist/quest.js +1 -1
- package/dist/user-center.js +1 -1
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@ import '../UserCenterWidget2.css';var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import { useContext, useState, useRef, useMemo, useCallback, forwardRef, useImperativeHandle, useEffect, useLayoutEffect, createContext } from "react";
|
|
5
|
+
import React__default, { useContext, useState, useRef, useMemo, useCallback, forwardRef, useImperativeHandle, useEffect, useLayoutEffect, createContext } from "react";
|
|
6
6
|
import { createUserApi, createNftClaimApi, NftClaimError, NftClaimErrorType, getNftChainName, generatePendingKey, getPendingHash, NftClaimType, WithdrawNft, ClaimMintedNft, ClaimCapNft, setPendingHash, clearPendingHash, RewardType, isNftClaimed, isNftClaimable, getNftClaimType, ChainType, DEFAULT_ERROR_MESSAGES, openInNewTab, toWei, USER_CENTER_REWARD_CARD_TYPES, UserCenterTabType, filterEnabledCards, formatTokenAmount as formatTokenAmount$1, RouletteRewardType, USER_CENTER_PAGE_SIZE, createUserCenterApi, getTxExplorerUrl } from "@taskon/core";
|
|
7
|
-
import { w as TaskOnContext, h as useTaskOnContext, P as Primitive, v as useLayoutEffect2, k as createContextScope, l as useComposedRefs, r as useCallbackRef, n as useControllableState, x as useId, q as composeEventHandlers, o as Presence, s as Portal$1, y as hideOthers, z as ReactRemoveScroll, m as createSlot, A as useFocusGuards, F as FocusScope, C as DismissableLayer, E as useTaskOnPortalContainer,
|
|
7
|
+
import { w as TaskOnContext, h as useTaskOnContext, D as Dialog, P as Primitive, v as useLayoutEffect2, k as createContextScope, l as useComposedRefs, r as useCallbackRef, n as useControllableState, x as useId, q as composeEventHandlers, o as Presence, s as Portal$1, y as hideOthers, z as ReactRemoveScroll, m as createSlot, A as useFocusGuards, F as FocusScope, C as DismissableLayer, E as useTaskOnPortalContainer, c as useTranslation, e as createLocaleLoader } from "./ThemeProvider-CulHkqqY.js";
|
|
8
8
|
import { c as useToast, u as useWallet } from "./useToast-BGJhd3BX.js";
|
|
9
9
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
10
10
|
import { P as Pagination$1, B as Button, T as Table, a as usePagination } from "./WidgetShell-8xn-Jivw.js";
|
|
@@ -845,6 +845,136 @@ function useNftClaim(options = {}) {
|
|
|
845
845
|
clearPending
|
|
846
846
|
};
|
|
847
847
|
}
|
|
848
|
+
const successIconUrl = new URL("data:image/svg+xml,%3csvg%20width='46'%20height='46'%20viewBox='0%200%2046%2046'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='23'%20cy='23'%20r='23'%20fill='%2331FF90'/%3e%3cpath%20d='M16.4281%2022.8899L20.6446%2027.1063L29.6798%2018.0711'%20stroke='black'%20stroke-width='5'%20stroke-linecap='square'%20stroke-linejoin='round'/%3e%3c/svg%3e", import.meta.url).href;
|
|
849
|
+
const warnIconUrl = new URL("data:image/svg+xml,%3csvg%20width='46'%20height='46'%20viewBox='0%200%2046%2046'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M22.9783%200.0225143C10.2876%200.0225143%200%2010.3101%200%2023.0006C0%2035.6903%2010.2876%2045.9776%2022.9783%2045.9776C35.6682%2045.9776%2045.9556%2035.6903%2045.9556%2023.0006C45.9558%2010.3101%2035.6682%200.0225143%2022.9783%200.0225143ZM21.797%209.85031C21.797%209.01328%2022.4783%208.33197%2023.3154%208.33197C24.1524%208.33197%2024.8337%209.01328%2024.8337%209.85031V11.729C24.8337%2012.5662%2024.1524%2013.2475%2023.3154%2013.2475C22.4783%2013.2475%2021.797%2012.5662%2021.797%2011.7292V9.85031ZM12.0443%2023.1095H10.1657C9.32842%2023.1095%208.64717%2022.4282%208.64717%2021.5912C8.64717%2020.7541%209.32842%2020.0729%2010.1657%2020.0729H12.0443C12.8814%2020.0729%2013.5627%2020.7541%2013.5627%2021.5912C13.5627%2022.4282%2012.8819%2023.1095%2012.0443%2023.1095ZM12.6546%2014.9563C12.368%2014.6697%2012.2098%2014.2882%2012.2098%2013.8823C12.2098%2013.477%2012.3678%2013.0957%2012.6546%2012.8086C12.9411%2012.522%2013.3223%2012.3638%2013.7282%2012.3638C14.134%2012.3638%2014.515%2012.5216%2014.8021%2012.8086L16.1305%2014.137C16.4173%2014.4241%2016.5753%2014.8054%2016.5753%2015.2107C16.5753%2015.6165%2016.4171%2015.9976%2016.1305%2016.2847C15.843%2016.5715%2015.4617%2016.7295%2015.0565%2016.7295C14.6511%2016.7295%2014.2698%2016.5715%2013.9828%2016.2847L12.6546%2014.9563ZM24.2545%2039.3233H22.3764C21.5389%2039.3233%2020.8574%2038.642%2020.8574%2037.8045C20.8574%2036.9674%2021.5389%2036.2861%2022.3764%2036.2861H24.2545C25.0916%2036.2861%2025.7731%2036.9674%2025.7731%2037.8045C25.7732%2038.6421%2025.0916%2039.3233%2024.2545%2039.3233ZM26.1334%2035.8432H20.4976C19.6603%2035.8432%2018.9792%2035.1622%2018.9792%2034.3253C18.9792%2033.4875%2019.6603%2032.8063%2020.4976%2032.8063H26.133C26.9701%2032.8063%2027.6513%2033.4878%2027.6513%2034.3253C27.6518%2035.1624%2026.9705%2035.8432%2026.1334%2035.8432ZM23.3154%2032.033C18.335%2032.033%2014.2826%2027.9809%2014.2826%2023C14.2826%2018.0196%2018.3345%2013.9671%2023.3154%2013.9671C28.2958%2013.9671%2032.3478%2018.0191%2032.3478%2023C32.3478%2027.9809%2028.2958%2032.033%2023.3154%2032.033ZM31.574%2016.7295C31.1682%2016.7295%2030.7867%2016.5713%2030.5%2016.2843C29.9086%2015.6924%2029.9086%2014.7293%2030.5%2014.1374L31.8288%2012.8086C32.1155%2012.522%2032.4972%2012.364%2032.9026%2012.364C33.3082%2012.364%2033.6895%2012.522%2033.9762%2012.8084C34.568%2013.4009%2034.5676%2014.364%2033.9762%2014.9559L32.6478%2016.2843C32.3613%2016.5715%2031.98%2016.7295%2031.574%2016.7295ZM36.4652%2023.1095H34.5862C33.7491%2023.1095%2033.0678%2022.4282%2033.0678%2021.5912C33.0678%2020.7541%2033.7491%2020.0729%2034.5862%2020.0729H36.4652C37.3025%2020.0729%2037.9835%2020.7541%2037.9835%2021.5912C37.9836%2022.4282%2037.3025%2023.1095%2036.4652%2023.1095Z'%20fill='%23F89D35'/%3e%3c/svg%3e", import.meta.url).href;
|
|
850
|
+
function getNoticeIcon(type) {
|
|
851
|
+
if (type === "success") {
|
|
852
|
+
return successIconUrl;
|
|
853
|
+
}
|
|
854
|
+
if (type === "warn") {
|
|
855
|
+
return warnIconUrl;
|
|
856
|
+
}
|
|
857
|
+
return null;
|
|
858
|
+
}
|
|
859
|
+
function ConfirmNoticeDialog({
|
|
860
|
+
open,
|
|
861
|
+
onOpenChange,
|
|
862
|
+
type = "default",
|
|
863
|
+
title,
|
|
864
|
+
desc,
|
|
865
|
+
col = false,
|
|
866
|
+
cancelButton,
|
|
867
|
+
confirmButton,
|
|
868
|
+
onCancel,
|
|
869
|
+
onConfirm,
|
|
870
|
+
onClose,
|
|
871
|
+
closeOnCancel = true,
|
|
872
|
+
closeOnConfirm = true,
|
|
873
|
+
cancelDisabled = false,
|
|
874
|
+
confirmDisabled = false,
|
|
875
|
+
showCloseButton = false,
|
|
876
|
+
closeOnOverlayClick = true,
|
|
877
|
+
closeOnEscapeKey = true,
|
|
878
|
+
maxWidth = 470,
|
|
879
|
+
className,
|
|
880
|
+
contentClassName,
|
|
881
|
+
children,
|
|
882
|
+
actions,
|
|
883
|
+
footer,
|
|
884
|
+
accessibilityTitle,
|
|
885
|
+
accessibilityDescription
|
|
886
|
+
}) {
|
|
887
|
+
const noticeIcon = getNoticeIcon(type);
|
|
888
|
+
const shouldRenderDefaultActions = !actions && Boolean(cancelButton || confirmButton);
|
|
889
|
+
const closeDialog = React__default.useCallback(() => {
|
|
890
|
+
onOpenChange(false);
|
|
891
|
+
onClose == null ? void 0 : onClose();
|
|
892
|
+
}, [onOpenChange, onClose]);
|
|
893
|
+
const handleOpenChange = React__default.useCallback(
|
|
894
|
+
(nextOpen) => {
|
|
895
|
+
onOpenChange(nextOpen);
|
|
896
|
+
if (!nextOpen) {
|
|
897
|
+
onClose == null ? void 0 : onClose();
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
[onOpenChange, onClose]
|
|
901
|
+
);
|
|
902
|
+
const handleCancel = React__default.useCallback(() => {
|
|
903
|
+
onCancel == null ? void 0 : onCancel();
|
|
904
|
+
if (closeOnCancel) {
|
|
905
|
+
closeDialog();
|
|
906
|
+
}
|
|
907
|
+
}, [onCancel, closeOnCancel, closeDialog]);
|
|
908
|
+
const handleConfirm = React__default.useCallback(() => {
|
|
909
|
+
onConfirm == null ? void 0 : onConfirm();
|
|
910
|
+
if (closeOnConfirm) {
|
|
911
|
+
closeDialog();
|
|
912
|
+
}
|
|
913
|
+
}, [onConfirm, closeOnConfirm, closeDialog]);
|
|
914
|
+
const ariaTitle = accessibilityTitle ?? (typeof title === "string" ? title : "Confirm notice");
|
|
915
|
+
return /* @__PURE__ */ jsx(
|
|
916
|
+
Dialog,
|
|
917
|
+
{
|
|
918
|
+
open,
|
|
919
|
+
onOpenChange: handleOpenChange,
|
|
920
|
+
title: ariaTitle,
|
|
921
|
+
description: accessibilityDescription,
|
|
922
|
+
showCloseButton,
|
|
923
|
+
closeOnOverlayClick,
|
|
924
|
+
closeOnEscapeKey,
|
|
925
|
+
maxWidth,
|
|
926
|
+
contentClassName,
|
|
927
|
+
children: /* @__PURE__ */ jsxs(
|
|
928
|
+
"div",
|
|
929
|
+
{
|
|
930
|
+
className: `taskon-confirm-notice taskon-confirm-notice--${type} ${className || ""}`.trim(),
|
|
931
|
+
children: [
|
|
932
|
+
noticeIcon && /* @__PURE__ */ jsx(
|
|
933
|
+
"img",
|
|
934
|
+
{
|
|
935
|
+
className: "taskon-confirm-notice-icon",
|
|
936
|
+
src: noticeIcon,
|
|
937
|
+
alt: ""
|
|
938
|
+
}
|
|
939
|
+
),
|
|
940
|
+
title && /* @__PURE__ */ jsx("h3", { className: "taskon-confirm-notice-title", children: title }),
|
|
941
|
+
desc && /* @__PURE__ */ jsx("p", { className: "taskon-confirm-notice-desc", children: desc }),
|
|
942
|
+
children,
|
|
943
|
+
(actions || shouldRenderDefaultActions) && /* @__PURE__ */ jsx(
|
|
944
|
+
"div",
|
|
945
|
+
{
|
|
946
|
+
className: `taskon-confirm-notice-buttons ${col ? "taskon-confirm-notice-buttons--col" : ""}`.trim(),
|
|
947
|
+
children: actions || /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
948
|
+
cancelButton && /* @__PURE__ */ jsx(
|
|
949
|
+
"button",
|
|
950
|
+
{
|
|
951
|
+
type: "button",
|
|
952
|
+
className: "taskon-confirm-notice-button taskon-confirm-notice-button--cancel",
|
|
953
|
+
onClick: handleCancel,
|
|
954
|
+
disabled: cancelDisabled,
|
|
955
|
+
children: cancelButton
|
|
956
|
+
}
|
|
957
|
+
),
|
|
958
|
+
confirmButton && /* @__PURE__ */ jsx(
|
|
959
|
+
"button",
|
|
960
|
+
{
|
|
961
|
+
type: "button",
|
|
962
|
+
className: "taskon-confirm-notice-button taskon-confirm-notice-button--confirm",
|
|
963
|
+
onClick: handleConfirm,
|
|
964
|
+
disabled: confirmDisabled,
|
|
965
|
+
children: confirmButton
|
|
966
|
+
}
|
|
967
|
+
)
|
|
968
|
+
] })
|
|
969
|
+
}
|
|
970
|
+
),
|
|
971
|
+
footer
|
|
972
|
+
]
|
|
973
|
+
}
|
|
974
|
+
)
|
|
975
|
+
}
|
|
976
|
+
);
|
|
977
|
+
}
|
|
848
978
|
const Input = forwardRef(
|
|
849
979
|
function Input2({
|
|
850
980
|
value,
|
|
@@ -4570,7 +4700,7 @@ function getErrorMessage(error2, messages) {
|
|
|
4570
4700
|
}
|
|
4571
4701
|
return messages.claimFailed || DEFAULT_ERROR_MESSAGES[error2.type] || DEFAULT_ERROR_MESSAGES[NftClaimErrorType.Unknown];
|
|
4572
4702
|
}
|
|
4573
|
-
function formatTxHash$
|
|
4703
|
+
function formatTxHash$2(hash) {
|
|
4574
4704
|
if (hash.length <= 16) return hash;
|
|
4575
4705
|
return `${hash.slice(0, 10)}...${hash.slice(-6)}`;
|
|
4576
4706
|
}
|
|
@@ -4638,7 +4768,7 @@ function ClaimNftDialog({
|
|
|
4638
4768
|
/* @__PURE__ */ jsx("p", { className: "taskon-claim-dialog-message", children: status === "error" && error2 ? getErrorMessage(error2, resolvedMessages) : getStatusMessage(status, resolvedMessages) }),
|
|
4639
4769
|
txHash && (status === "pending" || status === "success") && /* @__PURE__ */ jsxs("div", { className: "taskon-claim-dialog-tx", children: [
|
|
4640
4770
|
/* @__PURE__ */ jsx("span", { className: "taskon-claim-dialog-tx__label", children: "Tx:" }),
|
|
4641
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-claim-dialog-tx__hash", children: formatTxHash$
|
|
4771
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-claim-dialog-tx__hash", children: formatTxHash$2(txHash) })
|
|
4642
4772
|
] }),
|
|
4643
4773
|
/* @__PURE__ */ jsxs("div", { className: "taskon-claim-dialog-actions", children: [
|
|
4644
4774
|
txHash && explorerUrl && /* @__PURE__ */ jsx(
|
|
@@ -4683,7 +4813,7 @@ const DEFAULT_PENDING_MESSAGES = {
|
|
|
4683
4813
|
claimAgain: enMessages.claim_again,
|
|
4684
4814
|
continueWaiting: enMessages.continue_waiting
|
|
4685
4815
|
};
|
|
4686
|
-
function formatTxHash(hash) {
|
|
4816
|
+
function formatTxHash$1(hash) {
|
|
4687
4817
|
if (hash.length <= 16) return hash;
|
|
4688
4818
|
return `${hash.slice(0, 10)}...${hash.slice(-6)}`;
|
|
4689
4819
|
}
|
|
@@ -4735,9 +4865,9 @@ function PendingTxDialog({
|
|
|
4735
4865
|
type: "button",
|
|
4736
4866
|
className: "taskon-pending-dialog-hash-link",
|
|
4737
4867
|
onClick: handleViewTx,
|
|
4738
|
-
children: formatTxHash(txHash)
|
|
4868
|
+
children: formatTxHash$1(txHash)
|
|
4739
4869
|
}
|
|
4740
|
-
) : /* @__PURE__ */ jsx("span", { className: "taskon-pending-dialog-hash-value", children: formatTxHash(txHash) })
|
|
4870
|
+
) : /* @__PURE__ */ jsx("span", { className: "taskon-pending-dialog-hash-value", children: formatTxHash$1(txHash) })
|
|
4741
4871
|
] }),
|
|
4742
4872
|
/* @__PURE__ */ jsxs("ul", { className: "taskon-pending-dialog-notice-list", children: [
|
|
4743
4873
|
/* @__PURE__ */ jsx("li", { className: "taskon-pending-dialog-notice-item", children: claimAgainWarn }),
|
|
@@ -5835,7 +5965,8 @@ function useRewardDetails(options) {
|
|
|
5835
5965
|
mode = "pagination",
|
|
5836
5966
|
autoLoad = true
|
|
5837
5967
|
} = options;
|
|
5838
|
-
const { client } = useTaskOnContext();
|
|
5968
|
+
const { client, userToken } = useTaskOnContext();
|
|
5969
|
+
const authKey = userToken ?? "__anonymous__";
|
|
5839
5970
|
const [data, setData] = useState([]);
|
|
5840
5971
|
const [total, setTotal] = useState(0);
|
|
5841
5972
|
const [loading2, setLoading] = useState(false);
|
|
@@ -5881,7 +6012,7 @@ function useRewardDetails(options) {
|
|
|
5881
6012
|
setLoading(false);
|
|
5882
6013
|
}
|
|
5883
6014
|
},
|
|
5884
|
-
[api, rewardType, pageSize]
|
|
6015
|
+
[api, rewardType, pageSize, authKey]
|
|
5885
6016
|
);
|
|
5886
6017
|
const refresh = useCallback(async () => {
|
|
5887
6018
|
setData([]);
|
|
@@ -5918,7 +6049,8 @@ function useTokenAssets(options = {}) {
|
|
|
5918
6049
|
getAll = false,
|
|
5919
6050
|
tokenId = 0
|
|
5920
6051
|
} = options;
|
|
5921
|
-
const { client } = useTaskOnContext();
|
|
6052
|
+
const { client, userToken } = useTaskOnContext();
|
|
6053
|
+
const authKey = userToken ?? "__anonymous__";
|
|
5922
6054
|
const [data, setData] = useState([]);
|
|
5923
6055
|
const [total, setTotal] = useState(0);
|
|
5924
6056
|
const [pendingWithdrawals, setPendingWithdrawals] = useState(0);
|
|
@@ -5970,7 +6102,7 @@ function useTokenAssets(options = {}) {
|
|
|
5970
6102
|
setLoading(false);
|
|
5971
6103
|
}
|
|
5972
6104
|
},
|
|
5973
|
-
[api, pageSize, getAll, tokenId]
|
|
6105
|
+
[api, pageSize, getAll, tokenId, authKey]
|
|
5974
6106
|
);
|
|
5975
6107
|
const refresh = useCallback(async () => {
|
|
5976
6108
|
if (autoLoad && pagination.page !== 0) {
|
|
@@ -6124,6 +6256,7 @@ function isSameAddress(addr1, addr2) {
|
|
|
6124
6256
|
return addr1.toLowerCase() === addr2.toLowerCase();
|
|
6125
6257
|
}
|
|
6126
6258
|
const WITHDRAW_WALLET_NOT_BOUND_MESSAGE = "Wallet address is not bound";
|
|
6259
|
+
const RESEND_LOG_PREFIX$1 = "[UserCenter][WithdrawResend]";
|
|
6127
6260
|
function useTokenWithdraw(options = {}) {
|
|
6128
6261
|
const { userAddress, resend: resend2, onSuccess, onCancel, onError, onConnect } = options;
|
|
6129
6262
|
const normalizedUserAddress = (userAddress == null ? void 0 : userAddress.trim()) ?? "";
|
|
@@ -6137,6 +6270,8 @@ function useTokenWithdraw(options = {}) {
|
|
|
6137
6270
|
const [txHash, setTxHash] = useState(null);
|
|
6138
6271
|
const [isGasInsufficient, setIsGasInsufficient] = useState(false);
|
|
6139
6272
|
const [connectedAddress, setConnectedAddress] = useState(null);
|
|
6273
|
+
const connectedAddressRef = useRef(null);
|
|
6274
|
+
const tokensRef = useRef([]);
|
|
6140
6275
|
const isResend = !!((resend2 == null ? void 0 : resend2.nonce) && (resend2 == null ? void 0 : resend2.receiverAddress));
|
|
6141
6276
|
const currentChainRef = useRef(null);
|
|
6142
6277
|
const api = useMemo(() => {
|
|
@@ -6175,6 +6310,7 @@ function useTokenWithdraw(options = {}) {
|
|
|
6175
6310
|
);
|
|
6176
6311
|
}
|
|
6177
6312
|
}
|
|
6313
|
+
connectedAddressRef.current = address;
|
|
6178
6314
|
setConnectedAddress(address);
|
|
6179
6315
|
onConnect == null ? void 0 : onConnect(address);
|
|
6180
6316
|
if (!isSameAddress(address, targetAddress)) {
|
|
@@ -6212,11 +6348,14 @@ function useTokenWithdraw(options = {}) {
|
|
|
6212
6348
|
if (chainInfo) {
|
|
6213
6349
|
currentChainRef.current = chainInfo;
|
|
6214
6350
|
}
|
|
6215
|
-
|
|
6351
|
+
const initialTokens = [toWithdrawItem(token)];
|
|
6352
|
+
tokensRef.current = initialTokens;
|
|
6353
|
+
setTokens(initialTokens);
|
|
6216
6354
|
setError(null);
|
|
6217
6355
|
setErrorType(null);
|
|
6218
6356
|
setTxHash(null);
|
|
6219
6357
|
setIsGasInsufficient(false);
|
|
6358
|
+
connectedAddressRef.current = null;
|
|
6220
6359
|
setConnectedAddress(null);
|
|
6221
6360
|
setStatus("init");
|
|
6222
6361
|
},
|
|
@@ -6236,11 +6375,14 @@ function useTokenWithdraw(options = {}) {
|
|
|
6236
6375
|
currentChainRef.current = chainInfo;
|
|
6237
6376
|
}
|
|
6238
6377
|
}
|
|
6239
|
-
|
|
6378
|
+
const initialTokens = withdrawableTokens.map(toWithdrawItem);
|
|
6379
|
+
tokensRef.current = initialTokens;
|
|
6380
|
+
setTokens(initialTokens);
|
|
6240
6381
|
setError(null);
|
|
6241
6382
|
setErrorType(null);
|
|
6242
6383
|
setTxHash(null);
|
|
6243
6384
|
setIsGasInsufficient(false);
|
|
6385
|
+
connectedAddressRef.current = null;
|
|
6244
6386
|
setConnectedAddress(null);
|
|
6245
6387
|
setStatus("init");
|
|
6246
6388
|
},
|
|
@@ -6259,11 +6401,13 @@ function useTokenWithdraw(options = {}) {
|
|
|
6259
6401
|
currentChainRef.current = chainInfo;
|
|
6260
6402
|
}
|
|
6261
6403
|
}
|
|
6404
|
+
tokensRef.current = items;
|
|
6262
6405
|
setTokens(items);
|
|
6263
6406
|
setError(null);
|
|
6264
6407
|
setErrorType(null);
|
|
6265
6408
|
setTxHash(null);
|
|
6266
6409
|
setIsGasInsufficient(false);
|
|
6410
|
+
connectedAddressRef.current = null;
|
|
6267
6411
|
setConnectedAddress(null);
|
|
6268
6412
|
setStatus("init");
|
|
6269
6413
|
},
|
|
@@ -6273,7 +6417,8 @@ function useTokenWithdraw(options = {}) {
|
|
|
6273
6417
|
var _a;
|
|
6274
6418
|
const chainInfo = currentChainRef.current;
|
|
6275
6419
|
if (!chainInfo) {
|
|
6276
|
-
const
|
|
6420
|
+
const activeTokens = tokensRef.current.length > 0 ? tokensRef.current : tokens;
|
|
6421
|
+
const chainName = (_a = activeTokens[0]) == null ? void 0 : _a.chain;
|
|
6277
6422
|
if (!chainName) {
|
|
6278
6423
|
setError(new Error("No tokens available"));
|
|
6279
6424
|
return false;
|
|
@@ -6313,6 +6458,15 @@ function useTokenWithdraw(options = {}) {
|
|
|
6313
6458
|
return true;
|
|
6314
6459
|
} catch (err) {
|
|
6315
6460
|
const errType = parseTxError(err);
|
|
6461
|
+
console.error(`${RESEND_LOG_PREFIX$1} checkAndConnect failed`, {
|
|
6462
|
+
errType,
|
|
6463
|
+
chain: chain.name,
|
|
6464
|
+
chainId: chain.id,
|
|
6465
|
+
isResend,
|
|
6466
|
+
nonce: resend2 == null ? void 0 : resend2.nonce,
|
|
6467
|
+
receiverAddress: resend2 == null ? void 0 : resend2.receiverAddress,
|
|
6468
|
+
error: err
|
|
6469
|
+
});
|
|
6316
6470
|
setError(err instanceof Error ? err : new Error("Connection failed"));
|
|
6317
6471
|
setErrorType(errType);
|
|
6318
6472
|
setStatus("init");
|
|
@@ -6328,34 +6482,75 @@ function useTokenWithdraw(options = {}) {
|
|
|
6328
6482
|
onError
|
|
6329
6483
|
]);
|
|
6330
6484
|
const confirmWithdraw = useCallback(async () => {
|
|
6485
|
+
var _a;
|
|
6331
6486
|
if (!api) {
|
|
6487
|
+
console.warn(`${RESEND_LOG_PREFIX$1} confirmWithdraw guard hit`, {
|
|
6488
|
+
reason: "missing_api",
|
|
6489
|
+
isResend,
|
|
6490
|
+
nonce: resend2 == null ? void 0 : resend2.nonce
|
|
6491
|
+
});
|
|
6332
6492
|
setError(new Error("TaskOn client not initialized"));
|
|
6333
6493
|
return;
|
|
6334
6494
|
}
|
|
6335
|
-
|
|
6495
|
+
const activeConnectedAddress = connectedAddressRef.current ?? connectedAddress ?? evmAddress ?? null;
|
|
6496
|
+
if (!activeConnectedAddress) {
|
|
6497
|
+
console.warn(`${RESEND_LOG_PREFIX$1} confirmWithdraw guard hit`, {
|
|
6498
|
+
reason: "missing_connected_address",
|
|
6499
|
+
isResend,
|
|
6500
|
+
nonce: resend2 == null ? void 0 : resend2.nonce,
|
|
6501
|
+
evmAddress
|
|
6502
|
+
});
|
|
6336
6503
|
setError(new Error("Wallet not connected"));
|
|
6337
6504
|
return;
|
|
6338
6505
|
}
|
|
6339
6506
|
if (!userId) {
|
|
6507
|
+
console.warn(`${RESEND_LOG_PREFIX$1} confirmWithdraw guard hit`, {
|
|
6508
|
+
reason: "missing_user_id",
|
|
6509
|
+
isResend,
|
|
6510
|
+
nonce: resend2 == null ? void 0 : resend2.nonce
|
|
6511
|
+
});
|
|
6340
6512
|
setError(new Error("User not logged in"));
|
|
6341
6513
|
return;
|
|
6342
6514
|
}
|
|
6343
|
-
|
|
6515
|
+
const activeTokens = tokensRef.current.length > 0 ? tokensRef.current : tokens;
|
|
6516
|
+
if (activeTokens.length === 0) {
|
|
6517
|
+
console.warn(`${RESEND_LOG_PREFIX$1} confirmWithdraw guard hit`, {
|
|
6518
|
+
reason: "empty_tokens",
|
|
6519
|
+
isResend,
|
|
6520
|
+
nonce: resend2 == null ? void 0 : resend2.nonce
|
|
6521
|
+
});
|
|
6344
6522
|
setError(new Error("No tokens to withdraw"));
|
|
6345
6523
|
return;
|
|
6346
6524
|
}
|
|
6347
6525
|
const chainInfo = currentChainRef.current;
|
|
6348
6526
|
if (!chainInfo) {
|
|
6527
|
+
console.warn(`${RESEND_LOG_PREFIX$1} confirmWithdraw guard hit`, {
|
|
6528
|
+
reason: "missing_chain_info",
|
|
6529
|
+
isResend,
|
|
6530
|
+
nonce: resend2 == null ? void 0 : resend2.nonce
|
|
6531
|
+
});
|
|
6349
6532
|
setError(new Error("Chain configuration not found"));
|
|
6350
6533
|
return;
|
|
6351
6534
|
}
|
|
6352
6535
|
if (chainInfo.chain_type !== ChainType.evm) {
|
|
6536
|
+
console.warn(`${RESEND_LOG_PREFIX$1} confirmWithdraw guard hit`, {
|
|
6537
|
+
reason: "unsupported_chain_type",
|
|
6538
|
+
isResend,
|
|
6539
|
+
nonce: resend2 == null ? void 0 : resend2.nonce,
|
|
6540
|
+
chainType: chainInfo.chain_type
|
|
6541
|
+
});
|
|
6353
6542
|
setError(
|
|
6354
6543
|
new Error(`Withdrawal not supported for ${chainInfo.chain_type} chains yet`)
|
|
6355
6544
|
);
|
|
6356
6545
|
return;
|
|
6357
6546
|
}
|
|
6358
6547
|
if (!chainInfo.taskonfund_token_contract) {
|
|
6548
|
+
console.warn(`${RESEND_LOG_PREFIX$1} confirmWithdraw guard hit`, {
|
|
6549
|
+
reason: "missing_withdraw_contract",
|
|
6550
|
+
isResend,
|
|
6551
|
+
nonce: resend2 == null ? void 0 : resend2.nonce,
|
|
6552
|
+
chain: chainInfo.name
|
|
6553
|
+
});
|
|
6359
6554
|
setError(new Error("Withdraw contract address not configured"));
|
|
6360
6555
|
return;
|
|
6361
6556
|
}
|
|
@@ -6363,11 +6558,11 @@ function useTokenWithdraw(options = {}) {
|
|
|
6363
6558
|
setError(null);
|
|
6364
6559
|
setErrorType(null);
|
|
6365
6560
|
try {
|
|
6366
|
-
const tokenParams =
|
|
6561
|
+
const tokenParams = activeTokens.map((t) => ({
|
|
6367
6562
|
token_id: t.tokenId,
|
|
6368
6563
|
amount: t.amount
|
|
6369
6564
|
}));
|
|
6370
|
-
const receiverAddress = isResend ? resend2.receiverAddress :
|
|
6565
|
+
const receiverAddress = isResend ? resend2.receiverAddress : activeConnectedAddress;
|
|
6371
6566
|
const withdrawResult = await api.tokenWithdraw({
|
|
6372
6567
|
chain: chainInfo.name,
|
|
6373
6568
|
receiver_address: receiverAddress,
|
|
@@ -6375,7 +6570,22 @@ function useTokenWithdraw(options = {}) {
|
|
|
6375
6570
|
// 重发模式:传入原 nonce
|
|
6376
6571
|
...isResend && { nonce: resend2.nonce }
|
|
6377
6572
|
});
|
|
6378
|
-
const
|
|
6573
|
+
const apiReceiverAddress = ((_a = withdrawResult.receiver_address) == null ? void 0 : _a.trim()) ?? "";
|
|
6574
|
+
const contractReceiverAddress = apiReceiverAddress || receiverAddress;
|
|
6575
|
+
if (!contractReceiverAddress) {
|
|
6576
|
+
throw new Error("Withdraw receiver address is empty");
|
|
6577
|
+
}
|
|
6578
|
+
if (!apiReceiverAddress) {
|
|
6579
|
+
console.warn(
|
|
6580
|
+
`${RESEND_LOG_PREFIX$1} api withdraw result missing receiver_address, fallback to request receiver`,
|
|
6581
|
+
{
|
|
6582
|
+
isResend,
|
|
6583
|
+
nonce: withdrawResult.nonce,
|
|
6584
|
+
requestReceiverAddress: receiverAddress
|
|
6585
|
+
}
|
|
6586
|
+
);
|
|
6587
|
+
}
|
|
6588
|
+
const tokenAmounts = activeTokens.map((t) => ({
|
|
6379
6589
|
token: t.tokenAddress,
|
|
6380
6590
|
// 使用实际精度计算的 Wei 金额
|
|
6381
6591
|
amount: t.amountInWei || toWei(t.amount, t.tokenDecimals)
|
|
@@ -6391,7 +6601,7 @@ function useTokenWithdraw(options = {}) {
|
|
|
6391
6601
|
params: [
|
|
6392
6602
|
userId,
|
|
6393
6603
|
tokenAmounts,
|
|
6394
|
-
|
|
6604
|
+
contractReceiverAddress,
|
|
6395
6605
|
withdrawResult.nonce,
|
|
6396
6606
|
withdrawResult.expired_height,
|
|
6397
6607
|
withdrawResult.signatures
|
|
@@ -6404,6 +6614,16 @@ function useTokenWithdraw(options = {}) {
|
|
|
6404
6614
|
} catch (err) {
|
|
6405
6615
|
const errType = parseTxError(err);
|
|
6406
6616
|
const error22 = err instanceof Error ? err : new Error("Withdrawal failed");
|
|
6617
|
+
console.error(`${RESEND_LOG_PREFIX$1} confirmWithdraw failed`, {
|
|
6618
|
+
errType,
|
|
6619
|
+
chain: chainInfo.name,
|
|
6620
|
+
chainId: chainInfo.id,
|
|
6621
|
+
isResend,
|
|
6622
|
+
nonce: resend2 == null ? void 0 : resend2.nonce,
|
|
6623
|
+
receiverAddress: isResend ? resend2 == null ? void 0 : resend2.receiverAddress : activeConnectedAddress,
|
|
6624
|
+
tokenCount: activeTokens.length,
|
|
6625
|
+
error: err
|
|
6626
|
+
});
|
|
6407
6627
|
setError(error22);
|
|
6408
6628
|
setErrorType(errType);
|
|
6409
6629
|
if (errType === TxErrorType.Canceled) {
|
|
@@ -6417,6 +6637,7 @@ function useTokenWithdraw(options = {}) {
|
|
|
6417
6637
|
}, [
|
|
6418
6638
|
api,
|
|
6419
6639
|
connectedAddress,
|
|
6640
|
+
evmAddress,
|
|
6420
6641
|
userId,
|
|
6421
6642
|
tokens,
|
|
6422
6643
|
isResend,
|
|
@@ -6432,8 +6653,10 @@ function useTokenWithdraw(options = {}) {
|
|
|
6432
6653
|
setTimeout(() => {
|
|
6433
6654
|
setStatus("init");
|
|
6434
6655
|
setTokens([]);
|
|
6656
|
+
tokensRef.current = [];
|
|
6435
6657
|
setError(null);
|
|
6436
6658
|
setErrorType(null);
|
|
6659
|
+
connectedAddressRef.current = null;
|
|
6437
6660
|
setConnectedAddress(null);
|
|
6438
6661
|
currentChainRef.current = null;
|
|
6439
6662
|
}, 100);
|
|
@@ -6441,10 +6664,12 @@ function useTokenWithdraw(options = {}) {
|
|
|
6441
6664
|
const reset = useCallback(() => {
|
|
6442
6665
|
setStatus("init");
|
|
6443
6666
|
setTokens([]);
|
|
6667
|
+
tokensRef.current = [];
|
|
6444
6668
|
setError(null);
|
|
6445
6669
|
setErrorType(null);
|
|
6446
6670
|
setTxHash(null);
|
|
6447
6671
|
setIsGasInsufficient(false);
|
|
6672
|
+
connectedAddressRef.current = null;
|
|
6448
6673
|
setConnectedAddress(null);
|
|
6449
6674
|
currentChainRef.current = null;
|
|
6450
6675
|
}, []);
|
|
@@ -6473,7 +6698,8 @@ function usePointsHistory(options) {
|
|
|
6473
6698
|
pageSize = USER_CENTER_PAGE_SIZE,
|
|
6474
6699
|
autoLoad = true
|
|
6475
6700
|
} = options;
|
|
6476
|
-
const { client } = useTaskOnContext();
|
|
6701
|
+
const { client, userToken } = useTaskOnContext();
|
|
6702
|
+
const authKey = userToken ?? "__anonymous__";
|
|
6477
6703
|
const [data, setData] = useState([]);
|
|
6478
6704
|
const [loading2, setLoading] = useState(false);
|
|
6479
6705
|
const [error2, setError] = useState(null);
|
|
@@ -6515,7 +6741,7 @@ function usePointsHistory(options) {
|
|
|
6515
6741
|
setLoading(false);
|
|
6516
6742
|
}
|
|
6517
6743
|
},
|
|
6518
|
-
[client, pointsId, pageSize]
|
|
6744
|
+
[client, pointsId, pageSize, authKey]
|
|
6519
6745
|
);
|
|
6520
6746
|
const refresh = useCallback(() => {
|
|
6521
6747
|
fetchData(pagination.page);
|
|
@@ -7638,211 +7864,19 @@ function WithdrawFormInit({
|
|
|
7638
7864
|
) })
|
|
7639
7865
|
] });
|
|
7640
7866
|
}
|
|
7867
|
+
const RESEND_LOG_PREFIX = "[UserCenter][WithdrawResend]";
|
|
7641
7868
|
function formatAmount(amount) {
|
|
7642
|
-
const
|
|
7643
|
-
if (isNaN(
|
|
7644
|
-
|
|
7645
|
-
}
|
|
7646
|
-
|
|
7647
|
-
messages,
|
|
7648
|
-
tokens,
|
|
7649
|
-
loading: loading2,
|
|
7650
|
-
error: error2,
|
|
7651
|
-
onConfirm,
|
|
7652
|
-
onCancel
|
|
7653
|
-
}) {
|
|
7654
|
-
return /* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-confirm", children: [
|
|
7655
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-withdraw-confirm__header", children: /* @__PURE__ */ jsx("h3", { className: "taskon-withdraw-confirm__title", children: messages.withdraw_confirm }) }),
|
|
7656
|
-
/* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-confirm__content", children: [
|
|
7657
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-withdraw-confirm__tokens", children: tokens.map((token) => /* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-confirm__token", children: [
|
|
7658
|
-
/* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-confirm__token-info", children: [
|
|
7659
|
-
token.tokenIcon && /* @__PURE__ */ jsx(
|
|
7660
|
-
"img",
|
|
7661
|
-
{
|
|
7662
|
-
src: token.tokenIcon,
|
|
7663
|
-
alt: token.tokenSymbol,
|
|
7664
|
-
className: "taskon-withdraw-confirm__token-icon"
|
|
7665
|
-
}
|
|
7666
|
-
),
|
|
7667
|
-
/* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-confirm__token-details", children: [
|
|
7668
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-withdraw-confirm__token-symbol", children: token.tokenSymbol }),
|
|
7669
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-withdraw-confirm__token-chain", children: token.chainLabel })
|
|
7670
|
-
] })
|
|
7671
|
-
] }),
|
|
7672
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-withdraw-confirm__token-amount", children: formatAmount(token.amount) })
|
|
7673
|
-
] }, token.tokenId)) }),
|
|
7674
|
-
error2 && /* @__PURE__ */ jsx("div", { className: "taskon-withdraw-confirm__error", children: error2.message })
|
|
7675
|
-
] }),
|
|
7676
|
-
/* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-confirm__footer", children: [
|
|
7677
|
-
/* @__PURE__ */ jsx(
|
|
7678
|
-
Button,
|
|
7679
|
-
{
|
|
7680
|
-
variant: "secondary",
|
|
7681
|
-
onClick: onCancel,
|
|
7682
|
-
disabled: loading2,
|
|
7683
|
-
children: messages.cancel
|
|
7684
|
-
}
|
|
7685
|
-
),
|
|
7686
|
-
/* @__PURE__ */ jsx(
|
|
7687
|
-
Button,
|
|
7688
|
-
{
|
|
7689
|
-
variant: "primary",
|
|
7690
|
-
onClick: onConfirm,
|
|
7691
|
-
disabled: loading2,
|
|
7692
|
-
loading: loading2,
|
|
7693
|
-
children: loading2 ? messages.loading : messages.confirm
|
|
7694
|
-
}
|
|
7695
|
-
)
|
|
7696
|
-
] })
|
|
7697
|
-
] });
|
|
7698
|
-
}
|
|
7699
|
-
function WithdrawLoading({
|
|
7700
|
-
messages
|
|
7701
|
-
}) {
|
|
7702
|
-
return /* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-loading", children: [
|
|
7703
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-withdraw-loading__spinner", children: /* @__PURE__ */ jsx(
|
|
7704
|
-
"svg",
|
|
7705
|
-
{
|
|
7706
|
-
viewBox: "0 0 50 50",
|
|
7707
|
-
width: "64",
|
|
7708
|
-
height: "64",
|
|
7709
|
-
className: "taskon-withdraw-loading__circle",
|
|
7710
|
-
children: /* @__PURE__ */ jsx(
|
|
7711
|
-
"circle",
|
|
7712
|
-
{
|
|
7713
|
-
cx: "25",
|
|
7714
|
-
cy: "25",
|
|
7715
|
-
r: "20",
|
|
7716
|
-
fill: "none",
|
|
7717
|
-
stroke: "currentColor",
|
|
7718
|
-
strokeWidth: "4",
|
|
7719
|
-
strokeLinecap: "round",
|
|
7720
|
-
strokeDasharray: "80, 200",
|
|
7721
|
-
strokeDashoffset: "0"
|
|
7722
|
-
}
|
|
7723
|
-
)
|
|
7724
|
-
}
|
|
7725
|
-
) }),
|
|
7726
|
-
/* @__PURE__ */ jsx("p", { className: "taskon-withdraw-loading__text", children: messages.withdrawing })
|
|
7727
|
-
] });
|
|
7728
|
-
}
|
|
7729
|
-
function WithdrawSuccess({
|
|
7730
|
-
messages,
|
|
7731
|
-
txHash,
|
|
7732
|
-
onClose
|
|
7733
|
-
}) {
|
|
7734
|
-
return /* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-success", children: [
|
|
7735
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-withdraw-success__icon", children: /* @__PURE__ */ jsx(
|
|
7736
|
-
"svg",
|
|
7737
|
-
{
|
|
7738
|
-
viewBox: "0 0 24 24",
|
|
7739
|
-
fill: "currentColor",
|
|
7740
|
-
width: "64",
|
|
7741
|
-
height: "64",
|
|
7742
|
-
children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })
|
|
7743
|
-
}
|
|
7744
|
-
) }),
|
|
7745
|
-
/* @__PURE__ */ jsx("h3", { className: "taskon-withdraw-success__title", children: messages.withdraw_success }),
|
|
7746
|
-
txHash && /* @__PURE__ */ jsxs("p", { className: "taskon-withdraw-success__tx-hash", children: [
|
|
7747
|
-
"TX: ",
|
|
7748
|
-
txHash.slice(0, 10),
|
|
7749
|
-
"...",
|
|
7750
|
-
txHash.slice(-8)
|
|
7751
|
-
] }),
|
|
7752
|
-
/* @__PURE__ */ jsx(
|
|
7753
|
-
Button,
|
|
7754
|
-
{
|
|
7755
|
-
variant: "primary",
|
|
7756
|
-
onClick: onClose,
|
|
7757
|
-
className: "taskon-withdraw-success__btn",
|
|
7758
|
-
children: messages.close
|
|
7759
|
-
}
|
|
7760
|
-
)
|
|
7761
|
-
] });
|
|
7762
|
-
}
|
|
7763
|
-
function WithdrawCancel({
|
|
7764
|
-
messages,
|
|
7765
|
-
onRetry,
|
|
7766
|
-
onClose
|
|
7767
|
-
}) {
|
|
7768
|
-
return /* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-cancel", children: [
|
|
7769
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-withdraw-cancel__icon", children: /* @__PURE__ */ jsx(
|
|
7770
|
-
"svg",
|
|
7771
|
-
{
|
|
7772
|
-
viewBox: "0 0 24 24",
|
|
7773
|
-
fill: "currentColor",
|
|
7774
|
-
width: "64",
|
|
7775
|
-
height: "64",
|
|
7776
|
-
children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z" })
|
|
7777
|
-
}
|
|
7778
|
-
) }),
|
|
7779
|
-
/* @__PURE__ */ jsx("h3", { className: "taskon-withdraw-cancel__title", children: messages.withdraw_canceled }),
|
|
7780
|
-
/* @__PURE__ */ jsx("p", { className: "taskon-withdraw-cancel__message", children: messages.withdraw_canceled_message }),
|
|
7781
|
-
/* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-cancel__actions", children: [
|
|
7782
|
-
/* @__PURE__ */ jsx(
|
|
7783
|
-
Button,
|
|
7784
|
-
{
|
|
7785
|
-
variant: "secondary",
|
|
7786
|
-
onClick: onClose,
|
|
7787
|
-
children: messages.close
|
|
7788
|
-
}
|
|
7789
|
-
),
|
|
7790
|
-
/* @__PURE__ */ jsx(
|
|
7791
|
-
Button,
|
|
7792
|
-
{
|
|
7793
|
-
variant: "primary",
|
|
7794
|
-
onClick: onRetry,
|
|
7795
|
-
children: messages.retry
|
|
7796
|
-
}
|
|
7797
|
-
)
|
|
7798
|
-
] })
|
|
7799
|
-
] });
|
|
7800
|
-
}
|
|
7801
|
-
function WithdrawGasNotEnough({
|
|
7802
|
-
messages,
|
|
7803
|
-
chainLabel,
|
|
7804
|
-
onClose
|
|
7805
|
-
}) {
|
|
7806
|
-
const message = chainLabel ? messages.gas_not_enough_description_with_chain.replace("{chain}", chainLabel) : messages.gas_not_enough_description;
|
|
7807
|
-
return /* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-gas-not-enough", children: [
|
|
7808
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-withdraw-gas-not-enough__icon", children: /* @__PURE__ */ jsx(
|
|
7809
|
-
"svg",
|
|
7810
|
-
{
|
|
7811
|
-
viewBox: "0 0 24 24",
|
|
7812
|
-
fill: "currentColor",
|
|
7813
|
-
width: "64",
|
|
7814
|
-
height: "64",
|
|
7815
|
-
children: /* @__PURE__ */ jsx("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" })
|
|
7816
|
-
}
|
|
7817
|
-
) }),
|
|
7818
|
-
/* @__PURE__ */ jsx("h3", { className: "taskon-withdraw-gas-not-enough__title", children: messages.gas_not_enough }),
|
|
7819
|
-
/* @__PURE__ */ jsx("p", { className: "taskon-withdraw-gas-not-enough__message", children: message }),
|
|
7820
|
-
/* @__PURE__ */ jsx(
|
|
7821
|
-
Button,
|
|
7822
|
-
{
|
|
7823
|
-
variant: "primary",
|
|
7824
|
-
onClick: onClose,
|
|
7825
|
-
className: "taskon-withdraw-gas-not-enough__btn",
|
|
7826
|
-
children: messages.close
|
|
7827
|
-
}
|
|
7828
|
-
)
|
|
7829
|
-
] });
|
|
7869
|
+
const value = parseFloat(amount);
|
|
7870
|
+
if (Number.isNaN(value) || value <= 0) {
|
|
7871
|
+
return "0";
|
|
7872
|
+
}
|
|
7873
|
+
return value.toLocaleString(void 0, { maximumFractionDigits: 6 });
|
|
7830
7874
|
}
|
|
7831
|
-
function
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
return messages.withdraw_confirm;
|
|
7835
|
-
case "loading":
|
|
7836
|
-
return messages.loading;
|
|
7837
|
-
case "success":
|
|
7838
|
-
return messages.withdraw_success;
|
|
7839
|
-
case "cancel":
|
|
7840
|
-
return messages.withdraw_canceled;
|
|
7841
|
-
case "noEnough":
|
|
7842
|
-
return messages.gas_not_enough;
|
|
7843
|
-
default:
|
|
7844
|
-
return messages.withdraw;
|
|
7875
|
+
function formatTxHash(hash) {
|
|
7876
|
+
if (hash.length <= 16) {
|
|
7877
|
+
return hash;
|
|
7845
7878
|
}
|
|
7879
|
+
return `${hash.slice(0, 10)}...${hash.slice(-6)}`;
|
|
7846
7880
|
}
|
|
7847
7881
|
function WithdrawForm({
|
|
7848
7882
|
open,
|
|
@@ -7856,8 +7890,11 @@ function WithdrawForm({
|
|
|
7856
7890
|
onClose,
|
|
7857
7891
|
onSuccess
|
|
7858
7892
|
}) {
|
|
7893
|
+
var _a, _b;
|
|
7859
7894
|
const { messages } = useUserCenterLocale();
|
|
7860
7895
|
const [submitting, setSubmitting] = useState(false);
|
|
7896
|
+
const [showInsufficientBalanceNotice, setShowInsufficientBalanceNotice] = useState(false);
|
|
7897
|
+
const [insufficientBalanceNoticeDesc, setInsufficientBalanceNoticeDesc] = useState("");
|
|
7861
7898
|
const { toast } = useToast();
|
|
7862
7899
|
const { userInfo } = useTaskOnContext();
|
|
7863
7900
|
const isResendMode = Boolean(
|
|
@@ -7875,14 +7912,14 @@ function WithdrawForm({
|
|
|
7875
7912
|
messages
|
|
7876
7913
|
});
|
|
7877
7914
|
const resolvedUserAddress = useMemo(() => {
|
|
7878
|
-
var
|
|
7915
|
+
var _a2;
|
|
7879
7916
|
const explicitAddress = userAddress == null ? void 0 : userAddress.trim();
|
|
7880
7917
|
if (explicitAddress) {
|
|
7881
7918
|
return explicitAddress;
|
|
7882
7919
|
}
|
|
7883
|
-
const primaryAddress = (
|
|
7920
|
+
const primaryAddress = (_a2 = userInfo == null ? void 0 : userInfo.address.find(
|
|
7884
7921
|
(item) => item.chain_type === ChainType.evm && item.is_primary
|
|
7885
|
-
)) == null ? void 0 :
|
|
7922
|
+
)) == null ? void 0 : _a2.address;
|
|
7886
7923
|
return (primaryAddress == null ? void 0 : primaryAddress.trim()) ?? "";
|
|
7887
7924
|
}, [userAddress, userInfo]);
|
|
7888
7925
|
const showWithdrawErrorToast = useCallback(
|
|
@@ -7901,7 +7938,10 @@ function WithdrawForm({
|
|
|
7901
7938
|
toast.error(messages.error_network_switch);
|
|
7902
7939
|
break;
|
|
7903
7940
|
case TxErrorType.BalanceNotEnough:
|
|
7904
|
-
|
|
7941
|
+
setInsufficientBalanceNoticeDesc(
|
|
7942
|
+
error2.message.toLowerCase().includes("gas") ? messages.error_insufficient_gas : messages.amount_exceeds_balance
|
|
7943
|
+
);
|
|
7944
|
+
setShowInsufficientBalanceNotice(true);
|
|
7905
7945
|
break;
|
|
7906
7946
|
case TxErrorType.ConnectFailed:
|
|
7907
7947
|
toast.error(messages.failed_connect_wallet);
|
|
@@ -7929,11 +7969,25 @@ function WithdrawForm({
|
|
|
7929
7969
|
}
|
|
7930
7970
|
});
|
|
7931
7971
|
const handleResendSubmit = useCallback(async () => {
|
|
7972
|
+
console.info(`${RESEND_LOG_PREFIX} submit resend`, {
|
|
7973
|
+
nonce: resend2 == null ? void 0 : resend2.nonce,
|
|
7974
|
+
receiverAddress: resend2 == null ? void 0 : resend2.receiverAddress,
|
|
7975
|
+
resolvedUserAddress,
|
|
7976
|
+
tokenCount: (resendTokenItems == null ? void 0 : resendTokenItems.length) ?? 0
|
|
7977
|
+
});
|
|
7932
7978
|
if (!resolvedUserAddress) {
|
|
7979
|
+
console.warn(`${RESEND_LOG_PREFIX} blocked in modal`, {
|
|
7980
|
+
reason: "missing_resolved_user_address",
|
|
7981
|
+
nonce: resend2 == null ? void 0 : resend2.nonce
|
|
7982
|
+
});
|
|
7933
7983
|
toast.error(messages.wallet_not_bind);
|
|
7934
7984
|
return;
|
|
7935
7985
|
}
|
|
7936
7986
|
if (!resendTokenItems || resendTokenItems.length === 0) {
|
|
7987
|
+
console.warn(`${RESEND_LOG_PREFIX} blocked in modal`, {
|
|
7988
|
+
reason: "empty_resend_token_items",
|
|
7989
|
+
nonce: resend2 == null ? void 0 : resend2.nonce
|
|
7990
|
+
});
|
|
7937
7991
|
toast.error(messages.no_tokens_for_resend);
|
|
7938
7992
|
return;
|
|
7939
7993
|
}
|
|
@@ -7942,16 +7996,28 @@ function WithdrawForm({
|
|
|
7942
7996
|
withdraw2.initWithdrawTokens(resendTokenItems);
|
|
7943
7997
|
const canProceed = await withdraw2.checkAndConnect();
|
|
7944
7998
|
if (!canProceed) {
|
|
7999
|
+
console.warn(`${RESEND_LOG_PREFIX} checkAndConnect returned false`, {
|
|
8000
|
+
nonce: resend2 == null ? void 0 : resend2.nonce,
|
|
8001
|
+
status: withdraw2.status,
|
|
8002
|
+
error: withdraw2.error
|
|
8003
|
+
});
|
|
7945
8004
|
return;
|
|
7946
8005
|
}
|
|
8006
|
+
console.info(`${RESEND_LOG_PREFIX} confirm resend`, {
|
|
8007
|
+
nonce: resend2 == null ? void 0 : resend2.nonce
|
|
8008
|
+
});
|
|
7947
8009
|
await withdraw2.confirmWithdraw();
|
|
7948
8010
|
} catch (error2) {
|
|
7949
|
-
console.error(
|
|
8011
|
+
console.error(`${RESEND_LOG_PREFIX} resend submit failed`, {
|
|
8012
|
+
nonce: resend2 == null ? void 0 : resend2.nonce,
|
|
8013
|
+
error: error2
|
|
8014
|
+
});
|
|
7950
8015
|
} finally {
|
|
7951
8016
|
setSubmitting(false);
|
|
7952
8017
|
}
|
|
7953
8018
|
}, [
|
|
7954
8019
|
resolvedUserAddress,
|
|
8020
|
+
resend2,
|
|
7955
8021
|
resendTokenItems,
|
|
7956
8022
|
withdraw2,
|
|
7957
8023
|
toast,
|
|
@@ -8003,6 +8069,8 @@ function WithdrawForm({
|
|
|
8003
8069
|
await withdraw2.confirmWithdraw();
|
|
8004
8070
|
}, [withdraw2]);
|
|
8005
8071
|
const handleClose = useCallback(() => {
|
|
8072
|
+
setShowInsufficientBalanceNotice(false);
|
|
8073
|
+
setInsufficientBalanceNoticeDesc("");
|
|
8006
8074
|
withdraw2.reset();
|
|
8007
8075
|
form.resetForm();
|
|
8008
8076
|
onClose();
|
|
@@ -8010,24 +8078,40 @@ function WithdrawForm({
|
|
|
8010
8078
|
if (!open) {
|
|
8011
8079
|
return null;
|
|
8012
8080
|
}
|
|
8013
|
-
const
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
onConfirm: handleResendSubmit,
|
|
8026
|
-
onCancel: handleClose
|
|
8027
|
-
}
|
|
8028
|
-
);
|
|
8081
|
+
const showInitFormDialog = withdraw2.status === "init" && !isResendMode;
|
|
8082
|
+
const showResendConfirmDialog = withdraw2.status === "init" && isResendMode;
|
|
8083
|
+
const gasChainLabel = ((_a = resendTokenItems == null ? void 0 : resendTokenItems[0]) == null ? void 0 : _a.chainLabel) ?? ((_b = form.selectedToken) == null ? void 0 : _b.chain_label) ?? "";
|
|
8084
|
+
const gasNotEnoughDescription = gasChainLabel ? messages.gas_not_enough_description_with_chain.replace("{chain}", gasChainLabel) : messages.gas_not_enough_description;
|
|
8085
|
+
const renderTokenSummary = (tokens) => /* @__PURE__ */ jsx("div", { className: "taskon-withdraw-notice__tokens", children: tokens.map((token) => /* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-notice__token", children: [
|
|
8086
|
+
/* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-notice__token-info", children: [
|
|
8087
|
+
token.tokenIcon && /* @__PURE__ */ jsx(
|
|
8088
|
+
"img",
|
|
8089
|
+
{
|
|
8090
|
+
src: token.tokenIcon,
|
|
8091
|
+
alt: token.tokenSymbol,
|
|
8092
|
+
className: "taskon-withdraw-notice__token-icon"
|
|
8029
8093
|
}
|
|
8030
|
-
|
|
8094
|
+
),
|
|
8095
|
+
/* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-notice__token-details", children: [
|
|
8096
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-withdraw-notice__token-symbol", children: token.tokenSymbol }),
|
|
8097
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-withdraw-notice__token-chain", children: token.chainLabel })
|
|
8098
|
+
] })
|
|
8099
|
+
] }),
|
|
8100
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-withdraw-notice__token-amount", children: formatAmount(token.amount) })
|
|
8101
|
+
] }, token.tokenId)) });
|
|
8102
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8103
|
+
/* @__PURE__ */ jsx(
|
|
8104
|
+
Dialog,
|
|
8105
|
+
{
|
|
8106
|
+
open: open && showInitFormDialog,
|
|
8107
|
+
onOpenChange: (isOpen) => {
|
|
8108
|
+
if (!isOpen) handleClose();
|
|
8109
|
+
},
|
|
8110
|
+
title: messages.withdraw,
|
|
8111
|
+
showCloseButton: true,
|
|
8112
|
+
contentClassName: "taskon-withdraw-form__container",
|
|
8113
|
+
maxWidth: 480,
|
|
8114
|
+
children: /* @__PURE__ */ jsx(
|
|
8031
8115
|
WithdrawFormInit,
|
|
8032
8116
|
{
|
|
8033
8117
|
messages,
|
|
@@ -8053,66 +8137,170 @@ function WithdrawForm({
|
|
|
8053
8137
|
onSubmit: handleSubmit,
|
|
8054
8138
|
onClose: handleClose
|
|
8055
8139
|
}
|
|
8056
|
-
)
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
onCancel: handleCancel
|
|
8140
|
+
)
|
|
8141
|
+
}
|
|
8142
|
+
),
|
|
8143
|
+
/* @__PURE__ */ jsxs(
|
|
8144
|
+
ConfirmNoticeDialog,
|
|
8145
|
+
{
|
|
8146
|
+
open: open && showResendConfirmDialog,
|
|
8147
|
+
onOpenChange: (isOpen) => {
|
|
8148
|
+
if (!isOpen) {
|
|
8149
|
+
handleClose();
|
|
8067
8150
|
}
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8151
|
+
},
|
|
8152
|
+
title: messages.withdraw_confirm,
|
|
8153
|
+
actions: /* @__PURE__ */ jsxs("div", { className: "taskon-withdraw-notice__actions", children: [
|
|
8154
|
+
/* @__PURE__ */ jsx(
|
|
8155
|
+
"button",
|
|
8156
|
+
{
|
|
8157
|
+
type: "button",
|
|
8158
|
+
className: "taskon-confirm-notice-button taskon-confirm-notice-button--cancel taskon-withdraw-notice__action",
|
|
8159
|
+
onClick: handleClose,
|
|
8160
|
+
disabled: submitting,
|
|
8161
|
+
children: messages.cancel
|
|
8162
|
+
}
|
|
8163
|
+
),
|
|
8164
|
+
/* @__PURE__ */ jsx(
|
|
8165
|
+
"button",
|
|
8166
|
+
{
|
|
8167
|
+
type: "button",
|
|
8168
|
+
className: "taskon-confirm-notice-button taskon-confirm-notice-button--confirm taskon-withdraw-notice__action",
|
|
8169
|
+
onClick: handleResendSubmit,
|
|
8170
|
+
disabled: submitting,
|
|
8171
|
+
children: submitting ? messages.loading : messages.confirm
|
|
8172
|
+
}
|
|
8173
|
+
)
|
|
8174
|
+
] }),
|
|
8175
|
+
showCloseButton: true,
|
|
8176
|
+
accessibilityTitle: messages.withdraw_confirm,
|
|
8177
|
+
children: [
|
|
8178
|
+
renderTokenSummary(resendTokenItems ?? []),
|
|
8179
|
+
withdraw2.error && /* @__PURE__ */ jsx("div", { className: "taskon-withdraw-notice__error", children: withdraw2.error.message })
|
|
8180
|
+
]
|
|
8181
|
+
}
|
|
8182
|
+
),
|
|
8183
|
+
/* @__PURE__ */ jsxs(
|
|
8184
|
+
ConfirmNoticeDialog,
|
|
8185
|
+
{
|
|
8186
|
+
open: open && withdraw2.status === "confirm" && !isResendMode,
|
|
8187
|
+
onOpenChange: (isOpen) => {
|
|
8188
|
+
if (!isOpen) {
|
|
8189
|
+
handleClose();
|
|
8078
8190
|
}
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8191
|
+
},
|
|
8192
|
+
title: messages.withdraw_confirm,
|
|
8193
|
+
desc: messages.confirm_withdraw,
|
|
8194
|
+
cancelButton: messages.cancel,
|
|
8195
|
+
confirmButton: messages.confirm,
|
|
8196
|
+
onCancel: handleCancel,
|
|
8197
|
+
onConfirm: handleConfirm,
|
|
8198
|
+
closeOnCancel: false,
|
|
8199
|
+
closeOnConfirm: false,
|
|
8200
|
+
showCloseButton: true,
|
|
8201
|
+
accessibilityTitle: messages.withdraw_confirm,
|
|
8202
|
+
accessibilityDescription: messages.confirm_withdraw,
|
|
8203
|
+
children: [
|
|
8204
|
+
renderTokenSummary(withdraw2.tokens),
|
|
8205
|
+
withdraw2.error && /* @__PURE__ */ jsx("div", { className: "taskon-withdraw-notice__error", children: withdraw2.error.message })
|
|
8206
|
+
]
|
|
8207
|
+
}
|
|
8208
|
+
),
|
|
8209
|
+
/* @__PURE__ */ jsx(
|
|
8210
|
+
ConfirmNoticeDialog,
|
|
8211
|
+
{
|
|
8212
|
+
open: open && withdraw2.status === "loading",
|
|
8213
|
+
onOpenChange: () => void 0,
|
|
8214
|
+
title: messages.withdrawing,
|
|
8215
|
+
desc: messages.withdrawing_tip,
|
|
8216
|
+
closeOnOverlayClick: false,
|
|
8217
|
+
closeOnEscapeKey: false,
|
|
8218
|
+
accessibilityTitle: messages.withdrawing,
|
|
8219
|
+
accessibilityDescription: messages.withdrawing_tip,
|
|
8220
|
+
children: /* @__PURE__ */ jsx("div", { className: "taskon-withdraw-notice__loading", children: /* @__PURE__ */ jsx("span", { className: "taskon-withdraw-notice__spinner", "aria-hidden": true }) })
|
|
8221
|
+
}
|
|
8222
|
+
),
|
|
8223
|
+
/* @__PURE__ */ jsx(
|
|
8224
|
+
ConfirmNoticeDialog,
|
|
8225
|
+
{
|
|
8226
|
+
open: open && withdraw2.status === "success",
|
|
8227
|
+
onOpenChange: (isOpen) => {
|
|
8228
|
+
if (!isOpen) {
|
|
8229
|
+
handleClose();
|
|
8087
8230
|
}
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8231
|
+
},
|
|
8232
|
+
type: "success",
|
|
8233
|
+
title: messages.withdraw_success,
|
|
8234
|
+
confirmButton: messages.close,
|
|
8235
|
+
onConfirm: handleClose,
|
|
8236
|
+
closeOnConfirm: false,
|
|
8237
|
+
showCloseButton: true,
|
|
8238
|
+
accessibilityTitle: messages.withdraw_success,
|
|
8239
|
+
children: withdraw2.txHash && /* @__PURE__ */ jsxs("p", { className: "taskon-withdraw-notice__tx-hash", children: [
|
|
8240
|
+
"TX: ",
|
|
8241
|
+
formatTxHash(withdraw2.txHash)
|
|
8242
|
+
] })
|
|
8243
|
+
}
|
|
8244
|
+
),
|
|
8245
|
+
/* @__PURE__ */ jsx(
|
|
8246
|
+
ConfirmNoticeDialog,
|
|
8247
|
+
{
|
|
8248
|
+
open: open && withdraw2.status === "cancel",
|
|
8249
|
+
onOpenChange: (isOpen) => {
|
|
8250
|
+
if (!isOpen) {
|
|
8251
|
+
handleClose();
|
|
8096
8252
|
}
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8253
|
+
},
|
|
8254
|
+
type: "warn",
|
|
8255
|
+
title: messages.withdraw_canceled,
|
|
8256
|
+
desc: messages.withdraw_canceled_message,
|
|
8257
|
+
cancelButton: messages.close,
|
|
8258
|
+
confirmButton: messages.retry,
|
|
8259
|
+
onCancel: handleClose,
|
|
8260
|
+
onConfirm: handleRetry,
|
|
8261
|
+
closeOnCancel: false,
|
|
8262
|
+
closeOnConfirm: false,
|
|
8263
|
+
showCloseButton: true,
|
|
8264
|
+
className: "taskon-withdraw-notice--cancel",
|
|
8265
|
+
accessibilityTitle: messages.withdraw_canceled,
|
|
8266
|
+
accessibilityDescription: messages.withdraw_canceled_message
|
|
8267
|
+
}
|
|
8268
|
+
),
|
|
8269
|
+
/* @__PURE__ */ jsx(
|
|
8270
|
+
ConfirmNoticeDialog,
|
|
8271
|
+
{
|
|
8272
|
+
open: open && withdraw2.status === "noEnough",
|
|
8273
|
+
onOpenChange: (isOpen) => {
|
|
8274
|
+
if (!isOpen) {
|
|
8275
|
+
handleClose();
|
|
8276
|
+
}
|
|
8277
|
+
},
|
|
8278
|
+
type: "warn",
|
|
8279
|
+
title: messages.gas_not_enough,
|
|
8280
|
+
desc: gasNotEnoughDescription,
|
|
8281
|
+
confirmButton: messages.close,
|
|
8282
|
+
onConfirm: handleClose,
|
|
8283
|
+
closeOnConfirm: false,
|
|
8284
|
+
showCloseButton: true,
|
|
8285
|
+
accessibilityTitle: messages.gas_not_enough,
|
|
8286
|
+
accessibilityDescription: gasNotEnoughDescription
|
|
8287
|
+
}
|
|
8288
|
+
),
|
|
8289
|
+
/* @__PURE__ */ jsx(
|
|
8290
|
+
ConfirmNoticeDialog,
|
|
8291
|
+
{
|
|
8292
|
+
open: showInsufficientBalanceNotice,
|
|
8293
|
+
onOpenChange: setShowInsufficientBalanceNotice,
|
|
8294
|
+
type: "warn",
|
|
8295
|
+
title: messages.withdraw_failed,
|
|
8296
|
+
desc: insufficientBalanceNoticeDesc || messages.amount_exceeds_balance,
|
|
8297
|
+
confirmButton: messages.ok,
|
|
8298
|
+
showCloseButton: true,
|
|
8299
|
+
accessibilityTitle: messages.withdraw_failed,
|
|
8300
|
+
accessibilityDescription: insufficientBalanceNoticeDesc || messages.amount_exceeds_balance
|
|
8301
|
+
}
|
|
8302
|
+
)
|
|
8303
|
+
] });
|
|
8116
8304
|
}
|
|
8117
8305
|
export {
|
|
8118
8306
|
AssetImage as A,
|
|
@@ -8141,6 +8329,7 @@ export {
|
|
|
8141
8329
|
enMessages as n,
|
|
8142
8330
|
PendingTxDialog as o,
|
|
8143
8331
|
TipPopover as p,
|
|
8144
|
-
|
|
8332
|
+
ConfirmNoticeDialog as q,
|
|
8333
|
+
InfoIcon as r,
|
|
8145
8334
|
useUserCenterLocale as u
|
|
8146
8335
|
};
|