tek-wallet 0.0.297 → 0.0.299
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.
|
@@ -107,13 +107,14 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
107
107
|
var _c = (0, react_1.useState)(), selectedNetwork = _c[0], setSelectedNetwork = _c[1];
|
|
108
108
|
var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
|
|
109
109
|
var _d = (0, useWithdrawData_1.default)(), withdrawTokens = _d.withdrawTokens, updateWithdrawToken = _d.updateWithdrawToken;
|
|
110
|
-
var _e = (0, react_1.useState)(),
|
|
111
|
-
var _f = (0, react_1.useState)(
|
|
112
|
-
var _g = (0, react_1.useState)(
|
|
113
|
-
var _h = (0, react_1.useState)(
|
|
110
|
+
var _e = (0, react_1.useState)(), infoDialogContent = _e[0], setInfoDialogContent = _e[1];
|
|
111
|
+
var _f = (0, react_1.useState)(undefined), amount = _f[0], setAmount = _f[1];
|
|
112
|
+
var _g = (0, react_1.useState)(undefined), memo = _g[0], setMemo = _g[1];
|
|
113
|
+
var _h = (0, react_1.useState)(undefined), recipientAddress = _h[0], setRecipientAddress = _h[1];
|
|
114
114
|
var scannerAllQrCodeRef = (0, react_1.useRef)(null);
|
|
115
115
|
var scannerAddressQrCodeRef = (0, react_1.useRef)(null);
|
|
116
116
|
var backDropRef = (0, react_1.useRef)(null);
|
|
117
|
+
var suggestUseTransferInternalDialogRef = (0, react_1.useRef)(null);
|
|
117
118
|
var _j = (0, react_1.useState)(), selectedMethod = _j[0], setSelectedMethod = _j[1];
|
|
118
119
|
var networks = (0, react_1.useMemo)(function () {
|
|
119
120
|
console.warn("🚀 ~ networks ~ selectedToken:", selectedToken);
|
|
@@ -140,6 +141,9 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
140
141
|
open: open,
|
|
141
142
|
close: close,
|
|
142
143
|
}); });
|
|
144
|
+
var handleClearInfoDialogContent = function () {
|
|
145
|
+
setInfoDialogContent(undefined);
|
|
146
|
+
};
|
|
143
147
|
var handleChangeRecipientAddress = function (e) {
|
|
144
148
|
setRecipientAddress(e.target.value);
|
|
145
149
|
};
|
|
@@ -232,9 +236,9 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
232
236
|
// };
|
|
233
237
|
var handleScanAllQrCode = function (result) { return __awaiter(void 0, void 0, void 0, function () {
|
|
234
238
|
var text, tonTransferParam, validateWalletAddress;
|
|
235
|
-
var _a, _b, _c, _d;
|
|
236
|
-
return __generator(this, function (
|
|
237
|
-
switch (
|
|
239
|
+
var _a, _b, _c, _d, _e;
|
|
240
|
+
return __generator(this, function (_f) {
|
|
241
|
+
switch (_f.label) {
|
|
238
242
|
case 0:
|
|
239
243
|
(_a = scannerAllQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
240
244
|
if (!result) return [3 /*break*/, 2];
|
|
@@ -243,22 +247,20 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
243
247
|
tonTransferParam = (0, parseTonTransferUrl_1.default)(text);
|
|
244
248
|
console.warn("🚀 ~ handleScanAllQrCode ~ tonTransferParam:", tonTransferParam);
|
|
245
249
|
(_c = backDropRef.current) === null || _c === void 0 ? void 0 : _c.open();
|
|
246
|
-
if (!tonTransferParam) {
|
|
247
|
-
alert("Unsupported QR");
|
|
248
|
-
return [2 /*return*/];
|
|
249
|
-
}
|
|
250
250
|
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
251
251
|
address: tonTransferParam === null || tonTransferParam === void 0 ? void 0 : tonTransferParam.address,
|
|
252
252
|
network: (selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.slug) || "ton",
|
|
253
253
|
})];
|
|
254
254
|
case 1:
|
|
255
|
-
validateWalletAddress =
|
|
255
|
+
validateWalletAddress = _f.sent();
|
|
256
256
|
if (!validateWalletAddress) {
|
|
257
|
-
|
|
257
|
+
setInfoDialogContent("Unsupported QR");
|
|
258
258
|
return [2 /*return*/];
|
|
259
259
|
}
|
|
260
|
+
setRecipientAddress(tonTransferParam === null || tonTransferParam === void 0 ? void 0 : tonTransferParam.address);
|
|
261
|
+
setAmount(tonTransferParam === null || tonTransferParam === void 0 ? void 0 : tonTransferParam.amount);
|
|
262
|
+
setMemo(tonTransferParam === null || tonTransferParam === void 0 ? void 0 : tonTransferParam.text);
|
|
260
263
|
(_d = backDropRef.current) === null || _d === void 0 ? void 0 : _d.close();
|
|
261
|
-
setDialogContent("Unsupported QR, please scan a valid QR code or enter the recipient address manually");
|
|
262
264
|
console.warn("validateWalletAddress", validateWalletAddress);
|
|
263
265
|
// if(validateWalletAddress?.is_current_wallet) {
|
|
264
266
|
// return
|
|
@@ -266,21 +268,33 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
266
268
|
if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address)) {
|
|
267
269
|
//internal
|
|
268
270
|
console.warn("internal");
|
|
271
|
+
(_e = suggestUseTransferInternalDialogRef.current) === null || _e === void 0 ? void 0 : _e.open();
|
|
269
272
|
}
|
|
270
273
|
else if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.valid)) {
|
|
271
274
|
//external
|
|
275
|
+
handleSelectContinueTransferExternal();
|
|
272
276
|
console.warn("external");
|
|
273
277
|
}
|
|
274
278
|
else {
|
|
275
279
|
//invalid
|
|
276
280
|
console.warn("invalid");
|
|
277
281
|
}
|
|
278
|
-
|
|
282
|
+
_f.label = 2;
|
|
279
283
|
case 2: return [2 /*return*/];
|
|
280
284
|
}
|
|
281
285
|
});
|
|
282
286
|
}); };
|
|
283
287
|
var handleScanAddressQrCode = function () { };
|
|
288
|
+
var handleSelectTransferInternal = function () {
|
|
289
|
+
var _a;
|
|
290
|
+
(_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
291
|
+
gotoStep(WithdrawStep.CONFIRM);
|
|
292
|
+
};
|
|
293
|
+
var handleSelectContinueTransferExternal = function () {
|
|
294
|
+
var _a;
|
|
295
|
+
(_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
296
|
+
gotoStep(WithdrawStep.CONFIRM);
|
|
297
|
+
};
|
|
284
298
|
(0, react_1.useEffect)(function () {
|
|
285
299
|
if (isAuthenticated && !withdrawTokens) {
|
|
286
300
|
console.warn("🚀 ~ updateWithdrawToken ~ isAuthenticated:", isAuthenticated);
|
|
@@ -329,7 +343,11 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
329
343
|
placeholder: "Enter memo",
|
|
330
344
|
value: memo,
|
|
331
345
|
onChange: handleChangeMemo,
|
|
332
|
-
} })] }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, 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: !!
|
|
346
|
+
} })] }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, 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: infoDialogContent, actions: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.dialogActionsOk), { width: "100%" }), onClick: handleClearInfoDialogContent, children: "Ok" }) }) }), (0, jsx_runtime_1.jsx)(AppDialog_1.default, { ref: suggestUseTransferInternalDialogRef, children: (0, jsx_runtime_1.jsx)(DialogContentLayout_1.default, { content: "This wallet is supported send internally, use it for faster transaction?", actions: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
347
|
+
display: "grid",
|
|
348
|
+
gridTemplateColumns: "1fr auto 1fr",
|
|
349
|
+
gap: theme.mixins.gaps.g8,
|
|
350
|
+
}, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.dialogActionsCancel), { width: "100%" }), onClick: 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" })] }) }) })] }) }) }));
|
|
333
351
|
});
|
|
334
352
|
WithdrawFunction.displayName = "WithdrawFunction";
|
|
335
353
|
exports.default = WithdrawFunction;
|
package/dist/theme/mui/theme.js
CHANGED
|
@@ -272,8 +272,10 @@ var theme = (0, styles_1.createTheme)({
|
|
|
272
272
|
},
|
|
273
273
|
dialogActionsOk: {
|
|
274
274
|
fontSize: typography.fontSize14,
|
|
275
|
-
lineHeight: typography.
|
|
275
|
+
lineHeight: typography.leading100,
|
|
276
276
|
color: "#2482ff",
|
|
277
|
+
textAlign: "center",
|
|
278
|
+
padding: "".concat(customPadding.p8, " ").concat(customPadding.p16),
|
|
277
279
|
},
|
|
278
280
|
dialogActionsCancel: {
|
|
279
281
|
fontSize: typography.fontSize14,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface TonTransferUrlParams {
|
|
2
|
-
protocol
|
|
2
|
+
protocol?: "ton" | "https";
|
|
3
3
|
address: string;
|
|
4
4
|
amount: string | undefined;
|
|
5
5
|
text: string | undefined;
|
|
@@ -8,5 +8,4 @@ export interface TonTransferUrlParams {
|
|
|
8
8
|
jetton: string | undefined;
|
|
9
9
|
isDeepLinkFormat: boolean;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
12
|
-
export default function parseTonTransferUrl(url: string): ParseTonTransferUrlResult;
|
|
11
|
+
export default function parseTonTransferUrl(url: string): TonTransferUrlParams;
|
|
@@ -97,6 +97,15 @@ function parseTonTransferUrl(url) {
|
|
|
97
97
|
}
|
|
98
98
|
catch (error) {
|
|
99
99
|
console.error("error", error);
|
|
100
|
-
return
|
|
100
|
+
return {
|
|
101
|
+
protocol: undefined,
|
|
102
|
+
address: url,
|
|
103
|
+
amount: undefined,
|
|
104
|
+
text: undefined,
|
|
105
|
+
bin: undefined,
|
|
106
|
+
init: undefined,
|
|
107
|
+
jetton: undefined,
|
|
108
|
+
isDeepLinkFormat: false,
|
|
109
|
+
};
|
|
101
110
|
}
|
|
102
111
|
}
|