tek-wallet 0.0.752 → 0.0.754
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/index.d.ts +7 -0
- package/dist/components/TekWallet/components/index.js +7 -0
- package/dist/components/TekWallet/components/layouts/ChildPageLayout/index.js +14 -3
- package/dist/components/TekWallet/components/ui/BackHeader/index.js +5 -1
- package/dist/components/TekWallet/components/ui/BottomActionLayout/index.d.ts +3 -3
- package/dist/components/TekWallet/components/ui/BottomActionLayout/index.js +24 -6
- package/dist/components/TekWallet/components/ui/Button/index.js +2 -2
- package/dist/components/TekWallet/components/ui/ConfirmByPasscode/index.js +2 -6
- package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.d.ts +6 -2
- package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.js +92 -12
- package/dist/components/TekWallet/components/ui/ConfirmSendInternal/index.d.ts +4 -2
- package/dist/components/TekWallet/components/ui/ConfirmSendInternal/index.js +12 -4
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/Result.d.ts +8 -0
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/Result.js +112 -0
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/index.d.ts +18 -0
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/index.js +169 -0
- package/dist/components/TekWallet/components/ui/CopyableText/index.js +1 -1
- package/dist/components/TekWallet/components/ui/DetailSwap/index.js +1 -1
- package/dist/components/TekWallet/components/ui/Fees/index.d.ts +1 -1
- package/dist/components/TekWallet/components/ui/Fees/index.js +51 -41
- package/dist/components/TekWallet/components/ui/FeesAutoDebounce/index.d.ts +10 -0
- package/dist/components/TekWallet/components/ui/FeesAutoDebounce/index.js +223 -0
- package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareAction.js +2 -2
- package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareImage.js +13 -13
- package/dist/components/TekWallet/components/ui/FiatDeposit/index.js +6 -4
- package/dist/components/TekWallet/components/ui/Formatter/index.d.ts +1 -0
- package/dist/components/TekWallet/components/ui/Formatter/index.js +4 -2
- package/dist/components/TekWallet/components/ui/FunctionItem/index.js +5 -4
- package/dist/components/TekWallet/components/ui/Icon/index.d.ts +4 -2
- package/dist/components/TekWallet/components/ui/Icon/index.js +44 -3
- package/dist/components/TekWallet/components/ui/Input/index.js +3 -3
- package/dist/components/TekWallet/components/ui/ListItemCustom/index.d.ts +2 -1
- package/dist/components/TekWallet/components/ui/ListItemCustom/index.js +3 -3
- package/dist/components/TekWallet/components/ui/QRCode/index.js +1 -1
- package/dist/components/TekWallet/components/ui/SendExternalToken/index.js +1 -1
- package/dist/components/TekWallet/components/ui/SendExternalTokenWithdrawn/index.d.ts +2 -5
- package/dist/components/TekWallet/components/ui/SvgPath/index.d.ts +12 -0
- package/dist/components/TekWallet/components/ui/SvgPath/index.js +27 -15
- package/dist/components/TekWallet/components/ui/SwapFunction/index.js +4 -4
- package/dist/components/TekWallet/components/ui/SwapToken/index.d.ts +2 -3
- package/dist/components/TekWallet/components/ui/TokensBoard/index.js +1 -3
- package/dist/components/TekWallet/components/ui/ValidateWalletAddress/index.d.ts +5 -0
- package/dist/components/TekWallet/components/ui/ValidateWalletAddress/index.js +67 -0
- package/dist/components/TekWallet/components/ui/WaitingData/index.d.ts +1 -0
- package/dist/components/TekWallet/components/ui/WaitingData/index.js +10 -6
- package/dist/components/TekWallet/components/ui/WithdrawFunction/index.d.ts +1 -1
- package/dist/components/TekWallet/components/ui/WithdrawFunction/index.js +70 -32
- package/dist/components/TekWallet/components/views/AssetView/Menu.d.ts +7 -0
- package/dist/components/TekWallet/components/views/AssetView/Menu.js +25 -0
- package/dist/components/TekWallet/components/views/AssetView/index.js +25 -26
- package/dist/components/TekWallet/components/views/NotFoundView/index.d.ts +2 -0
- package/dist/components/TekWallet/components/views/NotFoundView/index.js +7 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Form.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Form.js +450 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Result.d.ts +14 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Result.js +140 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/SelectNetwork.d.ts +10 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/SelectNetwork.js +34 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/SelectToken.d.ts +8 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/SelectToken.js +173 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Summary.d.ts +12 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Summary.js +131 -0
- package/dist/components/TekWallet/components/views/SendExternalView/index.d.ts +23 -0
- package/dist/components/TekWallet/components/views/SendExternalView/index.js +143 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.js +380 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Form.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Form.js +381 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Result.d.ts +13 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Result.js +128 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/SelectToken.d.ts +8 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/SelectToken.js +173 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Summary.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Summary.js +126 -0
- package/dist/components/TekWallet/components/views/SendInternalView/index.d.ts +24 -0
- package/dist/components/TekWallet/components/views/SendInternalView/index.js +155 -0
- package/dist/components/TekWallet/components/views/SwapView/components/CardTo/index.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SwapView/components/CardTo/index.js +111 -0
- package/dist/components/TekWallet/components/views/SwapView/components/FromCard/index.d.ts +14 -0
- package/dist/components/TekWallet/components/views/SwapView/components/FromCard/index.js +180 -0
- package/dist/components/TekWallet/components/views/SwapView/components/SelectToken.d.ts +9 -0
- package/dist/components/TekWallet/components/views/SwapView/components/SelectToken.js +173 -0
- package/dist/components/TekWallet/components/views/SwapView/components/Summary.d.ts +14 -0
- package/dist/components/TekWallet/components/views/SwapView/components/Summary.js +239 -0
- package/dist/components/TekWallet/components/views/SwapView/functions/convertTokensRate.d.ts +3 -0
- package/dist/components/TekWallet/components/views/SwapView/functions/convertTokensRate.js +14 -0
- package/dist/components/TekWallet/components/views/SwapView/index.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SwapView/index.js +218 -0
- package/dist/components/TekWallet/components/views/TekWalletView/expose.d.ts +2 -0
- package/dist/components/TekWallet/components/views/TekWalletView/expose.js +18 -0
- package/dist/components/TekWallet/components/views/TekWalletView/index.d.ts +3 -0
- package/dist/components/TekWallet/components/views/TekWalletView/index.js +16 -0
- package/dist/components/TekWallet/components/views/TekWalletView/routes.d.ts +9 -0
- package/dist/components/TekWallet/components/views/TekWalletView/routes.js +74 -0
- package/dist/components/TekWallet/hooks/useValidateAmount.d.ts +26 -0
- package/dist/components/TekWallet/hooks/useValidateAmount.js +103 -0
- package/dist/components/TekWallet/providers/EventHandlerProvider/index.js +5 -0
- package/dist/components/TekWallet/providers/RealtimeProvider/index.js +2 -2
- package/dist/components/TekWallet/providers/TekWalletProvider/index.d.ts +3 -0
- package/dist/components/TekWallet/providers/TekWalletProvider/index.js +8 -2
- package/dist/components/TekWallet/providers/WithdrawProvider/index.js +36 -0
- package/dist/components/TekWallet/services/axios/get-est-fee-service/type.d.ts +5 -4
- package/dist/components/TekWallet/services/axios/send-external-service/type.d.ts +5 -30
- package/dist/components/TekWallet/services/axios/swap-service/type.d.ts +4 -0
- package/dist/components/TekWallet/services/axios/transfer-internal-service/type.d.ts +4 -32
- package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/components.js +3 -3
- package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/palette.js +3 -3
- package/dist/components/TekWallet/theme/mui/theme.js +9 -9
- package/dist/components/TekWallet/utils/stop.d.ts +3 -0
- package/dist/components/TekWallet/utils/stop.js +6 -0
- package/package.json +2 -2
- package/dist/components/TekWallet/components/ui/CardFrom/index.d.ts +0 -10
- package/dist/components/TekWallet/components/ui/CardFrom/index.js +0 -91
- package/dist/components/TekWallet/components/ui/CardTo/index.d.ts +0 -10
- package/dist/components/TekWallet/components/ui/CardTo/index.js +0 -39
- package/dist/components/TekWallet/components/ui/ConfirmLayout copy/index.d.ts +0 -7
- package/dist/components/TekWallet/components/ui/ConfirmLayout copy/index.js +0 -67
- package/dist/components/TekWallet/components/views/HelpView/index.d.ts +0 -2
- package/dist/components/TekWallet/components/views/HelpView/index.js +0 -7
|
@@ -0,0 +1,381 @@
|
|
|
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 providers_1 = require("../../../../providers");
|
|
94
|
+
var react_1 = require("react");
|
|
95
|
+
var validate_wallet_address_service_1 = __importDefault(require("../../../../services/axios/validate-wallet-address-service"));
|
|
96
|
+
var lodash_1 = require("lodash");
|
|
97
|
+
var Button_1 = __importStar(require("../../../ui/Button"));
|
|
98
|
+
var expose_1 = require("../../../../services/axios/expose");
|
|
99
|
+
var __1 = require("..");
|
|
100
|
+
var QrCodeReader_1 = __importDefault(require("../../../ui/QrCodeReader"));
|
|
101
|
+
var Icon_1 = __importDefault(require("../../../ui/Icon"));
|
|
102
|
+
var get_est_fee_service_1 = __importDefault(require("../../../../services/axios/get-est-fee-service"));
|
|
103
|
+
var type_1 = require("../../../../services/axios/get-activities-service/type");
|
|
104
|
+
var Fees_1 = __importStar(require("../../../ui/Fees"));
|
|
105
|
+
var xhub_keyboard_1 = require("xhub-keyboard");
|
|
106
|
+
var useUniqueId_1 = require("../../../../hooks/useUniqueId");
|
|
107
|
+
var validateAddressDebounce = (0, lodash_1.debounce)(function (callback) {
|
|
108
|
+
callback();
|
|
109
|
+
}, 500, { leading: true, trailing: true });
|
|
110
|
+
var getEstimateFeeDebounce = (0, lodash_1.debounce)(function (callback) {
|
|
111
|
+
callback();
|
|
112
|
+
}, 500, { leading: true, trailing: true });
|
|
113
|
+
function Form(props) {
|
|
114
|
+
var _this = this;
|
|
115
|
+
var theme = (0, providers_1.useTheme)();
|
|
116
|
+
var selectedToken = props.selectedToken, onContinue = props.onContinue, sx = props.sx;
|
|
117
|
+
var _a = (0, react_1.useState)(""), recipientAddress = _a[0], setRecipientAddress = _a[1];
|
|
118
|
+
var _b = (0, react_1.useState)(), recipientAddressError = _b[0], setRecipientAddressError = _b[1];
|
|
119
|
+
var _c = (0, react_1.useState)(""), amount = _c[0], setAmount = _c[1];
|
|
120
|
+
var _d = (0, react_1.useState)(), amountErrorMessage = _d[0], setAmountErrorMessage = _d[1];
|
|
121
|
+
var _e = (0, react_1.useState)(), amountError = _e[0], setAmountError = _e[1];
|
|
122
|
+
var _f = (0, react_1.useState)(undefined), comment = _f[0], setComment = _f[1];
|
|
123
|
+
var _g = (0, react_1.useState)(false), isValidatingAddress = _g[0], setIsValidatingAddress = _g[1];
|
|
124
|
+
var scannerAddressQrCodeRef = (0, react_1.useRef)(null);
|
|
125
|
+
var _h = (0, react_1.useState)(false), isEstimatingFee = _h[0], setIsLoadingEstimateFee = _h[1];
|
|
126
|
+
var _j = (0, react_1.useState)(), estimateFee = _j[0], setEstimateFee = _j[1];
|
|
127
|
+
var _k = (0, react_1.useState)(false), isEnoughBalanceToPayFee = _k[0], setIsEnoughBalanceToPayFee = _k[1];
|
|
128
|
+
var _l = (0, react_1.useState)(false), isKeyboardOpen = _l[0], setIsKeyboardOpen = _l[1];
|
|
129
|
+
var getEstimateFee = (0, react_1.useCallback)(function (amount) { return __awaiter(_this, void 0, void 0, function () {
|
|
130
|
+
var _this = this;
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
setIsLoadingEstimateFee(true);
|
|
133
|
+
getEstimateFeeDebounce(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
134
|
+
var response;
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0: return [4 /*yield*/, (0, get_est_fee_service_1.default)({
|
|
138
|
+
amount: "".concat(amount),
|
|
139
|
+
transaction_type: type_1.TransactionSlug.TRANSFER_INTERNAL,
|
|
140
|
+
currency: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.slug) || "",
|
|
141
|
+
})];
|
|
142
|
+
case 1:
|
|
143
|
+
response = _a.sent();
|
|
144
|
+
setIsLoadingEstimateFee(false);
|
|
145
|
+
setEstimateFee(response === null || response === void 0 ? void 0 : response.data);
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}); });
|
|
150
|
+
return [2 /*return*/];
|
|
151
|
+
});
|
|
152
|
+
}); }, [selectedToken]);
|
|
153
|
+
var validateAmount = (0, react_1.useCallback)(function (amount) {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
if (!selectedToken)
|
|
156
|
+
return false;
|
|
157
|
+
if (+amount < +(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value)) {
|
|
158
|
+
setAmountErrorMessage(__1.InternalAmountError.MIN_LIMIT);
|
|
159
|
+
setAmountError(+((_a = selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value) !== null && _a !== void 0 ? _a : 0));
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
if (+amount > +(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value)) {
|
|
163
|
+
setAmountErrorMessage(__1.InternalAmountError.MAX_LIMIT);
|
|
164
|
+
setAmountError(+((_b = selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value) !== null && _b !== void 0 ? _b : 0));
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
if (+amount > +(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.balance)) {
|
|
168
|
+
setAmountErrorMessage(__1.InternalAmountError.INSUFFICIENT_BALANCE);
|
|
169
|
+
setAmountError(undefined);
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
setAmountError(undefined);
|
|
173
|
+
setAmountErrorMessage(undefined);
|
|
174
|
+
getEstimateFee(amount);
|
|
175
|
+
return true;
|
|
176
|
+
}, [selectedToken, getEstimateFee]);
|
|
177
|
+
var validateAddress = function (address) {
|
|
178
|
+
if (!address) {
|
|
179
|
+
setRecipientAddressError("The address is required");
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
validateAddressDebounce(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
183
|
+
var validateResult, message;
|
|
184
|
+
return __generator(this, function (_a) {
|
|
185
|
+
switch (_a.label) {
|
|
186
|
+
case 0:
|
|
187
|
+
setIsValidatingAddress(true);
|
|
188
|
+
return [4 /*yield*/, (0, validate_wallet_address_service_1.default)({
|
|
189
|
+
address: address,
|
|
190
|
+
})];
|
|
191
|
+
case 1:
|
|
192
|
+
validateResult = _a.sent();
|
|
193
|
+
setIsValidatingAddress(false);
|
|
194
|
+
message = validateResult.message;
|
|
195
|
+
if (message === expose_1.ValidateWalletAddressResultMessage.ERROR) {
|
|
196
|
+
setRecipientAddressError("Something went wrong, please try again");
|
|
197
|
+
return [2 /*return*/];
|
|
198
|
+
}
|
|
199
|
+
if (message === expose_1.ValidateWalletAddressResultMessage.IN_VALID) {
|
|
200
|
+
setRecipientAddressError("The address is invalid");
|
|
201
|
+
return [2 /*return*/];
|
|
202
|
+
}
|
|
203
|
+
if (message === expose_1.ValidateWalletAddressResultMessage.EXTERNAL_WALLET ||
|
|
204
|
+
message === expose_1.ValidateWalletAddressResultMessage.EXTERNAL_WALLET_BUT_ALSO_INTERNAL_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
|
+
return ((0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { styles: {
|
|
317
|
+
container: {
|
|
318
|
+
height: "100%",
|
|
319
|
+
},
|
|
320
|
+
}, 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, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g16, minHeight: "100%", transition: "padding-bottom 0.3s ease-in-out" }), sx), (isKeyboardOpen
|
|
321
|
+
? {
|
|
322
|
+
paddingBottom: theme.mixins.customPadding.p8,
|
|
323
|
+
}
|
|
324
|
+
: {})), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
325
|
+
fontSize: theme.typography.fontSize14,
|
|
326
|
+
color: theme.palette.text.black,
|
|
327
|
+
fontWeight: theme.typography.fontWeight700,
|
|
328
|
+
}, children: "Wallet address" }), (0, jsx_runtime_1.jsx)(Input_1.default, { sx: {
|
|
329
|
+
paddingX: theme.mixins.customPadding.p16,
|
|
330
|
+
}, inputRest: {
|
|
331
|
+
placeholder: "Enter recipient address",
|
|
332
|
+
value: recipientAddress,
|
|
333
|
+
onChange: handleChangeRecipientAddress,
|
|
334
|
+
}, rightPart: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8 }), children: !!recipientAddress ? ((0, jsx_runtime_1.jsx)(material_1.Box, { onClick: handleClearRecipientAddress, sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.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.mixins.row), { gap: theme.mixins.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.mixins.validationError), children: recipientAddressError }))] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, alignItems: "center", justifyContent: "space-between" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
335
|
+
fontSize: theme.typography.fontSize14,
|
|
336
|
+
color: theme.palette.text.black,
|
|
337
|
+
fontWeight: theme.typography.fontWeight700,
|
|
338
|
+
}, children: "Withdrawal amount" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontSize: theme.typography.fontSize11, color: theme.palette.text.accent }), children: "Your balance " }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontSize: theme.typography.fontSize12, color: theme.palette.text.black, 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: {
|
|
339
|
+
display: "inline-flex",
|
|
340
|
+
alignItems: "center",
|
|
341
|
+
gap: theme.mixins.gaps.g4,
|
|
342
|
+
pointerEvents: "none",
|
|
343
|
+
}, 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: {
|
|
344
|
+
container: {
|
|
345
|
+
paddingRight: theme.mixins.customPadding.p4,
|
|
346
|
+
paddingLeft: theme.mixins.customPadding.p16,
|
|
347
|
+
paddingTop: theme.mixins.customPadding.p4,
|
|
348
|
+
paddingBottom: theme.mixins.customPadding.p4,
|
|
349
|
+
border: "1px ".concat(theme.palette.border.primary, " solid"),
|
|
350
|
+
borderRadius: theme.mixins.customRadius.r8,
|
|
351
|
+
},
|
|
352
|
+
}, rightElement: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8 }), children: (0, jsx_runtime_1.jsx)(material_1.Box, { onClick: handleClickMaxAmount, sx: {
|
|
353
|
+
background: theme.palette.background.tertiary,
|
|
354
|
+
color: theme.palette.text.black,
|
|
355
|
+
fontSize: theme.typography.fontSize11,
|
|
356
|
+
fontWeight: theme.typography.fontWeight700,
|
|
357
|
+
borderRadius: theme.mixins.customRadius.r4,
|
|
358
|
+
paddingX: theme.mixins.customPadding.p16,
|
|
359
|
+
paddingY: theme.mixins.customPadding.p8,
|
|
360
|
+
border: "0px solid",
|
|
361
|
+
cursor: "pointer",
|
|
362
|
+
}, children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
363
|
+
fontSize: theme.typography.fontSize12,
|
|
364
|
+
color: theme.palette.text.primary,
|
|
365
|
+
fontWeight: theme.typography.fontWeight500,
|
|
366
|
+
}, children: "Max" }) }) }) }) }), !!amountErrorMessage && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.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.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
367
|
+
fontSize: theme.typography.fontSize14,
|
|
368
|
+
color: theme.palette.text.black,
|
|
369
|
+
fontWeight: theme.typography.fontWeight700,
|
|
370
|
+
}, children: "Message" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
|
|
371
|
+
placeholder: "Enter comment if needed",
|
|
372
|
+
value: comment,
|
|
373
|
+
onChange: handleChangeComment,
|
|
374
|
+
} }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationDescription), children: "Enter comment if your receiving platform requires one to avoid losing your funds." })] }), (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 ||
|
|
375
|
+
!amount ||
|
|
376
|
+
!!recipientAddressError ||
|
|
377
|
+
!!amountError ||
|
|
378
|
+
!isEnoughBalanceToPayFee
|
|
379
|
+
? Button_1.BUTTON_STATUS.DISABLED
|
|
380
|
+
: Button_1.BUTTON_STATUS.ENABLED, sx: { width: "100%", marginTop: "auto" }, children: "Continue" })] }) }));
|
|
381
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SendInternalDataType, SendInternalResponse } from "../../../ui/ConfirmSendInternal";
|
|
2
|
+
import { ReactEventHandler } from "react";
|
|
3
|
+
import { WithdrawCurrency } from "../../../../services/axios/get-withdraw-tokens-list-service/type";
|
|
4
|
+
import { FeesDataType } from "../../../../services/axios/get-est-fee-service/type";
|
|
5
|
+
interface ResultProps {
|
|
6
|
+
response?: SendInternalResponse;
|
|
7
|
+
onDone?: ReactEventHandler;
|
|
8
|
+
payload?: SendInternalDataType;
|
|
9
|
+
estimateFee?: FeesDataType;
|
|
10
|
+
selectedToken?: WithdrawCurrency;
|
|
11
|
+
}
|
|
12
|
+
export default function Result(props: ResultProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export type { ResultProps };
|
|
@@ -0,0 +1,128 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.default = Result;
|
|
51
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
52
|
+
var material_1 = require("@mui/material");
|
|
53
|
+
var Text_1 = __importDefault(require("../../../ui/Text"));
|
|
54
|
+
var InlineTitleValue_1 = __importDefault(require("../../../ui/InlineTitleValue"));
|
|
55
|
+
var CopyTextComponent_1 = __importDefault(require("../../../ui/CopyTextComponent"));
|
|
56
|
+
var SvgPath_1 = require("../../../ui/SvgPath");
|
|
57
|
+
var Fees_1 = __importStar(require("../../../ui/Fees"));
|
|
58
|
+
var safeText_1 = require("../../../../utils/safeText");
|
|
59
|
+
var react_1 = require("react");
|
|
60
|
+
var Button_1 = __importDefault(require("../../../ui/Button"));
|
|
61
|
+
var providers_1 = require("../../../../providers");
|
|
62
|
+
var Formatter_1 = __importDefault(require("../../../ui/Formatter"));
|
|
63
|
+
var Icon_1 = __importDefault(require("../../../ui/Icon"));
|
|
64
|
+
var useFormatter_1 = __importDefault(require("../../../../hooks/useFormatter"));
|
|
65
|
+
function Result(props) {
|
|
66
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
67
|
+
var theme = (0, providers_1.useTheme)();
|
|
68
|
+
var formatDate = (0, useFormatter_1.default)().formatDate;
|
|
69
|
+
var response = props.response, onDone = props.onDone, payload = props.payload, estimateFee = props.estimateFee, selectedToken = props.selectedToken;
|
|
70
|
+
var status = (0, react_1.useMemo)(function () { var _a; return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.transaction_status) || "failed"; }, [(_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.transaction_status]);
|
|
71
|
+
var recipientAddress = (0, react_1.useMemo)(function () { var _a; return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.to_address) || (payload === null || payload === void 0 ? void 0 : payload.to_address); }, [(_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.to_address, payload === null || payload === void 0 ? void 0 : payload.to_address]);
|
|
72
|
+
var amount = (0, react_1.useMemo)(function () { var _a; return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.amount) || (payload === null || payload === void 0 ? void 0 : payload.amount); }, [(_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.amount, payload === null || payload === void 0 ? void 0 : payload.amount]);
|
|
73
|
+
var message = (0, react_1.useMemo)(function () { var _a; return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.message) || (payload === null || payload === void 0 ? void 0 : payload.message); }, [(_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.message, payload === null || payload === void 0 ? void 0 : payload.message]);
|
|
74
|
+
var feeInfo = (0, react_1.useMemo)(function () { var _a; return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.fee_info) || estimateFee; }, [(_e = response === null || response === void 0 ? void 0 : response.data) === null || _e === void 0 ? void 0 : _e.fee_info, estimateFee]);
|
|
75
|
+
var dateCreated = (0, react_1.useMemo)(function () { var _a; return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.date_created; }, [(_f = response === null || response === void 0 ? void 0 : response.data) === null || _f === void 0 ? void 0 : _f.date_created]);
|
|
76
|
+
var tokenName = (0, react_1.useMemo)(function () { var _a, _b; return ((_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.currency_data) === null || _b === void 0 ? void 0 : _b.name) || (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name); }, [(_h = (_g = response === null || response === void 0 ? void 0 : response.data) === null || _g === void 0 ? void 0 : _g.currency_data) === null || _h === void 0 ? void 0 : _h.name, selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name]);
|
|
77
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
78
|
+
display: "flex",
|
|
79
|
+
flexDirection: "column",
|
|
80
|
+
gap: 3,
|
|
81
|
+
height: "100%",
|
|
82
|
+
}, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
83
|
+
display: "flex",
|
|
84
|
+
flexDirection: "column",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
gap: theme.mixins.gaps.g16,
|
|
87
|
+
my: "auto",
|
|
88
|
+
backgroundColor: theme.palette.background.tertiary,
|
|
89
|
+
borderRadius: theme.mixins.customRadius.r16,
|
|
90
|
+
padding: theme.mixins.customPadding.p16,
|
|
91
|
+
paddingTop: "0px",
|
|
92
|
+
}, children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { iconKey: status === "success" ? "IC_CHECK_CIRCLE" : "IC_ERROR_CIRCLE", width: 100, sx: {
|
|
93
|
+
transform: "translateY(-50%)",
|
|
94
|
+
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
95
|
+
display: "flex",
|
|
96
|
+
flexDirection: "column",
|
|
97
|
+
alignItems: "center",
|
|
98
|
+
}, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
99
|
+
fontSize: theme.typography.fontSize13,
|
|
100
|
+
color: theme.palette.text.accent2,
|
|
101
|
+
}, children: "Transfer" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
102
|
+
color: theme.palette.text.primary,
|
|
103
|
+
textTransform: "capitalize",
|
|
104
|
+
fontWeight: 600,
|
|
105
|
+
fontSize: theme.typography.fontSize24,
|
|
106
|
+
}, children: status })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%", borderTop: "1px ".concat(theme.palette.border.accent3, " solid") } }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.bigValue), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { start: "- ", value: amount, unit: tokenName }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%", borderTop: "1px ".concat(theme.palette.border.accent3, " solid") } }), (0, jsx_runtime_1.jsx)(InlineTitleValue_1.default, { title: "Recipient address", titleStyle: {
|
|
107
|
+
fontSize: "0.6875rem",
|
|
108
|
+
fontWeight: 500,
|
|
109
|
+
color: "gray.700",
|
|
110
|
+
}, value: (0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: recipientAddress || "", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { className: "flex flex-row gap-2 items-center", children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: (0, safeText_1.safeText)(recipientAddress || "", { isShort: true }) }), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: {
|
|
111
|
+
width: 16,
|
|
112
|
+
height: 16,
|
|
113
|
+
}, children: SvgPath_1.IC_COPY })] }) }), isAligned: true }), message && ((0, jsx_runtime_1.jsx)(InlineTitleValue_1.default, { title: "Message", titleStyle: {
|
|
114
|
+
fontSize: "0.6875rem",
|
|
115
|
+
fontWeight: 500,
|
|
116
|
+
color: "gray.700",
|
|
117
|
+
}, value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: message }), isAligned: true })), dateCreated && ((0, jsx_runtime_1.jsx)(InlineTitleValue_1.default, { title: "Date time", titleStyle: {
|
|
118
|
+
fontSize: "0.6875rem",
|
|
119
|
+
fontWeight: 500,
|
|
120
|
+
color: "gray.700",
|
|
121
|
+
}, value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: formatDate(dateCreated, true) }), isAligned: true })), (0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: feeInfo || estimateFee, amount: +(amount || 0), tokenSlug: ((_j = response === null || response === void 0 ? void 0 : response.data) === null || _j === void 0 ? void 0 : _j.currency_slug) || "", feesStyle: Fees_1.FeesStyle.DEFAULT })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
122
|
+
marginTop: "auto",
|
|
123
|
+
width: "100%",
|
|
124
|
+
display: "grid",
|
|
125
|
+
gridTemplateColumns: "1fr",
|
|
126
|
+
gap: theme.mixins.gaps.g8,
|
|
127
|
+
}, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, onClick: onDone, children: "Done" }) })] }));
|
|
128
|
+
}
|
package/dist/components/TekWallet/components/views/SendInternalView/components/SelectToken.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WithdrawCurrency } from "../../../../services/axios/get-withdraw-tokens-list-service/type";
|
|
2
|
+
export interface SelectTokenProps {
|
|
3
|
+
tokens?: WithdrawCurrency[];
|
|
4
|
+
selectedToken?: WithdrawCurrency;
|
|
5
|
+
onChangeToken?: (token: WithdrawCurrency) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const SelectToken: (props: SelectTokenProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default SelectToken;
|