tek-wallet 0.0.460 → 0.0.462

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.
@@ -63,7 +63,6 @@ function Fees(props) {
63
63
  result[index].isEnoughBalanceToPay = +((_e = token === null || token === void 0 ? void 0 : token.current_value) !== null && _e !== void 0 ? _e : 0) >= totalFeeInCurrency;
64
64
  }
65
65
  });
66
- console.warn("🚀 ~ consttokensFee:FeeDetailType[]=useMemo ~ result:", result);
67
66
  return result;
68
67
  }, [tokens, feesData === null || feesData === void 0 ? void 0 : feesData.feeDetail, amount]);
69
68
  var feeCheckedBalance = (0, react_1.useMemo)(function () {
@@ -108,7 +108,7 @@ var ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
108
108
  var _f = (0, react_1.useState)(0), inputAmount = _f[0], setInputAmount = _f[1];
109
109
  var _g = (0, react_1.useState)(0), amount = _g[0], setAmount = _g[1];
110
110
  var _h = (0, react_1.useState)(""), amountError = _h[0], setAmountError = _h[1];
111
- var _j = (0, useReceiveData_1.default)(), receiveExternalTokens = _j.receiveExternalTokens, updateReceiveExternalToken = _j.updateReceiveExternalToken, isLoadingReceiveExternalToken = _j.isLoadingReceiveExternalToken, isLoadingReceiveInternalToken = _j.isLoadingReceiveInternalToken, receiveInternalTokens = _j.receiveInternalTokens, updateReceiveInternalToken = _j.updateReceiveInternalToken;
111
+ var _j = (0, useReceiveData_1.default)(), receiveExternalTokens = _j.receiveExternalTokens, updateReceiveExternalToken = _j.updateReceiveExternalToken, receiveInternalTokens = _j.receiveInternalTokens, updateReceiveInternalToken = _j.updateReceiveInternalToken;
112
112
  var receiveTokens = (0, react_1.useMemo)(function () {
113
113
  if (selectedMethod === ReceiveMethods.RECEIVE_INTERNAL) {
114
114
  return receiveInternalTokens;
@@ -276,20 +276,13 @@ var ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
276
276
  gotoStep(ReceiveStep.SELECT_METHOD);
277
277
  };
278
278
  (0, react_1.useEffect)(function () {
279
- console.warn("🚀 ~ useEffect ~ isAuthenticated:", isAuthenticated, receiveExternalTokens, isLoadingReceiveExternalToken, receiveInternalTokens, isLoadingReceiveInternalToken);
280
- if (isAuthenticated && !receiveExternalTokens && !isLoadingReceiveExternalToken) {
279
+ if (isAuthenticated && !receiveExternalTokens) {
281
280
  updateReceiveExternalToken();
282
281
  }
283
- if (isAuthenticated && !receiveInternalTokens && !isLoadingReceiveInternalToken) {
282
+ if (isAuthenticated && !receiveInternalTokens) {
284
283
  updateReceiveInternalToken();
285
284
  }
286
- }, [
287
- isAuthenticated,
288
- isLoadingReceiveExternalToken,
289
- isLoadingReceiveInternalToken,
290
- receiveExternalTokens,
291
- receiveInternalTokens,
292
- ]);
285
+ }, [isAuthenticated]);
293
286
  return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { overrideHeader: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { sx: {
294
287
  width: "100%",
295
288
  display: "flex",
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ // "use client";
3
+ // import { Box, useTheme } from "@mui/material";
4
+ // import Button, { BUTTON_STATUS } from "../../ui/Button";
5
+ // import { DrawerComponentRef } from "../DrawerComponent";
6
+ // import ConfirmLayout, { ConfirmLayoutProps } from "../ConfirmLayout";
7
+ // import { ActionConfirm } from "../ConfirmLayout/type";
8
+ // import LineValue from "../LineValue";
9
+ // import Formatter from "../Formatter";
10
+ // import ConfirmByPasscode from "../ConfirmByPasscode";
11
+ // import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
12
+ // import Text from "../Text";
13
+ // import { LockCurrency } from "../../../services/axios/get-lock-tokens-list-service/type";
14
+ // import RequireConnect from "../RequireConnect";
15
+ // import useWalletData from "../../../hooks/useWalletData";
16
+ // import { SendExternalBody, SendExternalResponse } from "../../../services/axios/send-external-service/type";
17
+ // import useWithdrawData from "../../../hooks/useWithdrawData";
18
+ // import sendExternalService from "../../../services/axios/send-external-service";
19
+ // import Icon from "../Icon";
20
+ // import Fees from "../Fees";
21
+ // import { FeesDataType } from "../../../services/axios/get-est-fee-service/type";
22
+ // interface SendExternalTokenProps extends Omit<ConfirmLayoutProps, "action"> {
23
+ // sendExternalData: SendExternalBody;
24
+ // onSuccess?: (data: SendExternalResponse) => any;
25
+ // }
26
+ // export interface SendExternalTokenRef {
27
+ // open: () => void;
28
+ // close: () => void;
29
+ // }
30
+ // export enum SendExternalTokenError {
31
+ // TOKEN_NOT_FOUND = "Token not found",
32
+ // NOT_ENOUGH_BALANCE = "Not enough balance",
33
+ // MAX_AMOUNT = "Max amount",
34
+ // MIN_AMOUNT = "Min amount",
35
+ // FAILED = "Failed",
36
+ // }
37
+ // const SendExternalToken = forwardRef<SendExternalTokenRef, SendExternalTokenProps>((props, ref) => {
38
+ // const theme = useTheme();
39
+ // const { withdrawTokens } = useWithdrawData();
40
+ // const { isAuthenticated } = useWalletData();
41
+ // const confirmLayoutDrawerRef = useRef<DrawerComponentRef>(null);
42
+ // const [token, setToken] = useState<LockCurrency | undefined>(undefined);
43
+ // const [error, setError] = useState<SendExternalTokenError | undefined>(undefined);
44
+ // const [errorAmount, setErrorAmount] = useState<string | number | undefined>(undefined);
45
+ // const [buttonStatus, setButtonStatus] = useState<BUTTON_STATUS>(BUTTON_STATUS.ENABLED);
46
+ // const [estimateFee, setEstimateFee] = useState<FeesDataType>();
47
+ // const amount = props.sendExternalData.amount;
48
+ // const network = props.sendExternalData.network;
49
+ // const memo = props.sendExternalData.memo;
50
+ // const toAddress = props.sendExternalData.to_address;
51
+ // const validateAmount = useCallback(
52
+ // (sendExternalData: SendExternalBody) => {
53
+ // const token = withdrawTokens?.find((token) => token.slug === sendExternalData.currency_slug);
54
+ // console.warn("🚀 ~ validateAmount ~ lockData:", sendExternalData, withdrawTokens, token);
55
+ // setToken(token);
56
+ // if (!token) {
57
+ // setError(SendExternalTokenError.TOKEN_NOT_FOUND);
58
+ // return;
59
+ // }
60
+ // if (+sendExternalData.amount > token.max_value) {
61
+ // setError(SendExternalTokenError.MAX_AMOUNT);
62
+ // setErrorAmount(token.max_value);
63
+ // return;
64
+ // }
65
+ // if (+sendExternalData.amount < token.min_value) {
66
+ // setError(SendExternalTokenError.MIN_AMOUNT);
67
+ // setErrorAmount(token.min_value);
68
+ // return;
69
+ // }
70
+ // if (+sendExternalData.amount > +token.balance) {
71
+ // setError(SendExternalTokenError.NOT_ENOUGH_BALANCE);
72
+ // setErrorAmount(token.balance);
73
+ // return;
74
+ // }
75
+ // setError(undefined);
76
+ // setErrorAmount(undefined);
77
+ // },
78
+ // [withdrawTokens]
79
+ // );
80
+ // const handleSendExternalToken = async (passcode: string) => {
81
+ // try {
82
+ // console.warn("🚀 ~ handleSendExternalToken ~ sendExternalData:", props.sendExternalData, passcode);
83
+ // setButtonStatus(BUTTON_STATUS.LOADING);
84
+ // const response = await sendExternalService(props.sendExternalData);
85
+ // console.warn("🚀 ~ handleSendExternalToken ~ response:", response);
86
+ // if (response.success) {
87
+ // confirmLayoutDrawerRef.current?.close();
88
+ // setButtonStatus(BUTTON_STATUS.ENABLED);
89
+ // props.onSuccess?.(response);
90
+ // } else {
91
+ // throw new Error("Send external failed");
92
+ // }
93
+ // } catch (err) {
94
+ // console.error(err);
95
+ // setButtonStatus(BUTTON_STATUS.ERROR);
96
+ // setTimeout(() => {
97
+ // setButtonStatus(BUTTON_STATUS.ENABLED);
98
+ // }, 1200);
99
+ // }
100
+ // };
101
+ // const handleOpen = () => {
102
+ // if (!isAuthenticated) throw new Error("Please connect your wallet");
103
+ // confirmLayoutDrawerRef.current?.open();
104
+ // };
105
+ // const handleClose = () => {
106
+ // if (!isAuthenticated) throw new Error("Please connect your wallet");
107
+ // confirmLayoutDrawerRef.current?.close();
108
+ // };
109
+ // useImperativeHandle(ref, () => ({
110
+ // open: handleOpen,
111
+ // close: handleClose,
112
+ // }));
113
+ // useEffect(() => {
114
+ // validateAmount(props.sendExternalData);
115
+ // }, [validateAmount, props.sendExternalData]);
116
+ // return (
117
+ // <RequireConnect>
118
+ // <ConfirmLayout ref={confirmLayoutDrawerRef} action={ActionConfirm.LOCK} trigger={props.children}>
119
+ // <Box sx={{ ...theme.mixins.column, gap: theme.mixins.gaps.g12 }}>
120
+ // <Box
121
+ // sx={{
122
+ // ...theme.mixins.paper,
123
+ // }}
124
+ // >
125
+ // <LineValue
126
+ // field="Recipient address"
127
+ // value={
128
+ // <Text
129
+ // sx={{
130
+ // wordBreak: "break-all",
131
+ // }}
132
+ // >
133
+ // {toAddress}
134
+ // </Text>
135
+ // }
136
+ // />
137
+ // <LineValue
138
+ // field="Network"
139
+ // value={
140
+ // <Box
141
+ // sx={{
142
+ // ...theme.mixins.row,
143
+ // gap: theme.mixins.gaps.g6,
144
+ // ml: "auto",
145
+ // }}
146
+ // >
147
+ // {/* <Icon width={20} src={props.sendExternalData.network?.icon} /> */}
148
+ // <Text sx={{ ...theme.mixins.value }}>{props.sendExternalData.network}</Text>
149
+ // </Box>
150
+ // }
151
+ // />
152
+ // <LineValue field="Amount" value={<Formatter value={amount} unit={` ${token?.name}`} />} />
153
+ // {!!memo && <LineValue field="Memo" value={memo} />}
154
+ // {estimateFee?.feeDetail?.length && !!amount && (
155
+ // <Fees feesData={JSON.stringify(estimateFee)} amount={+amount} />
156
+ // )}
157
+ // <LineValue
158
+ // field="Receive amount estimated"
159
+ // value={
160
+ // <Text
161
+ // sx={{
162
+ // fontWeight: theme.typography.fontWeight600,
163
+ // fontSize: theme.typography.fontSize16,
164
+ // }}
165
+ // >
166
+ // <Formatter value={estimateReceive} unit={` ${selectedToken?.name}`} />
167
+ // </Text>
168
+ // }
169
+ // />
170
+ // </Box>
171
+ // <ConfirmByPasscode action={ActionConfirm.LOCK} onConfirmSuccess={handleSendExternalToken}>
172
+ // <Button.Primary status={!!error ? BUTTON_STATUS.DISABLED : buttonStatus} sx={{ width: "100%" }}>
173
+ // Confirm
174
+ // </Button.Primary>
175
+ // </ConfirmByPasscode>
176
+ // </Box>
177
+ // </ConfirmLayout>
178
+ // </RequireConnect>
179
+ // );
180
+ // });
181
+ // SendExternalToken.displayName = "SendExternalToken";
182
+ // export default SendExternalToken;
@@ -0,0 +1,4 @@
1
+ export interface LockData {
2
+ amount: number;
3
+ tokenSlug: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -121,7 +121,6 @@ var type_1 = require("../ConfirmLayout/type");
121
121
  var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
122
122
  var LineValue_1 = __importDefault(require("../LineValue"));
123
123
  var send_external_service_1 = __importDefault(require("../../../services/axios/send-external-service"));
124
- var useRealtime_1 = __importDefault(require("../../../hooks/useRealtime"));
125
124
  var SendMethods;
126
125
  (function (SendMethods) {
127
126
  SendMethods["SCAN_QR_CODE"] = "scan qr code";
@@ -151,7 +150,6 @@ var AmountError;
151
150
  })(AmountError || (exports.AmountError = AmountError = {}));
152
151
  var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
153
152
  var _a, _b;
154
- var pushNotification = (0, useRealtime_1.default)().pushNotification;
155
153
  var drawerRef = (0, react_1.useRef)(null);
156
154
  var swiperRef = (0, react_1.useRef)(null);
157
155
  var confirmLayoutDrawerRef = (0, react_1.useRef)(null);
@@ -160,7 +158,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
160
158
  var _d = (0, react_1.useState)(), selectedToken = _d[0], setSelectedToken = _d[1];
161
159
  var _e = (0, react_1.useState)(), selectedNetwork = _e[0], setSelectedNetwork = _e[1];
162
160
  var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
163
- var _f = (0, useWithdrawData_1.default)(), withdrawTokens = _f.withdrawTokens, updateWithdrawToken = _f.updateWithdrawToken, updateSendInternalToken = _f.updateSendInternalToken, sendInternalTokens = _f.sendInternalTokens, isLoadingWithdrawToken = _f.isLoadingWithdrawToken, isLoadingSendInternalToken = _f.isLoadingSendInternalToken;
161
+ var _f = (0, useWithdrawData_1.default)(), withdrawTokens = _f.withdrawTokens, updateWithdrawToken = _f.updateWithdrawToken, updateSendInternalToken = _f.updateSendInternalToken, sendInternalTokens = _f.sendInternalTokens;
164
162
  var _g = (0, react_1.useState)(), infoDialogContent = _g[0], setInfoDialogContent = _g[1];
165
163
  var _h = (0, react_1.useState)(""), amount = _h[0], setAmount = _h[1];
166
164
  var _j = (0, react_1.useState)(undefined), memo = _j[0], setMemo = _j[1];
@@ -201,13 +199,6 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
201
199
  return undefined;
202
200
  return +amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeInCurrency);
203
201
  }, [estimateFee, amount]);
204
- var testPushNotification = function () {
205
- pushNotification({
206
- message: "Test notification",
207
- type: "success",
208
- id: new Date().getTime().toString(),
209
- });
210
- };
211
202
  (0, react_1.useEffect)(function () {
212
203
  setTimeout(function () {
213
204
  var _a;
@@ -572,6 +563,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
572
563
  if (response.success) {
573
564
  close();
574
565
  (_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
566
+ setSendButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
575
567
  (_b = props.onSendSuccess) === null || _b === void 0 ? void 0 : _b.call(props, response);
576
568
  }
577
569
  else {
@@ -603,13 +595,13 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
603
595
  }
604
596
  };
605
597
  (0, react_1.useEffect)(function () {
606
- if (isAuthenticated && !withdrawTokens && !isLoadingWithdrawToken) {
598
+ if (isAuthenticated && !withdrawTokens) {
607
599
  updateWithdrawToken();
608
600
  }
609
- if (isAuthenticated && !sendInternalTokens && !isLoadingSendInternalToken) {
601
+ if (isAuthenticated && !sendInternalTokens) {
610
602
  updateSendInternalToken();
611
603
  }
612
- }, [isAuthenticated, isLoadingWithdrawToken, isLoadingSendInternalToken]);
604
+ }, [isAuthenticated]);
613
605
  (0, react_1.useEffect)(function () {
614
606
  validateAmount();
615
607
  }, [validateAmount]);
@@ -627,11 +619,11 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
627
619
  : WITHDRAW_STEP_NAME[currentStep], children: (0, jsx_runtime_1.jsx)(CloseModal_1.default, { sx: { marginLeft: "auto" }, onClick: close }) }), children: [(0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: swiperRef, swiperProps: {
628
620
  autoHeight: true,
629
621
  spaceBetween: 32,
630
- }, disableSwipe: true, children: [(0, jsx_runtime_1.jsxs)(react_2.SwiperSlide, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.Primary, { onClick: testPushNotification, children: " Push" }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { height: "fit-content" }), children: Object.values(SendMethods).map(function (item, index) {
631
- return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index !== 0 && (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { title: item, description: item, icon: (0, getIcon_1.default)(item + "_icon"), onClick: function () { return handleSelectMethod(item); }, sx: {
632
- py: theme.mixins.customPadding.p12,
633
- } })] }, item));
634
- }) })] }, WithdrawStep.SELECT_METHOD), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: withdrawToken === null || withdrawToken === void 0 ? void 0 : withdrawToken.map(function (item) {
622
+ }, disableSwipe: true, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { height: "fit-content" }), children: Object.values(SendMethods).map(function (item, index) {
623
+ return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index !== 0 && (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { title: item, description: item, icon: (0, getIcon_1.default)(item + "_icon"), onClick: function () { return handleSelectMethod(item); }, sx: {
624
+ py: theme.mixins.customPadding.p12,
625
+ } })] }, item));
626
+ }) }) }, WithdrawStep.SELECT_METHOD), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: withdrawToken === null || withdrawToken === void 0 ? void 0 : withdrawToken.map(function (item) {
635
627
  var stringifiedTokenData = JSON.stringify(item);
636
628
  if (!item)
637
629
  return null;
@@ -661,7 +653,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
661
653
  placeholder: "Enter memo",
662
654
  value: memo,
663
655
  onChange: handleChangeMemo,
664
- } })] })), ((_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, { feesData: JSON.stringify(estimateFee), amount: +amount })), 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 }) })] })), (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: type_1.ActionConfirm.SEND, trigger: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, status: !!amountError ||
656
+ } })] })), !!((_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, { feesData: JSON.stringify(estimateFee), amount: +amount })), 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 }) })] })), (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: type_1.ActionConfirm.SEND, trigger: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, status: !!amountError ||
665
657
  !!recipientAddressError ||
666
658
  !recipientAddress ||
667
659
  !amount ||
@@ -671,7 +663,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
671
663
  ? Button_1.BUTTON_STATUS.DISABLED
672
664
  : Button_1.BUTTON_STATUS.ENABLED, children: "Continue" }), 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: {
673
665
  wordBreak: "break-all",
674
- }, children: recipientAddress }) }), selectedMethod === SendMethods.TRANSFER_EXTERNAL && ((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: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.name })] }) })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) }), !!memo && selectedMethod === SendMethods.TRANSFER_EXTERNAL && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Memo", value: memo })), ((_b = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _b === void 0 ? void 0 : _b.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { feesData: JSON.stringify(estimateFee), amount: +amount })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
666
+ }, children: recipientAddress }) }), selectedMethod === SendMethods.TRANSFER_EXTERNAL && ((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: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.name })] }) })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) }), !!memo && selectedMethod === SendMethods.TRANSFER_EXTERNAL && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Memo", value: memo })), !!((_b = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _b === void 0 ? void 0 : _b.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { feesData: JSON.stringify(estimateFee), amount: +amount })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
675
667
  fontWeight: theme.typography.fontWeight600,
