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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GeneralProps, UnknownFunction } from "../../../types/ui";
|
|
2
|
+
interface SwapViewProps extends GeneralProps {
|
|
3
|
+
onClose?: UnknownFunction;
|
|
4
|
+
onOpen?: UnknownFunction;
|
|
5
|
+
}
|
|
6
|
+
export type SwapViewRef = {
|
|
7
|
+
open: () => void;
|
|
8
|
+
close: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const SwapView: import("react").ForwardRefExoticComponent<SwapViewProps & import("react").RefAttributes<SwapViewRef>>;
|
|
11
|
+
export default SwapView;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
var _a;
|
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
+
exports.SwapView = void 0;
|
|
53
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
|
+
var react_1 = require("react");
|
|
55
|
+
var react_2 = require("swiper/react");
|
|
56
|
+
var material_1 = require("@mui/material");
|
|
57
|
+
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
58
|
+
var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
|
|
59
|
+
var SwiperControlled_1 = __importDefault(require("../../ui/SwiperControlled"));
|
|
60
|
+
var PageHeader_1 = __importDefault(require("../../ui/PageHeader"));
|
|
61
|
+
var SvgPath_1 = require("../../ui/SvgPath");
|
|
62
|
+
var Button_1 = __importStar(require("../../ui/Button"));
|
|
63
|
+
var FromCard_1 = __importDefault(require("./components/FromCard"));
|
|
64
|
+
var CardTo_1 = __importDefault(require("./components/CardTo"));
|
|
65
|
+
var xhub_keyboard_1 = require("xhub-keyboard");
|
|
66
|
+
var Text_1 = __importDefault(require("../../ui/Text"));
|
|
67
|
+
var Formatter_1 = __importDefault(require("../../ui/Formatter"));
|
|
68
|
+
var convertTokensRate_1 = __importDefault(require("./functions/convertTokensRate"));
|
|
69
|
+
var Summary_1 = __importDefault(require("./components/Summary"));
|
|
70
|
+
var useCustomRouter_1 = __importDefault(require("../../../hooks/useCustomRouter"));
|
|
71
|
+
var SwapStep;
|
|
72
|
+
(function (SwapStep) {
|
|
73
|
+
SwapStep[SwapStep["FORM"] = 0] = "FORM";
|
|
74
|
+
SwapStep[SwapStep["CONFIRM"] = 1] = "CONFIRM";
|
|
75
|
+
})(SwapStep || (SwapStep = {}));
|
|
76
|
+
var SWAP_STEP_NAME = (_a = {},
|
|
77
|
+
_a[SwapStep.FORM] = "Swap",
|
|
78
|
+
_a[SwapStep.CONFIRM] = "Confirm",
|
|
79
|
+
_a);
|
|
80
|
+
exports.SwapView = (0, react_1.forwardRef)(function (props, ref) {
|
|
81
|
+
var drawerRef = (0, react_1.useRef)(null);
|
|
82
|
+
var swiperRef = (0, react_1.useRef)(null);
|
|
83
|
+
var theme = (0, ThemeProvider_1.useTheme)();
|
|
84
|
+
var _a = (0, react_1.useState)(SwapStep.FORM), currentStep = _a[0], setCurrentStep = _a[1];
|
|
85
|
+
var _b = (0, react_1.useState)(null), fromTokenSelected = _b[0], setFromTokenSelected = _b[1];
|
|
86
|
+
var _c = (0, react_1.useState)(null), toTokenSelected = _c[0], setToTokenSelected = _c[1];
|
|
87
|
+
var _d = (0, react_1.useState)(), fromAmount = _d[0], setFormAmount = _d[1];
|
|
88
|
+
var _e = (0, react_1.useState)(false), fromInfoIsReady = _e[0], setFromInfoIsReady = _e[1];
|
|
89
|
+
var keyboardId = (0, xhub_keyboard_1.useUniqueId)("swap-form-keyboard");
|
|
90
|
+
var _f = (0, react_1.useState)(false), isKeyboardOpen = _f[0], setIsKeyboardOpen = _f[1];
|
|
91
|
+
var _g = (0, react_1.useState)(false), isUserTypedAmount = _g[0], setIsUserTypedAmount = _g[1];
|
|
92
|
+
var _h = (0, react_1.useState)(false), isChangeSlidePromptly = _h[0], setIsChangeSlidePromptly = _h[1];
|
|
93
|
+
var router = (0, useCustomRouter_1.default)();
|
|
94
|
+
var onChange = (0, react_1.useCallback)(function (e) {
|
|
95
|
+
var value = e.target.value;
|
|
96
|
+
setFormAmount(value);
|
|
97
|
+
}, []);
|
|
98
|
+
var clearValues = (0, react_1.useCallback)(function () {
|
|
99
|
+
setFromTokenSelected(null);
|
|
100
|
+
setToTokenSelected(null);
|
|
101
|
+
setFormAmount(undefined);
|
|
102
|
+
setFromInfoIsReady(false);
|
|
103
|
+
setIsUserTypedAmount(false);
|
|
104
|
+
}, []);
|
|
105
|
+
var toTokenRate = (0, react_1.useMemo)(function () {
|
|
106
|
+
if (!fromTokenSelected || !toTokenSelected)
|
|
107
|
+
return 0;
|
|
108
|
+
return (0, convertTokensRate_1.default)(fromTokenSelected, toTokenSelected, 1);
|
|
109
|
+
}, [fromTokenSelected, toTokenSelected]);
|
|
110
|
+
var handleKeyboardChangeAmount = (0, react_1.useCallback)(function (value) {
|
|
111
|
+
onChange({
|
|
112
|
+
target: {
|
|
113
|
+
value: value,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
setTimeout(function () {
|
|
117
|
+
setIsUserTypedAmount(true);
|
|
118
|
+
}, 500);
|
|
119
|
+
}, [onChange]);
|
|
120
|
+
var handleKeyboardOpen = (0, react_1.useCallback)(function () {
|
|
121
|
+
setIsKeyboardOpen(true);
|
|
122
|
+
}, []);
|
|
123
|
+
var handleKeyboardClose = (0, react_1.useCallback)(function () {
|
|
124
|
+
setIsKeyboardOpen(false);
|
|
125
|
+
}, []);
|
|
126
|
+
var gotoStep = function (step) {
|
|
127
|
+
var _a;
|
|
128
|
+
if (step === SwapStep.FORM) {
|
|
129
|
+
}
|
|
130
|
+
setCurrentStep(step);
|
|
131
|
+
(_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.slideTo(step);
|
|
132
|
+
};
|
|
133
|
+
var handleSelectToken = function (token) {
|
|
134
|
+
setFromTokenSelected(token);
|
|
135
|
+
};
|
|
136
|
+
var handleSelectOutputToken = function (output) {
|
|
137
|
+
setToTokenSelected(output);
|
|
138
|
+
};
|
|
139
|
+
var handleOnCloseSwap = (0, react_1.useCallback)(function () {
|
|
140
|
+
var _a;
|
|
141
|
+
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
142
|
+
gotoStep(SwapStep.FORM);
|
|
143
|
+
}, [props]);
|
|
144
|
+
var handleOnOpenSwap = (0, react_1.useCallback)(function () {
|
|
145
|
+
var _a;
|
|
146
|
+
(_a = props.onOpen) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
147
|
+
}, [props]);
|
|
148
|
+
var openSwapPage = (0, react_1.useCallback)(function () {
|
|
149
|
+
var _a;
|
|
150
|
+
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
151
|
+
handleOnOpenSwap();
|
|
152
|
+
}, [handleOnOpenSwap]);
|
|
153
|
+
var closeSwapPage = (0, react_1.useCallback)(function () {
|
|
154
|
+
var _a;
|
|
155
|
+
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
156
|
+
handleOnCloseSwap();
|
|
157
|
+
}, [handleOnCloseSwap]);
|
|
158
|
+
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
159
|
+
open: openSwapPage,
|
|
160
|
+
close: closeSwapPage,
|
|
161
|
+
}); });
|
|
162
|
+
var handlePreviewSwap = (0, react_1.useCallback)(function () {
|
|
163
|
+
gotoStep(SwapStep.CONFIRM);
|
|
164
|
+
}, []);
|
|
165
|
+
var handleBack = (0, react_1.useCallback)(function () {
|
|
166
|
+
if (currentStep === SwapStep.FORM) {
|
|
167
|
+
clearValues();
|
|
168
|
+
router.back();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
gotoStep(currentStep - 1);
|
|
172
|
+
}, [currentStep, clearValues, router]);
|
|
173
|
+
var handleNewTransaction = (0, react_1.useCallback)(function () {
|
|
174
|
+
clearValues();
|
|
175
|
+
gotoStep(SwapStep.FORM);
|
|
176
|
+
setIsChangeSlidePromptly(false);
|
|
177
|
+
}, [clearValues]);
|
|
178
|
+
var handleOnSuccessSwap = (0, react_1.useCallback)(function () {
|
|
179
|
+
setIsChangeSlidePromptly(true);
|
|
180
|
+
}, []);
|
|
181
|
+
return ((0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { styles: {
|
|
182
|
+
container: {
|
|
183
|
+
height: "100%",
|
|
184
|
+
},
|
|
185
|
+
}, id: keyboardId, onChange: handleKeyboardChangeAmount, keyboardType: xhub_keyboard_1.KeyboardType.Double, value: fromAmount === null || fromAmount === void 0 ? void 0 : fromAmount.toString(), keyboardId: "form-amount-keyboard-id", onOpen: handleKeyboardOpen, onClose: handleKeyboardClose, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: SWAP_STEP_NAME[currentStep], overrideBack: handleBack }) }), children: (0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: swiperRef, swiperProps: {
|
|
186
|
+
autoHeight: false,
|
|
187
|
+
spaceBetween: 32,
|
|
188
|
+
speed: isChangeSlidePromptly ? 0 : 500,
|
|
189
|
+
}, disableSwipe: true, initialActiveTab: currentStep, sx: {
|
|
190
|
+
height: "100%",
|
|
191
|
+
}, swiperStyle: {
|
|
192
|
+
height: "100%",
|
|
193
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: __assign(__assign({ height: "100%", minHeight: "100%" }, theme.mixins.pagePadding), { paddingBottom: isKeyboardOpen
|
|
194
|
+
? theme.mixins.customPadding.p8
|
|
195
|
+
: theme.mixins.customPadding.p24 }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
196
|
+
display: "flex",
|
|
197
|
+
flexDirection: "column",
|
|
198
|
+
gap: theme.mixins.gaps.g12,
|
|
199
|
+
height: "100%",
|
|
200
|
+
}, children: [(0, jsx_runtime_1.jsx)(FromCard_1.default, { onChange: onChange, onChangeToken: handleSelectToken, selectedToken: fromTokenSelected !== null && fromTokenSelected !== void 0 ? fromTokenSelected : undefined, amount: fromAmount !== null && fromAmount !== void 0 ? fromAmount : undefined, setFromInfoIsReady: setFromInfoIsReady, keyboardId: keyboardId, amountWasChanged: isUserTypedAmount }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: 1, children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 18, height: 18 }, children: SvgPath_1.IC_SWAP }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
201
|
+
flex: 1,
|
|
202
|
+
borderStyle: "dashed",
|
|
203
|
+
borderColor: "#A3A3A3",
|
|
204
|
+
opacity: 0.3,
|
|
205
|
+
} })] }), (0, jsx_runtime_1.jsx)(CardTo_1.default, { selectedToToken: toTokenSelected !== null && toTokenSelected !== void 0 ? toTokenSelected : undefined, selectedFromToken: fromTokenSelected !== null && fromTokenSelected !== void 0 ? fromTokenSelected : undefined, fromAmount: +(fromAmount !== null && fromAmount !== void 0 ? fromAmount : 0), onChangeToToken: handleSelectOutputToken }), !!toTokenRate && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: {
|
|
206
|
+
fontSize: theme.typography.fontSize12,
|
|
207
|
+
fontWeight: theme.typography.fontWeight500,
|
|
208
|
+
color: theme.palette.text.blackContrast,
|
|
209
|
+
alignSelf: "center",
|
|
210
|
+
}, children: ["1 ", fromTokenSelected === null || fromTokenSelected === void 0 ? void 0 : fromTokenSelected.name, " ~", " ", (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: toTokenRate, unit: toTokenSelected === null || toTokenSelected === void 0 ? void 0 : toTokenSelected.name })] })), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: {
|
|
211
|
+
marginTop: "auto",
|
|
212
|
+
}, status: !fromInfoIsReady ? Button_1.BUTTON_STATUS.DISABLED : Button_1.BUTTON_STATUS.ENABLED, fullWidth: true, onClick: handlePreviewSwap, children: "Preview swap" })] }) }, SwapStep.FORM), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: __assign({ height: "100%", minHeight: "100%" }, theme.mixins.pagePadding), children: (0, jsx_runtime_1.jsx)(Summary_1.default, { isActiveStep: currentStep === SwapStep.CONFIRM, fromToken: fromTokenSelected !== null && fromTokenSelected !== void 0 ? fromTokenSelected : undefined, toToken: toTokenSelected !== null && toTokenSelected !== void 0 ? toTokenSelected : undefined, fromAmount: +(fromAmount !== null && fromAmount !== void 0 ? fromAmount : 0), receiveAmountEstimate: fromAmount ? +(fromAmount !== null && fromAmount !== void 0 ? fromAmount : 0) * toTokenRate : 0, confirmProps: {
|
|
213
|
+
onDone: handleNewTransaction,
|
|
214
|
+
onSuccess: handleOnSuccessSwap,
|
|
215
|
+
} }) }, SwapStep.CONFIRM)] }) }) }));
|
|
216
|
+
});
|
|
217
|
+
exports.SwapView.displayName = "SwapView";
|
|
218
|
+
exports.default = exports.SwapView;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./routes"), exports);
|
|
18
|
+
__exportStar(require("./"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TekWalletView = TekWalletView;
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var navigation_1 = require("next/navigation");
|
|
7
|
+
var react_1 = require("react");
|
|
8
|
+
var routes_1 = require("./routes");
|
|
9
|
+
function TekWalletView() {
|
|
10
|
+
var pathname = (0, navigation_1.useParams)().pathname;
|
|
11
|
+
var pathnameArray = (0, react_1.useMemo)(function () { return (typeof pathname === "string" ? [pathname] : pathname); }, [pathname]);
|
|
12
|
+
var pathnameFull = (0, react_1.useMemo)(function () { return pathnameArray === null || pathnameArray === void 0 ? void 0 : pathnameArray.join("/"); }, [pathnameArray]);
|
|
13
|
+
console.warn("🚀 ~ TekWalletView ~ pathnameFull:", pathname, pathnameFull);
|
|
14
|
+
var View = (0, react_1.useMemo)(function () { return (pathname === undefined ? (0, routes_1.getView)("/") : (0, routes_1.getView)(pathnameFull || "")); }, [pathnameFull, pathname]);
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(View, {});
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
2
|
+
export declare enum TekWalletViewRoutes {
|
|
3
|
+
SEND_INTERNAL = "send/internal",
|
|
4
|
+
SEND_EXTERNAL = "send/external",
|
|
5
|
+
SWAP = "swap",
|
|
6
|
+
ASSET = "/",
|
|
7
|
+
NOT_FOUND = "not-found"
|
|
8
|
+
}
|
|
9
|
+
export declare const getView: (path: string) => ComponentType;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getView = exports.TekWalletViewRoutes = void 0;
|
|
40
|
+
var dynamic_1 = __importDefault(require("next/dynamic"));
|
|
41
|
+
var TekWalletViewRoutes;
|
|
42
|
+
(function (TekWalletViewRoutes) {
|
|
43
|
+
TekWalletViewRoutes["SEND_INTERNAL"] = "send/internal";
|
|
44
|
+
TekWalletViewRoutes["SEND_EXTERNAL"] = "send/external";
|
|
45
|
+
TekWalletViewRoutes["SWAP"] = "swap";
|
|
46
|
+
TekWalletViewRoutes["ASSET"] = "/";
|
|
47
|
+
TekWalletViewRoutes["NOT_FOUND"] = "not-found";
|
|
48
|
+
})(TekWalletViewRoutes || (exports.TekWalletViewRoutes = TekWalletViewRoutes = {}));
|
|
49
|
+
var getView = function (path) {
|
|
50
|
+
if (path.startsWith(TekWalletViewRoutes.SEND_INTERNAL)) {
|
|
51
|
+
return (0, dynamic_1.default)(function () { return Promise.resolve().then(function () { return __importStar(require("../SendInternalView")); }); }, {
|
|
52
|
+
ssr: false,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (path.startsWith(TekWalletViewRoutes.SEND_EXTERNAL)) {
|
|
56
|
+
return (0, dynamic_1.default)(function () { return Promise.resolve().then(function () { return __importStar(require("../SendExternalView")); }); }, {
|
|
57
|
+
ssr: false,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (path.startsWith(TekWalletViewRoutes.SWAP)) {
|
|
61
|
+
return (0, dynamic_1.default)(function () { return Promise.resolve().then(function () { return __importStar(require("../SwapView")); }); }, {
|
|
62
|
+
ssr: false,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (path.startsWith(TekWalletViewRoutes.ASSET)) {
|
|
66
|
+
return (0, dynamic_1.default)(function () { return Promise.resolve().then(function () { return __importStar(require("../AssetView")); }); }, {
|
|
67
|
+
ssr: false,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return (0, dynamic_1.default)(function () { return Promise.resolve().then(function () { return __importStar(require("../NotFoundView")); }); }, {
|
|
71
|
+
ssr: false,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
exports.getView = getView;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export declare enum AmountError {
|
|
3
|
+
INVALID_AMOUNT = "\u24D8 Invalid amount",
|
|
4
|
+
INSUFFICIENT_BALANCE = "\u24D8 Insufficient balance",
|
|
5
|
+
MAX_LIMIT = "\u24D8 Enter a maximum amount of",
|
|
6
|
+
MIN_LIMIT = "\u24D8 Enter a minimum amount of"
|
|
7
|
+
}
|
|
8
|
+
export interface ValidationData {
|
|
9
|
+
amount: number;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
balance?: number;
|
|
13
|
+
tokenName: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Options {
|
|
16
|
+
}
|
|
17
|
+
export interface UseValidateAmountProps {
|
|
18
|
+
validationData: ValidationData;
|
|
19
|
+
options?: Options;
|
|
20
|
+
}
|
|
21
|
+
declare function useValidateAmount({ validationData }: UseValidateAmountProps): {
|
|
22
|
+
amountError: number | undefined;
|
|
23
|
+
errorContent: ReactNode;
|
|
24
|
+
placeholder: string | import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
};
|
|
26
|
+
export default useValidateAmount;
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
exports.AmountError = void 0;
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
var react_1 = require("react");
|
|
20
|
+
var providers_1 = require("../providers");
|
|
21
|
+
var components_1 = require("../components");
|
|
22
|
+
var material_1 = require("@mui/material");
|
|
23
|
+
var Text_1 = __importDefault(require("../components/ui/Text"));
|
|
24
|
+
var AmountError;
|
|
25
|
+
(function (AmountError) {
|
|
26
|
+
AmountError["INVALID_AMOUNT"] = "\u24D8 Invalid amount";
|
|
27
|
+
AmountError["INSUFFICIENT_BALANCE"] = "\u24D8 Insufficient balance";
|
|
28
|
+
AmountError["MAX_LIMIT"] = "\u24D8 Enter a maximum amount of";
|
|
29
|
+
AmountError["MIN_LIMIT"] = "\u24D8 Enter a minimum amount of";
|
|
30
|
+
})(AmountError || (exports.AmountError = AmountError = {}));
|
|
31
|
+
var ErrorContent = function (_a) {
|
|
32
|
+
var children = _a.children;
|
|
33
|
+
var theme = (0, providers_1.useTheme)();
|
|
34
|
+
return (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: children });
|
|
35
|
+
};
|
|
36
|
+
var Container = function (_a) {
|
|
37
|
+
var children = _a.children;
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
39
|
+
pointerEvents: "none",
|
|
40
|
+
display: "inline-flex",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
gap: "0.25rem",
|
|
43
|
+
}, children: children }));
|
|
44
|
+
};
|
|
45
|
+
function useValidateAmount(_a) {
|
|
46
|
+
var validationData = _a.validationData;
|
|
47
|
+
var amount = validationData.amount, min = validationData.min, max = validationData.max, balance = validationData.balance, tokenName = validationData.tokenName;
|
|
48
|
+
var minValue = (0, react_1.useMemo)(function () { return +(min || 0); }, [min]);
|
|
49
|
+
var maxValue = (0, react_1.useMemo)(function () { return +(max || Infinity); }, [max]);
|
|
50
|
+
var theBalance = (0, react_1.useMemo)(function () { return +(balance || 0); }, [balance]);
|
|
51
|
+
var _b = (0, react_1.useState)(), amountError = _b[0], setAmountError = _b[1];
|
|
52
|
+
var _c = (0, react_1.useState)(), errorContent = _c[0], setErrorContent = _c[1];
|
|
53
|
+
var placeholder = (0, react_1.useMemo)(function () {
|
|
54
|
+
if (!!minValue && !!maxValue) {
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)(Container, { children: [(0, jsx_runtime_1.jsx)(components_1.Formatter, { value: minValue, unit: " ".concat(tokenName) }), " -", " ", (0, jsx_runtime_1.jsx)(components_1.Formatter, { value: maxValue, unit: " ".concat(tokenName) })] }));
|
|
56
|
+
}
|
|
57
|
+
if (!!minValue && maxValue === Infinity) {
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)(Container, { children: ["Min ", (0, jsx_runtime_1.jsx)(components_1.Formatter, { value: minValue, unit: " ".concat(tokenName) })] }));
|
|
59
|
+
}
|
|
60
|
+
if (!!maxValue && maxValue !== Infinity && !minValue) {
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(Container, { children: ["Max ", (0, jsx_runtime_1.jsx)(components_1.Formatter, { value: maxValue, unit: " ".concat(tokenName) })] }));
|
|
62
|
+
}
|
|
63
|
+
return "Enter amount";
|
|
64
|
+
}, [minValue, maxValue, tokenName]);
|
|
65
|
+
var validateAmount = (0, react_1.useCallback)(function () {
|
|
66
|
+
var amountIsNotANumber = isNaN(+amount);
|
|
67
|
+
if (amountIsNotANumber) {
|
|
68
|
+
setAmountError(undefined);
|
|
69
|
+
setErrorContent((0, jsx_runtime_1.jsx)(ErrorContent, { children: AmountError.INVALID_AMOUNT }));
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
var isAmountGreaterThanMaxValue = +amount > maxValue;
|
|
73
|
+
var isAmountLessThanMinValue = +amount < minValue;
|
|
74
|
+
var isAmountGreaterThanBalance = +amount > theBalance;
|
|
75
|
+
if (isAmountLessThanMinValue) {
|
|
76
|
+
setAmountError(minValue);
|
|
77
|
+
setErrorContent((0, jsx_runtime_1.jsxs)(ErrorContent, { children: [AmountError.MIN_LIMIT, " ", (0, jsx_runtime_1.jsx)(components_1.Formatter, { value: minValue, unit: tokenName })] }));
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (isAmountGreaterThanMaxValue) {
|
|
81
|
+
setAmountError(maxValue);
|
|
82
|
+
setErrorContent((0, jsx_runtime_1.jsxs)(ErrorContent, { children: [AmountError.MAX_LIMIT, " ", (0, jsx_runtime_1.jsx)(components_1.Formatter, { value: maxValue, unit: tokenName })] }));
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (isAmountGreaterThanBalance) {
|
|
86
|
+
setAmountError(undefined);
|
|
87
|
+
setErrorContent((0, jsx_runtime_1.jsx)(ErrorContent, { children: AmountError.INSUFFICIENT_BALANCE }));
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
setAmountError(undefined);
|
|
91
|
+
setErrorContent(undefined);
|
|
92
|
+
return true;
|
|
93
|
+
}, [minValue, maxValue, theBalance, amount, tokenName]);
|
|
94
|
+
(0, react_1.useEffect)(function () {
|
|
95
|
+
validateAmount();
|
|
96
|
+
}, [validateAmount]);
|
|
97
|
+
return {
|
|
98
|
+
amountError: amountError,
|
|
99
|
+
errorContent: errorContent,
|
|
100
|
+
placeholder: placeholder,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
exports.default = useValidateAmount;
|
|
@@ -13,10 +13,15 @@ function EventHandlerProvider(props) {
|
|
|
13
13
|
var _a = (0, useEventHandler_1.useEventHandler)(), transactionHandler = _a.transactionHandler, walletInfoHandler = _a.walletInfoHandler;
|
|
14
14
|
var _b = (0, useRealtime_1.default)(), pushNotification = _b.pushNotification, transaction = _b.transaction, walletHandlerInfo = _b.walletHandlerInfo;
|
|
15
15
|
(0, react_1.useEffect)(function () {
|
|
16
|
+
var _a;
|
|
16
17
|
if (!transactionHandler || !transaction)
|
|
17
18
|
return;
|
|
18
19
|
var theMessage = transactionHandler(transaction);
|
|
19
20
|
if (theMessage) {
|
|
21
|
+
if ((_a = theMessage.id) === null || _a === void 0 ? void 0 : _a.includes("processing")) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
console.warn("🚀 ~ EventHandlerProvider ~ theMessage:", theMessage);
|
|
20
25
|
pushNotification(theMessage);
|
|
21
26
|
}
|
|
22
27
|
}, [transaction]);
|
|
@@ -121,14 +121,14 @@ function RealtimeProvider(_a) {
|
|
|
121
121
|
transaction: transaction,
|
|
122
122
|
walletHandlerInfo: walletHandlerInfo,
|
|
123
123
|
pushNotification: pushNotification,
|
|
124
|
-
}, children: [children, (options === null || options === void 0 ? void 0 : options.useDefaultToastMessage) && ((0, jsx_runtime_1.jsx)(notistack_1.SnackbarProvider, { maxSnack: 2, children: notifications.map(function (notification) {
|
|
124
|
+
}, children: [children, !!(options === null || options === void 0 ? void 0 : options.useDefaultToastMessage) && ((0, jsx_runtime_1.jsx)(notistack_1.SnackbarProvider, { maxSnack: 2, children: notifications.map(function (notification) {
|
|
125
125
|
var _a, _b, _c, _d, _e, _f;
|
|
126
126
|
return ((0, jsx_runtime_1.jsx)(material_1.Snackbar, { open: (_a = notification.open) !== null && _a !== void 0 ? _a : true, anchorOrigin: {
|
|
127
127
|
vertical: (_c = (_b = notification === null || notification === void 0 ? void 0 : notification.anchorOrigin) === null || _b === void 0 ? void 0 : _b.vertical) !== null && _c !== void 0 ? _c : "top",
|
|
128
128
|
horizontal: (_e = (_d = notification === null || notification === void 0 ? void 0 : notification.anchorOrigin) === null || _d === void 0 ? void 0 : _d.horizontal) !== null && _e !== void 0 ? _e : "right",
|
|
129
129
|
}, onClose: function () {
|
|
130
130
|
closeNotification(notification.id);
|
|
131
|
-
}, slots: { transition: GrowTransition }, autoHideDuration: (_f = notification.duration) !== null && _f !== void 0 ? _f :
|
|
131
|
+
}, slots: { transition: GrowTransition }, autoHideDuration: (_f = notification.duration) !== null && _f !== void 0 ? _f : 10000, children: (0, jsx_runtime_1.jsx)(material_1.Alert, { icon: false, severity: notification.type, sx: {
|
|
132
132
|
width: "fit-content",
|
|
133
133
|
borderRadius: theme.mixins.customRadius.r6,
|
|
134
134
|
mx: "auto",
|
|
@@ -2,6 +2,7 @@ import { ReactNode } from "react";
|
|
|
2
2
|
export interface Options {
|
|
3
3
|
hideDefaultActivities?: boolean;
|
|
4
4
|
useDefaultToastMessage?: boolean;
|
|
5
|
+
basePath?: string;
|
|
5
6
|
}
|
|
6
7
|
export interface TekWalletProviderProps {
|
|
7
8
|
children: ReactNode;
|
|
@@ -11,7 +12,9 @@ export interface TekWalletProviderProps {
|
|
|
11
12
|
}
|
|
12
13
|
export interface TekWalletContextType {
|
|
13
14
|
isSSO: boolean | undefined;
|
|
15
|
+
options?: Options;
|
|
14
16
|
}
|
|
15
17
|
export declare const TekWalletContext: import("react").Context<TekWalletContextType>;
|
|
16
18
|
export declare function TekWalletProvider({ children, isSSO, accessToken, options, }: TekWalletProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export default TekWalletProvider;
|
|
20
|
+
export declare const useWalletConfig: () => TekWalletContextType;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.TekWalletContext = void 0;
|
|
7
|
+
exports.useWalletConfig = exports.TekWalletContext = void 0;
|
|
8
8
|
exports.TekWalletProvider = TekWalletProvider;
|
|
9
9
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
10
|
var react_1 = require("react");
|
|
@@ -20,6 +20,7 @@ var WalletDataProvider_1 = __importDefault(require("../WalletDataProvider"));
|
|
|
20
20
|
var ThemeProvider_1 = require("../ThemeProvider");
|
|
21
21
|
var initialTekWalletContext = {
|
|
22
22
|
isSSO: undefined,
|
|
23
|
+
options: undefined,
|
|
23
24
|
};
|
|
24
25
|
exports.TekWalletContext = (0, react_1.createContext)(initialTekWalletContext);
|
|
25
26
|
function TekWalletProvider(_a) {
|
|
@@ -29,6 +30,11 @@ function TekWalletProvider(_a) {
|
|
|
29
30
|
var onDisconnect = function () {
|
|
30
31
|
setResetTrigger(function (prev) { return prev + "1"; });
|
|
31
32
|
};
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(exports.TekWalletContext.Provider, { value: { isSSO: isSSO }, children: (0, jsx_runtime_1.jsx)(WalletProvider, { accessToken: accessToken !== null && accessToken !== void 0 ? accessToken : "", onDisconnect: onDisconnect, children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.CustomThemeProvider, { children: (0, jsx_runtime_1.jsx)(RealtimeProvider_1.default, { options: options, children: (0, jsx_runtime_1.jsx)(ActivitiesProvider_1.default, { children: (0, jsx_runtime_1.jsx)(ReceiveProvider_1.default, { children: (0, jsx_runtime_1.jsx)(LockTokenProvider_1.default, { children: (0, jsx_runtime_1.jsx)(WithdrawProvider_1.default, { children: (0, jsx_runtime_1.jsx)(SwapProvider_1.default, { children: (0, jsx_runtime_1.jsx)(EventHandlerProvider_1.default, { options: options, children: children }) }) }) }) }) }) }) }) }, resetTrigger) }));
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(exports.TekWalletContext.Provider, { value: { isSSO: isSSO, options: options }, children: (0, jsx_runtime_1.jsx)(WalletProvider, { accessToken: accessToken !== null && accessToken !== void 0 ? accessToken : "", onDisconnect: onDisconnect, children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.CustomThemeProvider, { children: (0, jsx_runtime_1.jsx)(RealtimeProvider_1.default, { options: options, children: (0, jsx_runtime_1.jsx)(ActivitiesProvider_1.default, { children: (0, jsx_runtime_1.jsx)(ReceiveProvider_1.default, { children: (0, jsx_runtime_1.jsx)(LockTokenProvider_1.default, { children: (0, jsx_runtime_1.jsx)(WithdrawProvider_1.default, { children: (0, jsx_runtime_1.jsx)(SwapProvider_1.default, { children: (0, jsx_runtime_1.jsx)(EventHandlerProvider_1.default, { options: options, children: children }) }) }) }) }) }) }) }) }, resetTrigger) }));
|
|
33
34
|
}
|
|
34
35
|
exports.default = TekWalletProvider;
|
|
36
|
+
var useWalletConfig = function () {
|
|
37
|
+
var config = (0, react_1.useContext)(exports.TekWalletContext);
|
|
38
|
+
return config;
|
|
39
|
+
};
|
|
40
|
+
exports.useWalletConfig = useWalletConfig;
|
|
@@ -80,6 +80,9 @@ var react_1 = __importStar(require("react"));
|
|
|
80
80
|
var useWalletData_1 = __importDefault(require("../../hooks/useWalletData"));
|
|
81
81
|
var get_withdraw_tokens_list_service_1 = __importDefault(require("../../services/axios/get-withdraw-tokens-list-service"));
|
|
82
82
|
var get_send_tokens_list_service_1 = __importDefault(require("../../services/axios/get-send-tokens-list-service"));
|
|
83
|
+
// import { WithdrawCurrency } from "../../services/axios/get-withdraw-tokens-list-service/type";
|
|
84
|
+
// import { FeesDataType } from "../../services/axios/get-est-fee-service/type";
|
|
85
|
+
// import { NetworkData } from "../../services/axios/type";
|
|
83
86
|
exports.initialWithdraw = {
|
|
84
87
|
isLoadingWithdrawToken: false,
|
|
85
88
|
withdrawTokens: undefined,
|
|
@@ -153,6 +156,17 @@ function WithdrawProvider(_a) {
|
|
|
153
156
|
}
|
|
154
157
|
});
|
|
155
158
|
}); }, [isInitPasscode, isLoadingSendInternalToken]);
|
|
159
|
+
// const [recipientAddress, setRecipientAddress] = useState<string>("");
|
|
160
|
+
// const [amount, setAmount] = useState<number>(0);
|
|
161
|
+
// const [comment, setComment] = useState<string>("");
|
|
162
|
+
// const [selectedToken, setSelectedToken] = useState<WithdrawCurrency | undefined>();
|
|
163
|
+
// const [estimateFee, setEstimateFee] = useState<FeesDataType>();
|
|
164
|
+
// const [selectedNetwork, setSelectedNetwork] = useState<NetworkData | undefined>();
|
|
165
|
+
// const [isLoadingEstimateFee, setIsLoadingEstimateFee] = useState<boolean>(false);
|
|
166
|
+
// const [isValidatingAddress, setIsValidatingAddress] = useState<boolean>(false);
|
|
167
|
+
// const [isEnoughBalanceToPayFee, setIsEnoughBalanceToPayFee] = useState<boolean>(false);
|
|
168
|
+
// const [amountError, setAmountError] = useState<string | undefined>();
|
|
169
|
+
// const [amountErrorMessage, setAmountErrorMessage] = useState<string | undefined>();
|
|
156
170
|
return ((0, jsx_runtime_1.jsx)(exports.WithdrawContext.Provider, { value: {
|
|
157
171
|
isLoadingWithdrawToken: isLoadingWithdrawToken,
|
|
158
172
|
withdrawTokens: withdrawTokens,
|
|
@@ -160,6 +174,28 @@ function WithdrawProvider(_a) {
|
|
|
160
174
|
isLoadingSendInternalToken: isLoadingSendInternalToken,
|
|
161
175
|
sendInternalTokens: sendInternalTokens,
|
|
162
176
|
updateSendInternalToken: updateSendInternalToken,
|
|
177
|
+
// recipientAddress,
|
|
178
|
+
// setRecipientAddress,
|
|
179
|
+
// amount,
|
|
180
|
+
// setAmount,
|
|
181
|
+
// comment,
|
|
182
|
+
// setComment,
|
|
183
|
+
// selectedToken,
|
|
184
|
+
// setSelectedToken,
|
|
185
|
+
// estimateFee,
|
|
186
|
+
// setEstimateFee,
|
|
187
|
+
// selectedNetwork,
|
|
188
|
+
// setSelectedNetwork,
|
|
189
|
+
// isLoadingEstimateFee,
|
|
190
|
+
// setIsLoadingEstimateFee,
|
|
191
|
+
// isValidatingAddress,
|
|
192
|
+
// setIsValidatingAddress,
|
|
193
|
+
// isEnoughBalanceToPayFee,
|
|
194
|
+
// setIsEnoughBalanceToPayFee,
|
|
195
|
+
// amountError,
|
|
196
|
+
// setAmountError,
|
|
197
|
+
// amountErrorMessage,
|
|
198
|
+
// setAmountErrorMessage,
|
|
163
199
|
}, children: children }));
|
|
164
200
|
}
|
|
165
201
|
exports.default = WithdrawProvider;
|