tek-wallet 0.0.610 → 0.0.612

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.
@@ -3,8 +3,7 @@ export interface FeesProps extends Omit<AccordionProps, "children"> {
3
3
  feesData: string;
4
4
  amount: number;
5
5
  isFeePaidByAmount?: boolean;
6
- onEnoughBalanceToPayFee?: (isEnough: boolean) => void;
7
- onNotEnoughBalanceToPayFee?: () => void;
6
+ setIsEnoughBalanceToPayFee?: (isEnough: boolean) => void;
8
7
  tokenSlug: string;
9
8
  }
10
9
  declare function Fees(props: FeesProps): import("react/jsx-runtime").JSX.Element;
@@ -37,7 +37,7 @@ var react_1 = require("react");
37
37
  var ReceiveFunction_1 = __importDefault(require("../ReceiveFunction"));
38
38
  var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
39
39
  function Fees(props) {
40
- var sx = props.sx, amount = props.amount, feesDataString = props.feesData, isFeePaidByAmount = props.isFeePaidByAmount, tokenSlug = props.tokenSlug, rest = __rest(props, ["sx", "amount", "feesData", "isFeePaidByAmount", "tokenSlug"]);
40
+ var sx = props.sx, amount = props.amount, feesDataString = props.feesData, isFeePaidByAmount = props.isFeePaidByAmount, tokenSlug = props.tokenSlug, setIsEnoughBalanceToPayFee = props.setIsEnoughBalanceToPayFee, rest = __rest(props, ["sx", "amount", "feesData", "isFeePaidByAmount", "tokenSlug", "setIsEnoughBalanceToPayFee"]);
41
41
  var theme = (0, material_1.useTheme)();
42
42
  var feesData = (0, parsePropsData_1.default)(feesDataString);
43
43
  var tokens = (0, useWalletData_1.default)().tokens;
@@ -51,33 +51,32 @@ function Fees(props) {
51
51
  }, [isFeePaidByAmount, amount, tokenSlug, tokens]);