676
668
  fontSize: theme.typography.fontSize16,
677
669
  }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) }) })] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.ActionConfirm.SEND, onConfirmSuccess: handleSend, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: sendButtonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) })] }) }, WithdrawStep.FORM)] }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAllQrCodeRef, onResult: handleScanAllQrCode }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAddressQrCodeRef, onResult: handleScanAddressQrCode }), (0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { ref: backDropRef }), (0, jsx_runtime_1.jsx)(AppDialog_1.default, { overrideOpen: !!infoDialogContent, children: (0, jsx_runtime_1.jsx)(DialogContentLayout_1.default, { content: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
@@ -79,7 +79,7 @@ var react_1 = __importStar(require("react"));
79
79
  var get_lock_tokens_list_service_1 = __importDefault(require("../../services/axios/get-lock-tokens-list-service"));
80
80
  var useWalletData_1 = __importDefault(require("../../hooks/useWalletData"));
81
81
  exports.initialLockTokens = {
82
- isLoadingLockToken: true,
82
+ isLoadingLockToken: false,
83
83
  lockTokens: undefined,
84
84
  updateLockToken: function () { },
85
85
  };
@@ -88,14 +88,16 @@ function LockTokensProvider(_a) {
88
88
  var _this = this;
89
89
  var children = _a.children;
90
90
  var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
91
- var _b = (0, react_1.useState)(true), isLoadingLockToken = _b[0], setIsLoadingLockToken = _b[1];
92
- var _c = react_1.default.useState(undefined), lockTokens = _c[0], setLockTokens = _c[1];
91
+ var _b = (0, react_1.useState)(exports.initialLockTokens.isLoadingLockToken), isLoadingLockToken = _b[0], setIsLoadingLockToken = _b[1];
92
+ var _c = react_1.default.useState(exports.initialLockTokens.lockTokens), lockTokens = _c[0], setLockTokens = _c[1];
93
93
  var updateLockToken = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
94
94
  var response, error_1;
95
95
  return __generator(this, function (_a) {
96
96
  switch (_a.label) {
97
97
  case 0:
98
98
  _a.trys.push([0, 2, , 3]);
99
+ if (isLoadingLockToken)
100
+ return [2 /*return*/];
99
101
  if (!isAuthenticated) {
100
102
  throw new Error("Authenticate to get lock tokens");
101
103
  }
@@ -115,7 +117,7 @@ function LockTokensProvider(_a) {
115
117
  case 3: return [2 /*return*/];
116
118
  }
117
119
  });
118
- }); }, [isAuthenticated]);
120
+ }); }, [isAuthenticated, isLoadingLockToken]);
119
121
  (0, react_1.useEffect)(function () {
120
122
  updateLockToken();
121
123
  }, [updateLockToken]);
