tek-wallet 0.0.815 → 0.0.823
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/AssetsBoard/index.d.ts +2 -0
- package/dist/components/TekWallet/components/ui/AssetsBoard/index.js +61 -0
- package/dist/components/TekWallet/components/ui/ChangePasscode/index.js +1 -1
- package/dist/components/TekWallet/components/ui/ConfirmByPasscode/index.js +3 -3
- package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.d.ts +2 -2
- package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.js +1 -1
- package/dist/components/TekWallet/components/ui/ConfirmSendNft/Result.d.ts +10 -0
- package/dist/components/TekWallet/components/ui/ConfirmSendNft/Result.js +87 -0
- package/dist/components/TekWallet/components/ui/ConfirmSendNft/index.d.ts +17 -0
- package/dist/components/TekWallet/components/ui/ConfirmSendNft/index.js +133 -0
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/index.d.ts +1 -1
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/index.js +1 -1
- package/dist/components/TekWallet/components/ui/DrawerComponent/index.d.ts +1 -1
- package/dist/components/TekWallet/components/ui/DrawerComponent/index.js +2 -1
- package/dist/components/TekWallet/components/ui/Input/ClearInput.d.ts +5 -0
- package/dist/components/TekWallet/components/ui/{WithdrawFunction/components/tutorial.js → Input/ClearInput.js} +5 -9
- package/dist/components/TekWallet/components/ui/Input/PasteInput.d.ts +5 -0
- package/dist/components/TekWallet/components/ui/{WithdrawFunction/components/transferHistory.js → Input/PasteInput.js} +5 -9
- package/dist/components/TekWallet/components/ui/Input/QrScan.d.ts +5 -0
- package/dist/components/TekWallet/components/ui/Input/QrScan.js +31 -0
- package/dist/components/TekWallet/components/ui/Input/index.d.ts +12 -10
- package/dist/components/TekWallet/components/ui/Input/index.js +120 -19
- package/dist/components/TekWallet/components/ui/Input/index_bk.d.ts +10 -0
- package/dist/components/TekWallet/components/ui/Input/index_bk.js +46 -0
- package/dist/components/TekWallet/components/ui/NftDetail/index.d.ts +6 -0
- package/dist/components/TekWallet/components/ui/NftDetail/index.js +47 -0
- package/dist/components/TekWallet/components/ui/NftItem/index.d.ts +8 -0
- package/dist/components/TekWallet/components/ui/NftItem/index.js +74 -0
- package/dist/components/TekWallet/components/ui/NftsBoard/index.d.ts +2 -0
- package/dist/components/TekWallet/components/ui/NftsBoard/index.js +118 -0
- package/dist/components/TekWallet/components/ui/QrCodeReader/index.d.ts +2 -1
- package/dist/components/TekWallet/components/ui/QrCodeReader/index.js +11 -4
- package/dist/components/TekWallet/components/ui/ReceiveDirectly/index.js +1 -1
- package/dist/components/TekWallet/components/ui/ReceiveFunction/index.js +2 -2
- package/dist/components/TekWallet/components/ui/ReceiveHistory/index.js +1 -1
- package/dist/components/TekWallet/components/ui/TokensBoard/index.js +21 -44
- package/dist/components/TekWallet/components/views/AssetView/index.js +2 -2
- package/dist/components/TekWallet/components/views/NftDetailView/LoadingView.d.ts +2 -0
- package/dist/components/TekWallet/components/views/NftDetailView/LoadingView.js +29 -0
- package/dist/components/TekWallet/components/views/NftDetailView/index.d.ts +8 -0
- package/dist/components/TekWallet/components/views/NftDetailView/index.js +20 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Form.js +54 -77
- package/dist/components/TekWallet/components/views/SendExternalView/index.js +1 -1
- package/dist/components/TekWallet/components/views/SendInternalView/components/Form.js +24 -68
- package/dist/components/TekWallet/components/views/SendNftView/components/Form.d.ts +12 -0
- package/dist/components/TekWallet/components/views/SendNftView/components/Form.js +222 -0
- package/dist/components/TekWallet/components/views/SendNftView/index.d.ts +2 -0
- package/dist/components/TekWallet/components/views/SendNftView/index.js +32 -0
- package/dist/components/TekWallet/components/views/SwapView/index.js +1 -1
- package/dist/components/TekWallet/components/views/TekWalletView/index.d.ts +1 -0
- package/dist/components/TekWallet/components/views/TekWalletView/index.js +5 -0
- package/dist/components/TekWallet/hooks/data/useNfts/api.d.ts +5 -0
- package/dist/components/TekWallet/hooks/data/useNfts/api.js +83 -0
- package/dist/components/TekWallet/hooks/data/useNfts/index.d.ts +213 -0
- package/dist/components/TekWallet/hooks/data/useNfts/index.js +55 -0
- package/dist/components/TekWallet/hooks/data/useNfts/nftQueryKey.d.ts +5 -0
- package/dist/components/TekWallet/hooks/data/useNfts/nftQueryKey.js +18 -0
- package/dist/components/TekWallet/hooks/data/useNfts/service.type.d.ts +84 -0
- package/dist/components/TekWallet/hooks/data/useNfts/service.type.js +10 -0
- package/dist/components/TekWallet/hooks/data/useNfts/state.type.d.ts +4 -0
- package/dist/components/TekWallet/hooks/data/useNfts/state.type.js +2 -0
- package/dist/components/TekWallet/hooks/data/useNfts/useNft.d.ts +22 -0
- package/dist/components/TekWallet/hooks/data/useNfts/useNft.js +213 -0
- package/dist/components/TekWallet/hooks/data/useVouchers/service.type.d.ts +22 -0
- package/dist/components/TekWallet/hooks/data/useVouchers/service.type.js +14 -0
- package/dist/components/TekWallet/hooks/store/useQueryKeys/index.d.ts +3 -0
- package/dist/components/TekWallet/hooks/store/useQueryKeys/index.js +86 -0
- package/dist/components/TekWallet/hooks/store/useQueryKeys/type.d.ts +27 -0
- package/dist/components/TekWallet/hooks/store/useQueryKeys/type.js +29 -0
- package/dist/components/TekWallet/hooks/store/useQueryKeys/useQueryKeyDependence.d.ts +11 -0
- package/dist/components/TekWallet/hooks/store/useQueryKeys/useQueryKeyDependence.js +35 -0
- package/dist/components/TekWallet/hooks/store/useQueryKeys/useQueryKeyDependenceOnAccount.d.ts +6 -0
- package/dist/components/TekWallet/hooks/store/useQueryKeys/useQueryKeyDependenceOnAccount.js +25 -0
- package/dist/components/TekWallet/hooks/useCustomRouter.js +7 -3
- package/dist/components/TekWallet/hooks/utils/useEditPageQuery.d.ts +9 -0
- package/dist/components/TekWallet/hooks/utils/useEditPageQuery.js +86 -0
- package/dist/components/TekWallet/hooks/utils/useEditSinglePageQuery.d.ts +4 -0
- package/dist/components/TekWallet/hooks/utils/useEditSinglePageQuery.js +75 -0
- package/dist/components/TekWallet/index.d.ts +1 -0
- package/dist/components/TekWallet/index.js +1 -0
- package/dist/components/TekWallet/providers/TanstackReactQuery/index.d.ts +4 -0
- package/dist/components/TekWallet/providers/TanstackReactQuery/index.js +33 -0
- package/dist/components/TekWallet/providers/TanstackReactQuery/query.config.d.ts +2 -0
- package/dist/components/TekWallet/providers/TanstackReactQuery/query.config.js +18 -0
- package/dist/components/TekWallet/providers/TekWalletProvider/index.d.ts +1 -0
- package/dist/components/TekWallet/providers/TekWalletProvider/index.js +3 -1
- package/dist/components/TekWallet/services/axios/clients/userClientRequest.d.ts +2 -2
- package/dist/components/TekWallet/services/axios/clients/userClientRequest.js +3 -3
- package/dist/components/TekWallet/services/axios/type.d.ts +11 -0
- package/dist/components/TekWallet/theme/mui/components/index.d.ts +1 -15
- package/dist/components/TekWallet/theme/mui/components/overrides/Button.d.ts +1 -15
- package/dist/components/TekWallet/theme/mui/components/overrides/Button.js +3 -8
- package/dist/components/TekWallet/theme/mui/palette.d.ts +10 -4
- package/dist/components/TekWallet/theme/mui/palette.js +6 -1
- package/dist/components/TekWallet/utils/getContractColor.d.ts +1 -1
- package/package.json +5 -2
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/selectToken.d.ts +0 -13
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/selectToken.js +0 -48
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sendForm.d.ts +0 -29
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sendForm.js +0 -235
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sortByBalance.d.ts +0 -7
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sortByBalance.js +0 -45
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sortByToken.d.ts +0 -7
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sortByToken.js +0 -45
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/summary/infoSummary.d.ts +0 -14
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/summary/infoSummary.js +0 -111
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/transferHistory.d.ts +0 -5
- package/dist/components/TekWallet/components/ui/WithdrawFunction/components/tutorial.d.ts +0 -5
- package/dist/components/TekWallet/components/ui/WithdrawFunction/index.d.ts +0 -38
- package/dist/components/TekWallet/components/ui/WithdrawFunction/index.js +0 -570
- package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.d.ts +0 -11
- package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.js +0 -382
- package/dist/components/TekWallet/utils/sort.utils.d.ts +0 -3
- package/dist/components/TekWallet/utils/sort.utils.js +0 -24
package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.js
DELETED
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
-
var ownKeys = function(o) {
|
|
31
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
-
var ar = [];
|
|
33
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
-
return ar;
|
|
35
|
-
};
|
|
36
|
-
return ownKeys(o);
|
|
37
|
-
};
|
|
38
|
-
return function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
47
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
48
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
49
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
50
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
51
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
52
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
56
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
57
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
58
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
59
|
-
function step(op) {
|
|
60
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
61
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
62
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
63
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
64
|
-
switch (op[0]) {
|
|
65
|
-
case 0: case 1: t = op; break;
|
|
66
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
67
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
68
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
69
|
-
default:
|
|
70
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
71
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
72
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
73
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
74
|
-
if (t[2]) _.ops.pop();
|
|
75
|
-
_.trys.pop(); continue;
|
|
76
|
-
}
|
|
77
|
-
op = body.call(thisArg, _);
|
|
78
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
79
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
83
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
84
|
-
};
|
|
85
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
86
|
-
exports.default = Form;
|
|
87
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
88
|
-
var material_1 = require("@mui/material");
|
|
89
|
-
var Input_1 = __importDefault(require("../../../ui/Input"));
|
|
90
|
-
var Formatter_1 = __importDefault(require("../../../ui/Formatter"));
|
|
91
|
-
var SvgPath_1 = require("../../../ui/SvgPath");
|
|
92
|
-
var Text_1 = __importDefault(require("../../../ui/Text"));
|
|
93
|
-
var react_1 = require("react");
|
|
94
|
-
var validate_wallet_address_service_1 = __importDefault(require("../../../../services/axios/validate-wallet-address-service"));
|
|
95
|
-
var lodash_1 = require("lodash");
|
|
96
|
-
var Button_1 = __importStar(require("../../../ui/Button"));
|
|
97
|
-
var expose_1 = require("../../../../services/axios/expose");
|
|
98
|
-
var __1 = require("..");
|
|
99
|
-
var QrCodeReader_1 = __importDefault(require("../../../ui/QrCodeReader"));
|
|
100
|
-
var Icon_1 = __importDefault(require("../../../ui/Icon"));
|
|
101
|
-
var get_est_fee_service_1 = __importDefault(require("../../../../services/axios/get-est-fee-service"));
|
|
102
|
-
var type_1 = require("../../../../services/axios/get-activities-service/type");
|
|
103
|
-
var Fees_1 = __importStar(require("../../../ui/Fees"));
|
|
104
|
-
var xhub_keyboard_1 = require("xhub-keyboard");
|
|
105
|
-
var useUniqueId_1 = require("../../../../hooks/useUniqueId");
|
|
106
|
-
var mui_1 = require("../../../../theme/mui");
|
|
107
|
-
var providers_1 = require("../../../../providers");
|
|
108
|
-
var validateAddressDebounce = (0, lodash_1.debounce)(function (callback) {
|
|
109
|
-
callback();
|
|
110
|
-
}, 500, { leading: true, trailing: true });
|
|
111
|
-
var getEstimateFeeDebounce = (0, lodash_1.debounce)(function (callback) {
|
|
112
|
-
callback();
|
|
113
|
-
}, 500, { leading: true, trailing: true });
|
|
114
|
-
function Form(props) {
|
|
115
|
-
var _this = this;
|
|
116
|
-
var theme = (0, mui_1.useTheme)();
|
|
117
|
-
var selectedToken = props.selectedToken, onContinue = props.onContinue, sx = props.sx;
|
|
118
|
-
var _a = (0, react_1.useState)(""), recipientAddress = _a[0], setRecipientAddress = _a[1];
|
|
119
|
-
var _b = (0, react_1.useState)(), recipientAddressError = _b[0], setRecipientAddressError = _b[1];
|
|
120
|
-
var _c = (0, react_1.useState)(""), amount = _c[0], setAmount = _c[1];
|
|
121
|
-
var _d = (0, react_1.useState)(), amountErrorMessage = _d[0], setAmountErrorMessage = _d[1];
|
|
122
|
-
var _e = (0, react_1.useState)(), amountError = _e[0], setAmountError = _e[1];
|
|
123
|
-
var _f = (0, react_1.useState)(undefined), comment = _f[0], setComment = _f[1];
|
|
124
|
-
var _g = (0, react_1.useState)(false), isValidatingAddress = _g[0], setIsValidatingAddress = _g[1];
|
|
125
|
-
var scannerAddressQrCodeRef = (0, react_1.useRef)(null);
|
|
126
|
-
var _h = (0, react_1.useState)(false), isEstimatingFee = _h[0], setIsLoadingEstimateFee = _h[1];
|
|
127
|
-
var _j = (0, react_1.useState)(), estimateFee = _j[0], setEstimateFee = _j[1];
|
|
128
|
-
var _k = (0, react_1.useState)(false), isEnoughBalanceToPayFee = _k[0], setIsEnoughBalanceToPayFee = _k[1];
|
|
129
|
-
var _l = (0, react_1.useState)(false), isKeyboardOpen = _l[0], setIsKeyboardOpen = _l[1];
|
|
130
|
-
var getEstimateFee = (0, react_1.useCallback)(function (amount) { return __awaiter(_this, void 0, void 0, function () {
|
|
131
|
-
var _this = this;
|
|
132
|
-
return __generator(this, function (_a) {
|
|
133
|
-
setIsLoadingEstimateFee(true);
|
|
134
|
-
getEstimateFeeDebounce(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
135
|
-
var response;
|
|
136
|
-
return __generator(this, function (_a) {
|
|
137
|
-
switch (_a.label) {
|
|
138
|
-
case 0: return [4 /*yield*/, (0, get_est_fee_service_1.default)({
|
|
139
|
-
amount: "".concat(amount),
|
|
140
|
-
transaction_type: type_1.TransactionSlug.TRANSFER_INTERNAL,
|
|
141
|
-
currency: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.slug) || "",
|
|
142
|
-
})];
|
|
143
|
-
case 1:
|
|
144
|
-
response = _a.sent();
|
|
145
|
-
setIsLoadingEstimateFee(false);
|
|
146
|
-
setEstimateFee(response === null || response === void 0 ? void 0 : response.data);
|
|
147
|
-
return [2 /*return*/];
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}); });
|
|
151
|
-
return [2 /*return*/];
|
|
152
|
-
});
|
|
153
|
-
}); }, [selectedToken]);
|
|
154
|
-
var validateAmount = (0, react_1.useCallback)(function (amount) {
|
|
155
|
-
var _a, _b;
|
|
156
|
-
if (!selectedToken)
|
|
157
|
-
return false;
|
|
158
|
-
if (+amount < +(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value)) {
|
|
159
|
-
setAmountErrorMessage(__1.InternalAmountError.MIN_LIMIT);
|
|
160
|
-
setAmountError(+((_a = selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value) !== null && _a !== void 0 ? _a : 0));
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
if (+amount > +(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value)) {
|
|
164
|
-
setAmountErrorMessage(__1.InternalAmountError.MAX_LIMIT);
|
|
165
|
-
setAmountError(+((_b = selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value) !== null && _b !== void 0 ? _b : 0));
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
if (+amount > +(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.balance)) {
|
|
169
|
-
setAmountErrorMessage(__1.InternalAmountError.INSUFFICIENT_BALANCE);
|
|
170
|
-
setAmountError(undefined);
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
setAmountError(undefined);
|
|
174
|
-
setAmountErrorMessage(undefined);
|
|
175
|
-
getEstimateFee(amount);
|
|
176
|
-
return true;
|
|
177
|
-
}, [selectedToken, getEstimateFee]);
|
|
178
|
-
var validateAddress = function (address) {
|
|
179
|
-
if (!address) {
|
|
180
|
-
setRecipientAddressError("The address is required");
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
validateAddressDebounce(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
184
|
-
var validateResult, message;
|
|
185
|
-
return __generator(this, function (_a) {
|
|
186
|
-
switch (_a.label) {
|
|
187
|
-
case 0:
|
|
188
|
-
setIsValidatingAddress(true);
|
|
189
|
-
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
190
|
-
address: address,
|
|
191
|
-
})];
|
|
192
|
-
case 1:
|
|
193
|
-
validateResult = _a.sent();
|
|
194
|
-
setIsValidatingAddress(false);
|
|
195
|
-
message = validateResult.message;
|
|
196
|
-
if (message === expose_1.ValidateWalletAddressResultMessage.ERROR) {
|
|
197
|
-
setRecipientAddressError("Something went wrong, please try again");
|
|
198
|
-
return [2 /*return*/];
|
|
199
|
-
}
|
|
200
|
-
if (message === expose_1.ValidateWalletAddressResultMessage.IN_VALID) {
|
|
201
|
-
setRecipientAddressError("The address is invalid");
|
|
202
|
-
return [2 /*return*/];
|
|
203
|
-
}
|
|
204
|
-
if (message === expose_1.ValidateWalletAddressResultMessage.EXTERNAL_WALLET) {
|
|
205
|
-
setRecipientAddressError("The address is not a master wallet");
|
|
206
|
-
return [2 /*return*/];
|
|
207
|
-
}
|
|
208
|
-
if (message === expose_1.ValidateWalletAddressResultMessage.IS_CURRENT_WALLET) {
|
|
209
|
-
setRecipientAddressError("You can not send to yourself wallet");
|
|
210
|
-
return [2 /*return*/];
|
|
211
|
-
}
|
|
212
|
-
if (message === expose_1.ValidateWalletAddressResultMessage.INTERNAL_WALLET) {
|
|
213
|
-
setRecipientAddressError(undefined);
|
|
214
|
-
}
|
|
215
|
-
return [2 /*return*/];
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}); });
|
|
219
|
-
};
|
|
220
|
-
var handleChangeRecipientAddress = function (e) {
|
|
221
|
-
var address = e.target.value.trim();
|
|
222
|
-
setRecipientAddress(address);
|
|
223
|
-
validateAddress(address);
|
|
224
|
-
};
|
|
225
|
-
var handlePaste = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
226
|
-
var text, address;
|
|
227
|
-
return __generator(this, function (_a) {
|
|
228
|
-
switch (_a.label) {
|
|
229
|
-
case 0: return [4 /*yield*/, navigator.clipboard.readText()];
|
|
230
|
-
case 1:
|
|
231
|
-
text = _a.sent();
|
|
232
|
-
address = text.trim();
|
|
233
|
-
if (!address) {
|
|
234
|
-
return [2 /*return*/];
|
|
235
|
-
}
|
|
236
|
-
handleChangeRecipientAddress({
|
|
237
|
-
target: { value: address },
|
|
238
|
-
});
|
|
239
|
-
return [2 /*return*/];
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
}); };
|
|
243
|
-
var handleClearRecipientAddress = function () {
|
|
244
|
-
handleChangeRecipientAddress({
|
|
245
|
-
target: { value: "" },
|
|
246
|
-
});
|
|
247
|
-
};
|
|
248
|
-
var handleChangeAmount = function (e) {
|
|
249
|
-
var amount = e.target.value;
|
|
250
|
-
setAmount(amount);
|
|
251
|
-
validateAmount(amount);
|
|
252
|
-
};
|
|
253
|
-
var handleKeyboardChangeAmount = function (amount) {
|
|
254
|
-
handleChangeAmount({
|
|
255
|
-
target: { value: amount },
|
|
256
|
-
});
|
|
257
|
-
};
|
|
258
|
-
var handleChangeComment = function (e) {
|
|
259
|
-
setComment(e.target.value);
|
|
260
|
-
};
|
|
261
|
-
var handleClickMaxAmount = function () {
|
|
262
|
-
if (!selectedToken)
|
|
263
|
-
return;
|
|
264
|
-
var balance = Math.min(+(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.balance), +(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value));
|
|
265
|
-
handleChangeAmount({
|
|
266
|
-
target: { value: balance || "" },
|
|
267
|
-
});
|
|
268
|
-
};
|
|
269
|
-
var handleContinue = function () {
|
|
270
|
-
onContinue === null || onContinue === void 0 ? void 0 : onContinue({
|
|
271
|
-
amount: +amount,
|
|
272
|
-
to_address: recipientAddress,
|
|
273
|
-
currency_slug: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.slug) || "",
|
|
274
|
-
extraTransactions: [],
|
|
275
|
-
message: comment,
|
|
276
|
-
}, estimateFee);
|
|
277
|
-
};
|
|
278
|
-
var openScannerAddressQrCode = function () {
|
|
279
|
-
var _a;
|
|
280
|
-
(_a = scannerAddressQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
281
|
-
};
|
|
282
|
-
var closeScannerAddressQrCode = function () {
|
|
283
|
-
var _a;
|
|
284
|
-
(_a = scannerAddressQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
285
|
-
};
|
|
286
|
-
var handleScanAddressQrCode = function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
287
|
-
var text, address, isReceiveInternal, data;
|
|
288
|
-
var _a;
|
|
289
|
-
return __generator(this, function (_b) {
|
|
290
|
-
closeScannerAddressQrCode();
|
|
291
|
-
text = (_a = result === null || result === void 0 ? void 0 : result[0]) === null || _a === void 0 ? void 0 : _a.rawValue;
|
|
292
|
-
address = "";
|
|
293
|
-
isReceiveInternal = text === null || text === void 0 ? void 0 : text.includes("isTekWalletReceiveInternal");
|
|
294
|
-
if (isReceiveInternal) {
|
|
295
|
-
data = JSON.parse(text);
|
|
296
|
-
address = data === null || data === void 0 ? void 0 : data.address;
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
address = text;
|
|
300
|
-
}
|
|
301
|
-
if (!address)
|
|
302
|
-
return [2 /*return*/];
|
|
303
|
-
handleChangeRecipientAddress({
|
|
304
|
-
target: { value: address },
|
|
305
|
-
});
|
|
306
|
-
return [2 /*return*/];
|
|
307
|
-
});
|
|
308
|
-
}); };
|
|
309
|
-
var keyboardId = (0, useUniqueId_1.useUniqueId)("form-keyboard");
|
|
310
|
-
var handleKeyboardOpen = function () {
|
|
311
|
-
setIsKeyboardOpen(true);
|
|
312
|
-
};
|
|
313
|
-
var handleKeyboardClose = function () {
|
|
314
|
-
setIsKeyboardOpen(false);
|
|
315
|
-
};
|
|
316
|
-
var keyboardThemeMode = (0, providers_1.useKeyboardThemeMode)();
|
|
317
|
-
return ((0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { styles: {
|
|
318
|
-
container: {
|
|
319
|
-
height: "100%",
|
|
320
|
-
},
|
|
321
|
-
}, id: keyboardId, onChange: handleKeyboardChangeAmount, keyboardType: xhub_keyboard_1.KeyboardType.Double, value: amount === null || amount === void 0 ? void 0 : amount.toString(), keyboardId: "form-amount-keyboard-id", onOpen: handleKeyboardOpen, onClose: handleKeyboardClose, theme: keyboardThemeMode, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign(__assign({}, theme.styleMixins.column), { gap: theme.styleMixins.gaps.g16, minHeight: "100%", transition: "padding-bottom 0.3s ease-in-out" }), sx), (isKeyboardOpen
|
|
322
|
-
? {
|
|
323
|
-
paddingBottom: theme.styleMixins.customPadding.p8,
|
|
324
|
-
}
|
|
325
|
-
: {})), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.column), { gap: theme.styleMixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
326
|
-
fontSize: theme.typography.fontSize14,
|
|
327
|
-
color: theme.palette.text.primary,
|
|
328
|
-
fontWeight: theme.typography.fontWeight700,
|
|
329
|
-
}, children: "Wallet address" }), (0, jsx_runtime_1.jsx)(Input_1.default, { sx: {
|
|
330
|
-
paddingX: theme.styleMixins.customPadding.p16,
|
|
331
|
-
}, inputRest: {
|
|
332
|
-
placeholder: "Enter recipient address",
|
|
333
|
-
value: recipientAddress,
|
|
334
|
-
onChange: handleChangeRecipientAddress,
|
|
335
|
-
}, rightPart: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g8 }), children: !!recipientAddress ? ((0, jsx_runtime_1.jsx)(material_1.Box, { onClick: handleClearRecipientAddress, sx: __assign(__assign({}, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g8, cursor: "pointer" }), children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 12, height: 12 }, children: SvgPath_1.IC_CLOSE }) })) : ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { onClick: openScannerAddressQrCode, children: (0, jsx_runtime_1.jsx)(Icon_1.default, { iconKey: "IC_SCAN", sx: { width: 18, height: 18 } }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical", variant: "fullWidth", flexItem: true }), (0, jsx_runtime_1.jsx)(material_1.Box, { onClick: handlePaste, children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 18, height: 18 }, children: SvgPath_1.IC_DOCUMENTS }) })] })) }) }), !!recipientAddressError && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.styleMixins.validationError), children: recipientAddressError }))] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.column), { gap: theme.styleMixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g8, alignItems: "center", justifyContent: "space-between" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
336
|
-
fontSize: theme.typography.fontSize14,
|
|
337
|
-
color: theme.palette.text.primary,
|
|
338
|
-
fontWeight: theme.typography.fontWeight700,
|
|
339
|
-
}, children: "Withdrawal amount" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g8, alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.styleMixins.value), { fontSize: theme.typography.fontSize11, color: theme.palette.text.secondary }), children: "Your balance " }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.styleMixins.value), { fontSize: theme.typography.fontSize12, color: theme.palette.text.primary, fontWeight: theme.typography.fontWeight700 }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.balance, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) })] })] }), (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Input, { elementsAcceptIds: ["form-amount-keyboard-id"], value: amount === null || amount === void 0 ? void 0 : amount.toString(), displayType: xhub_keyboard_1.DisplayType.Double, placeholder: ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
340
|
-
display: "inline-flex",
|
|
341
|
-
alignItems: "center",
|
|
342
|
-
gap: theme.styleMixins.gaps.g4,
|
|
343
|
-
pointerEvents: "none",
|
|
344
|
-
}, children: [(0, jsx_runtime_1.jsx)(Formatter_1.default, { value: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value }), " -", " ", (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) })] })), styles: {
|
|
345
|
-
container: {
|
|
346
|
-
paddingRight: theme.styleMixins.customPadding.p4,
|
|
347
|
-
paddingLeft: theme.styleMixins.customPadding.p16,
|
|
348
|
-
paddingTop: theme.styleMixins.customPadding.p4,
|
|
349
|
-
paddingBottom: theme.styleMixins.customPadding.p4,
|
|
350
|
-
border: "1px ".concat(theme.palette.divider, " solid"),
|
|
351
|
-
borderRadius: theme.styleMixins.customRadius.r8,
|
|
352
|
-
},
|
|
353
|
-
}, rightElement: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g8 }), children: (0, jsx_runtime_1.jsx)(material_1.Box, { onClick: handleClickMaxAmount, sx: {
|
|
354
|
-
background: theme.palette.background.tertiary,
|
|
355
|
-
color: theme.palette.text.primary,
|
|
356
|
-
fontSize: theme.typography.fontSize11,
|
|
357
|
-
fontWeight: theme.typography.fontWeight700,
|
|
358
|
-
borderRadius: theme.styleMixins.customRadius.r4,
|
|
359
|
-
paddingX: theme.styleMixins.customPadding.p16,
|
|
360
|
-
paddingY: theme.styleMixins.customPadding.p8,
|
|
361
|
-
border: "0px solid",
|
|
362
|
-
cursor: "pointer",
|
|
363
|
-
}, children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
364
|
-
fontSize: theme.typography.fontSize12,
|
|
365
|
-
color: theme.palette.text.primary,
|
|
366
|
-
fontWeight: theme.typography.fontWeight500,
|
|
367
|
-
}, children: "Max" }) }) }) }) }), !!amountErrorMessage && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.styleMixins.validationError), children: [amountErrorMessage, " ", !!amountError && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amountError, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) })] }))] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.column), { gap: theme.styleMixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
368
|
-
fontSize: theme.typography.fontSize14,
|
|
369
|
-
color: theme.palette.text.primary,
|
|
370
|
-
fontWeight: theme.typography.fontWeight700,
|
|
371
|
-
}, children: "Message" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
|
|
372
|
-
placeholder: "Enter comment if needed",
|
|
373
|
-
value: comment,
|
|
374
|
-
onChange: handleChangeComment,
|
|
375
|
-
} })] }), (0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: estimateFee, amount: +amount, tokenSlug: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.slug) || "", feesStyle: Fees_1.FeesStyle.WITH_BACKGROUND, setIsEnoughBalanceToPayFee: setIsEnoughBalanceToPayFee }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAddressQrCodeRef, onResult: handleScanAddressQrCode }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { loading: isValidatingAddress || isEstimatingFee, onClick: handleContinue, status: !recipientAddress ||
|
|
376
|
-
!amount ||
|
|
377
|
-
!!recipientAddressError ||
|
|
378
|
-
!!amountError ||
|
|
379
|
-
!isEnoughBalanceToPayFee
|
|
380
|
-
? Button_1.BUTTON_STATUS.DISABLED
|
|
381
|
-
: Button_1.BUTTON_STATUS.ENABLED, sx: { width: "100%", marginTop: "auto" }, children: "Continue" })] }) }));
|
|
382
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.sortByBalance = sortByBalance;
|
|
5
|
-
exports.sortByName = sortByName;
|
|
6
|
-
var WithdrawFunction_1 = require("../components/ui/WithdrawFunction");
|
|
7
|
-
function sortByBalance(list, sortBalance) {
|
|
8
|
-
if (sortBalance === void 0) { sortBalance = WithdrawFunction_1.SortBalance.ASC; }
|
|
9
|
-
if (sortBalance === WithdrawFunction_1.SortBalance.ASC) {
|
|
10
|
-
return list === null || list === void 0 ? void 0 : list.sort(function (a, b) { return Number(a === null || a === void 0 ? void 0 : a.balance) - Number(b === null || b === void 0 ? void 0 : b.balance); });
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
return list === null || list === void 0 ? void 0 : list.sort(function (a, b) { return Number(b === null || b === void 0 ? void 0 : b.balance) - Number(a === null || a === void 0 ? void 0 : a.balance); });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function sortByName(list, sortName) {
|
|
17
|
-
if (sortName === void 0) { sortName = WithdrawFunction_1.SortBalance.ASC; }
|
|
18
|
-
if (sortName === WithdrawFunction_1.SortBalance.ASC) {
|
|
19
|
-
return list === null || list === void 0 ? void 0 : list.sort(function (a, b) { var _a; return (_a = a === null || a === void 0 ? void 0 : a.name) === null || _a === void 0 ? void 0 : _a.localeCompare(b === null || b === void 0 ? void 0 : b.name); });
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return list === null || list === void 0 ? void 0 : list.sort(function (a, b) { var _a; return (_a = b === null || b === void 0 ? void 0 : b.name) === null || _a === void 0 ? void 0 : _a.localeCompare(a === null || a === void 0 ? void 0 : a.name); });
|
|
23
|
-
}
|
|
24
|
-
}
|