52
52
  var feeCheckedBalance = (0, react_1.useMemo)(function () {
53
53
  var _a, _b;
54
- var feeDetail = (_a = feesData === null || feesData === void 0 ? void 0 : feesData.feeDetail) !== null && _a !== void 0 ? _a : [];
55
- return ((_b = feeDetail === null || feeDetail === void 0 ? void 0 : feeDetail.map(function (fee, index, array) {
54
+ var fee_detail = (_a = feesData === null || feesData === void 0 ? void 0 : feesData.fee_detail) !== null && _a !== void 0 ? _a : [];
55
+ return ((_b = fee_detail === null || fee_detail === void 0 ? void 0 : fee_detail.map(function (fee, index, array) {
56
56
  var _a, _b;
57
- var totalFeeInCurrency = array === null || array === void 0 ? void 0 : array.reduce(function (acc, feeDetail) {
57
+ var totalfee_in_currency = array === null || array === void 0 ? void 0 : array.reduce(function (acc, fee_detail) {
58
58
  var _a, _b;
59
- if (((_a = feeDetail.currency) === null || _a === void 0 ? void 0 : _a.slug) === ((_b = fee === null || fee === void 0 ? void 0 : fee.currency) === null || _b === void 0 ? void 0 : _b.slug)) {
60
- return acc + feeDetail.feeInCurrency;
59
+ if (((_a = fee_detail.currency) === null || _a === void 0 ? void 0 : _a.slug) === ((_b = fee === null || fee === void 0 ? void 0 : fee.currency) === null || _b === void 0 ? void 0 : _b.slug)) {
60
+ return acc + fee_detail.fee_in_currency;
61
61
  }
62
62
  return acc;
63
63
  }, 0);
64
64
  var balanceUseToPaidFee = getBalanceUseToPaidFee((_b = (_a = fee === null || fee === void 0 ? void 0 : fee.currency) === null || _a === void 0 ? void 0 : _a.slug) !== null && _b !== void 0 ? _b : "");
65
- var payable = balanceUseToPaidFee >= totalFeeInCurrency;
65
+ var payable = balanceUseToPaidFee >= totalfee_in_currency;
66
66
  return __assign(__assign({}, fee), { isEnoughBalanceToPay: payable });
67
67
  })) !== null && _b !== void 0 ? _b : []);
68
- }, [feesData === null || feesData === void 0 ? void 0 : feesData.feeDetail, getBalanceUseToPaidFee]);
68
+ }, [feesData === null || feesData === void 0 ? void 0 : feesData.fee_detail, getBalanceUseToPaidFee]);
69
69
  var isNotEnoughBalanceToPayFee = (0, react_1.useMemo)(function () {
70
70
  var isNotEnoughBalanceToPay = feeCheckedBalance === null || feeCheckedBalance === void 0 ? void 0 : feeCheckedBalance.some(function (fee) { return !fee.isEnoughBalanceToPay; });
71
71
  return isNotEnoughBalanceToPay;
72
72
  }, [feeCheckedBalance]);
73
73
  (0, react_1.useEffect)(function () {
74
- var _a;
75
- if (isNotEnoughBalanceToPayFee) {
76
- (_a = props.onEnoughBalanceToPayFee) === null || _a === void 0 ? void 0 : _a.call(props, !isNotEnoughBalanceToPayFee);
74
+ if (!isNotEnoughBalanceToPayFee) {
75
+ setIsEnoughBalanceToPayFee === null || setIsEnoughBalanceToPayFee === void 0 ? void 0 : setIsEnoughBalanceToPayFee(!isNotEnoughBalanceToPayFee);
77
76
  }
78
77
  }, [isNotEnoughBalanceToPayFee]);
79
- var totalFeeInUSD = (0, react_1.useMemo)(function () {
80
- return feesData === null || feesData === void 0 ? void 0 : feesData.feeInUSD;
78
+ var totalfee_in_usd = (0, react_1.useMemo)(function () {
79
+ return feesData === null || feesData === void 0 ? void 0 : feesData.fee_in_usd;
81
80
  }, [feesData]);
82
81
  return ((0, jsx_runtime_1.jsxs)(material_1.Accordion, __assign({ defaultExpanded: true }, rest, { disableGutters: true, sx: __assign({ "&.MuiAccordion-root": {
83
82
  backgroundColor: "transparent",
@@ -113,15 +112,15 @@ function Fees(props) {
113
112
  width: "100%",
114
113
  ml: theme.mixins.gaps.g8,
115
114
  mr: theme.mixins.gaps.g8,
116
- } }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: totalFeeInUSD, start: "~ $", disableTooltip: true }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "0.5rem" }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8, pt: theme.mixins.gaps.g12 }), 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", justifyContent: "center" }), children: feeCheckedBalance === null || feeCheckedBalance === void 0 ? void 0 : feeCheckedBalance.map(function (item, index) {
115
+ } }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: totalfee_in_usd, start: "~ $", disableTooltip: true }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "0.5rem" }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8, pt: theme.mixins.gaps.g12 }), 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", justifyContent: "center" }), children: feeCheckedBalance === null || feeCheckedBalance === void 0 ? void 0 : feeCheckedBalance.map(function (item, index) {
117
116
  var _a;
118
117
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_2.Fragment, { children: [index !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
119
118
  borderRight: "1px dashed ".concat(theme.palette.border.white24),
120
119
  flex: 1,
121
- } })), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("timeline_dot"), width: 14, height: 14 })] }, (_a = item.feeType) === null || _a === void 0 ? void 0 : _a.name));
120
+ } })), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("timeline_dot"), width: 14, height: 14 })] }, (_a = item.fee_type) === null || _a === void 0 ? void 0 : _a.name));
122
121
  }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1, gap: theme.mixins.gaps.g8 }), children: feeCheckedBalance === null || feeCheckedBalance === void 0 ? void 0 : feeCheckedBalance.map(function (item) {
123
122
  var _a, _b, _c;
124
- 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: (_b = item.currency) === null || _b === void 0 ? void 0 : _b.name }, (_c = item.feeType) === null || _c === void 0 ? void 0 : _c.name));
123
+ return ((0, jsx_runtime_1.jsx)(FeeDetails, { feeName: (_a = item.fee_type) === null || _a === void 0 ? void 0 : _a.name, fee_in_currency: item.fee_in_currency, fee_in_usd: item.fee_in_usd, currencyName: (_b = item.currency) === null || _b === void 0 ? void 0 : _b.name }, (_c = item.fee_type) === null || _c === void 0 ? void 0 : _c.name));
125
124
  }) })] }), isNotEnoughBalanceToPayFee && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: ["You don't have enough balance to pay the fee, please ", " ", (0, jsx_runtime_1.jsxs)(ReceiveFunction_1.default, { children: [" ", (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
126
125
  textDecoration: "underline",
127
126
  cursor: "pointer",
@@ -129,8 +128,8 @@ function Fees(props) {
129
128
  }, children: "deposit more" })] }), " ", "to continue"] }))] }) })] })));
