tek-wallet 0.0.404 → 0.0.406

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.
@@ -1,5 +1,4 @@
1
1
  export declare enum ActionConfirm {
2
- WITHDRAW = "withdraw",
3
- TRANSFER = "transfer",
2
+ SEND = "send",
4
3
  LOCK = "lock token"
5
4
  }
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActionConfirm = void 0;
4
4
  var ActionConfirm;
5
5
  (function (ActionConfirm) {
6
- ActionConfirm["WITHDRAW"] = "withdraw";
7
- ActionConfirm["TRANSFER"] = "transfer";
6
+ ActionConfirm["SEND"] = "send";
8
7
  ActionConfirm["LOCK"] = "lock token";
9
8
  })(ActionConfirm || (exports.ActionConfirm = ActionConfirm = {}));
@@ -21,6 +21,6 @@ var material_1 = require("@mui/material");
21
21
  var LineValue = function (props) {
22
22
  var theme = (0, material_1.useTheme)();
23
23
  var field = props.field, value = props.value, valueDescription = props.valueDescription;
24
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.row), { alignItems: "start", gap: theme.mixins.gaps.g16 }), props.sx), children: [!!field && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: field })), (!!value || !!valueDescription) && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { alignItems: "end", gap: theme.mixins.gaps.g2 }), children: [!!value && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: value })), !!valueDescription && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: valueDescription }))] }))] }));
24
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.row), { alignItems: "start", gap: theme.mixins.gaps.g32 }), props.sx), children: [!!field && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { whiteSpace: "nowrap" }), children: field })), (!!value || !!valueDescription) && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1, alignItems: "end", gap: theme.mixins.gaps.g2 }), children: [!!value && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: value })), !!valueDescription && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: valueDescription }))] }))] }));
25
25
  };
26
26
  exports.default = LineValue;
@@ -148,33 +148,33 @@ var AmountError;
148
148
  AmountError["MIN_LIMIT"] = "The minimum amount is";
149
149
  })(AmountError || (exports.AmountError = AmountError = {}));
150
150
  var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
151
- var _a;
151
+ var _a, _b;
152
152
  var drawerRef = (0, react_1.useRef)(null);
153
153
  var swiperRef = (0, react_1.useRef)(null);
154
154
  var theme = (0, material_1.useTheme)();
155
- var _b = (0, react_1.useState)(WithdrawStep.SELECT_METHOD), currentStep = _b[0], setCurrentStep = _b[1];
156
- var _c = (0, react_1.useState)(), selectedToken = _c[0], setSelectedToken = _c[1];
157
- var _d = (0, react_1.useState)(), selectedNetwork = _d[0], setSelectedNetwork = _d[1];
155
+ var _c = (0, react_1.useState)(WithdrawStep.SELECT_METHOD), currentStep = _c[0], setCurrentStep = _c[1];
156
+ var _d = (0, react_1.useState)(), selectedToken = _d[0], setSelectedToken = _d[1];
157
+ var _e = (0, react_1.useState)(), selectedNetwork = _e[0], setSelectedNetwork = _e[1];
158
158
  var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
159
- var _e = (0, useWithdrawData_1.default)(), withdrawTokens = _e.withdrawTokens, updateWithdrawToken = _e.updateWithdrawToken, updateSendInternalToken = _e.updateSendInternalToken, sendInternalTokens = _e.sendInternalTokens;
160
- var _f = (0, react_1.useState)(), infoDialogContent = _f[0], setInfoDialogContent = _f[1];
161
- var _g = (0, react_1.useState)(""), amount = _g[0], setAmount = _g[1];
162
- var _h = (0, react_1.useState)(undefined), memo = _h[0], setMemo = _h[1];
163
- var _j = (0, react_1.useState)(undefined), recipientAddress = _j[0], setRecipientAddress = _j[1];
164
- var _k = (0, react_1.useState)(), amountErrorMessage = _k[0], setAmountErrorMessage = _k[1];
165
- var _l = (0, react_1.useState)(true), hiddenError = _l[0], setHiddenError = _l[1];
166
- var _m = (0, react_1.useState)(), amountError = _m[0], setAmountError = _m[1];
159
+ var _f = (0, useWithdrawData_1.default)(), withdrawTokens = _f.withdrawTokens, updateWithdrawToken = _f.updateWithdrawToken, updateSendInternalToken = _f.updateSendInternalToken, sendInternalTokens = _f.sendInternalTokens;
160
+ var _g = (0, react_1.useState)(), infoDialogContent = _g[0], setInfoDialogContent = _g[1];
161
+ var _h = (0, react_1.useState)(""), amount = _h[0], setAmount = _h[1];
162
+ var _j = (0, react_1.useState)(undefined), memo = _j[0], setMemo = _j[1];
163
+ var _k = (0, react_1.useState)(undefined), recipientAddress = _k[0], setRecipientAddress = _k[1];
164
+ var _l = (0, react_1.useState)(), amountErrorMessage = _l[0], setAmountErrorMessage = _l[1];
165
+ var _m = (0, react_1.useState)(true), hiddenError = _m[0], setHiddenError = _m[1];
166
+ var _o = (0, react_1.useState)(), amountError = _o[0], setAmountError = _o[1];
167
167
  var scannerAllQrCodeRef = (0, react_1.useRef)(null);
168
168
  var scannerAddressQrCodeRef = (0, react_1.useRef)(null);
169
169
  var backDropRef = (0, react_1.useRef)(null);
170
170
  var suggestUseTransferInternalDialogRef = (0, react_1.useRef)(null);
