tek-wallet 0.0.407 → 0.0.409
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.
- package/dist/components/ui/Button/index.d.ts +1 -0
- package/dist/components/ui/Button/index.js +1 -0
- package/dist/components/ui/LineValue/index.js +1 -1
- package/dist/components/ui/LockToken/index.js +5 -5
- package/dist/components/ui/WithdrawFunction/index.d.ts +1 -0
- package/dist/components/ui/WithdrawFunction/index.js +20 -10
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ var material_1 = require("@mui/material");
|
|
|
29
29
|
var BUTTON_STATUS;
|
|
30
30
|
(function (BUTTON_STATUS) {
|
|
31
31
|
BUTTON_STATUS["LOADING"] = "loading";
|
|
32
|
+
BUTTON_STATUS["ERROR"] = "error";
|
|
32
33
|
BUTTON_STATUS["DISABLED"] = "disabled";
|
|
33
34
|
BUTTON_STATUS["ENABLED"] = "enabled";
|
|
34
35
|
})(BUTTON_STATUS || (exports.BUTTON_STATUS = BUTTON_STATUS = {}));
|
|
@@ -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.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 }))] }))] }));
|
|
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(__assign({}, theme.mixins.value), { textAlign: "right" }), children: value })), !!valueDescription && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { textAlign: "right" }), children: valueDescription }))] }))] }));
|
|
25
25
|
};
|
|
26
26
|
exports.default = LineValue;
|
|
@@ -112,7 +112,7 @@ var LockToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
112
112
|
var theme = (0, material_1.useTheme)();
|
|
113
113
|
var lockTokens = (0, useLockTokenData_1.default)().lockTokens;
|
|
114
114
|
var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
|
|
115
|
-
var
|
|
115
|
+
var confirmLayoutDrawerRef = (0, react_1.useRef)(null);
|
|
116
116
|
var _c = (0, react_1.useState)(undefined), token = _c[0], setToken = _c[1];
|
|
117
117
|
var _d = (0, react_1.useState)(undefined), error = _d[0], setError = _d[1];
|
|
118
118
|
var _e = (0, react_1.useState)(undefined), errorAmount = _e[0], setErrorAmount = _e[1];
|
|
@@ -164,7 +164,7 @@ var LockToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
164
164
|
response = _c.sent();
|
|
165
165
|
console.warn("🚀 ~ handleLockToken ~ response:", response);
|
|
166
166
|
if (response.success) {
|
|
167
|
-
(_a =
|
|
167
|
+
(_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
168
168
|
(_b = props.onLockSuccess) === null || _b === void 0 ? void 0 : _b.call(props, response);
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
@@ -179,13 +179,13 @@ var LockToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
179
179
|
var _a;
|
|
180
180
|
if (!isAuthenticated)
|
|
181
181
|
throw new Error("Please connect your wallet");
|
|
182
|
-
(_a =
|
|
182
|
+
(_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
183
183
|
};
|
|
184
184
|
var handleClose = function () {
|
|
185
185
|
var _a;
|
|
186
186
|
if (!isAuthenticated)
|
|
187
187
|
throw new Error("Please connect your wallet");
|
|
188
|
-
(_a =
|
|
188
|
+
(_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
189
189
|
};
|
|
190
190
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
191
191
|
open: handleOpen,
|
|
@@ -194,7 +194,7 @@ var LockToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
194
194
|
(0, react_1.useEffect)(function () {
|
|
195
195
|
validateAmount(props.lockData);
|
|
196
196
|
}, [validateAmount]);
|
|
197
|
-
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref:
|
|
197
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: type_1.ActionConfirm.LOCK, trigger: props.children, 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: 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.value), children: ["Your balance is", " ", (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
198
198
|
fontWeight: theme.typography.fontWeight600,
|
|
199
199
|
color: theme.palette.text.secondary,
|
|
200
200
|
}, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: token === null || token === void 0 ? void 0 : token.balance, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) })] }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.gaps.g6 }), children: [error, " ", !!errorAmount && ((0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(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" }) })] }) }) }));
|
|
@@ -152,6 +152,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
152
152
|
var _a, _b;
|
|
153
153
|
var drawerRef = (0, react_1.useRef)(null);
|
|
154
154
|
var swiperRef = (0, react_1.useRef)(null);
|
|
155
|
+
var confirmLayoutDrawerRef = (0, react_1.useRef)(null);
|
|
155
156
|
var theme = (0, material_1.useTheme)();
|
|
156
157
|
var _c = (0, react_1.useState)(WithdrawStep.SELECT_METHOD), currentStep = _c[0], setCurrentStep = _c[1];
|
|
157
158
|
var _d = (0, react_1.useState)(), selectedToken = _d[0], setSelectedToken = _d[1];
|
|
@@ -550,8 +551,9 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
550
551
|
}); };
|
|
551
552
|
var handleSendExternal = function (passcode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
552
553
|
var response;
|
|
553
|
-
|
|
554
|
-
|
|
554
|
+
var _a, _b;
|
|
555
|
+
return __generator(this, function (_c) {
|
|
556
|
+
switch (_c.label) {
|
|
555
557
|
case 0:
|
|
556
558
|
console.warn("withdraw external");
|
|
557
559
|
setSendButtonStatus(Button_1.BUTTON_STATUS.LOADING);
|
|
@@ -564,9 +566,19 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
564
566
|
memo: memo || "",
|
|
565
567
|
})];
|
|
566
568
|
case 1:
|
|
567
|
-
response =
|
|
569
|
+
response = _c.sent();
|
|
568
570
|
console.warn("🚀 ~ handleSendExternal ~ response:", response);
|
|
569
|
-
|
|
571
|
+
if (response.success) {
|
|
572
|
+
close();
|
|
573
|
+
(_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
574
|
+
(_b = props.onSendSuccess) === null || _b === void 0 ? void 0 : _b.call(props, response);
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
setSendButtonStatus(Button_1.BUTTON_STATUS.ERROR);
|
|
578
|
+
setTimeout(function () {
|
|
579
|
+
setSendButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
|
|
580
|
+
}, 1200);
|
|
581
|
+
}
|
|
570
582
|
return [2 /*return*/];
|
|
571
583
|
}
|
|
572
584
|
});
|
|
@@ -644,11 +656,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
644
656
|
placeholder: "Enter memo",
|
|
645
657
|
value: memo,
|
|
646
658
|
onChange: handleChangeMemo,
|
|
647
|
-
} })] })), ((_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
|
|
648
|
-
// ref={confirmByPasscodeDrawerRef}
|
|
649
|
-
, {
|
|
650
|
-
// ref={confirmByPasscodeDrawerRef}
|
|
651
|
-
action: type_1.ActionConfirm.SEND, trigger: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, status: !!amountError ||
|
|
659
|
+
} })] })), ((_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, { ref: confirmLayoutDrawerRef, action: type_1.ActionConfirm.SEND, trigger: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, status: !!amountError ||
|
|
652
660
|
!!recipientAddressError ||
|
|
653
661
|
!recipientAddress ||
|
|
654
662
|
!amount ||
|
|
@@ -656,7 +664,9 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
656
664
|
isLoadingEstimateFee ||
|
|
657
665
|
isValidatingAddress
|
|
658
666
|
? Button_1.BUTTON_STATUS.DISABLED
|
|
659
|
-
: 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: {
|
|
667
|
+
: 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: {
|
|
668
|
+
wordBreak: "break-all",
|
|
669
|
+
}, 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)(Formatter_1.default, { value: amount, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) }), !!memo &&
|
|
660
670
|
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: {
|
|
661
671
|
fontWeight: theme.typography.fontWeight600,
|
|
662
672
|
fontSize: theme.typography.fontSize16,
|