tek-wallet 0.0.498 → 0.0.501
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.
|
@@ -146,8 +146,8 @@ var AmountError;
|
|
|
146
146
|
AmountError["MAX_LIMIT"] = "The maximum amount is";
|
|
147
147
|
AmountError["MIN_LIMIT"] = "The minimum amount is";
|
|
148
148
|
})(AmountError || (exports.AmountError = AmountError = {}));
|
|
149
|
-
var validateAmountDebounce = (0, createDebounce_1.default)(500);
|
|
150
149
|
var getEstimateFeeDebounce = (0, createDebounce_1.default)(500);
|
|
150
|
+
var validateAddressDebounce = (0, createDebounce_1.default)(500);
|
|
151
151
|
var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
152
152
|
var _a;
|
|
153
153
|
var drawerRef = (0, react_1.useRef)(null);
|
|
@@ -354,11 +354,14 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
var getEstimateFee = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
357
|
-
var response;
|
|
357
|
+
var isValidateAmount, response;
|
|
358
358
|
return __generator(this, function (_a) {
|
|
359
359
|
switch (_a.label) {
|
|
360
360
|
case 0:
|
|
361
|
-
if (!selectedToken
|
|
361
|
+
if (!selectedToken)
|
|
362
|
+
return [2 /*return*/];
|
|
363
|
+
isValidateAmount = validateAmount();
|
|
364
|
+
if (!isValidateAmount)
|
|
362
365
|
return [2 /*return*/];
|
|
363
366
|
setIsLoadingEstimateFee(true);
|
|
364
367
|
return [4 /*yield*/, (0, get_est_fee_service_1.default)({
|
|
@@ -373,7 +376,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
373
376
|
return [2 /*return*/];
|
|
374
377
|
}
|
|
375
378
|
});
|
|
376
|
-
}); }, [amount, selectedToken,
|
|
379
|
+
}); }, [amount, selectedToken, selectedMethod]);
|
|
377
380
|
var openScannerAddressQrCode = function () {
|
|
378
381
|
var _a;
|
|
379
382
|
(_a = scannerAddressQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
@@ -407,35 +410,39 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
407
410
|
gotoStep(WithdrawStep.FORM);
|
|
408
411
|
};
|
|
409
412
|
var handleValidateWalletAddress = function (address, network) { return __awaiter(void 0, void 0, void 0, function () {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
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*/];
|
|
436
442
|
}
|
|
437
|
-
|
|
438
|
-
}
|
|
443
|
+
});
|
|
444
|
+
}); });
|
|
445
|
+
return [2 /*return*/];
|
|
439
446
|
});
|
|
440
447
|
}); };
|
|
441
448
|
var handleScanAllQrCode = function (result) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -517,9 +524,6 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
517
524
|
updateSendInternalToken();
|
|
518
525
|
}
|
|
519
526
|
}, [isAuthenticated, withdrawTokens, sendInternalTokens]);
|
|
520
|
-
(0, react_1.useEffect)(function () {
|
|
521
|
-
validateAmountDebounce(validateAmount);
|
|
522
|
-
}, [validateAmount]);
|
|
523
527
|
(0, react_1.useEffect)(function () {
|
|
524
528
|
getEstimateFeeDebounce(getEstimateFee);
|
|
525
529
|
}, [getEstimateFee]);
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useEventHandler = void 0;
|
|
7
7
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
var react_1 = require("react");
|
|
8
9
|
var Formatter_1 = __importDefault(require("../components/ui/Formatter"));
|
|
9
10
|
var Text_1 = __importDefault(require("../components/ui/Text"));
|
|
10
11
|
var type_1 = require("../services/axios/get-activities-service/type");
|
|
@@ -15,11 +16,12 @@ var useEventHandler = function () {
|
|
|
15
16
|
var updateActivities = (0, useActivities_1.default)().updateActivities;
|
|
16
17
|
var updateWalletDetail = (0, useWalletData_1.default)().updateWalletDetail;
|
|
17
18
|
var _a = (0, useWithdrawData_1.default)(), updateWithdrawToken = _a.updateWithdrawToken, updateSendInternalToken = _a.updateSendInternalToken;
|
|
18
|
-
var updateData = function (transactionType) {
|
|
19
|
+
var updateData = (0, react_1.useCallback)(function (transactionType) {
|
|
19
20
|
var typeSlug = transactionType.slug;
|
|
20
21
|
console.warn("🚀 ~ updateData ~ typeSlug:", typeSlug);
|
|
21
22
|
switch (typeSlug) {
|
|
22
23
|
case type_1.TransactionSlug.Withdrawn:
|
|
24
|
+
case type_1.TransactionSlug.Send:
|
|
23
25
|
updateActivities({
|
|
24
26
|
page: 1,
|
|
25
27
|
take: 10,
|
|
@@ -40,7 +42,7 @@ var useEventHandler = function () {
|
|
|
40
42
|
default:
|
|
41
43
|
break;
|
|
42
44
|
}
|
|
43
|
-
};
|
|
45
|
+
}, [updateActivities, updateWalletDetail, updateWithdrawToken, updateSendInternalToken]);
|
|
44
46
|
var handler = function (messageEvent) {
|
|
45
47
|
if (!messageEvent)
|
|
46
48
|
return undefined;
|