tek-wallet 0.0.366 → 0.0.367
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.
|
@@ -304,9 +304,9 @@ var ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
304
304
|
overflow: "hidden",
|
|
305
305
|
backgroundColor: theme.palette.background.white,
|
|
306
306
|
backdropFilter: "blur(10px)",
|
|
307
|
-
}, children: (0, jsx_runtime_1.jsx)(QRCode_1.default, { value: qrCodeValue, title: "Receive ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name), logo: (0, getIcon_1.default)("ton"), bgColor: "transparent" }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, color: "text.white" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: "Network" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "button", sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g2, cursor: "pointer", transition: "transform 0.3s ease-in-out", "&:active": {
|
|
307
|
+
}, children: (0, jsx_runtime_1.jsx)(QRCode_1.default, { value: qrCodeValue, title: "Receive ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name), logo: (0, getIcon_1.default)("ton"), bgColor: "transparent" }) }), selectedMethod === ReceiveMethods.RECEIVE_EXTERNAL && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, color: "text.white" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: "Network" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "button", sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g2, cursor: "pointer", transition: "transform 0.3s ease-in-out", "&:active": {
|
|
308
308
|
transform: "translateX(0.5rem)",
|
|
309
|
-
} }), onClick: handleBack, children: [(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)(Icon_1.default, { src: (0, getIcon_1.default)("right_arrow"), width: 10 })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, color: "text.white" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: "Address" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { wordBreak: "break-all" }), children: (0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: receiveAddress || "", children: receiveAddress }) })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, backgroundColor: theme.palette.background.white16, borderRadius: theme.mixins.theBorderRadius.r12, padding: theme.mixins.customPadding.p8 }), children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!amount && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: ["Receive", " ", (0, jsx_runtime_1.jsxs)("strong", { style: { color: theme.palette.text.white }, children: ["min ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value, " ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name] }), " ", "and", " ", (0, jsx_runtime_1.jsx)("strong", { style: { color: theme.palette.text.white }, children: "select the correct network" }), ", or you will lose your assets."] })), !!amount && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: [(0, jsx_runtime_1.jsx)("strong", { children: "Please select the correct network" }), ", unless you will lose your assets."] }))] }) })] }), (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: amountDrawerRef, sx: {
|
|
309
|
+
} }), onClick: handleBack, children: [(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)(Icon_1.default, { src: (0, getIcon_1.default)("right_arrow"), width: 10 })] })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, color: "text.white" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: "Address" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { wordBreak: "break-all" }), children: (0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: receiveAddress || "", children: receiveAddress }) })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, backgroundColor: theme.palette.background.white16, borderRadius: theme.mixins.theBorderRadius.r12, padding: theme.mixins.customPadding.p8 }), children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!amount && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: ["Receive", " ", (0, jsx_runtime_1.jsxs)("strong", { style: { color: theme.palette.text.white }, children: ["min ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value, " ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name] }), " ", "and", " ", (0, jsx_runtime_1.jsx)("strong", { style: { color: theme.palette.text.white }, children: "select the correct network" }), ", or you will lose your assets."] })), !!amount && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: [(0, jsx_runtime_1.jsx)("strong", { children: "Please select the correct network" }), ", unless you will lose your assets."] }))] }) })] }), (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: amountDrawerRef, sx: {
|
|
310
310
|
width: "100%",
|
|
311
311
|
display: "flex",
|
|
312
312
|
justifyContent: "center",
|
|
@@ -275,17 +275,18 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
275
275
|
var findWithdrawToken = function (contract_address) {
|
|
276
276
|
return withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.find(function (item) { return (item === null || item === void 0 ? void 0 : item.address) === contract_address; });
|
|
277
277
|
};
|
|
278
|
-
var handleSelectTransferInternal = function () {
|
|
278
|
+
var handleSelectTransferInternal = function (tonTransferParam) {
|
|
279
279
|
var _a;
|
|
280
280
|
(_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
281
|
-
var
|
|
282
|
-
|
|
281
|
+
var data = tonTransferParam !== null && tonTransferParam !== void 0 ? tonTransferParam : sendInfoGet;
|
|
282
|
+
var tokenSet = findWithdrawToken((data === null || data === void 0 ? void 0 : data.jetton) || "");
|
|
283
|
+
console.warn("🚀 ~ handleSelectTransferInternal ~ sendInfoGet:", data);
|
|
283
284
|
setRecipientAddress(recipientAddressInternal);
|
|
284
285
|
setSelectedMethod(SendMethods.TRANSFER_INTERNAL);
|
|
285
286
|
if (onlyChangeAddress.current) {
|
|
286
287
|
return;
|
|
287
288
|
}
|
|
288
|
-
setAmount(getAmountAfterDecimal((
|
|
289
|
+
setAmount(getAmountAfterDecimal((data === null || data === void 0 ? void 0 : data.amount) || 0, (tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.decimal) || 0));
|
|
289
290
|
if (!tokenSet) {
|
|
290
291
|
gotoStep(WithdrawStep.SELECT_TOKEN);
|
|
291
292
|
}
|
|
@@ -335,11 +336,13 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
335
336
|
break;
|
|
336
337
|
}
|
|
337
338
|
};
|
|
338
|
-
var handleGetEstimateFee = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
339
|
+
var handleGetEstimateFee = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
339
340
|
var response;
|
|
340
341
|
return __generator(this, function (_a) {
|
|
341
342
|
switch (_a.label) {
|
|
342
343
|
case 0:
|
|
344
|
+
if (!selectedToken)
|
|
345
|
+
return [2 /*return*/];
|
|
343
346
|
setIsLoadingEstimateFee(true);
|
|
344
347
|
return [4 /*yield*/, (0, get_est_fee_service_1.default)({
|
|
345
348
|
amount: "".concat(amount),
|
|
@@ -353,7 +356,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
353
356
|
return [2 /*return*/];
|
|
354
357
|
}
|
|
355
358
|
});
|
|
356
|
-
}); };
|
|
359
|
+
}); }, [amount, selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.slug]);
|
|
357
360
|
var openScannerAddressQrCode = function () {
|
|
358
361
|
var _a;
|
|
359
362
|
(_a = scannerAddressQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
@@ -423,7 +426,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
423
426
|
});
|
|
424
427
|
}); };
|
|
425
428
|
var handleScanAllQrCode = function (result) { return __awaiter(void 0, void 0, void 0, function () {
|
|
426
|
-
var text, tonTransferParam, validateWalletAddress;
|
|
429
|
+
var text, isReceiveInternal, tonTransferParam, validateWalletAddress;
|
|
427
430
|
var _a, _b, _c, _d, _e;
|
|
428
431
|
return __generator(this, function (_f) {
|
|
429
432
|
switch (_f.label) {
|
|
@@ -432,7 +435,11 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
432
435
|
if (!result) return [3 /*break*/, 2];
|
|
433
436
|
console.error("result", result);
|
|
434
437
|
text = (_b = result === null || result === void 0 ? void 0 : result[0]) === null || _b === void 0 ? void 0 : _b.rawValue;
|
|
435
|
-
|
|
438
|
+
isReceiveInternal = text === null || text === void 0 ? void 0 : text.includes("isTekWalletReceiveInternal");
|
|
439
|
+
tonTransferParam = isReceiveInternal
|
|
440
|
+
? JSON.parse(text)
|
|
441
|
+
: (0, parseTonTransferUrl_1.default)(text);
|
|
442
|
+
console.warn("🚀 ~ handleScanAllQrCode ~ tonTransferParam:", tonTransferParam);
|
|
436
443
|
console.warn("🚀 ~ handleScanAllQrCode ~ tonTransferParam:", tonTransferParam);
|
|
437
444
|
(_c = backDropRef.current) === null || _c === void 0 ? void 0 : _c.open();
|
|
438
445
|
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
@@ -459,15 +466,16 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
459
466
|
setRecipientAddressError(undefined);
|
|
460
467
|
}
|
|
461
468
|
if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address)) {
|
|
462
|
-
//internal
|
|
463
|
-
console.warn("internal");
|
|
464
469
|
setRecipientAddressInternal(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address);
|
|
465
|
-
(
|
|
470
|
+
if (isReceiveInternal) {
|
|
471
|
+
handleSelectTransferInternal(tonTransferParam);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
(_e = suggestUseTransferInternalDialogRef.current) === null || _e === void 0 ? void 0 : _e.open();
|
|
475
|
+
}
|
|
466
476
|
}
|
|
467
477
|
else if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.valid)) {
|
|
468
|
-
//external
|
|
469
478
|
handleSelectContinueTransferExternal(tonTransferParam);
|
|
470
|
-
console.warn("external");
|
|
471
479
|
}
|
|
472
480
|
else {
|
|
473
481
|
setInfoDialogContent("Unsupported QR");
|
|
@@ -535,7 +543,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
535
543
|
}, [validateAmount]);
|
|
536
544
|
(0, react_1.useEffect)(function () {
|
|
537
545
|
handleGetEstimateFee();
|
|
538
|
-
}, [
|
|
546
|
+
}, [handleGetEstimateFee]);
|
|
539
547
|
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: {
|
|
540
548
|
width: "100%",
|
|
541
549
|
display: "flex",
|
|
@@ -598,7 +606,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
598
606
|
display: "grid",
|
|
599
607
|
gridTemplateColumns: "1fr auto 1fr",
|
|
600
608
|
gap: theme.mixins.gaps.g8,
|
|
601
|
-
}, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.dialogActionsCancel), { width: "100%" }), onClick: function () { return handleSelectContinueTransferExternal(); }, children: "Keep continue" }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical", variant: "middle", flexItem: true }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.dialogActionsOk), { width: "100%" }), onClick: handleSelectTransferInternal, children: "Ok" })] }) }) })] }) }) }));
|
|
609
|
+
}, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.dialogActionsCancel), { width: "100%" }), onClick: function () { return handleSelectContinueTransferExternal(); }, children: "Keep continue" }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical", variant: "middle", flexItem: true }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.dialogActionsOk), { width: "100%" }), onClick: function () { return handleSelectTransferInternal(); }, children: "Ok" })] }) }) })] }) }) }));
|
|
602
610
|
});
|
|
603
611
|
WithdrawFunction.displayName = "WithdrawFunction";
|
|
604
612
|
exports.default = WithdrawFunction;
|