171
171
  var suggestUseTransferExternalDialogRef = (0, react_1.useRef)(null);
172
- var _o = (0, react_1.useState)(), selectedMethod = _o[0], setSelectedMethod = _o[1];
173
- var _p = (0, react_1.useState)(), sendInfoGet = _p[0], setSendInfoGet = _p[1];
174
- var _q = (0, react_1.useState)(false), isLoadingEstimateFee = _q[0], setIsLoadingEstimateFee = _q[1];
175
- var _r = (0, react_1.useState)(false), isValidatingAddress = _r[0], setIsValidatingAddress = _r[1];
176
- var _s = (0, react_1.useState)(), estimateFee = _s[0], setEstimateFee = _s[1];
177
- var _t = (0, react_1.useState)(), recipientAddressError = _t[0], setRecipientAddressError = _t[1];
172
+ var _p = (0, react_1.useState)(), selectedMethod = _p[0], setSelectedMethod = _p[1];
173
+ var _q = (0, react_1.useState)(), sendInfoGet = _q[0], setSendInfoGet = _q[1];
174
+ var _r = (0, react_1.useState)(false), isLoadingEstimateFee = _r[0], setIsLoadingEstimateFee = _r[1];
175
+ var _s = (0, react_1.useState)(false), isValidatingAddress = _s[0], setIsValidatingAddress = _s[1];
176
+ var _t = (0, react_1.useState)(), estimateFee = _t[0], setEstimateFee = _t[1];
177
+ var _u = (0, react_1.useState)(), recipientAddressError = _u[0], setRecipientAddressError = _u[1];
178
178
  var onlyChangeAddress = (0, react_1.useRef)(false);
179
179
  var withdrawToken = (0, react_1.useMemo)(function () {
180
180
  return selectedMethod === SendMethods.TRANSFER_EXTERNAL
@@ -625,11 +625,11 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
625
625
  placeholder: "Enter memo",
626
626
  value: memo,
627
627
  onChange: handleChangeMemo,
628
- } })] })), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { feesData: JSON.stringify(estimateFee), amount: +amount })), estimateReceive !== undefined && !amountError && ((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: "Estimate receive" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive }) })] })), (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default
628
+ } })] })), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { feesData: JSON.stringify(estimateFee), amount: +amount })), estimateReceive !== undefined && !amountError && ((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: "Receive amount estimated" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive }) })] })), (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default
629
629
  // ref={confirmByPasscodeDrawerRef}
630
630
  , {
631
631
  // ref={confirmByPasscodeDrawerRef}
632
- action: type_1.ActionConfirm.LOCK, trigger: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, onClick: handleSend, status: !!amountError ||
632
+ action: type_1.ActionConfirm.SEND, trigger: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, onClick: handleSend, status: !!amountError ||
633
633
  !!recipientAddressError ||
634
634
  !recipientAddress ||
635
635
  !amount ||
@@ -637,7 +637,14 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
637
637
  isLoadingEstimateFee ||
638
638
  isValidatingAddress
639
639
  ? Button_1.BUTTON_STATUS.DISABLED
640
- : Button_1.BUTTON_STATUS.ENABLED, children: "Continue" }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name }) }) }), (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: ["Your balance is", " "] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.ActionConfirm.LOCK, onConfirmSuccess: function () { return console.warn("confirm success"); }, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: Button_1.BUTTON_STATUS.ENABLED, sx: { width: "100%" }, children: "Confirm" }) })] }) })] }) }, WithdrawStep.FORM)] }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAllQrCodeRef, onResult: handleScanAllQrCode }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAddressQrCodeRef, onResult: handleScanAddressQrCode }), (0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { ref: backDropRef }), (0, jsx_runtime_1.jsx)(AppDialog_1.default, { overrideOpen: !!infoDialogContent, children: (0, jsx_runtime_1.jsx)(DialogContentLayout_1.default, { content: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
640
+ : Button_1.BUTTON_STATUS.ENABLED, children: "Continue" }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Recipient address", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: { wordBreak: "break-all" }, children: recipientAddress }) }), selectedMethod === SendMethods.TRANSFER_EXTERNAL && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Network", value: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6, ml: "auto" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20, src: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.icon }), (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)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
641
+ fontWeight: theme.typography.fontWeight600,
642
+ fontSize: theme.typography.fontSize16,
643
+ }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) }) }), !!memo &&
644
+ selectedMethod === SendMethods.TRANSFER_EXTERNAL && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Memo", value: memo })), ((_b = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _b === void 0 ? void 0 : _b.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { feesData: JSON.stringify(estimateFee), amount: +amount })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
645
+ fontWeight: theme.typography.fontWeight600,
646
+ fontSize: theme.typography.fontSize16,
647
+ }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) }) })] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.ActionConfirm.SEND, onConfirmSuccess: function () { return console.warn("confirm success"); }, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: Button_1.BUTTON_STATUS.ENABLED, sx: { width: "100%" }, children: "Confirm" }) })] }) })] }) }, WithdrawStep.FORM)] }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAllQrCodeRef, onResult: handleScanAllQrCode }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAddressQrCodeRef, onResult: handleScanAddressQrCode }), (0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { ref: backDropRef }), (0, jsx_runtime_1.jsx)(AppDialog_1.default, { overrideOpen: !!infoDialogContent, children: (0, jsx_runtime_1.jsx)(DialogContentLayout_1.default, { content: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
641
648
  textAlign: "center",
642
649
  display: "inline-block",
643
650
  width: "100%",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.404",
3
+ "version": "0.0.406",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",