tek-wallet 0.0.346 → 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);
@@ -354,6 +355,36 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
354
355
  // network: data?.network,
355
356
  // });
356
357
  // };
358
+ var handleValidateWalletAddress = function (address, network) { return __awaiter(void 0, void 0, void 0, function () {
359
+ var validateWalletAddress;
360
+ var _a;
361
+ return __generator(this, function (_b) {
362
+ switch (_b.label) {
363
+ case 0:
364
+ setRecipientAddressError(undefined);
365
+ return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
366
+ address: address,
367
+ network: network,
368
+ })];
369
+ case 1:
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
+ }); };
357
388
  var handleScanAllQrCode = function (result) { return __awaiter(void 0, void 0, void 0, function () {
358
389
  var text, tonTransferParam, validateWalletAddress;
359
390
  var _a, _b, _c, _d, _e;
@@ -460,7 +491,12 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
460
491
  placeholder: "Enter memo",
461
492
  value: memo,
462
493
  onChange: handleChangeMemo,
463
- } })] })), (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
464
500
  ? Button_1.BUTTON_STATUS.DISABLED
465
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: {
466
502
  textAlign: "center",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.346",
3
+ "version": "0.0.347",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",