tek-wallet 0.0.175 → 0.0.177
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.
|
@@ -75,7 +75,8 @@ var LockToken = function (props) {
|
|
|
75
75
|
var _c = (0, react_1.useState)(undefined), error = _c[0], setError = _c[1];
|
|
76
76
|
var _d = (0, react_1.useState)(undefined), errorAmount = _d[0], setErrorAmount = _d[1];
|
|
77
77
|
var _e = (0, react_1.useState)(Button_1.BUTTON_STATUS.ENABLED), buttonStatus = _e[0], setButtonStatus = _e[1];
|
|
78
|
-
var validateAmount = function (lockData) {
|
|
78
|
+
var validateAmount = (0, react_1.useCallback)(function (lockData) {
|
|
79
|
+
console.warn("🚀 ~ validateAmount ~ lockData:", lockData, lockTokens);
|
|
79
80
|
var token = lockTokens === null || lockTokens === void 0 ? void 0 : lockTokens.find(function (token) { return token.slug === lockData.tokenSlug; });
|
|
80
81
|
if (!token) {
|
|
81
82
|
setError(LockTokenError.TOKEN_NOT_FOUND);
|
|
@@ -98,7 +99,7 @@ var LockToken = function (props) {
|
|
|
98
99
|
}
|
|
99
100
|
setError(undefined);
|
|
100
101
|
setErrorAmount(undefined);
|
|
101
|
-
};
|
|
102
|
+
}, [lockTokens, (_a = props.lockData) === null || _a === void 0 ? void 0 : _a.amount, (_b = props.lockData) === null || _b === void 0 ? void 0 : _b.tokenSlug]);
|
|
102
103
|
var handleLockToken = function (passcode) {
|
|
103
104
|
console.warn("🚀 ~ handleLockToken ~ lockData:", props.lockData, passcode);
|
|
104
105
|
setButtonStatus(Button_1.BUTTON_STATUS.LOADING);
|
|
@@ -110,7 +111,7 @@ var LockToken = function (props) {
|
|
|
110
111
|
};
|
|
111
112
|
(0, react_1.useEffect)(function () {
|
|
112
113
|
validateAmount(props.lockData);
|
|
113
|
-
}, [
|
|
114
|
+
}, [validateAmount]);
|
|
114
115
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmByPasscodeDrawerRef, action: type_1.ActionConfirm.LOCK, trigger: props.trigger, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g16 }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: props.lockData.amount, unit: props.lockData.tokenSlug }) }), (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: [error, " ", !!errorAmount && ((0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: props.lockData.tokenSlug }))] })] }) }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.ActionConfirm.LOCK, onConfirmSuccess: handleLockToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
|
|
115
116
|
};
|
|
116
117
|
exports.default = LockToken;
|