tek-wallet 0.0.231 → 0.0.233

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.
@@ -0,0 +1,11 @@
1
+ import { TextFieldProps } from "@mui/material";
2
+ interface InputProps {
3
+ className?: string;
4
+ inputRest?: TextFieldProps;
5
+ inputStyles?: React.CSSProperties;
6
+ leftPart?: React.ReactNode;
7
+ rightPart?: React.ReactNode;
8
+ }
9
+ export type InputRef = HTMLInputElement;
10
+ declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
11
+ export default Input;
@@ -0,0 +1,37 @@
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 __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ var jsx_runtime_1 = require("react/jsx-runtime");
26
+ var material_1 = require("@mui/material");
27
+ var react_1 = require("react");
28
+ var Input = (0, react_1.forwardRef)(function (props, inputRef) {
29
+ var inputRest = props.inputRest, inputClassName = props.inputStyles, leftPart = props.leftPart, rightPart = props.rightPart, rest = __rest(props, ["inputRest", "inputStyles", "leftPart", "rightPart"]);
30
+ var theme = (0, material_1.useTheme)();
31
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: inputRef, sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g12, borderRadius: theme.mixins.theBorderRadius.r12, px: theme.mixins.customPadding.p16, backgroundColor: "background.white16", border: "1px solid ".concat(theme.palette.border.white24), backdropFilter: "blur(10px)" }) }, rest, { children: [leftPart, (0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, inputRest, { variant: "outlined", sx: __assign({ backgroundColor: "transparent", border: "none", outline: "none", fontSize: theme.typography.fontSize16, lineHeight: theme.typography.leading140, fontWeight: theme.typography.fontWeight400, color: theme.palette.text.white, py: theme.mixins.customPadding.p12, flex: 1, "& ::placeholder": {
32
+ color: theme.palette.text.white64,
33
+ fontSize: theme.typography.fontSize14,
34
+ } }, inputClassName) })), (0, jsx_runtime_1.jsx)("input", { style: {} }), rightPart] })));
35
+ });
36
+ Input.displayName = "Input";
37
+ exports.default = Input;
@@ -17,7 +17,7 @@ export declare enum WithdrawStep {
17
17
  SELECT_METHOD = 1,
18
18
  SELECT_TOKEN = 2,
19
19
  SELECT_NETWORK = 3,
20
- SHOW_QR_CODE = 4
20
+ CONFIRM = 4
21
21
  }
22
22
  declare const WithdrawFunction: import("react").ForwardRefExoticComponent<WithdrawFunctionProps & import("react").RefAttributes<WithdrawFunctionRef>>;
23
23
  export default WithdrawFunction;
@@ -25,20 +25,18 @@ var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
25
25
  var ModalLayout_1 = __importDefault(require("../ModalLayout"));
26
26
  var react_2 = require("swiper/react");
27
27
  var BackHeader_1 = __importDefault(require("../BackHeader"));
28
- var QRCode_1 = __importDefault(require("../QRCode"));
29
28
  var Text_1 = __importDefault(require("../Text"));
30
29
  var material_1 = require("@mui/material");
31
- var CopyTextComponent_1 = __importDefault(require("../CopyTextComponent"));
32
30
  var Button_1 = __importDefault(require("../Button"));
33
31
  var Icon_1 = __importDefault(require("../Icon"));
34
32
  var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
35
- var Share_1 = __importDefault(require("../Share"));
36
33
  var NetworkSelection_1 = __importDefault(require("../NetworkSelection"));
37
34
  var TokenSelection_1 = __importDefault(require("../TokenSelection"));
38
35
  var CloseModal_1 = __importDefault(require("../CloseModal"));
39
36
  var RequireConnect_1 = __importDefault(require("../RequireConnect"));
40
37
  var useWithdrawData_1 = __importDefault(require("../../../hooks/useWithdrawData"));
41
38
  var ListItemCustom_1 = __importDefault(require("../ListItemCustom"));
39
+ var Input_1 = __importDefault(require("../Input"));
42
40
  var SendMethods;