130
129
  }
131
130
  exports.default = Fees;
132
- var FeeDetail = function (_a) {
133
- var feeName = _a.feeName, feeInCurrency = _a.feeInCurrency, feeInUSD = _a.feeInUSD, currencyName = _a.currencyName;
131
+ var FeeDetails = function (_a) {
132
+ var feeName = _a.feeName, fee_in_currency = _a.fee_in_currency, fee_in_usd = _a.fee_in_usd, currencyName = _a.currencyName;
134
133
  var theme = (0, material_1.useTheme)();
135
134
  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: {
136
135
  fontSize: theme.typography.fontSize11,
@@ -139,5 +138,5 @@ var FeeDetail = function (_a) {
139
138
  color: theme.palette.text.accent,
140
139
  pl: theme.mixins.gaps.g12,
141
140
  whiteSpace: "nowrap",
142
- }, 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: " ".concat(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: "~ $" }) })] })] }));
141
+ }, 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: fee_in_currency, unit: " ".concat(currencyName) }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: fee_in_usd, start: "~ $" }) })] })] }));
143
142
  };
@@ -21,5 +21,5 @@ var material_1 = require("@mui/material");
21
21
  function IconText(props) {
22
22
  var title = props.title, beforeIcon = props.beforeIcon, afterIcon = props.afterIcon, sx = props.sx;
23
23
  var theme = (0, material_1.useTheme)();
24
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g12 }), children: [beforeIcon && beforeIcon, (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, sx), children: title }), afterIcon && afterIcon] }));
24
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8 }), children: [beforeIcon && beforeIcon, (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, sx), children: title }), afterIcon && afterIcon] }));
25
25
  }
@@ -104,6 +104,9 @@ var get_est_fee_service_1 = __importDefault(require("../../../services/axios/get
104
104
  var type_1 = require("../../../services/axios/get-activities-service/type");
105
105
  var validate_wallet_address_service_1 = __importDefault(require("../../../services/axios/validate-wallet-address-service"));
106
106
  var type_2 = require("../../../services/axios/validate-wallet-address-service/type");
107
+ var CopyTextComponent_1 = __importDefault(require("../CopyTextComponent"));
108
+ var safeText_1 = require("../../../utils/safeText");
109
+ var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
107
110
  var SendExternalTokenError;
108
111
  (function (SendExternalTokenError) {
109
112
  SendExternalTokenError["TOKEN_NOT_FOUND"] = "Token not found";
@@ -262,19 +265,24 @@ var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
262
265
  open: handleOpen,
263
266
  close: handleClose,
264
267
  }); });
