tek-wallet 0.0.386 → 0.0.387
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.
|
@@ -32,14 +32,17 @@ var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
|
|
|
32
32
|
var Text_1 = __importDefault(require("../Text"));
|
|
33
33
|
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
34
34
|
var jsx_runtime_2 = require("react/jsx-runtime");
|
|
35
|
+
var parsePropsData_1 = __importDefault(require("../../../utils/parsePropsData"));
|
|
35
36
|
var FeeDetail = function (_a) {
|
|
36
|
-
var feeName = _a.feeName,
|
|
37
|
+
var feeName = _a.feeName, feeInCurrency = _a.feeInCurrency, feeInUSD = _a.feeInUSD, currencyName = _a.currencyName;
|
|
37
38
|
var theme = (0, material_1.useTheme)();
|
|
38
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.fieldTitle), { whiteSpace: "nowrap" }), children: feeName }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1, width: "fit-content", alignItems: "flex-end" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value:
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.fieldTitle), { whiteSpace: "nowrap" }), children: feeName }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1, width: "fit-content", alignItems: "flex-end" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: feeInCurrency, unit: currencyName }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: feeInUSD, start: "~ $" }) })] })] }));
|
|
39
40
|
};
|
|
40
41
|
function Fees(props) {
|
|
42
|
+
var _a, _b;
|
|
41
43
|
var sx = props.sx, rest = __rest(props, ["sx"]);
|
|
42
44
|
var theme = (0, material_1.useTheme)();
|
|
45
|
+
var feesData = (0, parsePropsData_1.default)(props === null || props === void 0 ? void 0 : props.feesData);
|
|
43
46
|
return ((0, jsx_runtime_1.jsxs)(material_1.Accordion, __assign({ defaultExpanded: true }, rest, { sx: __assign({ "&.MuiAccordion-root": {
|
|
44
47
|
backgroundColor: "transparent",
|
|
45
48
|
margin: 0,
|
|
@@ -58,9 +61,15 @@ function Fees(props) {
|
|
|
58
61
|
}, "& .MuiAccordionDetails-root": {
|
|
59
62
|
paddingLeft: theme.mixins.customPadding.p12,
|
|
60
63
|
paddingRight: theme.mixins.customPadding.p12,
|
|
61
|
-
} }, sx), children: [(0, jsx_runtime_1.jsx)(material_1.AccordionSummary, { expandIcon: (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("arrow_down"), width: 20 }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "100%" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Total fees" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 1000 }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { alignItems: "stretch" }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { width: "fit-content", gap: theme.mixins.gaps.g8, alignItems: "center" }), children:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
} }, sx), children: [(0, jsx_runtime_1.jsx)(material_1.AccordionSummary, { expandIcon: (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("arrow_down"), width: 20 }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "100%" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Total fees" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 1000 }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { alignItems: "stretch" }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { width: "fit-content", gap: theme.mixins.gaps.g8, alignItems: "center" }), children: (_a = feesData === null || feesData === void 0 ? void 0 : feesData.feeDetail) === null || _a === void 0 ? void 0 : _a.map(function (item, index) {
|
|
65
|
+
var _a;
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_2.Fragment, { children: [index !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
67
|
+
borderRight: "1px dashed ".concat(theme.palette.border.white24),
|
|
68
|
+
flex: 1,
|
|
69
|
+
} })), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("timeline_dot"), width: 16 })] }, (_a = item.feeType) === null || _a === void 0 ? void 0 : _a.name));
|
|
70
|
+
}) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1, gap: theme.mixins.gaps.g8 }), children: (_b = feesData === null || feesData === void 0 ? void 0 : feesData.feeDetail) === null || _b === void 0 ? void 0 : _b.map(function (item) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(FeeDetail, { feeName: (_a = item.feeType) === null || _a === void 0 ? void 0 : _a.name, feeInCurrency: item.feeInCurrency, feeInUSD: item.feeInUSD, currencyName: "USDT" }, (_b = item.feeType) === null || _b === void 0 ? void 0 : _b.name));
|
|
73
|
+
}) })] }) })] })));
|
|
65
74
|
}
|
|
66
75
|
exports.default = Fees;
|
|
@@ -145,6 +145,7 @@ var AmountError;
|
|
|
145
145
|
})(AmountError || (exports.AmountError = AmountError = {}));
|
|
146
146
|
var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
147
147
|
var swiperKey = (0, react_1.useId)();
|
|
148
|
+
console.warn("🚀 ~ swiperKey:", swiperKey);
|
|
148
149
|
var drawerRef = (0, react_1.useRef)(null);
|
|
149
150
|
var swiperRef = (0, react_1.useRef)(null);
|
|
150
151
|
var theme = (0, material_1.useTheme)();
|
|
@@ -168,8 +169,8 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
168
169
|
var _m = (0, react_1.useState)(), selectedMethod = _m[0], setSelectedMethod = _m[1];
|
|
169
170
|
var _o = (0, react_1.useState)(), sendInfoGet = _o[0], setSendInfoGet = _o[1];
|
|
170
171
|
var _p = (0, react_1.useState)(false), isLoadingEstimateFee = _p[0], setIsLoadingEstimateFee = _p[1];
|
|
171
|
-
|
|
172
|
-
var
|
|
172
|
+
var _q = (0, react_1.useState)(), estimateFee = _q[0], setEstimateFee = _q[1];
|
|
173
|
+
var _r = (0, react_1.useState)(), recipientAddressError = _r[0], setRecipientAddressError = _r[1];
|
|
173
174
|
var onlyChangeAddress = (0, react_1.useRef)(false);
|
|
174
175
|
var withdrawToken = (0, react_1.useMemo)(function () {
|
|
175
176
|
return selectedMethod === SendMethods.TRANSFER_EXTERNAL
|
|
@@ -304,12 +305,12 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
304
305
|
var data = dataPromptly !== null && dataPromptly !== void 0 ? dataPromptly : sendInfoGet;
|
|
305
306
|
console.warn("🚀 ~ data handleSelectContinueTransferExternal:", data);
|
|
306
307
|
(_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
307
|
-
var tokenSet = findWithdrawToken((data === null || data === void 0 ? void 0 : data.jetton) || "");
|
|
308
308
|
setSelectedMethod(SendMethods.TRANSFER_EXTERNAL);
|
|
309
309
|
setRecipientAddress(data === null || data === void 0 ? void 0 : data.address);
|
|
310
310
|
if (onlyChangeAddress.current) {
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
|
+
var tokenSet = findWithdrawToken((data === null || data === void 0 ? void 0 : data.jetton) || "");
|
|
313
314
|
if (!tokenSet) {
|
|
314
315
|
gotoStep(WithdrawStep.SELECT_TOKEN);
|
|
315
316
|
}
|
|
@@ -357,6 +358,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
357
358
|
response = _a.sent();
|
|
358
359
|
console.warn("🚀 ~ handleGetEstimateFee ~ response:", response);
|
|
359
360
|
setIsLoadingEstimateFee(false);
|
|
361
|
+
setEstimateFee(response === null || response === void 0 ? void 0 : response.data);
|
|
360
362
|
return [2 /*return*/];
|
|
361
363
|
}
|
|
362
364
|
});
|
|
@@ -604,7 +606,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
604
606
|
placeholder: "Enter memo",
|
|
605
607
|
value: memo,
|
|
606
608
|
onChange: handleChangeMemo,
|
|
607
|
-
} })] })), (0, jsx_runtime_1.jsx)(Fees_1.default, {}), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, onClick: handleSend, status: !!amountError ||
|
|
609
|
+
} })] })), (0, jsx_runtime_1.jsx)(Fees_1.default, { feesData: JSON.stringify(estimateFee) }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, onClick: handleSend, status: !!amountError ||
|
|
608
610
|
!recipientAddress ||
|
|
609
611
|
!amount ||
|
|
610
612
|
!selectedToken ||
|
|
@@ -6,10 +6,10 @@ export interface GetEstimateFeeServiceQuery {
|
|
|
6
6
|
export interface GetEstimateFeeServiceResponse {
|
|
7
7
|
success: boolean;
|
|
8
8
|
message: string;
|
|
9
|
-
data:
|
|
9
|
+
data: FeesDataType;
|
|
10
10
|
timestamp: string;
|
|
11
11
|
}
|
|
12
|
-
interface
|
|
12
|
+
export interface FeesDataType {
|
|
13
13
|
feeInUSD: number;
|
|
14
14
|
feeInCurrency: number;
|
|
15
15
|
originalAmountInUSD: number;
|
|
@@ -17,15 +17,14 @@ interface Data {
|
|
|
17
17
|
originalCurrency: string;
|
|
18
18
|
feeDetail: FeeDetail[];
|
|
19
19
|
}
|
|
20
|
-
interface FeeDetail {
|
|
20
|
+
export interface FeeDetail {
|
|
21
21
|
feeType: FeeType;
|
|
22
22
|
feeInUSD: number;
|
|
23
23
|
feeInCurrency: number;
|
|
24
24
|
feePercent: number;
|
|
25
25
|
feeFixed: number;
|
|
26
26
|
}
|
|
27
|
-
interface FeeType {
|
|
27
|
+
export interface FeeType {
|
|
28
28
|
name: string;
|
|
29
29
|
slug: string;
|
|
30
30
|
}
|
|
31
|
-
export {};
|