tek-wallet 0.0.177 → 0.0.178

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.
@@ -72,12 +72,14 @@ var LockToken = function (props) {
72
72
  var theme = (0, material_1.useTheme)();
73
73
  var lockTokens = (0, useLockTokenData_1.default)().lockTokens;
74
74
  var confirmByPasscodeDrawerRef = (0, react_1.useRef)(null);
75
- var _c = (0, react_1.useState)(undefined), error = _c[0], setError = _c[1];
76
- var _d = (0, react_1.useState)(undefined), errorAmount = _d[0], setErrorAmount = _d[1];
77
- var _e = (0, react_1.useState)(Button_1.BUTTON_STATUS.ENABLED), buttonStatus = _e[0], setButtonStatus = _e[1];
75
+ var _c = (0, react_1.useState)(undefined), token = _c[0], setToken = _c[1];
76
+ var _d = (0, react_1.useState)(undefined), error = _d[0], setError = _d[1];
77
+ var _e = (0, react_1.useState)(undefined), errorAmount = _e[0], setErrorAmount = _e[1];
78
+ var _f = (0, react_1.useState)(Button_1.BUTTON_STATUS.ENABLED), buttonStatus = _f[0], setButtonStatus = _f[1];
78
79
  var validateAmount = (0, react_1.useCallback)(function (lockData) {
79
80
  console.warn("🚀 ~ validateAmount ~ lockData:", lockData, lockTokens);
80
81
  var token = lockTokens === null || lockTokens === void 0 ? void 0 : lockTokens.find(function (token) { return token.slug === lockData.tokenSlug; });
82
+ setToken(token);
81
83
  if (!token) {
82
84
  setError(LockTokenError.TOKEN_NOT_FOUND);
83
85
  return;
@@ -112,6 +114,6 @@ var LockToken = function (props) {
112
114
  (0, react_1.useEffect)(function () {
113
115
  validateAmount(props.lockData);
114
116
  }, [validateAmount]);
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" }) })] }) }) }));
117
+ 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: token === null || token === void 0 ? void 0 : token.name }) }), (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: token === null || token === void 0 ? void 0 : token.name }))] })] }) }), (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" }) })] }) }) }));
116
118
  };
117
119
  exports.default = LockToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.177",
3
+ "version": "0.0.178",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",