265
- var estimateReceive = (0, react_1.useMemo)(function () {
266
- if (!estimateFee || !amount)
267
- return undefined;
268
- return +amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeInCurrency);
269
- }, [estimateFee, amount]);
270
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Recipient address", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
271
- wordBreak: "break-all",
272
- }, children: toAddress }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: errorAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Network", value: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6, ml: "auto" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20, src: network === null || network === void 0 ? void 0 : network.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: network === null || network === void 0 ? void 0 : network.name })] }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), !!memo && (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Memo", value: memo }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug, onEnoughBalanceToPayFee: setIsEnoughBalanceToPayFee })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: "Receive amount estimated" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
273
- fontWeight: theme.typography.fontWeight600,
274
- fontSize: theme.typography.fontSize16,
275
- }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSendExternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee || isValidatingAddress || errorAddress || !isEnoughBalanceToPayFee
276
- ? Button_1.BUTTON_STATUS.DISABLED
277
- : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
268
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, isFlag: false, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.headerTitle), { textAlign: "start", mr: "auto" }), component: "p", children: "Transaction summary" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4, ml: "auto", alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { component: "p", sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight700 }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { component: "p", sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight700 }), children: token === null || token === void 0 ? void 0 : token.name })] }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: errorAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Network", value: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4, ml: "auto" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20, src: network === null || network === void 0 ? void 0 : network.link, sx: {
269
+ borderRadius: theme.mixins.customRadius.full,
270
+ } }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight700 }), children: network === null || network === void 0 ? void 0 : network.name })] }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: errorAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Address", value: (0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: toAddress, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
271
+ fontSize: theme.typography.fontSize14,
272
+ fontWeight: theme.typography.fontWeight700,
273
+ }, children: (0, safeText_1.safeText)(toAddress, { isShort: true }) }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("ic_copy") })] }) }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Type", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight700 }), children: "On-chain withdraw" }) }), !!memo && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Comment", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight700 }), children: memo }) })), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_detail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug, setIsEnoughBalanceToPayFee: setIsEnoughBalanceToPayFee })), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] })), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSendExternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee || isValidatingAddress || errorAddress || !isEnoughBalanceToPayFee
274
+ ? Button_1.BUTTON_STATUS.DISABLED
275
+ : buttonStatus, sx: {
276
+ position: "absolute",
277
+ bottom: "1.5rem",
278
+ left: "50%",
279
+ transform: "translateX(-50%)",
280
+ width: "calc(100dvw - 2rem)",
281
+ backgroundColor: "#1E4841",
282
+ fontWeight: theme.typography.fontWeight500,
283
+ fontSize: theme.typography.fontSize14,
284
+ borderRadius: theme.mixins.customRadius.r12,
285
+ }, children: "Confirm" }) })] })] }) }));
278
286
  });
279
287
  SendExternalToken.displayName = "SendExternalToken";
280
288
  exports.default = SendExternalToken;
@@ -262,11 +262,11 @@ var SendInternalToken = (0, react_1.forwardRef)(function (props, ref) {
262
262
  var estimateReceive = (0, react_1.useMemo)(function () {
263
263
  if (!estimateFee || !amount)
264
264
  return undefined;
265
- return +amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeInCurrency);
265
+ return +amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_in_currency);
266
266
  }, [estimateFee, amount]);
267
267
  return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Recipient address", value: (0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: toAddress, children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
268
268
  wordBreak: "break-all",
269
- }, children: toAddress }) }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: errorAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: "Receive amount estimated" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
269
+ }, children: toAddress }) }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: errorAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_detail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: "Receive amount estimated" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
270
270
  fontWeight: theme.typography.fontWeight600,
271
271
  fontSize: theme.typography.fontSize16,
272
272
  }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSendInternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee || isValidatingAddress || errorAddress
@@ -257,9 +257,9 @@ var SwapToken = (0, react_1.forwardRef)(function (props, ref) {
257
257
  var estimateReceive = (0, react_1.useMemo)(function () {
258
258
  if (!estimateFee || !amount || !(toToken === null || toToken === void 0 ? void 0 : toToken.usd_rate))
259
259
  return undefined;
260
- return (+amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeInCurrency)) / +(toToken === null || toToken === void 0 ? void 0 : toToken.usd_rate);
260
+ return (+amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_in_currency)) / +(toToken === null || toToken === void 0 ? void 0 : toToken.usd_rate);
261
261
  }, [estimateFee, toToken, amount]);