43
41
  (function (SendMethods) {
44
42
  SendMethods["SCAN_QR_CODE"] = "scan qr code";
@@ -50,13 +48,13 @@ var WithdrawStep;
50
48
  WithdrawStep[WithdrawStep["SELECT_METHOD"] = 1] = "SELECT_METHOD";
51
49
  WithdrawStep[WithdrawStep["SELECT_TOKEN"] = 2] = "SELECT_TOKEN";
52
50
  WithdrawStep[WithdrawStep["SELECT_NETWORK"] = 3] = "SELECT_NETWORK";
53
- WithdrawStep[WithdrawStep["SHOW_QR_CODE"] = 4] = "SHOW_QR_CODE";
51
+ WithdrawStep[WithdrawStep["CONFIRM"] = 4] = "CONFIRM";
54
52
  })(WithdrawStep || (exports.WithdrawStep = WithdrawStep = {}));
55
53
  var WITHDRAW_STEP_NAME = (_a = {},
56
54
  _a[WithdrawStep.SELECT_METHOD] = "Select method",
57
55
  _a[WithdrawStep.SELECT_TOKEN] = "Select token",
58
56
  _a[WithdrawStep.SELECT_NETWORK] = "Select network",
59
- _a[WithdrawStep.SHOW_QR_CODE] = "Scan QR code",
57
+ _a[WithdrawStep.CONFIRM] = "Confirm",
60
58
  _a);
61
59
  var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
62
60
  var drawerRef = (0, react_1.useRef)(null);
@@ -67,6 +65,9 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
67
65
  var _c = (0, react_1.useState)(), selectedNetwork = _c[0], setSelectedNetwork = _c[1];
68
66
  var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
69
67
  var _d = (0, useWithdrawData_1.default)(), withdrawTokens = _d.withdrawTokens, updateWithdrawToken = _d.updateWithdrawToken;