@@ -102,6 +102,8 @@ function ReceiveProvider(_a) {
102
102
  switch (_a.label) {
103
103
  case 0:
104
104
  _a.trys.push([0, 2, , 3]);
105
+ if (isLoadingReceiveExternalToken)
106
+ return [2 /*return*/];
105
107
  if (!isAuthenticated) {
106
108
  throw new Error("Authenticate to get receive tokens");
107
109
  }
@@ -121,7 +123,7 @@ function ReceiveProvider(_a) {
121
123
  case 3: return [2 /*return*/];
122
124
  }
123
125
  });
124
- }); }, [isAuthenticated]);
126
+ }); }, [isAuthenticated, isLoadingReceiveExternalToken]);
125
127
  var updateReceiveInternalToken = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
126
128
  var response, error_2;
127
129
  return __generator(this, function (_a) {
@@ -131,6 +133,8 @@ function ReceiveProvider(_a) {
131
133
  _a.label = 1;
132
134
  case 1:
133
135
  _a.trys.push([1, 3, , 4]);
136
+ if (isLoadingReceiveInternalToken)
137
+ return [2 /*return*/];
134
138
  if (!isAuthenticated) {
135
139
  throw new Error("Authenticate to get receive tokens");
136
140
  }
@@ -150,7 +154,7 @@ function ReceiveProvider(_a) {
150
154
  case 4: return [2 /*return*/];
151
155
  }
152
156
  });
153
- }); }, [isAuthenticated]);
157
+ }); }, [isAuthenticated, isLoadingReceiveInternalToken]);
154
158
  return ((0, jsx_runtime_1.jsx)(exports.ReceiveContext.Provider, { value: {
155
159
  isLoadingReceiveExternalToken: isLoadingReceiveExternalToken,
156
160
  receiveExternalTokens: receiveExternalTokens,
@@ -104,6 +104,8 @@ function WithdrawProvider(_a) {
104
104
  _a.label = 1;
105
105
  case 1:
106
106
  _a.trys.push([1, 3, , 4]);
107
+ if (isLoadingWithdrawToken)
108
+ return [2 /*return*/];
107
109
  if (!isAuthenticated) {
108
110
  throw new Error("Authenticate to get withdraw tokens");
109
111
  }
@@ -124,7 +126,7 @@ function WithdrawProvider(_a) {
124
126
  case 4: return [2 /*return*/];
125
127
  }
126
128
  });
127
- }); }, [isAuthenticated]);
129
+ }); }, [isAuthenticated, isLoadingWithdrawToken]);
128
130
  var updateSendInternalToken = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
129
131
  var response, error_2;
130
132
  return __generator(this, function (_a) {
@@ -134,6 +136,8 @@ function WithdrawProvider(_a) {
134
136
  _a.label = 1;
135
137
  case 1:
136
138
  _a.trys.push([1, 3, , 4]);
139
+ if (isLoadingSendInternalToken)
140
+ return [2 /*return*/];
137
141
  if (!isAuthenticated) {
138
142
  throw new Error("Authenticate to get withdraw tokens");
139
143
  }
@@ -154,7 +158,7 @@ function WithdrawProvider(_a) {
154
158
  case 4: return [2 /*return*/];
155
159
  }
156
160
  });
157
- }); }, [isAuthenticated]);
161
+ }); }, [isAuthenticated, isLoadingSendInternalToken]);
158
162
  return ((0, jsx_runtime_1.jsx)(exports.WithdrawContext.Provider, { value: {
159
163
  isLoadingWithdrawToken: isLoadingWithdrawToken,
160
164
  withdrawTokens: withdrawTokens,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.460",
3
+ "version": "0.0.462",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",