tek-wallet 0.0.474 → 0.0.477
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/Activities/index.js +1 -1
- package/dist/components/ui/ActivityDetail/index.d.ts +7 -0
- package/dist/components/ui/ActivityDetail/index.js +72 -0
- package/dist/components/ui/ActivityItem/index.js +31 -8
- package/dist/components/ui/ConfirmByPasscode/index.d.ts +2 -2
- package/dist/components/ui/ConfirmLayout/index.d.ts +2 -2
- package/dist/components/ui/LockToken/index.js +3 -3
- package/dist/components/ui/ModalLayout/index.d.ts +2 -2
- package/dist/components/ui/SendExternalToken/index.js +5 -5
- package/dist/components/ui/SendInternalToken/index.js +5 -5
- package/dist/services/axios/get-config-tokens-list-service/index.d.ts +2 -2
- package/dist/services/axios/get-config-tokens-list-service/index.js +7 -7
- package/dist/services/axios/get-lock-tokens-list-service/index.js +1 -1
- package/dist/services/axios/get-receive-external-tokens-list-service/index.js +1 -1
- package/dist/services/axios/get-receive-external-tokens-list-service copy/index.js +1 -1
- package/dist/services/axios/get-receive-internal-tokens-list-service/index.js +1 -1
- package/dist/services/axios/get-receive-internal-tokens-list-service copy/index.js +1 -1
- package/dist/services/axios/get-withdraw-tokens-list-service/index.js +1 -1
- package/package.json +1 -1
- package/dist/components/ui/ConfirmLayout/type.d.ts +0 -4
- package/dist/components/ui/ConfirmLayout/type.js +0 -8
- package/dist/components/ui/SendExternalToken/type.d.ts +0 -4
- package/dist/components/ui/SendExternalToken/type.js +0 -2
- package/dist/components/ui/SendInternalToken/type.d.ts +0 -4
- package/dist/components/ui/SendInternalToken/type.js +0 -2
|
@@ -73,7 +73,7 @@ var Activities = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
73
73
|
close();
|
|
74
74
|
handleOnClose();
|
|
75
75
|
};
|
|
76
|
-
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { disableSwipe: true, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Activities", overrideBack: handleBack }), children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: { height: "100%" }, children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { swiperProps: {
|
|
76
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { disableSwipe: true, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Activities", overrideBack: handleBack }), children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: { height: "100%", paddingTop: 0 }, children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { swiperProps: {
|
|
77
77
|
slidesPerView: 1,
|
|
78
78
|
spaceBetween: 40,
|
|
79
79
|
}, tabs: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BoxProps } from "@mui/material";
|
|
2
|
+
import { Transaction } from "../../../services/axios/get-activities-service/type";
|
|
3
|
+
interface ActivityDetailProps extends BoxProps {
|
|
4
|
+
activityData: Transaction;
|
|
5
|
+
}
|
|
6
|
+
declare function ActivityDetail(props: ActivityDetailProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export default ActivityDetail;
|
|
@@ -0,0 +1,72 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
var material_1 = require("@mui/material");
|
|
19
|
+
var type_1 = require("../../../services/axios/get-activities-service/type");
|
|
20
|
+
var Icon_1 = __importDefault(require("../Icon"));
|
|
21
|
+
var react_1 = require("react");
|
|
22
|
+
var react_2 = require("react");
|
|
23
|
+
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
24
|
+
var Text_1 = __importDefault(require("../Text"));
|
|
25
|
+
var formatDate_1 = __importDefault(require("../../../utils/formatDate"));
|
|
26
|
+
var LineValue_1 = __importDefault(require("../LineValue"));
|
|
27
|
+
function ActivityDetail(props) {
|
|
28
|
+
var _a;
|
|
29
|
+
var theme = (0, material_1.useTheme)();
|
|
30
|
+
var activityData = props.activityData;
|
|
31
|
+
var status = activityData === null || activityData === void 0 ? void 0 : activityData.transaction_status;
|
|
32
|
+
var type = (0, react_2.useMemo)(function () {
|
|
33
|
+
return activityData === null || activityData === void 0 ? void 0 : activityData.transaction_type;
|
|
34
|
+
}, [activityData]);
|
|
35
|
+
var slug = (0, react_2.useMemo)(function () {
|
|
36
|
+
return type === null || type === void 0 ? void 0 : type.slug;
|
|
37
|
+
}, [type]);
|
|
38
|
+
var isIncrease = (0, react_2.useMemo)(function () {
|
|
39
|
+
return slug === type_1.TransactionSlug.Deposit;
|
|
40
|
+
}, [slug]);
|
|
41
|
+
var isReceive = (0, react_2.useMemo)(function () {
|
|
42
|
+
return slug === type_1.TransactionSlug.Receive || slug === type_1.TransactionSlug.Deposit;
|
|
43
|
+
}, [slug]);
|
|
44
|
+
var isSend = (0, react_2.useMemo)(function () {
|
|
45
|
+
return (slug === type_1.TransactionSlug.Send || slug === type_1.TransactionSlug.Withdrawn || slug === type_1.TransactionSlug.TransferInternal);
|
|
46
|
+
}, [slug]);
|
|
47
|
+
var getStatusColor = (0, react_1.useCallback)(function () {
|
|
48
|
+
switch (status) {
|
|
49
|
+
case type_1.TransactionStatus.Processing:
|
|
50
|
+
return theme.palette.text.loadingStatus;
|
|
51
|
+
case type_1.TransactionStatus.Success:
|
|
52
|
+
return theme.palette.text.successStatus;
|
|
53
|
+
case type_1.TransactionStatus.Failed:
|
|
54
|
+
return theme.palette.text.warningStatus;
|
|
55
|
+
default:
|
|
56
|
+
return theme.palette.text.primary;
|
|
57
|
+
}
|
|
58
|
+
}, [status, theme]);
|
|
59
|
+
var getAmountColor = (0, react_1.useCallback)(function () {
|
|
60
|
+
if (isIncrease)
|
|
61
|
+
return theme.palette.text.successStatus;
|
|
62
|
+
return theme.palette.text.white;
|
|
63
|
+
}, [isIncrease, theme]);
|
|
64
|
+
if (!activityData)
|
|
65
|
+
return null;
|
|
66
|
+
return ((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)(Icon_1.default, { src: (_a = activityData.transaction_type) === null || _a === void 0 ? void 0 : _a.link, width: 64 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { width: "fit-content", gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeightBold, color: getAmountColor() }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { start: isIncrease ? "+" : "-", value: activityData.amount, unit: activityData.currency_slug }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: (0, formatDate_1.default)(activityData.date_created) }), status !== type_1.TransactionStatus.Success && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4 }), children: [status === type_1.TransactionStatus.Processing && (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { color: "secondary", size: 16 }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
67
|
+
fontSize: theme.typography.fontSize12,
|
|
68
|
+
textTransform: "capitalize",
|
|
69
|
+
color: getStatusColor(),
|
|
70
|
+
}, children: status })] }))] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.paper), { p: theme.mixins.gaps.g12 }), children: [isReceive && (0, jsx_runtime_1.jsx)(LineValue_1.default, { sx: { flexWrap: "wrap" }, field: "From", value: activityData === null || activityData === void 0 ? void 0 : activityData.from_address }), isSend && (0, jsx_runtime_1.jsx)(LineValue_1.default, { sx: { flexWrap: "wrap" }, field: "To", value: activityData === null || activityData === void 0 ? void 0 : activityData.to_address })] })] }));
|
|
71
|
+
}
|
|
72
|
+
exports.default = ActivityDetail;
|
|
@@ -35,9 +35,14 @@ var Text_1 = __importDefault(require("../Text"));
|
|
|
35
35
|
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
36
36
|
var formatDate_1 = __importDefault(require("../../../utils/formatDate"));
|
|
37
37
|
var compactWalletAddress_1 = __importDefault(require("../../../utils/compactWalletAddress"));
|
|
38
|
+
var DrawerComponent_1 = __importDefault(require("../DrawerComponent"));
|
|
39
|
+
var ActivityDetail_1 = __importDefault(require("../ActivityDetail"));
|
|
40
|
+
var ModalLayout_1 = __importDefault(require("../ModalLayout"));
|
|
38
41
|
function ActivityItem(props) {
|
|
39
42
|
var sx = props.sx, data = props.data, rest = __rest(props, ["sx", "data"]);
|
|
40
43
|
var theme = (0, material_1.useTheme)();
|
|
44
|
+
var detailDrawerRef = (0, react_1.useRef)(null);
|
|
45
|
+
var _a = (0, react_1.useState)(false), isOpenDetail = _a[0], setIsOpenDetail = _a[1];
|
|
41
46
|
var activityData = (0, react_1.useMemo)(function () {
|
|
42
47
|
if (!data)
|
|
43
48
|
return undefined;
|
|
@@ -64,6 +69,24 @@ function ActivityItem(props) {
|
|
|
64
69
|
}
|
|
65
70
|
return null;
|
|
66
71
|
}, [slug, activityData === null || activityData === void 0 ? void 0 : activityData.from_address, activityData === null || activityData === void 0 ? void 0 : activityData.to_address]);
|
|
72
|
+
var openDetail = (0, react_1.useCallback)(function () {
|
|
73
|
+
var _a;
|
|
74
|
+
(_a = detailDrawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
75
|
+
setIsOpenDetail(true);
|
|
76
|
+
}, []);
|
|
77
|
+
var closeDetail = (0, react_1.useCallback)(function (e) {
|
|
78
|
+
var _a;
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
(_a = detailDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
81
|
+
setTimeout(function () {
|
|
82
|
+
setIsOpenDetail(false);
|
|
83
|
+
}, 800);
|
|
84
|
+
}, []);
|
|
85
|
+
var onCloseDetail = (0, react_1.useCallback)(function () {
|
|
86
|
+
setTimeout(function () {
|
|
87
|
+
setIsOpenDetail(false);
|
|
88
|
+
}, 800);
|
|
89
|
+
}, []);
|
|
67
90
|
var getStatusColor = (0, react_1.useCallback)(function () {
|
|
68
91
|
switch (status) {
|
|
69
92
|
case type_1.TransactionStatus.Processing:
|
|
@@ -83,13 +106,13 @@ function ActivityItem(props) {
|
|
|
83
106
|
}, [isIncrease, theme]);
|
|
84
107
|
if (!activityData)
|
|
85
108
|
return null;
|
|
86
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.ListItemButton, __assign({ sx: __assign(__assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, backgroundColor: theme.palette.background.white16, borderRadius: theme.mixins.customRadius.r16, p: theme.mixins.customPadding.p12, flexGrow: "unset", boxShadow: theme.shadows[1] }), sx) }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.ListItemButton, __assign({ onClick: openDetail, sx: __assign(__assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, backgroundColor: theme.palette.background.white16, borderRadius: theme.mixins.customRadius.r16, p: theme.mixins.customPadding.p12, flexGrow: "unset", boxShadow: theme.shadows[1] }), sx) }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
110
|
+
width: "fit-content",
|
|
111
|
+
height: "fit-content",
|
|
112
|
+
}, children: (0, jsx_runtime_1.jsx)(Icon_1.default, { src: type === null || type === void 0 ? void 0 : type.link, width: 24 }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { width: "fit-content" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.activityTitle, children: type === null || type === void 0 ? void 0 : type.name }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.activityDescription, children: descriptionElement }), status !== type_1.TransactionStatus.Success && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4 }), children: [status === type_1.TransactionStatus.Processing && (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { color: "secondary", size: 16 }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
113
|
+
fontSize: theme.typography.fontSize12,
|
|
114
|
+
textTransform: "capitalize",
|
|
115
|
+
color: getStatusColor(),
|
|
116
|
+
}, children: status })] }))] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { width: "fit-content", alignItems: "flex-end", ml: "auto" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeightBold, color: getAmountColor(), textAlign: "right" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { start: isIncrease ? "+" : "-", value: activityData.amount, unit: activityData.currency_slug }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { textAlign: "right" }), children: (0, formatDate_1.default)(activityData.date_created) })] })] })), (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: detailDrawerRef, onClose: onCloseDetail, children: isOpenDetail && ((0, jsx_runtime_1.jsx)(ModalLayout_1.default, { onClose: closeDetail, title: "Detail", children: (0, jsx_runtime_1.jsx)(ActivityDetail_1.default, { activityData: activityData }) })) })] }));
|
|
94
117
|
}
|
|
95
118
|
exports.default = ActivityItem;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GeneralProps } from "../../../types/ui";
|
|
2
|
-
import { ActionConfirm } from "../ConfirmLayout/type";
|
|
3
2
|
import { DrawerComponentProps, DrawerComponentRef } from "../DrawerComponent";
|
|
3
|
+
import { TransactionSlug } from "../../../services/axios/get-activities-service/type";
|
|
4
4
|
interface ConfirmByPasscodeProps extends Omit<GeneralProps, "onclick" | "sx" | "onClick">, DrawerComponentProps {
|
|
5
5
|
onConfirmSuccess?: (passcode: string) => any;
|
|
6
|
-
action:
|
|
6
|
+
action: TransactionSlug;
|
|
7
7
|
}
|
|
8
8
|
export interface ConfirmByPasscodeRef extends Omit<DrawerComponentRef, "trigger"> {
|
|
9
9
|
clearData: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DrawerComponentProps, DrawerComponentRef } from "../DrawerComponent";
|
|
2
|
-
import {
|
|
2
|
+
import { TransactionSlug } from "../../../services/axios/get-activities-service/type";
|
|
3
3
|
export interface ConfirmLayoutProps extends DrawerComponentProps {
|
|
4
|
-
action:
|
|
4
|
+
action: TransactionSlug;
|
|
5
5
|
}
|
|
6
6
|
declare const ConfirmLayout: import("react").ForwardRefExoticComponent<Omit<ConfirmLayoutProps, "ref"> & import("react").RefAttributes<DrawerComponentRef>>;
|
|
7
7
|
export default ConfirmLayout;
|
|
@@ -89,7 +89,6 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
89
89
|
var material_1 = require("@mui/material");
|
|
90
90
|
var Button_1 = __importStar(require("../../ui/Button"));
|
|
91
91
|
var ConfirmLayout_1 = __importDefault(require("../ConfirmLayout"));
|
|
92
|
-
var type_1 = require("../ConfirmLayout/type");
|
|
93
92
|
var LineValue_1 = __importDefault(require("../LineValue"));
|
|
94
93
|
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
95
94
|
var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
|
|
@@ -99,6 +98,7 @@ var Text_1 = __importDefault(require("../Text"));
|
|
|
99
98
|
var RequireConnect_1 = __importDefault(require("../RequireConnect"));
|
|
100
99
|
var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
|
|
101
100
|
var lock_token_service_1 = __importDefault(require("../../../services/axios/lock-token-service"));
|
|
101
|
+
var type_1 = require("../../../services/axios/get-activities-service/type");
|
|
102
102
|
var LockTokenError;
|
|
103
103
|
(function (LockTokenError) {
|
|
104
104
|
LockTokenError["TOKEN_NOT_FOUND"] = "Token not found";
|
|
@@ -191,10 +191,10 @@ var LockToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
191
191
|
(0, react_1.useEffect)(function () {
|
|
192
192
|
validateAmount(props.lockData);
|
|
193
193
|
}, [validateAmount]);
|
|
194
|
-
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: type_1.
|
|
194
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: type_1.TransactionSlug.LockedBalances, 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: {
|
|
195
195
|
fontWeight: theme.typography.fontWeight600,
|
|
196
196
|
color: theme.palette.text.secondary,
|
|
197
|
-
}, 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.
|
|
197
|
+
}, 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.TransactionSlug.LockedBalances, 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" }) })] }) }) }));
|
|
198
198
|
});
|
|
199
199
|
LockToken.displayName = "LockToken";
|
|
200
200
|
exports.default = LockToken;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GeneralProps } from "../../../types/ui";
|
|
2
|
-
import { ReactNode } from "react";
|
|
2
|
+
import { ReactEventHandler, ReactNode } from "react";
|
|
3
3
|
interface ModalLayoutProps extends GeneralProps {
|
|
4
4
|
title?: ReactNode;
|
|
5
|
-
onClose?:
|
|
5
|
+
onClose?: ReactEventHandler;
|
|
6
6
|
hideHeader?: boolean;
|
|
7
7
|
overrideHeader?: ReactNode;
|
|
8
8
|
}
|
|
@@ -89,7 +89,6 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
89
89
|
var material_1 = require("@mui/material");
|
|
90
90
|
var Button_1 = __importStar(require("../../ui/Button"));
|
|
91
91
|
var ConfirmLayout_1 = __importDefault(require("../ConfirmLayout"));
|
|
92
|
-
var type_1 = require("../ConfirmLayout/type");
|
|
93
92
|
var LineValue_1 = __importDefault(require("../LineValue"));
|
|
94
93
|
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
95
94
|
var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
|
|
@@ -102,7 +101,7 @@ var send_external_service_1 = __importDefault(require("../../../services/axios/s
|
|
|
102
101
|
var Icon_1 = __importDefault(require("../Icon"));
|
|
103
102
|
var Fees_1 = __importDefault(require("../Fees"));
|
|
104
103
|
var get_est_fee_service_1 = __importDefault(require("../../../services/axios/get-est-fee-service"));
|
|
105
|
-
var
|
|
104
|
+
var type_1 = require("../../../services/axios/get-activities-service/type");
|
|
106
105
|
var SendExternalTokenError;
|
|
107
106
|
(function (SendExternalTokenError) {
|
|
108
107
|
SendExternalTokenError["TOKEN_NOT_FOUND"] = "Token not found";
|
|
@@ -111,6 +110,7 @@ var SendExternalTokenError;
|
|
|
111
110
|
SendExternalTokenError["MIN_AMOUNT"] = "Min amount";
|
|
112
111
|
SendExternalTokenError["FAILED"] = "Failed";
|
|
113
112
|
})(SendExternalTokenError || (exports.SendExternalTokenError = SendExternalTokenError = {}));
|
|
113
|
+
var transactionSlug = type_1.TransactionSlug.Withdrawn;
|
|
114
114
|
var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
115
115
|
var _a;
|
|
116
116
|
var theme = (0, material_1.useTheme)();
|
|
@@ -138,7 +138,7 @@ var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
138
138
|
setIsLoadingEstimateFee(true);
|
|
139
139
|
return [4 /*yield*/, (0, get_est_fee_service_1.default)({
|
|
140
140
|
amount: "".concat(amount),
|
|
141
|
-
transaction_type:
|
|
141
|
+
transaction_type: transactionSlug,
|
|
142
142
|
currency: tokenSlug || "",
|
|
143
143
|
})];
|
|
144
144
|
case 1:
|
|
@@ -233,12 +233,12 @@ var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
233
233
|
(0, react_1.useEffect)(function () {
|
|
234
234
|
validateAmount(props.sendExternalData);
|
|
235
235
|
}, [validateAmount, props.sendExternalData]);
|
|
236
|
-
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action:
|
|
236
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: transactionSlug, 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.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: {
|
|
237
237
|
wordBreak: "break-all",
|
|
238
238
|
}, children: toAddress }) }), (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: network === null || network === void 0 ? void 0 : network.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: network === null || network === void 0 ? void 0 : network.name })] }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), !!memo && (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Memo", value: memo }), ((_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 })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
239
239
|
fontWeight: theme.typography.fontWeight600,
|
|
240
240
|
fontSize: theme.typography.fontSize16,
|
|
241
|
-
}, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, 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:
|
|
241
|
+
}, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, 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: transactionSlug, onConfirmSuccess: handleSendExternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
|
|
242
242
|
});
|
|
243
243
|
SendExternalToken.displayName = "SendExternalToken";
|
|
244
244
|
exports.default = SendExternalToken;
|
|
@@ -89,7 +89,6 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
89
89
|
var material_1 = require("@mui/material");
|
|
90
90
|
var Button_1 = __importStar(require("../../ui/Button"));
|
|
91
91
|
var ConfirmLayout_1 = __importDefault(require("../ConfirmLayout"));
|
|
92
|
-
var type_1 = require("../ConfirmLayout/type");
|
|
93
92
|
var LineValue_1 = __importDefault(require("../LineValue"));
|
|
94
93
|
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
95
94
|
var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
|
|
@@ -100,7 +99,7 @@ var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
|
|
|
100
99
|
var useWithdrawData_1 = __importDefault(require("../../../hooks/useWithdrawData"));
|
|
101
100
|
var Fees_1 = __importDefault(require("../Fees"));
|
|
102
101
|
var get_est_fee_service_1 = __importDefault(require("../../../services/axios/get-est-fee-service"));
|
|
103
|
-
var
|
|
102
|
+
var type_1 = require("../../../services/axios/get-activities-service/type");
|
|
104
103
|
var send_internal_service_1 = __importDefault(require("../../../services/axios/send-internal-service"));
|
|
105
104
|
var SendInternalTokenError;
|
|
106
105
|
(function (SendInternalTokenError) {
|
|
@@ -110,6 +109,7 @@ var SendInternalTokenError;
|
|
|
110
109
|
SendInternalTokenError["MIN_AMOUNT"] = "Min amount";
|
|
111
110
|
SendInternalTokenError["FAILED"] = "Failed";
|
|
112
111
|
})(SendInternalTokenError || (exports.SendInternalTokenError = SendInternalTokenError = {}));
|
|
112
|
+
var transactionSlug = type_1.TransactionSlug.TransferInternal;
|
|
113
113
|
var SendInternalToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
114
114
|
var _a;
|
|
115
115
|
var theme = (0, material_1.useTheme)();
|
|
@@ -135,7 +135,7 @@ var SendInternalToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
135
135
|
setIsLoadingEstimateFee(true);
|
|
136
136
|
return [4 /*yield*/, (0, get_est_fee_service_1.default)({
|
|
137
137
|
amount: "".concat(amount),
|
|
138
|
-
transaction_type:
|
|
138
|
+
transaction_type: transactionSlug,
|
|
139
139
|
currency: tokenSlug || "",
|
|
140
140
|
})];
|
|
141
141
|
case 1:
|
|
@@ -230,12 +230,12 @@ var SendInternalToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
230
230
|
(0, react_1.useEffect)(function () {
|
|
231
231
|
validateAmount(props.sendInternalData);
|
|
232
232
|
}, [validateAmount, props.sendInternalData]);
|
|
233
|
-
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action:
|
|
233
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: transactionSlug, 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.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: {
|
|
234
234
|
wordBreak: "break-all",
|
|
235
235
|
}, children: toAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), ((_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 })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
236
236
|
fontWeight: theme.typography.fontWeight600,
|
|
237
237
|
fontSize: theme.typography.fontSize16,
|
|
238
|
-
}, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, 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:
|
|
238
|
+
}, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, 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: transactionSlug, onConfirmSuccess: handleSendInternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
|
|
239
239
|
});
|
|
240
240
|
SendInternalToken.displayName = "SendInternalToken";
|
|
241
241
|
exports.default = SendInternalToken;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare enum
|
|
1
|
+
export declare enum TransactionListType {
|
|
2
2
|
DEPOSIT = "deposit",
|
|
3
3
|
WITHDRAWN = "withdrawn",
|
|
4
4
|
TRANSFER_INTERNAL = "transfer-internal"
|
|
@@ -6,7 +6,7 @@ export declare enum TransactionType {
|
|
|
6
6
|
export interface GetConfigTokenListQuery {
|
|
7
7
|
page?: number;
|
|
8
8
|
take?: number;
|
|
9
|
-
transactionType:
|
|
9
|
+
transactionType: TransactionListType;
|
|
10
10
|
}
|
|
11
11
|
declare const getConfigTokenList: <T>(query?: GetConfigTokenListQuery) => Promise<T>;
|
|
12
12
|
export default getConfigTokenList;
|
|
@@ -39,14 +39,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.
|
|
42
|
+
exports.TransactionListType = void 0;
|
|
43
43
|
var userClientRequest_1 = __importDefault(require("../clients/userClientRequest"));
|
|
44
|
-
var
|
|
45
|
-
(function (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})(
|
|
44
|
+
var TransactionListType;
|
|
45
|
+
(function (TransactionListType) {
|
|
46
|
+
TransactionListType["DEPOSIT"] = "deposit";
|
|
47
|
+
TransactionListType["WITHDRAWN"] = "withdrawn";
|
|
48
|
+
TransactionListType["TRANSFER_INTERNAL"] = "transfer-internal";
|
|
49
|
+
})(TransactionListType || (exports.TransactionListType = TransactionListType = {}));
|
|
50
50
|
var getConfigTokenList = function (query) { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
51
|
var response;
|
|
52
52
|
return __generator(this, function (_a) {
|
|
@@ -86,7 +86,7 @@ var getLockTokenList = function (query) { return __awaiter(void 0, void 0, void
|
|
|
86
86
|
return __generator(this, function (_a) {
|
|
87
87
|
switch (_a.label) {
|
|
88
88
|
case 0:
|
|
89
|
-
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.
|
|
89
|
+
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.TransactionListType.WITHDRAWN });
|
|
90
90
|
return [4 /*yield*/, (0, get_config_tokens_list_service_1.default)(params)];
|
|
91
91
|
case 1:
|
|
92
92
|
response = _a.sent();
|
|
@@ -86,7 +86,7 @@ var getReceiveExternalTokenList = function (query) { return __awaiter(void 0, vo
|
|
|
86
86
|
return __generator(this, function (_a) {
|
|
87
87
|
switch (_a.label) {
|
|
88
88
|
case 0:
|
|
89
|
-
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.
|
|
89
|
+
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.TransactionListType.DEPOSIT });
|
|
90
90
|
return [4 /*yield*/, (0, get_config_tokens_list_service_1.default)(params)];
|
|
91
91
|
case 1:
|
|
92
92
|
response = _a.sent();
|
|
@@ -86,7 +86,7 @@ var getReceiveExternalTokenList = function (query) { return __awaiter(void 0, vo
|
|
|
86
86
|
return __generator(this, function (_a) {
|
|
87
87
|
switch (_a.label) {
|
|
88
88
|
case 0:
|
|
89
|
-
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.
|
|
89
|
+
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.TransactionListType.DEPOSIT });
|
|
90
90
|
return [4 /*yield*/, (0, get_config_tokens_list_service_1.default)(params)];
|
|
91
91
|
case 1:
|
|
92
92
|
response = _a.sent();
|
|
@@ -86,7 +86,7 @@ var getReceiveInternalTokenList = function (query) { return __awaiter(void 0, vo
|
|
|
86
86
|
return __generator(this, function (_a) {
|
|
87
87
|
switch (_a.label) {
|
|
88
88
|
case 0:
|
|
89
|
-
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.
|
|
89
|
+
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.TransactionListType.TRANSFER_INTERNAL });
|
|
90
90
|
return [4 /*yield*/, (0, get_config_tokens_list_service_1.default)(params)];
|
|
91
91
|
case 1:
|
|
92
92
|
response = _a.sent();
|
|
@@ -86,7 +86,7 @@ var getReceiveExternalTokenList = function (query) { return __awaiter(void 0, vo
|
|
|
86
86
|
return __generator(this, function (_a) {
|
|
87
87
|
switch (_a.label) {
|
|
88
88
|
case 0:
|
|
89
|
-
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.
|
|
89
|
+
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.TransactionListType.DEPOSIT });
|
|
90
90
|
return [4 /*yield*/, (0, get_config_tokens_list_service_1.default)(params)];
|
|
91
91
|
case 1:
|
|
92
92
|
response = _a.sent();
|
|
@@ -86,7 +86,7 @@ var getWithdrawTokenList = function (query) { return __awaiter(void 0, void 0, v
|
|
|
86
86
|
return __generator(this, function (_a) {
|
|
87
87
|
switch (_a.label) {
|
|
88
88
|
case 0:
|
|
89
|
-
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.
|
|
89
|
+
params = __assign(__assign({}, query), { transactionType: get_config_tokens_list_service_1.TransactionListType.WITHDRAWN });
|
|
90
90
|
return [4 /*yield*/, (0, get_config_tokens_list_service_1.default)(params)];
|
|
91
91
|
case 1:
|
|
92
92
|
response = _a.sent();
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActionConfirm = void 0;
|
|
4
|
-
var ActionConfirm;
|
|
5
|
-
(function (ActionConfirm) {
|
|
6
|
-
ActionConfirm["SEND"] = "send";
|
|
7
|
-
ActionConfirm["LOCK"] = "lock token";
|
|
8
|
-
})(ActionConfirm || (exports.ActionConfirm = ActionConfirm = {}));
|