tek-wallet 0.0.345 → 0.0.347
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.
|
@@ -236,6 +236,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
236
236
|
};
|
|
237
237
|
var handleChangeRecipientAddress = function (e) {
|
|
238
238
|
setRecipientAddress(e.target.value);
|
|
239
|
+
handleValidateWalletAddress(e.target.value, (selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.slug) || "ton");
|
|
239
240
|
};
|
|
240
241
|
var handleChangeAmount = function (e) {
|
|
241
242
|
setAmount(e.target.value);
|
|
@@ -356,22 +357,59 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
356
357
|
// };
|
|
357
358
|
var handleValidateWalletAddress = function (address, network) { return __awaiter(void 0, void 0, void 0, function () {
|
|
358
359
|
var validateWalletAddress;
|
|
359
|
-
var _a
|
|
360
|
-
return __generator(this, function (
|
|
361
|
-
switch (
|
|
360
|
+
var _a;
|
|
361
|
+
return __generator(this, function (_b) {
|
|
362
|
+
switch (_b.label) {
|
|
362
363
|
case 0:
|
|
363
|
-
(
|
|
364
|
+
setRecipientAddressError(undefined);
|
|
364
365
|
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
365
366
|
address: address,
|
|
366
367
|
network: network,
|
|
367
368
|
})];
|
|
368
369
|
case 1:
|
|
369
|
-
validateWalletAddress =
|
|
370
|
+
validateWalletAddress = _b.sent();
|
|
371
|
+
if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address)) {
|
|
372
|
+
setRecipientAddressInternal(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address);
|
|
373
|
+
(_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
374
|
+
}
|
|
375
|
+
else if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.valid)) {
|
|
376
|
+
//external
|
|
377
|
+
handleSelectContinueTransferExternal();
|
|
378
|
+
console.warn("external");
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
setInfoDialogContent("Unsupported QR");
|
|
382
|
+
setRecipientAddressError("Invalid wallet address");
|
|
383
|
+
}
|
|
384
|
+
return [2 /*return*/];
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
}); };
|
|
388
|
+
var handleScanAllQrCode = function (result) { return __awaiter(void 0, void 0, void 0, function () {
|
|
389
|
+
var text, tonTransferParam, validateWalletAddress;
|
|
390
|
+
var _a, _b, _c, _d, _e;
|
|
391
|
+
return __generator(this, function (_f) {
|
|
392
|
+
switch (_f.label) {
|
|
393
|
+
case 0:
|
|
394
|
+
(_a = scannerAllQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
395
|
+
if (!result) return [3 /*break*/, 2];
|
|
396
|
+
console.error("result", result);
|
|
397
|
+
text = (_b = result === null || result === void 0 ? void 0 : result[0]) === null || _b === void 0 ? void 0 : _b.rawValue;
|
|
398
|
+
tonTransferParam = (0, parseTonTransferUrl_1.default)(text);
|
|
399
|
+
console.warn("🚀 ~ handleScanAllQrCode ~ tonTransferParam:", tonTransferParam);
|
|
400
|
+
(_c = backDropRef.current) === null || _c === void 0 ? void 0 : _c.open();
|
|
401
|
+
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
402
|
+
address: tonTransferParam === null || tonTransferParam === void 0 ? void 0 : tonTransferParam.address,
|
|
403
|
+
network: (selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.slug) || "ton",
|
|
404
|
+
})];
|
|
405
|
+
case 1:
|
|
406
|
+
validateWalletAddress = _f.sent();
|
|
370
407
|
if (!validateWalletAddress) {
|
|
371
408
|
setInfoDialogContent("Unsupported QR");
|
|
372
409
|
return [2 /*return*/];
|
|
373
410
|
}
|
|
374
|
-
(
|
|
411
|
+
setSendInfoGet(tonTransferParam);
|
|
412
|
+
(_d = backDropRef.current) === null || _d === void 0 ? void 0 : _d.close();
|
|
375
413
|
console.warn("validateWalletAddress", validateWalletAddress);
|
|
376
414
|
// if(validateWalletAddress?.is_current_wallet) {
|
|
377
415
|
// return
|
|
@@ -380,38 +418,20 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
380
418
|
//internal
|
|
381
419
|
console.warn("internal");
|
|
382
420
|
setRecipientAddressInternal(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address);
|
|
383
|
-
(
|
|
421
|
+
(_e = suggestUseTransferInternalDialogRef.current) === null || _e === void 0 ? void 0 : _e.open();
|
|
384
422
|
}
|
|
385
423
|
else if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.valid)) {
|
|
386
424
|
//external
|
|
387
|
-
handleSelectContinueTransferExternal();
|
|
425
|
+
handleSelectContinueTransferExternal(tonTransferParam);
|
|
388
426
|
console.warn("external");
|
|
389
427
|
}
|
|
390
428
|
else {
|
|
391
|
-
setInfoDialogContent("
|
|
429
|
+
setInfoDialogContent("Unsupported QR");
|
|
392
430
|
setRecipientAddressError("Invalid wallet address");
|
|
393
431
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
});
|
|
397
|
-
}); };
|
|
398
|
-
(0, react_1.useEffect)(function () {
|
|
399
|
-
handleValidateWalletAddress(recipientAddress || "", (selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.slug) || "ton");
|
|
400
|
-
}, [recipientAddress]);
|
|
401
|
-
var handleScanAllQrCode = function (result) { return __awaiter(void 0, void 0, void 0, function () {
|
|
402
|
-
var text, tonTransferParam;
|
|
403
|
-
var _a, _b;
|
|
404
|
-
return __generator(this, function (_c) {
|
|
405
|
-
(_a = scannerAllQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
406
|
-
if (result) {
|
|
407
|
-
console.error("result", result);
|
|
408
|
-
text = (_b = result === null || result === void 0 ? void 0 : result[0]) === null || _b === void 0 ? void 0 : _b.rawValue;
|
|
409
|
-
tonTransferParam = (0, parseTonTransferUrl_1.default)(text);
|
|
410
|
-
console.warn("🚀 ~ handleScanAllQrCode ~ tonTransferParam:", tonTransferParam);
|
|
411
|
-
setSendInfoGet(tonTransferParam);
|
|
412
|
-
setRecipientAddress(tonTransferParam === null || tonTransferParam === void 0 ? void 0 : tonTransferParam.address);
|
|
432
|
+
_f.label = 2;
|
|
433
|
+
case 2: return [2 /*return*/];
|
|
413
434
|
}
|
|
414
|
-
return [2 /*return*/];
|
|
415
435
|
});
|
|
416
436
|
}); };
|
|
417
437
|
var handleScanAddressQrCode = function () { };
|
|
@@ -471,7 +491,12 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
471
491
|
placeholder: "Enter memo",
|
|
472
492
|
value: memo,
|
|
473
493
|
onChange: handleChangeMemo,
|
|
474
|
-
} })] })), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, status: amountError
|
|
494
|
+
} })] })), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, status: amountError ||
|
|
495
|
+
!recipientAddress ||
|
|
496
|
+
!amount ||
|
|
497
|
+
!selectedToken ||
|
|
498
|
+
!selectedNetwork ||
|
|
499
|
+
!!recipientAddressError
|
|
475
500
|
? Button_1.BUTTON_STATUS.DISABLED
|
|
476
501
|
: Button_1.BUTTON_STATUS.ENABLED, children: "Confirm" })] }) }, WithdrawStep.CONFIRM)] }, withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.length), (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: {
|
|
477
502
|
textAlign: "center",
|