262
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: [!!fromToken && !!toToken && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { alignItems: "start", gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16, width: "100%" }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: fromToken === null || fromToken === void 0 ? void 0 : fromToken.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight600 }), children: fromToken === null || fromToken === void 0 ? void 0 : fromToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount }) })] }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("swap-one-direction"), width: 24 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16, width: "100%" }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: toToken === null || toToken === void 0 ? void 0 : toToken.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight600 }), children: toToken === null || toToken === void 0 ? void 0 : toToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: toAmount }) })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.row), theme.mixins.valueDescription), { width: "100%", justifyContent: "center" }), children: ["1 ", fromToken === null || fromToken === void 0 ? void 0 : fromToken.name, " ~ ", (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 1 / +(toToken === null || toToken === void 0 ? void 0 : toToken.usd_rate) }), " ", toToken === null || toToken === void 0 ? void 0 : toToken.name] }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: fromTokenSlug })), !estimateFee && !!amount && isLoadingEstimateFee && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, width: "100%" }), children: [(0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 16, sx: { color: theme.palette.text.white } }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: { color: "text.white" }, children: "Calculating fee" })] })), !!estimateReceive && !error && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: "Receive amount estimated" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
262
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: [!!fromToken && !!toToken && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { alignItems: "start", gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16, width: "100%" }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: fromToken === null || fromToken === void 0 ? void 0 : fromToken.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight600 }), children: fromToken === null || fromToken === void 0 ? void 0 : fromToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount }) })] }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("swap-one-direction"), width: 24 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16, width: "100%" }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: toToken === null || toToken === void 0 ? void 0 : toToken.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeight600 }), children: toToken === null || toToken === void 0 ? void 0 : toToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: toAmount }) })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.row), theme.mixins.valueDescription), { width: "100%", justifyContent: "center" }), children: ["1 ", fromToken === null || fromToken === void 0 ? void 0 : fromToken.name, " ~ ", (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 1 / +(toToken === null || toToken === void 0 ? void 0 : toToken.usd_rate) }), " ", toToken === null || toToken === void 0 ? void 0 : toToken.name] }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_detail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: fromTokenSlug })), !estimateFee && !!amount && isLoadingEstimateFee && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, width: "100%" }), children: [(0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 16, sx: { color: theme.palette.text.white } }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: { color: "text.white" }, children: "Calculating fee" })] })), !!estimateReceive && !error && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: "Receive amount estimated" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
263
263
  fontWeight: theme.typography.fontWeight600,
264
264
  fontSize: theme.typography.fontSize16,
265
265
  }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) })), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSwapToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] })), (!fromToken || !toToken) && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.paper), { alignItems: "center", justifyContent: "center" }), children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { fontSize: theme.typography.fontSize16 }), children: SwapTokenError.TOKEN_NOT_FOUND }) }))] }) }));
@@ -5,7 +5,7 @@ interface TransferInfoProps {
5
5
  estimateFee?: FeesDataType;
6
6
  amount?: number;
7
7
  tokenSlug?: string;
8
- onEnoughBalanceToPayFee: (isEnough: boolean) => void;
8
+ setIsEnoughBalanceToPayFee: (isEnough: boolean) => void;
9
9
  }
10
10
  export default function TransferInfo(props: TransferInfoProps): import("react/jsx-runtime").JSX.Element;
11
11
  export type { TransferInfoProps };
@@ -27,7 +27,7 @@ var CopyTextComponent_1 = __importDefault(require("../../CopyTextComponent"));
27
27
  var getIcon_1 = __importDefault(require("../../../../utils/getIcon"));
