tek-wallet 0.0.497 → 0.0.500
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.
|
@@ -64,7 +64,6 @@ var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
|
|
|
64
64
|
update: update,
|
|
65
65
|
}); });
|
|
66
66
|
var rememberTab = function (index) {
|
|
67
|
-
console.warn("rememberTab", index);
|
|
68
67
|
var params = new URLSearchParams(window.location.search);
|
|
69
68
|
params.set(tabParamName, index.toString());
|
|
70
69
|
router.replace("".concat(pathname, "?").concat(params.toString()));
|
|
@@ -118,6 +118,7 @@ var Fees_1 = __importDefault(require("../Fees"));
|
|
|
118
118
|
var type_1 = require("../../../services/axios/get-activities-service/type");
|
|
119
119
|
var SendExternalToken_1 = __importDefault(require("../SendExternalToken"));
|
|
120
120
|
var SendInternalToken_1 = __importDefault(require("../SendInternalToken"));
|
|
121
|
+
var createDebounce_1 = __importDefault(require("../../../utils/createDebounce"));
|
|
121
122
|
var SendMethods;
|
|
122
123
|
(function (SendMethods) {
|
|
123
124
|
SendMethods["SCAN_QR_CODE"] = "scan qr code";
|
|
@@ -145,6 +146,8 @@ var AmountError;
|
|
|
145
146
|
AmountError["MAX_LIMIT"] = "The maximum amount is";
|
|
146
147
|
AmountError["MIN_LIMIT"] = "The minimum amount is";
|
|
147
148
|
})(AmountError || (exports.AmountError = AmountError = {}));
|
|
149
|
+
var getEstimateFeeDebounce = (0, createDebounce_1.default)(500);
|
|
150
|
+
var validateAddressDebounce = (0, createDebounce_1.default)(500);
|
|
148
151
|
var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
149
152
|
var _a;
|
|
150
153
|
var drawerRef = (0, react_1.useRef)(null);
|
|
@@ -351,11 +354,14 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
351
354
|
}
|
|
352
355
|
};
|
|
353
356
|
var getEstimateFee = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
354
|
-
var response;
|
|
357
|
+
var isValidateAmount, response;
|
|
355
358
|
return __generator(this, function (_a) {
|
|
356
359
|
switch (_a.label) {
|
|
357
360
|
case 0:
|
|
358
|
-
if (!selectedToken
|
|
361
|
+
if (!selectedToken)
|
|
362
|
+
return [2 /*return*/];
|
|
363
|
+
isValidateAmount = validateAmount();
|
|
364
|
+
if (!isValidateAmount)
|
|
359
365
|
return [2 /*return*/];
|
|
360
366
|
setIsLoadingEstimateFee(true);
|
|
361
367
|
return [4 /*yield*/, (0, get_est_fee_service_1.default)({
|
|
@@ -370,7 +376,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
370
376
|
return [2 /*return*/];
|
|
371
377
|
}
|
|
372
378
|
});
|
|
373
|
-
}); }, [amount, selectedToken,
|
|
379
|
+
}); }, [amount, selectedToken, selectedMethod]);
|
|
374
380
|
var openScannerAddressQrCode = function () {
|
|
375
381
|
var _a;
|
|
376
382
|
(_a = scannerAddressQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
@@ -404,35 +410,39 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
404
410
|
gotoStep(WithdrawStep.FORM);
|
|
405
411
|
};
|
|
406
412
|
var handleValidateWalletAddress = function (address, network) { return __awaiter(void 0, void 0, void 0, function () {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
413
|
+
return __generator(this, function (_a) {
|
|
414
|
+
setIsValidatingAddress(true);
|
|
415
|
+
validateAddressDebounce(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
416
|
+
var validateWalletAddress;
|
|
417
|
+
var _a;
|
|
418
|
+
return __generator(this, function (_b) {
|
|
419
|
+
switch (_b.label) {
|
|
420
|
+
case 0: return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
421
|
+
address: address,
|
|
422
|
+
network: network,
|
|
423
|
+
})];
|
|
424
|
+
case 1:
|
|
425
|
+
validateWalletAddress = _b.sent();
|
|
426
|
+
setIsValidatingAddress(false);
|
|
427
|
+
if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.valid)) {
|
|
428
|
+
setRecipientAddressError(undefined);
|
|
429
|
+
}
|
|
430
|
+
if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address)) {
|
|
431
|
+
(_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
432
|
+
}
|
|
433
|
+
else if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.valid)) {
|
|
434
|
+
//external
|
|
435
|
+
handleSelectContinueTransferExternal();
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
// setInfoDialogContent("Unsupported QR");
|
|
439
|
+
setRecipientAddressError("Invalid wallet address");
|
|
440
|
+
}
|
|
441
|
+
return [2 /*return*/];
|
|
433
442
|
}
|
|
434
|
-
|
|
435
|
-
}
|
|
443
|
+
});
|
|
444
|
+
}); });
|
|
445
|
+
return [2 /*return*/];
|
|
436
446
|
});
|
|
437
447
|
}); };
|
|
438
448
|
var handleScanAllQrCode = function (result) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -515,10 +525,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
515
525
|
}
|
|
516
526
|
}, [isAuthenticated, withdrawTokens, sendInternalTokens]);
|
|
517
527
|
(0, react_1.useEffect)(function () {
|
|
518
|
-
|
|
519
|
-
}, [validateAmount]);
|
|
520
|
-
(0, react_1.useEffect)(function () {
|
|
521
|
-
getEstimateFee();
|
|
528
|
+
getEstimateFeeDebounce(getEstimateFee);
|
|
522
529
|
}, [getEstimateFee]);
|
|
523
530
|
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.jsxs)(ModalLayout_1.default, { overrideHeader: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { sx: {
|
|
524
531
|
width: "100%",
|