tek-wallet 0.0.463 → 0.0.465
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/ActivityItem/index.js +12 -7
- package/dist/components/ui/SendExternalToken/index.js +5 -4
- package/dist/components/ui/WithdrawFunction/index.js +29 -8
- package/dist/hooks/useEventHandler.js +1 -1
- package/dist/providers/ActivitiesProvider/const.d.ts +2 -5
- package/dist/providers/ActivitiesProvider/const.js +6 -0
- package/dist/services/axios/get-activities-service/type.d.ts +12 -7
- package/dist/services/axios/get-activities-service/type.js +20 -0
- package/package.json +1 -1
|
@@ -43,22 +43,27 @@ function ActivityItem(props) {
|
|
|
43
43
|
return undefined;
|
|
44
44
|
return (0, parsePropsData_1.default)(data);
|
|
45
45
|
}, [data]);
|
|
46
|
-
var type = activityData === null || activityData === void 0 ? void 0 : activityData.transaction_type;
|
|
47
46
|
var status = activityData === null || activityData === void 0 ? void 0 : activityData.transaction_status;
|
|
48
|
-
var
|
|
49
|
-
return
|
|
47
|
+
var type = (0, react_1.useMemo)(function () {
|
|
48
|
+
return activityData === null || activityData === void 0 ? void 0 : activityData.transaction_type;
|
|
49
|
+
}, [activityData]);
|
|
50
|
+
var slug = (0, react_1.useMemo)(function () {
|
|
51
|
+
return type === null || type === void 0 ? void 0 : type.slug;
|
|
50
52
|
}, [type]);
|
|
53
|
+
var isIncrease = (0, react_1.useMemo)(function () {
|
|
54
|
+
return slug === type_1.TransactionSlug.Deposit;
|
|
55
|
+
}, [slug]);
|
|
51
56
|
var descriptionElement = (0, react_1.useMemo)(function () {
|
|
52
|
-
var isReceive =
|
|
57
|
+
var isReceive = slug === type_1.TransactionSlug.Receive || slug === type_1.TransactionSlug.Deposit;
|
|
53
58
|
if (isReceive) {
|
|
54
59
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["From: ", (0, compactWalletAddress_1.default)(activityData === null || activityData === void 0 ? void 0 : activityData.from_address)] });
|
|
55
60
|
}
|
|
56
|
-
var isSend =
|
|
61
|
+
var isSend = slug === type_1.TransactionSlug.Send || slug === type_1.TransactionSlug.Withdrawn;
|
|
57
62
|
if (isSend) {
|
|
58
63
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["To: ", (0, compactWalletAddress_1.default)(activityData === null || activityData === void 0 ? void 0 : activityData.to_address)] });
|
|
59
64
|
}
|
|
60
65
|
return null;
|
|
61
|
-
}, [
|
|
66
|
+
}, [slug, activityData === null || activityData === void 0 ? void 0 : activityData.from_address, activityData === null || activityData === void 0 ? void 0 : activityData.to_address]);
|
|
62
67
|
var getStatusColor = (0, react_1.useCallback)(function () {
|
|
63
68
|
switch (status) {
|
|
64
69
|
case type_1.TransactionStatus.Processing:
|
|
@@ -81,7 +86,7 @@ function ActivityItem(props) {
|
|
|
81
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: {
|
|
82
87
|
width: "fit-content",
|
|
83
88
|
height: "fit-content",
|
|
84
|
-
}, children: (0, jsx_runtime_1.jsx)(Icon_1.default, { src:
|
|
89
|
+
}, 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: {
|
|
85
90
|
fontSize: theme.typography.fontSize12,
|
|
86
91
|
textTransform: "capitalize",
|
|
87
92
|
color: getStatusColor(),
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
// import Icon from "../Icon";
|
|
20
20
|
// import Fees from "../Fees";
|
|
21
21
|
// import { FeesDataType } from "../../../services/axios/get-est-fee-service/type";
|
|
22
|
+
// import { NetworkData } from "../../../services/axios/type";
|
|
22
23
|
// interface SendExternalTokenProps extends Omit<ConfirmLayoutProps, "action"> {
|
|
23
|
-
// sendExternalData: SendExternalBody;
|
|
24
|
+
// sendExternalData: Omit<SendExternalBody, "network"> & { network: NetworkData };
|
|
24
25
|
// onSuccess?: (data: SendExternalResponse) => any;
|
|
25
26
|
// }
|
|
26
27
|
// export interface SendExternalTokenRef {
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
// try {
|
|
82
83
|
// console.warn("🚀 ~ handleSendExternalToken ~ sendExternalData:", props.sendExternalData, passcode);
|
|
83
84
|
// setButtonStatus(BUTTON_STATUS.LOADING);
|
|
84
|
-
// const response = await sendExternalService(props.sendExternalData);
|
|
85
|
+
// const response = await sendExternalService({ ...props.sendExternalData, network: network?.slug });
|
|
85
86
|
// console.warn("🚀 ~ handleSendExternalToken ~ response:", response);
|
|
86
87
|
// if (response.success) {
|
|
87
88
|
// confirmLayoutDrawerRef.current?.close();
|
|
@@ -144,8 +145,8 @@
|
|
|
144
145
|
// ml: "auto",
|
|
145
146
|
// }}
|
|
146
147
|
// >
|
|
147
|
-
//
|
|
148
|
-
// <Text sx={{ ...theme.mixins.value }}>{
|
|
148
|
+
// <Icon width={20} src={network?.icon} />
|
|
149
|
+
// <Text sx={{ ...theme.mixins.value }}>{network?.name}</Text>
|
|
149
150
|
// </Box>
|
|
150
151
|
// }
|
|
151
152
|
// />
|
|
@@ -522,11 +522,14 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
522
522
|
});
|
|
523
523
|
}); };
|
|
524
524
|
var handleSendInternal = function (passcode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
525
|
-
var response;
|
|
526
|
-
|
|
527
|
-
|
|
525
|
+
var response, err_1;
|
|
526
|
+
var _a, _b;
|
|
527
|
+
return __generator(this, function (_c) {
|
|
528
|
+
switch (_c.label) {
|
|
528
529
|
case 0:
|
|
530
|
+
_c.trys.push([0, 2, , 3]);
|
|
529
531
|
console.warn("withdraw internal");
|
|
532
|
+
setSendButtonStatus(Button_1.BUTTON_STATUS.LOADING);
|
|
530
533
|
return [4 /*yield*/, (0, send_internal_service_1.default)({
|
|
531
534
|
amount: "".concat(amount),
|
|
532
535
|
to_address: recipientAddress || "",
|
|
@@ -534,14 +537,32 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
534
537
|
passcode: passcode,
|
|
535
538
|
})];
|
|
536
539
|
case 1:
|
|
537
|
-
response =
|
|
540
|
+
response = _c.sent();
|
|
538
541
|
console.warn("🚀 ~ handleSendInternal ~ response:", response);
|
|
539
|
-
|
|
542
|
+
if (response.success) {
|
|
543
|
+
close();
|
|
544
|
+
(_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
545
|
+
setSendButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
|
|
546
|
+
(_b = props.onSendSuccess) === null || _b === void 0 ? void 0 : _b.call(props, response);
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
throw new Error("Send internal failed");
|
|
550
|
+
}
|
|
551
|
+
return [3 /*break*/, 3];
|
|
552
|
+
case 2:
|
|
553
|
+
err_1 = _c.sent();
|
|
554
|
+
console.error(err_1);
|
|
555
|
+
setSendButtonStatus(Button_1.BUTTON_STATUS.ERROR);
|
|
556
|
+
setTimeout(function () {
|
|
557
|
+
setSendButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
|
|
558
|
+
}, 1200);
|
|
559
|
+
return [3 /*break*/, 3];
|
|
560
|
+
case 3: return [2 /*return*/];
|
|
540
561
|
}
|
|
541
562
|
});
|
|
542
563
|
}); };
|
|
543
564
|
var handleSendExternal = function (passcode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
544
|
-
var response,
|
|
565
|
+
var response, err_2;
|
|
545
566
|
var _a, _b;
|
|
546
567
|
return __generator(this, function (_c) {
|
|
547
568
|
switch (_c.label) {
|
|
@@ -571,8 +592,8 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
571
592
|
}
|
|
572
593
|
return [3 /*break*/, 3];
|
|
573
594
|
case 2:
|
|
574
|
-
|
|
575
|
-
console.error(
|
|
595
|
+
err_2 = _c.sent();
|
|
596
|
+
console.error(err_2);
|
|
576
597
|
setSendButtonStatus(Button_1.BUTTON_STATUS.ERROR);
|
|
577
598
|
setTimeout(function () {
|
|
578
599
|
setSendButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
|
|
@@ -31,7 +31,7 @@ var useEventHandler = function () {
|
|
|
31
31
|
notificationType = "info";
|
|
32
32
|
}
|
|
33
33
|
return {
|
|
34
|
-
message: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: { textTransform: "capitalize" }, children: type }), " ", (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: currency }), " is", " ", status] })),
|
|
34
|
+
message: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: { textTransform: "capitalize" }, children: type.name }), " ", (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: currency }), " is", " ", status] })),
|
|
35
35
|
type: notificationType,
|
|
36
36
|
id: "".concat(transactionId, "-").concat(status),
|
|
37
37
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransactionType } from "../../services/axios/get-activities-service/type";
|
|
2
2
|
export declare const ACTIVITIES_PAGE_SIZE = 10;
|
|
3
|
-
export declare const ACTIVITIES_TYPE_ALL:
|
|
4
|
-
name: string;
|
|
5
|
-
slug: TransactionSlug;
|
|
6
|
-
};
|
|
3
|
+
export declare const ACTIVITIES_TYPE_ALL: TransactionType;
|
|
@@ -4,6 +4,12 @@ exports.ACTIVITIES_TYPE_ALL = exports.ACTIVITIES_PAGE_SIZE = void 0;
|
|
|
4
4
|
var type_1 = require("../../services/axios/get-activities-service/type");
|
|
5
5
|
exports.ACTIVITIES_PAGE_SIZE = 10;
|
|
6
6
|
exports.ACTIVITIES_TYPE_ALL = {
|
|
7
|
+
id: -1,
|
|
8
|
+
status: "all",
|
|
7
9
|
name: "All",
|
|
8
10
|
slug: type_1.TransactionSlug.All,
|
|
11
|
+
description: null,
|
|
12
|
+
icon: "",
|
|
13
|
+
link: "",
|
|
14
|
+
icon_svg: "",
|
|
9
15
|
};
|
|
@@ -17,17 +17,13 @@ export interface Data {
|
|
|
17
17
|
transaction_types: TransactionType[];
|
|
18
18
|
paginated: Paginated;
|
|
19
19
|
}
|
|
20
|
-
export interface TransactionType {
|
|
21
|
-
name: string;
|
|
22
|
-
slug: TransactionSlug;
|
|
23
|
-
}
|
|
24
20
|
export interface Transaction {
|
|
25
21
|
id: number;
|
|
26
|
-
transaction_type:
|
|
22
|
+
transaction_type: TransactionType;
|
|
27
23
|
from_address: string;
|
|
28
24
|
to_address: string;
|
|
29
25
|
network: string;
|
|
30
|
-
from_app_slug:
|
|
26
|
+
from_app_slug: string;
|
|
31
27
|
currency_slug: string;
|
|
32
28
|
fee: string;
|
|
33
29
|
amount: string;
|
|
@@ -36,10 +32,19 @@ export interface Transaction {
|
|
|
36
32
|
user_updated: string;
|
|
37
33
|
date_created: string;
|
|
38
34
|
date_updated: null;
|
|
39
|
-
description: null
|
|
35
|
+
description: null;
|
|
40
36
|
from_locked_balance: null;
|
|
41
37
|
to_locked_balance: null;
|
|
38
|
+
}
|
|
39
|
+
export interface TransactionType {
|
|
40
|
+
id: number;
|
|
41
|
+
status: string;
|
|
42
|
+
name: string;
|
|
43
|
+
slug: TransactionSlug;
|
|
44
|
+
description: null;
|
|
42
45
|
icon: string;
|
|
46
|
+
link: string;
|
|
47
|
+
icon_svg: string;
|
|
43
48
|
}
|
|
44
49
|
export declare enum TransactionSlug {
|
|
45
50
|
All = "all",
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransactionStatus = exports.TransactionSlug = void 0;
|
|
4
|
+
// export interface Transaction {
|
|
5
|
+
// id: number;
|
|
6
|
+
// transaction_type: TransactionSlug;
|
|
7
|
+
// from_address: string;
|
|
8
|
+
// to_address: string;
|
|
9
|
+
// network: string;
|
|
10
|
+
// from_app_slug: null | string;
|
|
11
|
+
// currency_slug: string;
|
|
12
|
+
// fee: string;
|
|
13
|
+
// amount: string;
|
|
14
|
+
// transaction_status: TransactionStatus;
|
|
15
|
+
// user_created: string;
|
|
16
|
+
// user_updated: string;
|
|
17
|
+
// date_created: string;
|
|
18
|
+
// date_updated: null;
|
|
19
|
+
// description: null | string;
|
|
20
|
+
// from_locked_balance: null;
|
|
21
|
+
// to_locked_balance: null;
|
|
22
|
+
// icon: string;
|
|
23
|
+
// }
|
|
4
24
|
var TransactionSlug;
|
|
5
25
|
(function (TransactionSlug) {
|
|
6
26
|
TransactionSlug["All"] = "all";
|