68
+ var _e = (0, react_1.useState)(""), amount = _e[0], setAmount = _e[1];
69
+ var _f = (0, react_1.useState)(""), memo = _f[0], setMemo = _f[1];
70
+ var _g = (0, react_1.useState)(""), recipientAddress = _g[0], setRecipientAddress = _g[1];
70
71
  var networks = (0, react_1.useMemo)(function () {
71
72
  console.warn("🚀 ~ networks ~ selectedToken:", selectedToken);
72
73
  if (!selectedToken) {
@@ -86,11 +87,39 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
86
87
  var close = function () {
87
88
  var _a;
88
89
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
90
+ clearValues();
89
91
  };
90
92
  (0, react_1.useImperativeHandle)(ref, function () { return ({
91
93
  open: open,
92
94
  close: close,
93
95
  }); });
96
+ var handleChangeRecipientAddress = function (e) {
97
+ setRecipientAddress(e.target.value);
98
+ };
99
+ var handleChangeAmount = function (e) {
100
+ setAmount(e.target.value);
101
+ };
102
+ var handleChangeMemo = function (e) {
103
+ setMemo(e.target.value);
104
+ };
105
+ var gotoStep = function (step) {
106
+ var _a;
107
+ setCurrentStep(step);
108
+ (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.slideTo(step);
109
+ };
110
+ var clearValues = function () {
111
+ setSelectedToken(undefined);
112
+ setSelectedNetwork(undefined);
113
+ gotoStep(WithdrawStep.SELECT_METHOD);
114
+ setAmount("");
115
+ setMemo("");
116
+ setRecipientAddress("");
117
+ };
118
+ var handleOnClose = function (e) {
119
+ var _a;
120
+ clearValues();
121
+ (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e);
122
+ };
94
123
  var handleSelectMethod = function (method) {
95
124
  console.warn("🚀 ~ handleSelectMethod ~ method:", method);
96
125
  switch (method) {
@@ -133,7 +162,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
133
162
  updateWithdrawToken();
134
163
  }
135
164
  }, [isAuthenticated]);
136
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: props.onClose, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { overrideHeader: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { sx: {
165
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { overrideHeader: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { sx: {
137
166
  width: "100%",
138
167
  display: "flex",
139
168
  alignItems: "center",
@@ -153,31 +182,19 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
153
182
  if (!item)
154
183
  return null;
155
184
  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 }, item.id));
156
- }) }) }, WithdrawStep.SELECT_NETWORK), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
157
- display: "flex",
158
- flexDirection: "column",
159
- gap: theme.mixins.gaps.g16,
160
- }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ width: "100%" }, theme.mixins.column), { gap: theme.mixins.gaps.g12, backgroundColor: theme.palette.background.black24, borderRadius: theme.mixins.theBorderRadius.r16, padding: theme.mixins.customPadding.p16, alignItems: "flex-start", backdropFilter: "blur(10px)" }), id: "share-deposit-info", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
161
- width: "fit-content",
162
- height: "fit-content",
163
- alignSelf: "center",
164
- borderRadius: theme.mixins.theBorderRadius.r12,
165
- overflow: "hidden",
166
- backgroundColor: theme.palette.background.white,
167
- backdropFilter: "blur(10px)",
168
- }, children: (0, jsx_runtime_1.jsx)(QRCode_1.default, { value: "qrCodeValue", title: "Deposit ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name), logo: (0, getIcon_1.default)("ton"), bgColor: "transparent" }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, color: "text.white" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: "Network" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "button", sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g2, cursor: "pointer", transition: "transform 0.3s ease-in-out", "&:active": {
169
- transform: "translateX(0.5rem)",
170
- } }), onClick: handleBack, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.name }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("right_arrow"), width: 10 })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, color: "text.white" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: "Address" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { wordBreak: "break-all" }) })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, backgroundColor: theme.palette.background.white16, borderRadius: theme.mixins.theBorderRadius.r12, padding: theme.mixins.customPadding.p8 }), children: (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: ["Deposit", " ", (0, jsx_runtime_1.jsxs)("strong", { style: { color: theme.palette.text.white }, children: ["min ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value, " ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name] }), " ", "and", " ", (0, jsx_runtime_1.jsx)("strong", { style: { color: theme.palette.text.white }, children: "select the correct network" }), ", or you will lose your assets."] }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g12, justifyContent: "center" }), children: [(0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: "qrCodeValue", children: (0, jsx_runtime_1.jsxs)(Button_1.default.Secondary, { className: "gap-1.5 flex items-center", children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
171
- fontSize: theme.typography.fontSize12,
172
- fontWeight: theme.typography.fontWeight400,
173
- leading: "typography.leading150",
174
- textTransform: "capitalize",
175
- }, children: "Copy" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("copy"), width: 20 })] }) }), (0, jsx_runtime_1.jsx)(Share_1.default, { elementId: "share-deposit-info", children: (0, jsx_runtime_1.jsxs)(Button_1.default.Secondary, { sx: __assign({ gap: theme.mixins.gaps.g4 }, theme.mixins.row), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
176
- fontSize: theme.typography.fontSize12,
177
- fontWeight: theme.typography.fontWeight400,
178
- leading: "typography.leading150",
179
- textTransform: "capitalize",
180
- }, children: "Share" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("share"), width: 20 })] }) })] })] }) }, WithdrawStep.SHOW_QR_CODE)] }, withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.length) }) }) }));
185
+ }) }) }, WithdrawStep.SELECT_NETWORK), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { 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.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Recipient address" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
186
+ placeholder: "Enter recipient address",
187
+ value: recipientAddress,
188
+ onChange: handleChangeRecipientAddress,
189
+ }, rightPart: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { sx: __assign({}, theme.mixins.smallButton), children: "Paste" }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("qr_can"), width: 20 })] }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Select network" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { ml: "auto" }), children: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.name })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Enter amount" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
190
+ placeholder: "".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value, " - ").concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value, " ").concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name),
191
+ value: amount,
192
+ onChange: handleChangeAmount,
193
+ }, rightPart: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { sx: __assign({}, theme.mixins.smallButton), children: "Max" }) }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Memo" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
194
+ placeholder: "Enter memo",
195
+ value: memo,
196
+ onChange: handleChangeMemo,
197
+ } })] }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, children: "Confirm" })] }) }, WithdrawStep.CONFIRM)] }, withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.length) }) }) }));
181
198
  });
182
199
  WithdrawFunction.displayName = "WithdrawFunction";
183
200
  exports.default = WithdrawFunction;
@@ -223,6 +223,10 @@ var theme = (0, styles_1.createTheme)({
223
223
  fontWeight: typography.fontWeight400,
224
224
  fontSize: typography.fontSize12,
225
225
  },
226
+ smallButton: {
227
+ fontSize: typography.fontSize11,
228
+ padding: "".concat(customPadding.p8, " ").concat(customPadding.p4),
229
+ },
226
230
  },
227
231
  });
228
232
  exports.default = theme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.231",
3
+ "version": "0.0.233",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",