tek-wallet 0.0.752 → 0.0.753
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
package/dist/components/TekWallet/components/views/SendExternalView/components/SelectNetwork.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
var react_1 = require("react");
|
|
19
|
+
var material_1 = require("@mui/material");
|
|
20
|
+
var providers_1 = require("../../../../providers");
|
|
21
|
+
var NetworkSelection_1 = __importDefault(require("../../../ui/NetworkSelection"));
|
|
22
|
+
function SelectNetwork(props) {
|
|
23
|
+
var networks = props.networks, selectedNetwork = props.selectedNetwork, onChangeNetwork = props.onChangeNetwork, selectedToken = props.selectedToken;
|
|
24
|
+
var theme = (0, providers_1.useTheme)();
|
|
25
|
+
var handleSelectNetwork = (0, react_1.useCallback)(function (network) {
|
|
26
|
+
onChangeNetwork === null || onChangeNetwork === void 0 ? void 0 : onChangeNetwork(network);
|
|
27
|
+
}, [onChangeNetwork]);
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: networks === null || networks === void 0 ? void 0 : networks.map(function (item, index) {
|
|
29
|
+
if (!item)
|
|
30
|
+
return null;
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(NetworkSelection_1.default, { onClick: handleSelectNetwork, networkData: JSON.stringify(item), active: (selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.id) === item.id, token: selectedToken }, "network_".concat(item.id, "_").concat(index)));
|
|
32
|
+
}) }));
|
|
33
|
+
}
|
|
34
|
+
exports.default = SelectNetwork;
|
package/dist/components/TekWallet/components/views/SendExternalView/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;
|
|
@@ -0,0 +1,173 @@
|
|
|
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
47
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
48
|
+
if (ar || !(i in from)) {
|
|
49
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
50
|
+
ar[i] = from[i];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
54
|
+
};
|
|
55
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
56
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
60
|
+
var material_1 = require("@mui/material");
|
|
61
|
+
var providers_1 = require("../../../../providers");
|
|
62
|
+
var TokenSelection_1 = __importDefault(require("../../../ui/TokenSelection"));
|
|
63
|
+
var SvgPath_1 = require("../../../ui/SvgPath");
|
|
64
|
+
var EmptyData_1 = __importDefault(require("../../../ui/EmptyData"));
|
|
65
|
+
var WaitingData_1 = __importDefault(require("../../../ui/WaitingData"));
|
|
66
|
+
var react_1 = require("react");
|
|
67
|
+
var lodash_1 = require("lodash");
|
|
68
|
+
var SortGroup_1 = __importStar(require("../../../ui/ReceiveFunction/components/SortGroup"));
|
|
69
|
+
var SortTool_1 = require("../../../ui/ReceiveFunction/components/SortTool");
|
|
70
|
+
var searchDebounce = (0, lodash_1.debounce)(function (callback) {
|
|
71
|
+
callback();
|
|
72
|
+
}, 500, { leading: true, trailing: true });
|
|
73
|
+
var SelectToken = function (props) {
|
|
74
|
+
var theme = (0, providers_1.useTheme)();
|
|
75
|
+
var _a = (0, react_1.useState)(""), searchValue = _a[0], setSearchValue = _a[1];
|
|
76
|
+
var _b = (0, react_1.useState)(), searchedReceiveTokens = _b[0], setSearchedReceiveTokens = _b[1];
|
|
77
|
+
var _c = (0, react_1.useState)([]), tokenRender = _c[0], setTokenRender = _c[1];
|
|
78
|
+
var tokens = props.tokens, selectedToken = props.selectedToken, onChangeToken = props.onChangeToken;
|
|
79
|
+
var isSearching = (0, react_1.useMemo)(function () {
|
|
80
|
+
return searchValue.length > 0;
|
|
81
|
+
}, [searchValue]);
|
|
82
|
+
var isLoadingDepositTokens = (0, react_1.useMemo)(function () {
|
|
83
|
+
return !tokens;
|
|
84
|
+
}, [tokens]);
|
|
85
|
+
var isEmptyDepositTokens = (0, react_1.useMemo)(function () {
|
|
86
|
+
return !isLoadingDepositTokens && (tokens === null || tokens === void 0 ? void 0 : tokens.length) === 0;
|
|
87
|
+
}, [isLoadingDepositTokens, tokens]);
|
|
88
|
+
var isEmptySearch = (0, react_1.useMemo)(function () {
|
|
89
|
+
return isSearching && (searchedReceiveTokens === null || searchedReceiveTokens === void 0 ? void 0 : searchedReceiveTokens.length) === 0;
|
|
90
|
+
}, [isSearching, searchedReceiveTokens]);
|
|
91
|
+
var handleClearSearch = function () {
|
|
92
|
+
setSearchValue("");
|
|
93
|
+
};
|
|
94
|
+
var handleSelectToken = function (token) {
|
|
95
|
+
onChangeToken === null || onChangeToken === void 0 ? void 0 : onChangeToken(token);
|
|
96
|
+
};
|
|
97
|
+
var handleSearch = function (e) {
|
|
98
|
+
var searchValue = e.target.value;
|
|
99
|
+
setSearchValue(searchValue);
|
|
100
|
+
searchDebounce(function () {
|
|
101
|
+
if (searchValue.length > 0) {
|
|
102
|
+
var filteredTokens = tokens === null || tokens === void 0 ? void 0 : tokens.filter(function (item) {
|
|
103
|
+
return item.name.toLowerCase().includes(searchValue.toLowerCase());
|
|
104
|
+
});
|
|
105
|
+
setSearchedReceiveTokens(filteredTokens || []);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
setSearchedReceiveTokens(tokens);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
var handleSort = function (sortBy, sortOrder) {
|
|
113
|
+
var sortedTokens = __spreadArray([], tokenRender, true);
|
|
114
|
+
sortedTokens.sort(function (a, b) {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
if (sortBy === SortGroup_1.SortByType.Name) {
|
|
117
|
+
return sortOrder === SortTool_1.SortOrder.ASC
|
|
118
|
+
? ((_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) || "")) || 0
|
|
119
|
+
: ((_b = b === null || b === void 0 ? void 0 : b.name) === null || _b === void 0 ? void 0 : _b.localeCompare((a === null || a === void 0 ? void 0 : a.name) || "")) || 0;
|
|
120
|
+
}
|
|
121
|
+
return sortOrder === SortTool_1.SortOrder.ASC
|
|
122
|
+
? +((a === null || a === void 0 ? void 0 : a.balance) || 0) - +((b === null || b === void 0 ? void 0 : b.balance) || 0)
|
|
123
|
+
: +((b === null || b === void 0 ? void 0 : b.balance) || 0) - +((a === null || a === void 0 ? void 0 : a.balance) || 0);
|
|
124
|
+
});
|
|
125
|
+
setTokenRender(sortedTokens);
|
|
126
|
+
};
|
|
127
|
+
(0, react_1.useEffect)(function () {
|
|
128
|
+
if (isSearching) {
|
|
129
|
+
setTokenRender(searchedReceiveTokens || []);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
setTokenRender(tokens || []);
|
|
133
|
+
}
|
|
134
|
+
}, [isSearching, searchedReceiveTokens, tokens]);
|
|
135
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: [!isEmptyDepositTokens && !isLoadingDepositTokens && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
136
|
+
position: "sticky",
|
|
137
|
+
backgroundColor: theme.palette.background.white,
|
|
138
|
+
zIndex: 100,
|
|
139
|
+
top: "0px",
|
|
140
|
+
pb: theme.mixins.customPadding.p12,
|
|
141
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.InputBase, { onChange: handleSearch, startAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "start", children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: SvgPath_1.IC_SEARCH }) }), value: searchValue, placeholder: "Search", sx: {
|
|
142
|
+
borderRadius: theme.mixins.customRadius.r12,
|
|
143
|
+
border: "1px solid",
|
|
144
|
+
borderColor: theme.palette.border.accent3,
|
|
145
|
+
background: theme.palette.background.white,
|
|
146
|
+
color: theme.palette.text.black,
|
|
147
|
+
py: theme.mixins.customPadding.p6,
|
|
148
|
+
px: theme.mixins.customPadding.p12,
|
|
149
|
+
fontSize: theme.typography.fontSize16,
|
|
150
|
+
width: "100%",
|
|
151
|
+
lineHeight: "100%",
|
|
152
|
+
"input::placeholder": {
|
|
153
|
+
fontSize: theme.typography.fontSize12,
|
|
154
|
+
pl: theme.mixins.customPadding.p4,
|
|
155
|
+
fontWeight: theme.typography.fontWeight500,
|
|
156
|
+
color: theme.palette.text.black,
|
|
157
|
+
lineHeight: "100%",
|
|
158
|
+
},
|
|
159
|
+
}, endAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", sx: {
|
|
160
|
+
visibility: isSearching ? "visible" : "hidden",
|
|
161
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: {
|
|
162
|
+
width: 20,
|
|
163
|
+
height: 20,
|
|
164
|
+
p: theme.mixins.customPadding.p4,
|
|
165
|
+
cursor: "pointer",
|
|
166
|
+
}, onClick: handleClearSearch, children: SvgPath_1.IC_CLOSE }) }) }), (tokenRender === null || tokenRender === void 0 ? void 0 : tokenRender.length) > 0 && (0, jsx_runtime_1.jsx)(SortGroup_1.default, { onChange: handleSort })] })), isLoadingDepositTokens && (0, jsx_runtime_1.jsx)(WaitingData_1.default, { numberOfSkeleton: 8 }), isEmptyDepositTokens && ((0, jsx_runtime_1.jsx)(EmptyData_1.default, { sx: { py: "4rem" }, title: "No deposit tokens", description: "No deposit tokens" })), isSearching && isEmptySearch && ((0, jsx_runtime_1.jsx)(EmptyData_1.default, { sx: { py: "4rem" }, title: "No search results", description: "Let's try again with a different search" })), tokenRender === null || tokenRender === void 0 ? void 0 : tokenRender.map(function (item, index) {
|
|
167
|
+
var stringifiedTokenData = JSON.stringify(item);
|
|
168
|
+
if (!item)
|
|
169
|
+
return null;
|
|
170
|
+
return ((0, jsx_runtime_1.jsx)(TokenSelection_1.default, { onClick: handleSelectToken, tokenData: stringifiedTokenData, active: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.id) === item.id }, "token_".concat(item.id, "_").concat(index)));
|
|
171
|
+
})] }));
|
|
172
|
+
};
|
|
173
|
+
exports.default = SelectToken;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FeesDataType } from "../../../../services/axios/get-est-fee-service/type";
|
|
2
|
+
import { WithdrawCurrency } from "../../../../services/axios/get-withdraw-tokens-list-service/type";
|
|
3
|
+
import { SendExternalDataType } from "../../../ui/ConfirmSendExternal";
|
|
4
|
+
import { ConfirmSendExternalProps } from "../../../ui/ConfirmSendExternal";
|
|
5
|
+
interface SummaryProps {
|
|
6
|
+
estimateFee?: FeesDataType;
|
|
7
|
+
selectedToken?: WithdrawCurrency;
|
|
8
|
+
payload: SendExternalDataType;
|
|
9
|
+
confirmProps?: Omit<ConfirmSendExternalProps, "payload">;
|
|
10
|
+
}
|
|
11
|
+
export default function Summary(props: SummaryProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export type { SummaryProps };
|
|
@@ -0,0 +1,131 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
47
|
+
var t = {};
|
|
48
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
49
|
+
t[p] = s[p];
|
|
50
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
51
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
52
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
53
|
+
t[p[i]] = s[p[i]];
|
|
54
|
+
}
|
|
55
|
+
return t;
|
|
56
|
+
};
|
|
57
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
58
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
59
|
+
};
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
+
exports.default = Summary;
|
|
62
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
63
|
+
var material_1 = require("@mui/material");
|
|
64
|
+
var Text_1 = __importDefault(require("../../../ui/Text"));
|
|
65
|
+
var InlineTitleValue_1 = __importDefault(require("../../../ui/InlineTitleValue"));
|
|
66
|
+
var CopyTextComponent_1 = __importDefault(require("../../../ui/CopyTextComponent"));
|
|
67
|
+
var SvgPath_1 = require("../../../ui/SvgPath");
|
|
68
|
+
var Fees_1 = __importStar(require("../../../ui/Fees"));
|
|
69
|
+
var safeText_1 = require("../../../../utils/safeText");
|
|
70
|
+
var react_1 = require("react");
|
|
71
|
+
var Button_1 = __importStar(require("../../../ui/Button"));
|
|
72
|
+
var providers_1 = require("../../../../providers");
|
|
73
|
+
var Formatter_1 = __importDefault(require("../../../ui/Formatter"));
|
|
74
|
+
var ConfirmSendExternal_1 = __importDefault(require("../../../ui/ConfirmSendExternal"));
|
|
75
|
+
var Icon_1 = __importDefault(require("../../../ui/Icon"));
|
|
76
|
+
function Summary(props) {
|
|
77
|
+
var estimateFee = props.estimateFee, selectedToken = props.selectedToken, payload = props.payload, confirmProps = props.confirmProps;
|
|
78
|
+
var _a = confirmProps || {}, onSuccess = _a.onSuccess, onError = _a.onError, onStart = _a.onStart, onFinally = _a.onFinally, confirmPropsRest = __rest(_a, ["onSuccess", "onError", "onStart", "onFinally"]);
|
|
79
|
+
var theme = (0, providers_1.useTheme)();
|
|
80
|
+
var recipientAddress = (0, react_1.useMemo)(function () { return payload.to_address; }, [payload.to_address]);
|
|
81
|
+
var amount = (0, react_1.useMemo)(function () { return payload.amount; }, [payload.amount]);
|
|
82
|
+
var memo = (0, react_1.useMemo)(function () { return payload.memo; }, [payload.memo]);
|
|
83
|
+
var _b = (0, react_1.useState)(Button_1.BUTTON_STATUS.ENABLED), confirmButtonStatus = _b[0], setContinueButtonStatus = _b[1];
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
85
|
+
display: "flex",
|
|
86
|
+
flexDirection: "column",
|
|
87
|
+
gap: 3,
|
|
88
|
+
height: "100%",
|
|
89
|
+
}, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
90
|
+
fontSize: 16,
|
|
91
|
+
fontWeight: 600,
|
|
92
|
+
}, children: "Transaction summary" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
93
|
+
display: "flex",
|
|
94
|
+
flexDirection: "column",
|
|
95
|
+
gap: 3,
|
|
96
|
+
}, children: [(0, jsx_runtime_1.jsx)(InlineTitleValue_1.default, { title: "Amount", titleStyle: {
|
|
97
|
+
fontSize: "0.6875rem",
|
|
98
|
+
fontWeight: 500,
|
|
99
|
+
color: "gray.700",
|
|
100
|
+
}, value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name }) }), isAligned: true }), (0, jsx_runtime_1.jsx)(InlineTitleValue_1.default, { title: "Recipient address", titleStyle: {
|
|
101
|
+
fontSize: "0.6875rem",
|
|
102
|
+
fontWeight: 500,
|
|
103
|
+
color: "gray.700",
|
|
104
|
+
}, 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: {
|
|
105
|
+
width: 16,
|
|
106
|
+
height: 16,
|
|
107
|
+
}, children: SvgPath_1.IC_COPY })] }) }), isAligned: true }), (0, jsx_runtime_1.jsx)(InlineTitleValue_1.default, { title: "Network", titleStyle: {
|
|
108
|
+
fontSize: "0.6875rem",
|
|
109
|
+
fontWeight: 500,
|
|
110
|
+
color: "gray.700",
|
|
111
|
+
}, value: (0, jsx_runtime_1.jsxs)(material_1.Box, { className: "flex gap-2 items-center", children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: payload.network.link, width: 20 }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: payload.network.name })] }), isAligned: true }), memo && ((0, jsx_runtime_1.jsx)(InlineTitleValue_1.default, { title: "Comment", titleStyle: {
|
|
112
|
+
fontSize: "0.6875rem",
|
|
113
|
+
fontWeight: 500,
|
|
114
|
+
color: "gray.700",
|
|
115
|
+
}, value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: memo }), isAligned: true })), (0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: estimateFee, amount: +(amount || 0), tokenSlug: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.slug) || "", feesStyle: Fees_1.FeesStyle.DEFAULT })] }), (0, jsx_runtime_1.jsx)(ConfirmSendExternal_1.default, __assign({ sx: {
|
|
116
|
+
width: "100%",
|
|
117
|
+
marginTop: "auto",
|
|
118
|
+
}, payload: payload }, confirmPropsRest, { onSuccess: function (res) {
|
|
119
|
+
setContinueButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
|
|
120
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
121
|
+
}, onError: function (err) {
|
|
122
|
+
setContinueButtonStatus(Button_1.BUTTON_STATUS.DISABLED);
|
|
123
|
+
onError === null || onError === void 0 ? void 0 : onError(err);
|
|
124
|
+
}, onStart: function () {
|
|
125
|
+
setContinueButtonStatus(Button_1.BUTTON_STATUS.LOADING);
|
|
126
|
+
onStart === null || onStart === void 0 ? void 0 : onStart();
|
|
127
|
+
}, onFinally: function () {
|
|
128
|
+
setContinueButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
|
|
129
|
+
onFinally === null || onFinally === void 0 ? void 0 : onFinally();
|
|
130
|
+
}, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { loading: confirmButtonStatus === Button_1.BUTTON_STATUS.LOADING, status: !recipientAddress || !amount ? Button_1.BUTTON_STATUS.DISABLED : confirmButtonStatus, sx: { width: "100%" }, children: "Confirm" }) }))] }));
|
|
131
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactEventHandler } from "react";
|
|
2
|
+
import { GeneralProps } from "../../../types/ui";
|
|
3
|
+
interface SendExternalViewProps extends GeneralProps {
|
|
4
|
+
onClose?: ReactEventHandler;
|
|
5
|
+
onOpen?: ReactEventHandler;
|
|
6
|
+
onSendSuccess?: (response: any) => void;
|
|
7
|
+
}
|
|
8
|
+
type SendExternalViewRef = {
|
|
9
|
+
open: () => void;
|
|
10
|
+
close: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare enum SendExternalStep {
|
|
13
|
+
SELECT_TOKEN = 0,
|
|
14
|
+
ADDRESS_FORM = 1,
|
|
15
|
+
CONFIRM = 2
|
|
16
|
+
}
|
|
17
|
+
export declare enum WithdrawAmountError {
|
|
18
|
+
INSUFFICIENT_BALANCE = "\u24D8 Insufficient balance",
|
|
19
|
+
MAX_LIMIT = "\u24D8 Enter a maximum amount of",
|
|
20
|
+
MIN_LIMIT = "\u24D8 Enter a minimum amount of"
|
|
21
|
+
}
|
|
22
|
+
declare const SendExternalView: import("react").ForwardRefExoticComponent<SendExternalViewProps & import("react").RefAttributes<SendExternalViewRef>>;
|
|
23
|
+
export default SendExternalView;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
"use client";
|
|
4
|
+
var __assign = (this && this.__assign) || function () {
|
|
5
|
+
__assign = Object.assign || function(t) {
|
|
6
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7
|
+
s = arguments[i];
|
|
8
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
9
|
+
t[p] = s[p];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
return __assign.apply(this, arguments);
|
|
14
|
+
};
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
var _a;
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.WithdrawAmountError = exports.SendExternalStep = void 0;
|
|
21
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
22
|
+
var react_1 = require("react");
|
|
23
|
+
var SwiperControlled_1 = __importDefault(require("../../ui/SwiperControlled"));
|
|
24
|
+
var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
|
|
25
|
+
var react_2 = require("swiper/react");
|
|
26
|
+
var useWithdrawData_1 = __importDefault(require("../../../hooks/useWithdrawData"));
|
|
27
|
+
var SelectToken_1 = __importDefault(require("./components/SelectToken"));
|
|
28
|
+
var Form_1 = __importDefault(require("./components/Form"));
|
|
29
|
+
var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
|
|
30
|
+
var PageHeader_1 = __importDefault(require("../../ui/PageHeader"));
|
|
31
|
+
var DefaultPageLayout_1 = __importDefault(require("../../layouts/DefaultPageLayout"));
|
|
32
|
+
var Summary_1 = __importDefault(require("./components/Summary"));
|
|
33
|
+
var useCustomRouter_1 = __importDefault(require("../../../hooks/useCustomRouter"));
|
|
34
|
+
var providers_1 = require("../../../providers");
|
|
35
|
+
var SendExternalStep;
|
|
36
|
+
(function (SendExternalStep) {
|
|
37
|
+
SendExternalStep[SendExternalStep["SELECT_TOKEN"] = 0] = "SELECT_TOKEN";
|
|
38
|
+
SendExternalStep[SendExternalStep["ADDRESS_FORM"] = 1] = "ADDRESS_FORM";
|
|
39
|
+
SendExternalStep[SendExternalStep["CONFIRM"] = 2] = "CONFIRM";
|
|
40
|
+
})(SendExternalStep || (exports.SendExternalStep = SendExternalStep = {}));
|
|
41
|
+
var WITHDRAW_STEP_NAME = (_a = {},
|
|
42
|
+
_a[SendExternalStep.SELECT_TOKEN] = "Select token",
|
|
43
|
+
_a[SendExternalStep.ADDRESS_FORM] = "Enter address",
|
|
44
|
+
_a[SendExternalStep.CONFIRM] = "Confirm",
|
|
45
|
+
_a);
|
|
46
|
+
var WithdrawAmountError;
|
|
47
|
+
(function (WithdrawAmountError) {
|
|
48
|
+
WithdrawAmountError["INSUFFICIENT_BALANCE"] = "\u24D8 Insufficient balance";
|
|
49
|
+
WithdrawAmountError["MAX_LIMIT"] = "\u24D8 Enter a maximum amount of";
|
|
50
|
+
WithdrawAmountError["MIN_LIMIT"] = "\u24D8 Enter a minimum amount of";
|
|
51
|
+
})(WithdrawAmountError || (exports.WithdrawAmountError = WithdrawAmountError = {}));
|
|
52
|
+
var SendExternalView = (0, react_1.forwardRef)(function (props, ref) {
|
|
53
|
+
var isInitPasscode = (0, useWalletData_1.default)().isInitPasscode;
|
|
54
|
+
var _a = (0, useWithdrawData_1.default)(), updateWithdrawToken = _a.updateWithdrawToken, withdrawTokens = _a.withdrawTokens;
|
|
55
|
+
var theme = (0, providers_1.useTheme)();
|
|
56
|
+
var router = (0, useCustomRouter_1.default)();
|
|
57
|
+
var drawerRef = (0, react_1.useRef)(null);
|
|
58
|
+
var stepsRef = (0, react_1.useRef)(null);
|
|
59
|
+
var swiperRef = (0, react_1.useRef)(null);
|
|
60
|
+
var _b = (0, react_1.useState)(SendExternalStep.SELECT_TOKEN), currentStep = _b[0], setCurrentStep = _b[1];
|
|
61
|
+
var _c = (0, react_1.useState)(), selectedToken = _c[0], setSelectedToken = _c[1];
|
|
62
|
+
var _d = (0, react_1.useState)(), payload = _d[0], setPayload = _d[1];
|
|
63
|
+
var _e = (0, react_1.useState)(), estimateFee = _e[0], setEstimateFee = _e[1];
|
|
64
|
+
var _f = (0, react_1.useState)(""), clearFormKey = _f[0], setClearFormKey = _f[1];
|
|
65
|
+
var _g = (0, react_1.useState)(false), isChangeSlidePromptly = _g[0], setIsChangeSlidePromptly = _g[1];
|
|
66
|
+
var clearValues = (0, react_1.useCallback)(function () {
|
|
67
|
+
setSelectedToken(undefined);
|
|
68
|
+
setPayload(undefined);
|
|
69
|
+
setClearFormKey(function (prev) { return prev + 1; });
|
|
70
|
+
setEstimateFee(undefined);
|
|
71
|
+
setIsChangeSlidePromptly(false);
|
|
72
|
+
}, []);
|
|
73
|
+
var close = function () {
|
|
74
|
+
var _a;
|
|
75
|
+
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
76
|
+
};
|
|
77
|
+
var gotoStep = (0, react_1.useCallback)(function (step) {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
if (step === SendExternalStep.SELECT_TOKEN) {
|
|
80
|
+
clearValues();
|
|
81
|
+
(_a = stepsRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
82
|
+
}
|
|
83
|
+
setCurrentStep(step);
|
|
84
|
+
(_b = swiperRef.current) === null || _b === void 0 ? void 0 : _b.slideTo(step);
|
|
85
|
+
}, [clearValues]);
|
|
86
|
+
var open = function () {
|
|
87
|
+
var _a;
|
|
88
|
+
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
89
|
+
};
|
|
90
|
+
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
91
|
+
open: open,
|
|
92
|
+
close: close,
|
|
93
|
+
}); });
|
|
94
|
+
var handleBack = function () {
|
|
95
|
+
if (currentStep === SendExternalStep.SELECT_TOKEN) {
|
|
96
|
+
clearValues();
|
|
97
|
+
router.back();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
gotoStep(currentStep - 1);
|
|
101
|
+
};
|
|
102
|
+
var gotoConfirmStep = function (payload, estimateFee) {
|
|
103
|
+
gotoStep(SendExternalStep.CONFIRM);
|
|
104
|
+
setPayload(payload);
|
|
105
|
+
setEstimateFee(estimateFee);
|
|
106
|
+
};
|
|
107
|
+
var handleSelectToken = function (token) {
|
|
108
|
+
setSelectedToken(token);
|
|
109
|
+
gotoStep(SendExternalStep.ADDRESS_FORM);
|
|
110
|
+
};
|
|
111
|
+
var handleSendSuccess = (0, react_1.useCallback)(function () {
|
|
112
|
+
setIsChangeSlidePromptly(true);
|
|
113
|
+
}, []);
|
|
114
|
+
var startNewTransaction = function () {
|
|
115
|
+
gotoStep(SendExternalStep.SELECT_TOKEN);
|
|
116
|
+
};
|
|
117
|
+
(0, react_1.useEffect)(function () {
|
|
118
|
+
if (isInitPasscode && !withdrawTokens) {
|
|
119
|
+
updateWithdrawToken();
|
|
120
|
+
}
|
|
121
|
+
}, [isInitPasscode, withdrawTokens]);
|
|
122
|
+
return ((0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: WITHDRAW_STEP_NAME[currentStep], overrideBack: handleBack }), children: (0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { disableSwipe: true, ref: swiperRef, swiperProps: {
|
|
123
|
+
spaceBetween: 32,
|
|
124
|
+
speed: isChangeSlidePromptly ? 0 : 500,
|
|
125
|
+
}, sx: {
|
|
126
|
+
height: "100%",
|
|
127
|
+
}, swiperStyle: {
|
|
128
|
+
height: "100%",
|
|
129
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: { minHeight: "100%" }, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { children: (0, jsx_runtime_1.jsx)(SelectToken_1.default, { tokens: withdrawTokens, selectedToken: selectedToken, onChangeToken: handleSelectToken }) }) }, SendExternalStep.SELECT_TOKEN), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: { minHeight: "100%" }, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
|
|
130
|
+
height: "100%",
|
|
131
|
+
paddingLeft: "0px",
|
|
132
|
+
paddingRight: "0px",
|
|
133
|
+
paddingTop: "0px",
|
|
134
|
+
paddingBottom: "0px",
|
|
135
|
+
}, children: (0, jsx_runtime_1.jsx)(Form_1.default, { sx: __assign({}, theme.mixins.pagePadding), selectedToken: selectedToken, onContinue: gotoConfirmStep }, clearFormKey) }) }, SendExternalStep.ADDRESS_FORM), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: { minHeight: "100%" }, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
|
|
136
|
+
height: "100%",
|
|
137
|
+
}, children: payload && ((0, jsx_runtime_1.jsx)(Summary_1.default, { estimateFee: estimateFee, payload: __assign(__assign({}, payload), { await_completion: true }), selectedToken: selectedToken, confirmProps: {
|
|
138
|
+
onSuccess: handleSendSuccess,
|
|
139
|
+
onClose: startNewTransaction,
|
|
140
|
+
} })) }) }, SendExternalStep.CONFIRM)] }) }));
|
|
141
|
+
});
|
|
142
|
+
SendExternalView.displayName = "SendExternalView";
|
|
143
|
+
exports.default = SendExternalView;
|
package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SxProps } from "@mui/material";
|
|
2
|
+
import { WithdrawCurrency } from "../../../../services/axios/get-withdraw-tokens-list-service/type";
|
|
3
|
+
import { FeesDataType } from "../../../../services/axios/get-est-fee-service/type";
|
|
4
|
+
import { SendInternalDataType } from "../../../ui/ConfirmSendInternal";
|
|
5
|
+
interface FormProps {
|
|
6
|
+
onContinue?: (payload?: SendInternalDataType, estimateFee?: FeesDataType) => void;
|
|
7
|
+
selectedToken?: WithdrawCurrency;
|
|
8
|
+
sx?: SxProps;
|
|
9
|
+
}
|
|
10
|
+
export default function Form(props: FormProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export type { FormProps };
|