tek-wallet 0.0.679 → 0.0.681
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/components/TekWallet/components/ui/ReceiveFunction/index.js +43 -41
- package/dist/components/TekWallet/components/ui/TransferConfirmation/index.d.ts +3 -3
- package/dist/components/TekWallet/components/ui/TransferConfirmation/index.js +17 -16
- package/dist/components/TekWallet/components/ui/TransferInternal/index.d.ts +1 -1
- package/dist/components/TekWallet/components/ui/TransferInternal/index.js +6 -6
- package/dist/components/TekWallet/index.d.ts +1 -0
- package/dist/components/TekWallet/index.js +1 -0
- package/dist/components/TekWallet/services/axios/swap-service/type.d.ts +0 -1
- package/package.json +1 -1
|
@@ -104,6 +104,7 @@ var RECEIVE_STEP_NAME = (_a = {},
|
|
|
104
104
|
_a[ReceiveStep.SHOW_QR_CODE] = "Scan QR code",
|
|
105
105
|
_a);
|
|
106
106
|
exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
107
|
+
var onClose = props.onClose;
|
|
107
108
|
var drawerRef = (0, react_1.useRef)(null);
|
|
108
109
|
var amountDrawerRef = (0, react_1.useRef)(null);
|
|
109
110
|
var _a = (0, react_1.useState)(), selectedMethod = _a[0], setSelectedMethod = _a[1];
|
|
@@ -169,27 +170,29 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
169
170
|
};
|
|
170
171
|
return JSON.stringify(tonTransferParamInternal);
|
|
171
172
|
}
|
|
172
|
-
return "ton://transfer/".concat(receiveAddress, "?jetton=").concat((_e = (_d = selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.network_data) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.address, "&
|
|
173
|
+
return "ton://transfer/".concat(receiveAddress, "?jetton=").concat((_e = (_d = selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.network_data) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.address, "&amount=").concat(+amount * Math.pow(10, ((_f = selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.decimal) !== null && _f !== void 0 ? _f : 0)));
|
|
173
174
|
}, [receiveAddress, selectedToken, amount, selectedMethod]);
|
|
174
175
|
var warningMessage = (0, react_1.useMemo)(function () {
|
|
175
|
-
if (selectedMethod === ReceiveMethods.RECEIVE_EXTERNAL
|
|
176
|
+
if (selectedMethod === ReceiveMethods.RECEIVE_EXTERNAL) {
|
|
176
177
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["The amount must be between", " ", (0, jsx_runtime_1.jsxs)("strong", { style: { color: theme.palette.primary.main }, children: [(0, jsx_runtime_1.jsx)(Formatter_1.default, { value: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value }), " to", " ", (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }), " "] }), " ", "and", " ", (0, jsx_runtime_1.jsx)("strong", { style: { color: theme.palette.primary.main }, children: "select the correct network" }), ", unless you will lose your assets."] }));
|
|
177
178
|
}
|
|
178
|
-
if (selectedMethod === ReceiveMethods.
|
|
179
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Please", " ", (0, jsx_runtime_1.jsx)("strong", { style: { color: theme.palette.primary.main }, children: "select the correct network" }), ", unless you will lose your assets."] }));
|
|
180
|
-
}
|
|
181
|
-
if (selectedMethod === ReceiveMethods.RECEIVE_INTERNAL && !amount) {
|
|
179
|
+
if (selectedMethod === ReceiveMethods.RECEIVE_INTERNAL) {
|
|
182
180
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["The amount must be between", " ", (0, jsx_runtime_1.jsxs)("strong", { style: { color: theme.palette.primary.main }, children: [(0, jsx_runtime_1.jsx)(Formatter_1.default, { value: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value }), " to", " ", (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) })] }), ", unless you will lose your assets."] }));
|
|
183
181
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
}, [
|
|
183
|
+
selectedMethod,
|
|
184
|
+
theme.palette.primary.main,
|
|
185
|
+
selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value,
|
|
186
|
+
selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value,
|
|
187
|
+
selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name,
|
|
188
|
+
]);
|
|
189
|
+
var handleShareProgress = (0, react_1.useCallback)(function () {
|
|
187
190
|
setIsSharing(true);
|
|
188
|
-
};
|
|
189
|
-
var handleShareFinish = function () {
|
|
191
|
+
}, []);
|
|
192
|
+
var handleShareFinish = (0, react_1.useCallback)(function () {
|
|
190
193
|
setIsSharing(false);
|
|
191
|
-
};
|
|
192
|
-
var clearValues = function () {
|
|
194
|
+
}, []);
|
|
195
|
+
var clearValues = (0, react_1.useCallback)(function () {
|
|
193
196
|
setInputAmount("");
|
|
194
197
|
setAmount("");
|
|
195
198
|
setAmountError("");
|
|
@@ -197,32 +200,48 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
197
200
|
setSelectedNetwork(undefined);
|
|
198
201
|
setSelectedMethod(undefined);
|
|
199
202
|
handleShareFinish();
|
|
200
|
-
};
|
|
203
|
+
}, [handleShareFinish]);
|
|
201
204
|
var open = function () {
|
|
202
205
|
var _a;
|
|
203
206
|
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
204
207
|
};
|
|
205
|
-
var
|
|
208
|
+
var gotoStep = (0, react_1.useCallback)(function (step) {
|
|
206
209
|
var _a;
|
|
207
|
-
(
|
|
210
|
+
if (step === ReceiveStep.SELECT_METHOD) {
|
|
211
|
+
clearValues();
|
|
212
|
+
}
|
|
213
|
+
setCurrentStep(step);
|
|
214
|
+
(_a = stepSwiperRef.current) === null || _a === void 0 ? void 0 : _a.slideTo(step - 1);
|
|
215
|
+
}, [clearValues, stepDrawerRef, stepSwiperRef]);
|
|
216
|
+
var handleOnClose = (0, react_1.useCallback)(function () {
|
|
217
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
208
218
|
gotoStep(ReceiveStep.SELECT_METHOD);
|
|
209
|
-
};
|
|
219
|
+
}, [gotoStep, onClose]);
|
|
220
|
+
var close = (0, react_1.useCallback)(function () {
|
|
221
|
+
var _a;
|
|
222
|
+
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
223
|
+
handleOnClose();
|
|
224
|
+
}, [handleOnClose]);
|
|
210
225
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
211
226
|
open: open,
|
|
212
227
|
close: close,
|
|
213
228
|
}); });
|
|
214
|
-
var handleBack = function () {
|
|
229
|
+
var handleBack = (0, react_1.useCallback)(function () {
|
|
230
|
+
var _a;
|
|
215
231
|
if (currentStep === ReceiveStep.SHOW_QR_CODE &&
|
|
216
232
|
selectedMethod === ReceiveMethods.RECEIVE_INTERNAL) {
|
|
217
233
|
gotoStep(ReceiveStep.SELECT_TOKEN);
|
|
218
234
|
return;
|
|
219
235
|
}
|
|
236
|
+
if (currentStep === ReceiveStep.SELECT_TOKEN) {
|
|
237
|
+
(_a = stepDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
238
|
+
}
|
|
220
239
|
gotoStep(currentStep - 1);
|
|
221
|
-
};
|
|
222
|
-
var closeHistory = function () {
|
|
240
|
+
}, [currentStep, gotoStep, selectedMethod]);
|
|
241
|
+
var closeHistory = (0, react_1.useCallback)(function () {
|
|
223
242
|
var _a;
|
|
224
243
|
(_a = historyRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
225
|
-
};
|
|
244
|
+
}, []);
|
|
226
245
|
var handleSelectMethod = function (method) {
|
|
227
246
|
setSelectedMethod(method);
|
|
228
247
|
switch (method) {
|
|
@@ -234,15 +253,6 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
234
253
|
break;
|
|
235
254
|
}
|
|
236
255
|
};
|
|
237
|
-
var gotoStep = function (step) {
|
|
238
|
-
var _a, _b;
|
|
239
|
-
if (step === ReceiveStep.SELECT_METHOD) {
|
|
240
|
-
clearValues();
|
|
241
|
-
(_a = stepDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
242
|
-
}
|
|
243
|
-
setCurrentStep(step);
|
|
244
|
-
(_b = stepSwiperRef.current) === null || _b === void 0 ? void 0 : _b.slideTo(step - 1);
|
|
245
|
-
};
|
|
246
256
|
var handleSelectToken = function (token) {
|
|
247
257
|
setSelectedToken(token);
|
|
248
258
|
if (!!token) {
|
|
@@ -302,11 +312,6 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
302
312
|
setInputAmount("");
|
|
303
313
|
(_a = amountDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
304
314
|
};
|
|
305
|
-
var handleOnClose = function () {
|
|
306
|
-
var _a;
|
|
307
|
-
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
308
|
-
gotoStep(ReceiveStep.SELECT_METHOD);
|
|
309
|
-
};
|
|
310
315
|
(0, react_1.useEffect)(function () {
|
|
311
316
|
if (isInitPasscode && !receiveExternalTokens) {
|
|
312
317
|
updateReceiveExternalToken();
|
|
@@ -323,7 +328,7 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
323
328
|
var blockchainAddress = (_a = blockchainWallets === null || blockchainWallets === void 0 ? void 0 : blockchainWallets.find(function (item) { return item.networkSlug === (selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.slug); })) === null || _a === void 0 ? void 0 : _a.blockchainAddress;
|
|
324
329
|
return blockchainAddress;
|
|
325
330
|
}, [blockchainWallets, masterWallet, selectedMethod, selectedNetwork]);
|
|
326
|
-
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { sx: props.sx, children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, sx: props.sx, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: RECEIVE_STEP_NAME[ReceiveStep.SELECT_METHOD], onClose: close, children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: stepDrawerRef, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, sx: {
|
|
331
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { sx: props.sx, children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, sx: props.sx, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: RECEIVE_STEP_NAME[ReceiveStep.SELECT_METHOD], onClose: close, children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: stepDrawerRef, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, onClose: close, sx: {
|
|
327
332
|
width: "100%",
|
|
328
333
|
}, trigger: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content", width: "100%" }), children: [(0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { title: "Top up via internal transfer", description: "Receive crypto from other Ting users", icon: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 24, height: 24 }, children: SvgPath_1.IC_RECEIVE_INTERNAL }), onClick: function () { return handleSelectMethod(ReceiveMethods.RECEIVE_INTERNAL); } }), (0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { title: "Top up via blockchain", description: "Deposit using a Web3 or an Exchange wallet", icon: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 24, height: 24 }, children: SvgPath_1.IC_RECEIVE_EXTERNAL }), onClick: function () { return handleSelectMethod(ReceiveMethods.RECEIVE_EXTERNAL); } })] }), children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { sx: {
|
|
329
334
|
position: "relative",
|
|
@@ -339,11 +344,8 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
339
344
|
? "max-height 0.3s linear 0.3s"
|
|
340
345
|
: "max-height 0s linear",
|
|
341
346
|
}, children: (0, jsx_runtime_1.jsx)(Share_1.default, { elementId: "share-receive-info", onProgress: handleShareProgress, onFinish: handleShareFinish, imageName: sharedImageName, children: (0, jsx_runtime_1.jsx)(BottomActionLayout_1.default, { children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { fullWidth: true, status: isSharing ? Button_1.BUTTON_STATUS.LOADING : undefined, children: "Share" }) }) }) }), children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { padding: theme.mixins.pagePadding }, children: (0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: stepSwiperRef, swiperProps: {
|
|
342
|
-
// autoHeight: true,
|
|
343
347
|
spaceBetween: 32,
|
|
344
|
-
}, disableSwipe: true,
|
|
345
|
-
// key={`step_${currentStep}`}
|
|
346
|
-
initialActiveTab: currentStep - 1, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: [!receiveTokens && (0, jsx_runtime_1.jsx)(WaitingData_1.default, {}), (receiveTokens === null || receiveTokens === void 0 ? void 0 : receiveTokens.length) === 0 && (0, jsx_runtime_1.jsx)(EmptyData_1.default, {}), receiveTokens && (receiveTokens === null || receiveTokens === void 0 ? void 0 : receiveTokens.length) > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.InputBase, { startAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "start", children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: SvgPath_1.IC_SEARCH }) }), placeholder: "Search", sx: {
|
|
348
|
+
}, disableSwipe: true, initialActiveTab: currentStep - 1, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: [!receiveTokens && (0, jsx_runtime_1.jsx)(WaitingData_1.default, {}), (receiveTokens === null || receiveTokens === void 0 ? void 0 : receiveTokens.length) === 0 && (0, jsx_runtime_1.jsx)(EmptyData_1.default, {}), receiveTokens && (receiveTokens === null || receiveTokens === void 0 ? void 0 : receiveTokens.length) > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.InputBase, { startAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "start", children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: SvgPath_1.IC_SEARCH }) }), placeholder: "Search", sx: {
|
|
347
349
|
borderRadius: theme.mixins.customRadius.r12,
|
|
348
350
|
border: "1px solid",
|
|
349
351
|
borderColor: theme.palette.border.accent3,
|
|
@@ -391,7 +393,7 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
391
393
|
: "Address" }), selectedMethod === ReceiveMethods.RECEIVE_INTERNAL && ((0, jsx_runtime_1.jsx)(CustomTooltip_1.default, { trigger: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 16, height: 16, mb: "3px" }, children: SvgPath_1.IC_TOOLTIP }), children: (0, jsx_runtime_1.jsx)(DialogContentLayout_1.default, { content: (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.warning), children: ["This address is used to receive token by internal transfer. You can not use it for blockchain transaction. If you want to receive token by blockchain, please select the ", (0, jsx_runtime_1.jsx)("strong", { children: "Receive External" }), " method instead."] }) }) }))] }), (0, jsx_runtime_1.jsxs)(CopyTextComponent_1.default, { sx: __assign(__assign({}, theme.mixins.row), { justifyContent: "space-between" }), value: receiveAddress || "", children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { wordBreak: "break-all", maxWidth: "85%" }), children: receiveAddress }), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: SvgPath_1.IC_COPY })] })] }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
392
394
|
color: theme.palette.border.accent,
|
|
393
395
|
width: "100%",
|
|
394
|
-
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ width: "100%" }, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [!!amount && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { color: theme.palette.text.accent, fontSize: theme.typography.fontSize13 }), children: "Amount" }), value: (0, jsx_runtime_1.
|
|
396
|
+
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ width: "100%" }, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [!!amount && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { color: theme.palette.text.accent, fontSize: theme.typography.fontSize13 }), children: "Amount" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.activityTitle), { fontSize: theme.typography.fontSize13 }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name }) }) })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { color: theme.palette.text.accent, fontSize: theme.typography.fontSize13 }), children: "Top Up Arrival Time" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.activityTitle), { fontSize: theme.typography.fontSize13 }), children: "~ 7 Minutes" }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { color: theme.palette.text.accent, fontSize: theme.typography.fontSize13 }), children: "Withdrawal Arrival Time" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.activityTitle), { fontSize: theme.typography.fontSize13 }), children: "~ 20 Minutes" }) })] }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
395
397
|
color: theme.palette.border.accent,
|
|
396
398
|
width: "100%",
|
|
397
399
|
mt: theme.mixins.customMargin.m12,
|
|
@@ -7,16 +7,16 @@ interface TransferConfirmationProps extends Omit<ConfirmLayoutProps, "action"> {
|
|
|
7
7
|
titleHeader: string;
|
|
8
8
|
onTransferSuccess?: (data: SendInternalResponse) => any;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface TransferConfirmationTokenRef {
|
|
11
11
|
open: () => void;
|
|
12
12
|
close: () => void;
|
|
13
13
|
}
|
|
14
|
-
export declare enum
|
|
14
|
+
export declare enum TransferConfirmationError {
|
|
15
15
|
TOKEN_NOT_FOUND = "Token not found",
|
|
16
16
|
NOT_ENOUGH_BALANCE = "Not enough balance",
|
|
17
17
|
MAX_AMOUNT = "Max amount",
|
|
18
18
|
MIN_AMOUNT = "Min amount",
|
|
19
19
|
FAILED = "Failed"
|
|
20
20
|
}
|
|
21
|
-
export declare const TransferConfirmation: import("react").ForwardRefExoticComponent<Omit<TransferConfirmationProps, "ref"> & import("react").RefAttributes<
|
|
21
|
+
export declare const TransferConfirmation: import("react").ForwardRefExoticComponent<Omit<TransferConfirmationProps, "ref"> & import("react").RefAttributes<TransferConfirmationTokenRef>>;
|
|
22
22
|
export default TransferConfirmation;
|
|
@@ -85,7 +85,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
85
85
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
86
86
|
};
|
|
87
87
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88
|
-
exports.TransferConfirmation = exports.
|
|
88
|
+
exports.TransferConfirmation = exports.TransferConfirmationError = void 0;
|
|
89
89
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
90
90
|
var Button_1 = __importStar(require("../Button"));
|
|
91
91
|
var ConfirmLayout_1 = __importDefault(require("../ConfirmLayout"));
|
|
@@ -101,14 +101,14 @@ var validate_wallet_address_service_1 = __importDefault(require("../../../servic
|
|
|
101
101
|
var type_2 = require("../../../services/axios/validate-wallet-address-service/type");
|
|
102
102
|
var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
|
|
103
103
|
var instructions_service_1 = __importDefault(require("../../../services/axios/instructions-service"));
|
|
104
|
-
var
|
|
105
|
-
(function (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
})(
|
|
104
|
+
var TransferConfirmationError;
|
|
105
|
+
(function (TransferConfirmationError) {
|
|
106
|
+
TransferConfirmationError["TOKEN_NOT_FOUND"] = "Token not found";
|
|
107
|
+
TransferConfirmationError["NOT_ENOUGH_BALANCE"] = "Not enough balance";
|
|
108
|
+
TransferConfirmationError["MAX_AMOUNT"] = "Max amount";
|
|
109
|
+
TransferConfirmationError["MIN_AMOUNT"] = "Min amount";
|
|
110
|
+
TransferConfirmationError["FAILED"] = "Failed";
|
|
111
|
+
})(TransferConfirmationError || (exports.TransferConfirmationError = TransferConfirmationError = {}));
|
|
112
112
|
exports.TransferConfirmation = (0, react_1.forwardRef)(function (props, ref) {
|
|
113
113
|
var _a;
|
|
114
114
|
var theme = (0, material_1.useTheme)();
|
|
@@ -122,10 +122,11 @@ exports.TransferConfirmation = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
122
122
|
var _f = (0, react_1.useState)(false), isValidatingAddress = _f[0], setIsValidatingAddress = _f[1];
|
|
123
123
|
var _g = (0, react_1.useState)(undefined), errorAddress = _g[0], setErrorAddress = _g[1];
|
|
124
124
|
var _h = (0, react_1.useMemo)(function () {
|
|
125
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
125
126
|
return {
|
|
126
|
-
transferDetails: transferData.instructions[0],
|
|
127
|
-
amount: transferData.instructions[0].currency_update_info[0].amount,
|
|
128
|
-
currencySlug: transferData.instructions[0].currency_update_info[0].currency_slug,
|
|
127
|
+
transferDetails: (_a = transferData.instructions[0]) !== null && _a !== void 0 ? _a : {},
|
|
128
|
+
amount: (_d = (_c = (_b = transferData.instructions[0]) === null || _b === void 0 ? void 0 : _b.currency_update_info[0]) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : 0,
|
|
129
|
+
currencySlug: (_g = (_f = (_e = transferData.instructions[0]) === null || _e === void 0 ? void 0 : _e.currency_update_info[0]) === null || _f === void 0 ? void 0 : _f.currency_slug) !== null && _g !== void 0 ? _g : "",
|
|
129
130
|
};
|
|
130
131
|
}, [transferData]), transferDetails = _h.transferDetails, amount = _h.amount, currencySlug = _h.currencySlug;
|
|
131
132
|
var toAddress = transferDetails.master_wallet_address;
|
|
@@ -134,21 +135,21 @@ exports.TransferConfirmation = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
134
135
|
}, [currencySlug, sendInternalTokens]);
|
|
135
136
|
var validateAmount = (0, react_1.useCallback)(function () {
|
|
136
137
|
if (!token) {
|
|
137
|
-
setError(
|
|
138
|
+
setError(TransferConfirmationError.TOKEN_NOT_FOUND);
|
|
138
139
|
return false;
|
|
139
140
|
}
|
|
140
141
|
if (amount > token.max_value) {
|
|
141
|
-
setError(
|
|
142
|
+
setError(TransferConfirmationError.MAX_AMOUNT);
|
|
142
143
|
setErrorAmount(token.max_value);
|
|
143
144
|
return false;
|
|
144
145
|
}
|
|
145
146
|
if (amount < token.min_value) {
|
|
146
|
-
setError(
|
|
147
|
+
setError(TransferConfirmationError.MIN_AMOUNT);
|
|
147
148
|
setErrorAmount(token.min_value);
|
|
148
149
|
return false;
|
|
149
150
|
}
|
|
150
151
|
if (amount > +token.balance) {
|
|
151
|
-
setError(
|
|
152
|
+
setError(TransferConfirmationError.NOT_ENOUGH_BALANCE);
|
|
152
153
|
setErrorAmount(token.balance);
|
|
153
154
|
return false;
|
|
154
155
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfirmLayoutProps } from "
|
|
1
|
+
import { ConfirmLayoutProps } from "../../ui/ConfirmLayout";
|
|
2
2
|
import { SendInternalBody, SendInternalResponse } from "../../../services/axios/send-internal-service/type";
|
|
3
3
|
export type TransferInternalData = Omit<SendInternalBody, "passcode">;
|
|
4
4
|
interface TransferTokenProps extends Omit<ConfirmLayoutProps, "action"> {
|
|
@@ -86,13 +86,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
86
86
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
87
87
|
exports.TransferInternal = exports.TransferError = void 0;
|
|
88
88
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
89
|
-
var Button_1 = __importStar(require("
|
|
90
|
-
var ConfirmLayout_1 = __importDefault(require("
|
|
91
|
-
var Formatter_1 = __importDefault(require("
|
|
92
|
-
var ConfirmByPasscode_1 = __importDefault(require("
|
|
89
|
+
var Button_1 = __importStar(require("../../ui/Button"));
|
|
90
|
+
var ConfirmLayout_1 = __importDefault(require("../../ui/ConfirmLayout"));
|
|
91
|
+
var Formatter_1 = __importDefault(require("../../ui/Formatter"));
|
|
92
|
+
var ConfirmByPasscode_1 = __importDefault(require("../../ui/ConfirmByPasscode"));
|
|
93
93
|
var react_1 = require("react");
|
|
94
|
-
var Text_1 = __importDefault(require("
|
|
95
|
-
var RequireConnect_1 = __importDefault(require("
|
|
94
|
+
var Text_1 = __importDefault(require("../../ui/Text"));
|
|
95
|
+
var RequireConnect_1 = __importDefault(require("../../ui/RequireConnect"));
|
|
96
96
|
var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
|
|
97
97
|
var type_1 = require("../../../services/axios/get-activities-service/type");
|
|
98
98
|
var useWithdrawData_1 = __importDefault(require("../../../hooks/useWithdrawData"));
|
|
@@ -35,3 +35,4 @@ __exportStar(require("./components/index"), exports);
|
|
|
35
35
|
__exportStar(require("./providers/TekWalletProvider"), exports);
|
|
36
36
|
__exportStar(require("./components/ui/UpdateLockToken"), exports);
|
|
37
37
|
__exportStar(require("./components/ui/SendExternalTokenWithdrawn"), exports);
|
|
38
|
+
__exportStar(require("./components/ui/TransferConfirmation"), exports);
|