28
28
  function TransferInfo(props) {
29
29
  var _a, _b, _c;
30
- var transferData = props.transferData, estimateFee = props.estimateFee, amount = props.amount, tokenSlug = props.tokenSlug;
30
+ var transferData = props.transferData, estimateFee = props.estimateFee, amount = props.amount, tokenSlug = props.tokenSlug, setIsEnoughBalanceToPayFee = props.setIsEnoughBalanceToPayFee;
31
31
  var theme = (0, material_1.useTheme)();
32
32
  return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
33
33
  fontWeight: theme.typography.fontWeight700,
@@ -41,18 +41,18 @@ function TransferInfo(props) {
41
41
  }, value: (0, jsx_runtime_1.jsx)(IconText_1.default, { title: (0, safeText_1.safeText)((_a = transferData.receiver) === null || _a === void 0 ? void 0 : _a.nick_name), sx: {
42
42
  fontSize: theme.typography.fontSize14,
43
43
  fontWeight: theme.typography.fontWeight700,
44
- }, beforeIcon: (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (_b = transferData.receiver) === null || _b === void 0 ? void 0 : _b.avatar, width: 24, height: 24, rounded: true }) }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "network", sxField: {
44
+ }, beforeIcon: (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (_b = transferData.receiver) === null || _b === void 0 ? void 0 : _b.avatar, width: 16, height: 16, rounded: true }) }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "network", sxField: {
45
45
  fontSize: theme.typography.fontSize11,
46
46
  fontWeight: theme.typography.fontWeight500,
47
47
  color: theme.palette.text.darkContrast,
48
48
  }, value: (0, jsx_runtime_1.jsx)(IconText_1.default, { title: (0, safeText_1.safeText)(transferData.network), sx: {
49
49
  fontSize: theme.typography.fontSize14,
50
50
  fontWeight: theme.typography.fontWeight700,
51
- }, beforeIcon: (0, jsx_runtime_1.jsx)(Icon_1.default, { src: transferData.link, width: 24, height: 24, rounded: true }) }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "address", sxField: {
51
+ }, beforeIcon: (0, jsx_runtime_1.jsx)(Icon_1.default, { src: transferData.link, width: 16, height: 16, rounded: true }) }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "address", sxField: {
52
52
  fontSize: theme.typography.fontSize11,
53
53
  fontWeight: theme.typography.fontWeight500,
54
54
  color: theme.palette.text.darkContrast,
55
- }, value: (0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: (0, safeText_1.safeText)(transferData.to_address, { isShort: true }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
55
+ }, value: (0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: transferData.to_address, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
56
56
  fontSize: theme.typography.fontSize14,
57
57
  fontWeight: theme.typography.fontWeight700,
58
58
  }, children: (0, safeText_1.safeText)(transferData.to_address, { isShort: true }) }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("ic_copy") })] }) }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "type", sxField: {
@@ -76,5 +76,5 @@ function TransferInfo(props) {
76
76
  }, value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
77
77
  fontSize: theme.typography.fontSize14,
78
78
  fontWeight: theme.typography.fontWeight700,
79
- }, children: (0, safeText_1.safeDateTimeText)(transferData.datetime) }) }), ((_c = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _c === void 0 ? void 0 : _c.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug !== null && tokenSlug !== void 0 ? tokenSlug : "", onEnoughBalanceToPayFee: props.onEnoughBalanceToPayFee }))] })] }));
79
+ }, children: (0, safeText_1.safeDateTimeText)(transferData.datetime) }) }), ((_c = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_detail) === null || _c === void 0 ? void 0 : _c.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug !== null && tokenSlug !== void 0 ? tokenSlug : "", setIsEnoughBalanceToPayFee: setIsEnoughBalanceToPayFee }))] })] }));
80
80
  }
@@ -266,9 +266,9 @@ var TransferInternal = (0, react_1.forwardRef)(function (props, ref) {
266
266
  }, [sendInternalTokens, updateSendInternalToken]);
267
267
  // const estimateReceive = useMemo(() => {
268
268
  // if (!estimateFee || !amount) return undefined;
269
- // return +amount - +estimateFee?.feeInCurrency;
269
+ // return +amount - +estimateFee?.fee_in_currency;
270
270
  // }, [estimateFee, amount]);
271
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { title: "Transfer Amount", link: token === null || token === void 0 ? void 0 : token.link, transferAmount: transferData.amount, ref: confirmLayoutDrawerRef, action: type_1.TransactionSlug.TransferInternal, trigger: props.children, currency: token === null || token === void 0 ? void 0 : token.name, onOpen: validateAll, children: [(0, jsx_runtime_1.jsx)(transferTarget_1.default, { transferData: transferData }), (0, jsx_runtime_1.jsx)(transferInfo_1.default, { transferData: transferData, estimateFee: estimateFee, amount: amount, tokenSlug: tokenSlug, onEnoughBalanceToPayFee: setIsEnoughBalanceToPayFee }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.gaps.g6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { justifyContent: "center", mt: theme.mixins.customMargin.m12, mb: theme.mixins.customMargin.m16, position: "absolute", bottom: 0, left: 0, right: 0 }), children: (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.TransactionSlug.TransferInternal, onConfirmSuccess: handleSendInternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: {
271
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { title: "Transfer Amount", link: token === null || token === void 0 ? void 0 : token.link, transferAmount: transferData.amount, ref: confirmLayoutDrawerRef, action: type_1.TransactionSlug.TransferInternal, trigger: props.children, currency: token === null || token === void 0 ? void 0 : token.name, onOpen: validateAll, children: [(0, jsx_runtime_1.jsx)(transferTarget_1.default, { transferData: transferData }), (0, jsx_runtime_1.jsx)(transferInfo_1.default, { transferData: transferData, estimateFee: estimateFee, amount: amount, tokenSlug: tokenSlug, setIsEnoughBalanceToPayFee: setIsEnoughBalanceToPayFee }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.gaps.g6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { justifyContent: "center", mt: theme.mixins.customMargin.m12, mb: theme.mixins.customMargin.m16, position: "absolute", bottom: 0, left: 0, right: 0 }), children: (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.TransactionSlug.TransferInternal, onConfirmSuccess: handleSendInternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: {
272
272
  width: "100%",
273
273
  }, status: !!error || isLoadingEstimateFee || isValidatingAddress || errorAddress || !isEnoughBalanceToPayFee
274
274
  ? Button_1.BUTTON_STATUS.DISABLED
@@ -195,7 +195,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
195
195
  var estimateReceive = (0, react_1.useMemo)(function () {
196
196
  if (!estimateFee || !amount)
197
197
  return undefined;
198
- return +amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeInCurrency);
198
+ return +amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_in_currency);
199
199
  }, [estimateFee, amount]);
200
200
  (0, react_1.useEffect)(function () {
201
201
  setTimeout(function () {
@@ -585,7 +585,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
585
585
  placeholder: "Enter memo",
586
586
  value: memo,
587
587
  onChange: handleChangeMemo,
588
- } })] })), !!((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.slug) || "" })), estimateReceive !== undefined && !amountError && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Receive amount estimated" }), (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: estimateReceive }) })] })), selectedMethod === SendMethods.TRANSFER_EXTERNAL && ((0, jsx_runtime_1.jsx)(SendExternalToken_1.default, { initFeeData: estimateFee, sendExternalData: {
588
+ } })] })), !!((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.fee_detail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.slug) || "" })), estimateReceive !== undefined && !amountError && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Receive amount estimated" }), (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: estimateReceive }) })] })), selectedMethod === SendMethods.TRANSFER_EXTERNAL && ((0, jsx_runtime_1.jsx)(SendExternalToken_1.default, { initFeeData: estimateFee, sendExternalData: {
589
589
  amount: "".concat(amount),
