tek-wallet 0.0.765 → 0.0.766
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.
|
@@ -70,7 +70,6 @@ var Summary_1 = __importDefault(require("./components/Summary"));
|
|
|
70
70
|
var useCustomRouter_1 = __importDefault(require("../../../hooks/useCustomRouter"));
|
|
71
71
|
var FromCardSkeleton_1 = __importDefault(require("./components/FromCard/FromCardSkeleton"));
|
|
72
72
|
var useWallet_1 = __importDefault(require("../../../hooks/useWallet"));
|
|
73
|
-
var SwapFunction_1 = __importDefault(require("../../ui/SwapFunction"));
|
|
74
73
|
var SwapStep;
|
|
75
74
|
(function (SwapStep) {
|
|
76
75
|
SwapStep[SwapStep["FORM"] = 0] = "FORM";
|
|
@@ -162,39 +161,37 @@ var SwapView = function () {
|
|
|
162
161
|
container: {
|
|
163
162
|
height: "100%",
|
|
164
163
|
},
|
|
165
|
-
}, 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.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
display: "none",
|
|
197
|
-
}, children: (0, jsx_runtime_1.jsx)(SwapFunction_1.default, {}) })] }) }));
|
|
164
|
+
}, 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: {
|
|
165
|
+
autoHeight: false,
|
|
166
|
+
spaceBetween: 32,
|
|
167
|
+
speed: isChangeSlidePromptly ? 0 : 500,
|
|
168
|
+
}, disableSwipe: true, initialActiveTab: currentStep, sx: {
|
|
169
|
+
height: "100%",
|
|
170
|
+
}, swiperStyle: {
|
|
171
|
+
height: "100%",
|
|
172
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: __assign(__assign({ height: "100%", minHeight: "100%" }, theme.mixins.pagePadding), { paddingBottom: isKeyboardOpen
|
|
173
|
+
? theme.mixins.customPadding.p8
|
|
174
|
+
: theme.mixins.customPadding.p24 }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
175
|
+
display: "flex",
|
|
176
|
+
flexDirection: "column",
|
|
177
|
+
gap: theme.mixins.gaps.g12,
|
|
178
|
+
height: "100%",
|
|
179
|
+
}, children: [!fromTokens && (0, jsx_runtime_1.jsx)(FromCardSkeleton_1.default, {}), !!fromTokens && ((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, fromTokens: fromTokens })), (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: {
|
|
180
|
+
flex: 1,
|
|
181
|
+
borderStyle: "dashed",
|
|
182
|
+
borderColor: "#A3A3A3",
|
|
183
|
+
opacity: 0.3,
|
|
184
|
+
} })] }), !fromTokenSelected && (0, jsx_runtime_1.jsx)(FromCardSkeleton_1.default, {}), !!fromTokenSelected && ((0, jsx_runtime_1.jsx)(ToCard_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: {
|
|
185
|
+
fontSize: theme.typography.fontSize12,
|
|
186
|
+
fontWeight: theme.typography.fontWeight500,
|
|
187
|
+
color: theme.palette.text.blackContrast,
|
|
188
|
+
alignSelf: "center",
|
|
189
|
+
}, 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: {
|
|
190
|
+
marginTop: "auto",
|
|
191
|
+
}, 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: {
|
|
192
|
+
onDone: handleNewTransaction,
|
|
193
|
+
onSuccess: handleOnSuccessSwap,
|
|
194
|
+
} }) }, SwapStep.CONFIRM)] }) }) }));
|
|
198
195
|
};
|
|
199
196
|
exports.SwapView = SwapView;
|
|
200
197
|
exports.default = exports.SwapView;
|
|
@@ -119,6 +119,11 @@ function SwapProvider(_a) {
|
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
}); }, [isInitPasscode, isLoadingSwapToken]);
|
|
122
|
+
(0, react_1.useEffect)(function () {
|
|
123
|
+
if (!fromTokens && isInitPasscode) {
|
|
124
|
+
updateSwapTokens();
|
|
125
|
+
}
|
|
126
|
+
}, [fromTokens, updateSwapTokens, isInitPasscode]);
|
|
122
127
|
return ((0, jsx_runtime_1.jsx)(exports.SwapContext.Provider, { value: {
|
|
123
128
|
isLoadingSwapToken: isLoadingSwapToken,
|
|
124
129
|
fromTokens: fromTokens,
|