tek-wallet 0.0.701 → 0.0.703
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/QrCodeReader/index.js +11 -25
- package/dist/components/TekWallet/components/ui/ReceiveFunction/index.js +82 -80
- package/dist/components/TekWallet/components/ui/ScanQRToSend/index.d.ts +5 -1
- package/dist/components/TekWallet/components/ui/ScanQRToSend/index.js +13 -11
- package/dist/components/TekWallet/components/ui/SendExternalToken/index.js +0 -1
- package/dist/components/TekWallet/components/ui/SendInternalToken/index.js +0 -1
- package/dist/components/TekWallet/components/ui/TransferInternal/index.js +0 -1
- package/dist/components/TekWallet/services/axios/validate-wallet-address-service/type.d.ts +5 -3
- package/package.json +1 -1
|
@@ -77,29 +77,14 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
}, [isOpen]);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
// top: 100%;
|
|
89
|
-
// }
|
|
90
|
-
// 100% {
|
|
91
|
-
// top: 0%;
|
|
92
|
-
// }
|
|
93
|
-
// }
|
|
94
|
-
// .move-up-down-animation {
|
|
95
|
-
// animation: move-up-down 5s infinite linear;
|
|
96
|
-
// }
|
|
97
|
-
// `;
|
|
98
|
-
// document.head.appendChild(styleTag);
|
|
99
|
-
// return () => {
|
|
100
|
-
// styleTag.remove();
|
|
101
|
-
// };
|
|
102
|
-
// }, []);
|
|
80
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
81
|
+
var styleTag = document.createElement("style");
|
|
82
|
+
styleTag.innerHTML = "\n @keyframes move-up-down {\n 0% {\n transform: translateY(0%);\n }\n 50% {\n transform: translateY(100%);\n }\n 100% {\n transform: translateY(0%);\n }\n }\n\n .move-up-down-animation {\n animation: move-up-down 5s infinite linear;\n }\n ";
|
|
83
|
+
document.head.appendChild(styleTag);
|
|
84
|
+
return function () {
|
|
85
|
+
styleTag.remove();
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
103
88
|
return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { trigger: props.children, ref: drawerRef, onClose: onClose, onOpen: onOpen, sx: sx, className: className, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { sx: {
|
|
104
89
|
backgroundColor: "transparent !important",
|
|
105
90
|
}, header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { hideBack: true, title: "Scan QR code", sx: {
|
|
@@ -131,9 +116,10 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
131
116
|
}, children: [(0, jsx_runtime_1.jsx)("div", { className: "move-up-down-animation", style: {
|
|
132
117
|
position: "absolute",
|
|
133
118
|
left: 0,
|
|
119
|
+
top: 0,
|
|
134
120
|
width: "100%",
|
|
135
|
-
height: "
|
|
136
|
-
|
|
121
|
+
height: "100%",
|
|
122
|
+
borderTop: "2px solid currentColor",
|
|
137
123
|
} }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
138
124
|
position: "absolute",
|
|
139
125
|
borderTopLeftRadius: STYLES.borderRadius,
|
|
@@ -67,6 +67,7 @@ var Share_1 = __importDefault(require("../Share"));
|
|
|
67
67
|
var NetworkSelection_1 = __importDefault(require("../NetworkSelection"));
|
|
68
68
|
var TokenSelection_1 = __importDefault(require("../TokenSelection"));
|
|
69
69
|
var useReceiveData_1 = __importDefault(require("../../../hooks/useReceiveData"));
|
|
70
|
+
var RequireConnect_1 = __importDefault(require("../RequireConnect"));
|
|
70
71
|
var WaitingData_1 = __importDefault(require("../WaitingData"));
|
|
71
72
|
var EmptyData_1 = __importDefault(require("../EmptyData"));
|
|
72
73
|
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
@@ -151,7 +152,7 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
151
152
|
return (_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;
|
|
152
153
|
}, [blockchainWallets, selectedNetwork, selectedMethod, masterWallet, selectedToken]);
|
|
153
154
|
var qrCodeValue = (0, react_1.useMemo)(function () {
|
|
154
|
-
var _a, _b, _c
|
|
155
|
+
var _a, _b, _c;
|
|
155
156
|
if (!receiveAddress || !selectedToken) {
|
|
156
157
|
return "";
|
|
157
158
|
}
|
|
@@ -168,7 +169,8 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
168
169
|
};
|
|
169
170
|
return JSON.stringify(tonTransferParamInternal);
|
|
170
171
|
}
|
|
171
|
-
return
|
|
172
|
+
// return `ton://transfer/${receiveAddress}?jetton=${selectedToken?.network_data?.[0]?.address}&text=test-text&amount=${+amount * 10 ** (selectedToken?.decimal ?? 0)}`;
|
|
173
|
+
return "".concat(receiveAddress);
|
|
172
174
|
}, [receiveAddress, selectedToken, amount, selectedMethod]);
|
|
173
175
|
var warningMessage = (0, react_1.useMemo)(function () {
|
|
174
176
|
if (selectedMethod === ReceiveMethods.RECEIVE_EXTERNAL && !amount) {
|
|
@@ -322,87 +324,87 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
322
324
|
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;
|
|
323
325
|
return blockchainAddress;
|
|
324
326
|
}, [blockchainWallets, masterWallet, selectedMethod, selectedNetwork]);
|
|
325
|
-
return ((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: {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
color: theme.palette.text.black,
|
|
351
|
-
py: theme.mixins.customPadding.p6,
|
|
352
|
-
px: theme.mixins.customPadding.p12,
|
|
353
|
-
fontSize: theme.typography.fontSize16,
|
|
354
|
-
"input::placeholder": {
|
|
355
|
-
fontSize: theme.typography.fontSize12,
|
|
356
|
-
pl: theme.mixins.customPadding.p4,
|
|
357
|
-
fontWeight: theme.typography.fontWeight500,
|
|
327
|
+
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: {
|
|
328
|
+
width: "100%",
|
|
329
|
+
}, 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: {
|
|
330
|
+
position: "relative",
|
|
331
|
+
sx: "100dvh",
|
|
332
|
+
}, header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: RECEIVE_STEP_NAME[Math.max(currentStep, ReceiveStep.SELECT_TOKEN)], overrideBack: handleBack, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, marginLeft: "auto" }), children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: SvgPath_1.IC_HELP }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical", sx: {
|
|
333
|
+
height: "1rem",
|
|
334
|
+
width: "1px",
|
|
335
|
+
backgroundColor: theme.palette.border.accent3,
|
|
336
|
+
} }), (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: historyRef, trigger: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20, display: "block" }, children: SvgPath_1.IC_HISTORY }), direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, children: (0, jsx_runtime_1.jsx)(ReceiveHistory_1.default, { onClose: closeHistory }) })] }) }), footer: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
337
|
+
maxHeight: currentStep === ReceiveStep.SHOW_QR_CODE ? "120px" : 0,
|
|
338
|
+
overflow: "hidden",
|
|
339
|
+
transition: currentStep === ReceiveStep.SHOW_QR_CODE
|
|
340
|
+
? "max-height 0.3s linear 0.3s"
|
|
341
|
+
: "max-height 0s linear",
|
|
342
|
+
}, 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: {
|
|
343
|
+
// autoHeight: true,
|
|
344
|
+
spaceBetween: 32,
|
|
345
|
+
}, disableSwipe: true,
|
|
346
|
+
// key={`step_${currentStep}`}
|
|
347
|
+
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
|
+
borderRadius: theme.mixins.customRadius.r12,
|
|
349
|
+
border: "1px solid",
|
|
350
|
+
borderColor: theme.palette.border.accent3,
|
|
351
|
+
background: theme.palette.background.white,
|
|
358
352
|
color: theme.palette.text.black,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
353
|
+
py: theme.mixins.customPadding.p6,
|
|
354
|
+
px: theme.mixins.customPadding.p12,
|
|
355
|
+
fontSize: theme.typography.fontSize16,
|
|
356
|
+
"input::placeholder": {
|
|
357
|
+
fontSize: theme.typography.fontSize12,
|
|
358
|
+
pl: theme.mixins.customPadding.p4,
|
|
359
|
+
fontWeight: theme.typography.fontWeight500,
|
|
360
|
+
color: theme.palette.text.black,
|
|
361
|
+
},
|
|
362
|
+
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
363
|
+
display: theme.mixins.row,
|
|
364
|
+
justifyContent: "space-between",
|
|
365
|
+
mt: theme.mixins.customMargin.m16,
|
|
366
|
+
}, children: [(0, jsx_runtime_1.jsx)(sortByBalance_1.default, { name: "Token" }), (0, jsx_runtime_1.jsx)(sortByBalance_1.default, { name: "Balance",
|
|
367
|
+
// sortBalance={sortBalance}
|
|
368
|
+
setSortBalance: setSortBalance })] })] })), receiveTokens === null || receiveTokens === void 0 ? void 0 : receiveTokens.map(function (item, index) {
|
|
369
|
+
var stringifiedTokenData = JSON.stringify(item);
|
|
370
|
+
if (!item)
|
|
371
|
+
return null;
|
|
372
|
+
return ((0, jsx_runtime_1.jsx)(TokenSelection_1.default, { onClick: handleSelectToken, tokenData: stringifiedTokenData, active: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.id) === item.id }, "token_".concat(item.id, "_").concat(index)));
|
|
373
|
+
})] }) }, "slide_step_".concat(ReceiveStep.SELECT_TOKEN)), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, display: selectedMethod === ReceiveMethods.RECEIVE_EXTERNAL ? "flex" : "none" }), children: networks === null || networks === void 0 ? void 0 : networks.map(function (item, index) {
|
|
368
374
|
if (!item)
|
|
369
375
|
return null;
|
|
370
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
371
|
-
})
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
fontSize: theme.typography.fontSize14,
|
|
403
|
-
textTransform: "none",
|
|
404
|
-
fontWeight: theme.typography.fontWeight500,
|
|
405
|
-
}, children: [amount ? "Edit" : "+ Set", " amount"] }) }), children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { id: keyboardId, onChange: handleChangeAmount, keyboardType: xhub_keyboard_1.KeyboardType.Double, value: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.toString(), keyboardId: "amount-keyboard-id", children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { onClose: function () { var _a; return (_a = amountDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, title: (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: [amount ? "Edit" : "Set", " ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name, " amount"] }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Input, { ref: amountInputRef, elementsAcceptIds: ["amount-keyboard-id"], value: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.toString(), displayType: xhub_keyboard_1.DisplayType.Double, rightElement: (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { onClick: handleClickMaxAmount, sx: __assign({}, theme.mixins.smallButton), children: "Max" }) }) }), amountError && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: amountError })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "100%", mt: theme.mixins.customMargin.m8, gap: theme.mixins.gaps.g12 }), children: [!!amount && (0, jsx_runtime_1.jsx)(Button_1.default.Text, { onClick: handleUnset, children: "Unset" }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { flex: 1 }, onClick: handleContinue, status: !!amountError ? Button_1.BUTTON_STATUS.DISABLED : Button_1.BUTTON_STATUS.ENABLED, children: "Continue" })] })] }) }) }) })] }) }, "slide_step_".concat(ReceiveStep.SHOW_QR_CODE))] }) }) }) }) }) }));
|
|
376
|
+
return ((0, jsx_runtime_1.jsx)(NetworkSelection_1.default, { onClick: handleSelectNetwork, networkData: JSON.stringify(item), active: (selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.id) === item.id }, "network_".concat(item.id, "_").concat(index)));
|
|
377
|
+
}) }) }, "slide_step_".concat(ReceiveStep.SELECT_NETWORK)), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
378
|
+
display: "flex",
|
|
379
|
+
flexDirection: "column",
|
|
380
|
+
gap: theme.mixins.gaps.g16,
|
|
381
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { id: "share-receive-info", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ width: "100%" }, theme.mixins.column), { gap: theme.mixins.gaps.g12, backgroundColor: theme.palette.background.tertiary, borderRadius: theme.mixins.customRadius.r16, padding: theme.mixins.customPadding.p16, paddingTop: "5rem", alignItems: "flex-start", position: "relative", marginTop: "4.6875rem" }), children: [(0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
382
|
+
color: theme.palette.border.accent,
|
|
383
|
+
width: "100%",
|
|
384
|
+
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.center), { top: 0, width: "fit-content", height: "fit-content", borderRadius: theme.mixins.customRadius.r12, padding: theme.mixins.customPadding.p8 }), children: [(0, jsx_runtime_1.jsx)(QRCode_1.default, { value: qrCodeValue, logo: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.link, bgColor: "transparent", size: 150 }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.center), { padding: theme.mixins.customPadding.p4, borderRadius: 9999, backgroundColor: theme.palette.background.white }), children: (0, jsx_runtime_1.jsx)(Icon_1.default, { crossOrigin: "anonymous", width: 24, height: 24, src: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.link, sx: {
|
|
385
|
+
borderRadius: 9999,
|
|
386
|
+
} }) })] }), selectedMethod === ReceiveMethods.RECEIVE_EXTERNAL && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: "Network" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.row), onClick: handleBack, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { component: "button", sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4, cursor: "pointer", transition: "transform 0.3s ease-in-out", "&:active": {
|
|
387
|
+
transform: "translateX(0.5rem)",
|
|
388
|
+
} }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 24, height: 24, sx: {
|
|
389
|
+
borderRadius: "9999px",
|
|
390
|
+
}, src: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.link }), (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)(material_1.SvgIcon, { sx: { width: 12, height: 12, ml: "auto" }, children: SvgPath_1.IC_CHEVRON_RIGHT })] })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: selectedMethod === ReceiveMethods.RECEIVE_INTERNAL
|
|
391
|
+
? "Internal address"
|
|
392
|
+
: "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: {
|
|
393
|
+
color: theme.palette.border.accent,
|
|
394
|
+
width: "100%",
|
|
395
|
+
} }), (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.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.activityTitle), { fontSize: theme.typography.fontSize13 }), children: [amount, " ", 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: "Minimum Top Up" }), value: (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.activityTitle), { fontSize: theme.typography.fontSize13 }), children: ["0.003 ", selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.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: {
|
|
396
|
+
color: theme.palette.border.accent,
|
|
397
|
+
width: "100%",
|
|
398
|
+
mt: theme.mixins.customMargin.m12,
|
|
399
|
+
} }), !!warningMessage && ((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.customRadius.r12, padding: theme.mixins.customPadding.p8 }), children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: warningMessage }) }))] }) }), (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: amountDrawerRef, sx: {
|
|
400
|
+
width: "100%",
|
|
401
|
+
display: "flex",
|
|
402
|
+
justifyContent: "center",
|
|
403
|
+
}, onOpen: handleAmountModalOpen, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsxs)(Button_1.default.Text, { sx: {
|
|
404
|
+
fontSize: theme.typography.fontSize14,
|
|
405
|
+
textTransform: "none",
|
|
406
|
+
fontWeight: theme.typography.fontWeight500,
|
|
407
|
+
}, children: [amount ? "Edit" : "+ Set", " amount"] }) }), children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { id: keyboardId, onChange: handleChangeAmount, keyboardType: xhub_keyboard_1.KeyboardType.Double, value: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.toString(), keyboardId: "amount-keyboard-id", children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { onClose: function () { var _a; return (_a = amountDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, title: (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: [amount ? "Edit" : "Set", " ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name, " amount"] }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Input, { ref: amountInputRef, elementsAcceptIds: ["amount-keyboard-id"], value: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.toString(), displayType: xhub_keyboard_1.DisplayType.Double, rightElement: (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { onClick: handleClickMaxAmount, sx: __assign({}, theme.mixins.smallButton), children: "Max" }) }) }), amountError && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: amountError })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "100%", mt: theme.mixins.customMargin.m8, gap: theme.mixins.gaps.g12 }), children: [!!amount && ((0, jsx_runtime_1.jsx)(Button_1.default.Text, { onClick: handleUnset, children: "Unset" })), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { flex: 1 }, onClick: handleContinue, status: !!amountError ? Button_1.BUTTON_STATUS.DISABLED : Button_1.BUTTON_STATUS.ENABLED, children: "Continue" })] })] }) }) }) })] }) }, "slide_step_".concat(ReceiveStep.SHOW_QR_CODE))] }) }) }) }) }) }) }));
|
|
406
408
|
});
|
|
407
409
|
exports.ReceiveFunction.displayName = "ReceiveFunction";
|
|
408
410
|
exports.default = exports.ReceiveFunction;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { GeneralProps } from "../../../types/ui";
|
|
2
2
|
import { TonTransferUrlParams } from "../../../utils/parseTonTransferUrl";
|
|
3
|
+
export interface SendExternalParams {
|
|
4
|
+
address: string;
|
|
5
|
+
network: string[];
|
|
6
|
+
}
|
|
3
7
|
interface ScanQRToSendProps extends GeneralProps {
|
|
4
8
|
overrideAmount?: number;
|
|
5
9
|
overrideMemo?: string;
|
|
@@ -7,7 +11,7 @@ interface ScanQRToSendProps extends GeneralProps {
|
|
|
7
11
|
transferInternalPath?: string;
|
|
8
12
|
transferExternalPath?: string;
|
|
9
13
|
gotoTransferInternalOverride?: (params?: TonTransferUrlParams) => void;
|
|
10
|
-
gotoTransferExternalOverride?: (params?:
|
|
14
|
+
gotoTransferExternalOverride?: (params?: SendExternalParams) => void;
|
|
11
15
|
}
|
|
12
16
|
export type ScanQRToSendRef = {
|
|
13
17
|
open: () => void;
|
|
@@ -105,7 +105,7 @@ exports.ScanQRToSend = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
105
105
|
router.push(url);
|
|
106
106
|
};
|
|
107
107
|
var gotoTransferExternal = function (params) {
|
|
108
|
-
var theParams = params
|
|
108
|
+
var theParams = params;
|
|
109
109
|
if (gotoTransferExternalOverride) {
|
|
110
110
|
gotoTransferExternalOverride(theParams);
|
|
111
111
|
return;
|
|
@@ -117,11 +117,11 @@ exports.ScanQRToSend = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
117
117
|
};
|
|
118
118
|
var handleScanAllQrCode = function (result) { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
119
|
var text, isReceiveInternal, tonTransferParam, validateResult, message, error_1;
|
|
120
|
-
var _a, _b, _c, _d, _e, _f;
|
|
121
|
-
return __generator(this, function (
|
|
122
|
-
switch (
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
121
|
+
return __generator(this, function (_k) {
|
|
122
|
+
switch (_k.label) {
|
|
123
123
|
case 0:
|
|
124
|
-
|
|
124
|
+
_k.trys.push([0, 3, , 4]);
|
|
125
125
|
(_a = scannerAllQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
126
126
|
if (!result) return [3 /*break*/, 2];
|
|
127
127
|
text = (_b = result === null || result === void 0 ? void 0 : result[0]) === null || _b === void 0 ? void 0 : _b.rawValue;
|
|
@@ -133,10 +133,9 @@ exports.ScanQRToSend = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
133
133
|
(_c = loadingDropRef.current) === null || _c === void 0 ? void 0 : _c.open();
|
|
134
134
|
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
135
135
|
address: tonTransferParam === null || tonTransferParam === void 0 ? void 0 : tonTransferParam.address,
|
|
136
|
-
network: "ton",
|
|
137
136
|
})];
|
|
138
137
|
case 1:
|
|
139
|
-
validateResult =
|
|
138
|
+
validateResult = _k.sent();
|
|
140
139
|
(_d = loadingDropRef.current) === null || _d === void 0 ? void 0 : _d.close();
|
|
141
140
|
message = validateResult.message;
|
|
142
141
|
if (message === type_1.ValidateWalletAddressResultMessage.ERROR) {
|
|
@@ -159,13 +158,16 @@ exports.ScanQRToSend = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
159
158
|
gotoTransferInternal(tonTransferParam);
|
|
160
159
|
}
|
|
161
160
|
if (message === type_1.ValidateWalletAddressResultMessage.EXTERNAL_WALLET) {
|
|
162
|
-
gotoTransferExternal(
|
|
161
|
+
gotoTransferExternal({
|
|
162
|
+
address: ((_f = validateResult === null || validateResult === void 0 ? void 0 : validateResult.data) === null || _f === void 0 ? void 0 : _f.address) || "",
|
|
163
|
+
network: ((_h = (_g = validateResult === null || validateResult === void 0 ? void 0 : validateResult.data) === null || _g === void 0 ? void 0 : _g.networks) === null || _h === void 0 ? void 0 : _h.map(function (item) { return item.slug; })) || [],
|
|
164
|
+
});
|
|
163
165
|
}
|
|
164
|
-
|
|
166
|
+
_k.label = 2;
|
|
165
167
|
case 2: return [3 /*break*/, 4];
|
|
166
168
|
case 3:
|
|
167
|
-
error_1 =
|
|
168
|
-
(
|
|
169
|
+
error_1 = _k.sent();
|
|
170
|
+
(_j = loadingDropRef.current) === null || _j === void 0 ? void 0 : _j.close();
|
|
169
171
|
console.error(error_1);
|
|
170
172
|
return [3 /*break*/, 4];
|
|
171
173
|
case 4: return [2 /*return*/];
|
|
@@ -192,7 +192,6 @@ exports.SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
192
192
|
setIsValidatingAddress(true);
|
|
193
193
|
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
194
194
|
address: toAddress,
|
|
195
|
-
network: network === null || network === void 0 ? void 0 : network.slug,
|
|
196
195
|
})];
|
|
197
196
|
case 1:
|
|
198
197
|
message = (_a.sent()).message;
|
|
@@ -186,7 +186,6 @@ var SendInternalToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
186
186
|
setIsValidatingAddress(true);
|
|
187
187
|
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
188
188
|
address: toAddress,
|
|
189
|
-
network: "ton",
|
|
190
189
|
})];
|
|
191
190
|
case 1:
|
|
192
191
|
message = (_a.sent()).message;
|
|
@@ -157,7 +157,6 @@ exports.TransferInternal = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
157
157
|
setIsValidatingAddress(true);
|
|
158
158
|
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
159
159
|
address: toAddress,
|
|
160
|
-
network: "ton",
|
|
161
160
|
})];
|
|
162
161
|
case 1:
|
|
163
162
|
message = (_a.sent()).message;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { NetworkData } from "../type";
|
|
1
2
|
export interface ValidateWalletAddressResponse {
|
|
2
3
|
success: boolean;
|
|
3
4
|
message: string;
|
|
4
5
|
data: ValidateWalletAddressData;
|
|
5
6
|
timestamp: string;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
interface ValidateWalletAddressData {
|
|
8
9
|
status: number;
|
|
9
|
-
address:
|
|
10
|
+
address: null;
|
|
10
11
|
valid: number;
|
|
11
12
|
master_wallet_address: null;
|
|
12
13
|
is_existed: boolean;
|
|
14
|
+
networks: NetworkData[];
|
|
13
15
|
is_current_wallet: boolean;
|
|
14
16
|
}
|
|
15
17
|
export interface ValidateWalletAddressBody {
|
|
16
18
|
address: string;
|
|
17
|
-
network?: string;
|
|
18
19
|
}
|
|
19
20
|
export interface ValidateWalletAddressResult {
|
|
20
21
|
message: ValidateWalletAddressResultMessage;
|
|
@@ -28,3 +29,4 @@ export declare enum ValidateWalletAddressResultMessage {
|
|
|
28
29
|
IS_CURRENT_WALLET = "is current wallet",
|
|
29
30
|
EXTERNAL_WALLET_BUT_ALSO_INTERNAL_WALLET = "external wallet but also internal wallet"
|
|
30
31
|
}
|
|
32
|
+
export {};
|