590
590
  currency_slug: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.slug) || "",
591
591
  to_address: recipientAddress || "",
@@ -0,0 +1,42 @@
1
+ export interface GetEstimateFeeServiceSample {
2
+ data: {
3
+ fee_detail: [
4
+ {
5
+ currency: {
6
+ id: 0;
7
+ name: "string";
8
+ slug: "string";
9
+ full_name: "string";
10
+ icon: "string";
11
+ link: "string";
12
+ usd_rate: 0;
13
+ };
14
+ outputs: [
15
+ {
16
+ id: 0;
17
+ name: "string";
18
+ slug: "string";
19
+ full_name: "string";
20
+ icon: "string";
21
+ link: "string";
22
+ usd_rate: 0;
23
+ swap_amount: 0;
24
+ }
25
+ ];
26
+ },
27
+ fee_fixed: 0,
28
+ fee_in_currency: 0,
29
+ fee_in_usd: 0,
30
+ fee_percent: 0,
31
+ fee_type: {
32
+ name: "string";
33
+ slug: "string";
34
+ }
35
+ ];
36
+ fee_in_currency: 0;
37
+ fee_in_usd: 0;
38
+ original_amount_in_currency: 0;
39
+ original_amount_in_usd: 0;
40
+ original_currency: "string";
41
+ };
42
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -13,23 +13,23 @@ export interface GetEstimateFeeServiceResponse {
13
13
  timestamp: string;
14
14
  }
15
15
  export interface FeesDataType {
16
- feeInUSD: number;
17
- feeInCurrency: number;
18
- originalAmountInUSD: number;
19
- originalAmountInCurrency: number;
20
- originalCurrency: string;
21
- feeDetail: FeeDetailType[];
16
+ fee_in_usd: number;
17
+ fee_in_currency: number;
18
+ original_amount_in_usd: number;
19
+ original_amount_in_currency: number;
20
+ original_currency: string;
21
+ fee_detail: fee_detailType[];
22
22
  }
23
- export interface FeeDetailType {
24
- feeType: FeeType;
25
- feeInUSD: number;
26
- feeInCurrency: number;
27
- feePercent: number;
23
+ export interface fee_detailType {
24
+ fee_type: fee_type;
25
+ fee_in_usd: number;
26
+ fee_in_currency: number;
27
+ fee_percent: number;
28
28
  currency: Currency;
29
- feeFixed: number;
29
+ fee_fixed: number;
30
30
  isEnoughBalanceToPay?: boolean;
31
31
  }
32
- export interface FeeType {
32
+ export interface fee_type {
33
33
  name: string;
34
34
  slug: string;
35
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.610",
3
+ "version": "0.0.612",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",