tek-wallet 0.0.755 → 0.0.757
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/TekWallet/components/ui/ActivitiesTypeSlice/index.d.ts +3 -0
- package/dist/components/TekWallet/components/ui/ActivitiesTypeSlice/index.js +7 -7
- package/dist/components/TekWallet/components/ui/ActivityDetail/index.js +5 -5
- package/dist/components/TekWallet/components/ui/ActivityItem/index.js +9 -4
- package/dist/components/TekWallet/components/ui/AmountGroupAndChart/index.js +103 -101
- package/dist/components/TekWallet/components/ui/AnalyticGroup/index.d.ts +2 -1
- package/dist/components/TekWallet/components/ui/AnalyticGroup/index.js +47 -32
- package/dist/components/TekWallet/components/ui/CopyTextComponent/index.js +1 -1
- package/dist/components/TekWallet/components/ui/FiatDeposit/index.js +37 -39
- package/dist/components/TekWallet/components/ui/HistorySwap/index.js +1 -2
- package/dist/components/TekWallet/components/ui/NeonLineChart/index.d.ts +6 -5
- package/dist/components/TekWallet/components/ui/NeonLineChart/index.js +2 -2
- package/dist/components/TekWallet/components/ui/ReceiveFunction/index.js +4 -3
- package/dist/components/TekWallet/components/ui/ReceiveHistory/index.js +1 -2
- package/dist/components/TekWallet/components/ui/SmartList/index.d.ts +0 -1
- package/dist/components/TekWallet/components/ui/SmartList/index.js +5 -4
- package/dist/components/TekWallet/components/ui/SvgPath/index.d.ts +1 -0
- package/dist/components/TekWallet/components/ui/SvgPath/index.js +3 -2
- package/dist/components/TekWallet/components/ui/SwapToken/index.js +0 -5
- package/dist/components/TekWallet/components/ui/SwiperControlled/index.js +5 -1
- package/dist/components/TekWallet/components/ui/TimeFilter/index.d.ts +4 -3
- package/dist/components/TekWallet/components/ui/TimeFilter/index.js +27 -30
- package/dist/components/TekWallet/components/ui/TokenItem/index.js +11 -6
- package/dist/components/TekWallet/components/ui/TokensBoard/index.js +1 -3
- package/dist/components/TekWallet/components/views/ActivityView/index.d.ts +10 -0
- package/dist/components/TekWallet/components/views/ActivityView/index.js +64 -0
- package/dist/components/TekWallet/components/views/AssetView/index.js +69 -6
- package/dist/components/TekWallet/components/views/TekWalletView/index.js +1 -1
- package/dist/components/TekWallet/components/views/TekWalletView/routes.d.ts +5 -4
- package/dist/components/TekWallet/components/views/TekWalletView/routes.js +11 -5
- package/dist/components/TekWallet/const/app.config.d.ts +1 -0
- package/dist/components/TekWallet/const/app.config.js +4 -0
- package/dist/components/TekWallet/index.d.ts +1 -1
- package/dist/components/TekWallet/index.js +1 -1
- package/dist/components/TekWallet/providers/ActivitiesProvider/const.d.ts +1 -1
- package/dist/components/TekWallet/providers/ActivitiesProvider/const.js +1 -1
- package/dist/components/TekWallet/providers/ActivitiesProvider/functions/sortActivity.d.ts +3 -0
- package/dist/components/TekWallet/providers/ActivitiesProvider/functions/sortActivity.js +8 -0
- package/dist/components/TekWallet/providers/ActivitiesProvider/index.js +55 -51
- package/dist/components/TekWallet/providers/ActivitiesProvider/type.d.ts +1 -1
- package/dist/components/TekWallet/providers/WalletDataProvider/index.js +2 -0
- package/dist/components/TekWallet/providers/WalletDataProviderNoImport/index.js +41 -6
- package/dist/components/TekWallet/services/axios/get-activities-service/index.js +0 -3
- package/dist/components/TekWallet/services/axios/get-activities-service/type.d.ts +4 -4
- package/dist/components/TekWallet/services/axios/get-balance-analytic/index.d.ts +3 -0
- package/dist/components/TekWallet/services/axios/get-balance-analytic/index.js +56 -0
- package/dist/components/TekWallet/services/axios/get-balance-analytic/type.d.ts +18 -0
- package/dist/components/TekWallet/services/axios/get-balance-analytic/type.js +2 -0
- package/dist/components/TekWallet/store/balance/index.d.ts +15 -0
- package/dist/components/TekWallet/store/balance/index.js +24 -0
- package/dist/components/TekWallet/store/balance/type.d.ts +9 -0
- package/dist/components/TekWallet/store/balance/type.js +2 -0
- package/dist/components/TekWallet/store/createStorage.d.ts +3 -0
- package/dist/components/TekWallet/store/createStorage.js +17 -0
- package/dist/components/TekWallet/store/user/index.d.ts +15 -0
- package/dist/components/TekWallet/store/user/index.js +52 -0
- package/dist/components/TekWallet/store/user/type.d.ts +38 -0
- package/dist/components/TekWallet/store/user/type.js +9 -0
- package/dist/components/TekWallet/types/expose-type.d.ts +3 -0
- package/package.json +3 -2
- package/dist/components/TekWallet/components/ui/Activities/index.d.ts +0 -12
- package/dist/components/TekWallet/components/ui/Activities/index.js +0 -117
|
@@ -76,8 +76,6 @@ var TokensBoard = function () {
|
|
|
76
76
|
}, children: "PnL" })] })), tokens === null || tokens === void 0 ? void 0 : tokens.map(function (item) {
|
|
77
77
|
var stringifiedTokenData = JSON.stringify(__assign({}, item));
|
|
78
78
|
return ((0, jsx_runtime_1.jsx)(TokenItem_1.default, { showSmallAssets: showSmallAssets, tokenData: stringifiedTokenData }, item.id));
|
|
79
|
-
}), !tokens && (0, jsx_runtime_1.jsx)(WaitingData_1.default, { sx: { margin: "auto" } })] })
|
|
80
|
-
borderColor: theme.palette.border.accent,
|
|
81
|
-
} })] }));
|
|
79
|
+
}), !tokens && (0, jsx_runtime_1.jsx)(WaitingData_1.default, { sx: { margin: "auto" } })] })] }));
|
|
82
80
|
};
|
|
83
81
|
exports.default = TokensBoard;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GeneralProps } from "../../../types/ui";
|
|
2
|
+
import { SxProps } from "@mui/material";
|
|
3
|
+
interface ActivityViewProps extends GeneralProps {
|
|
4
|
+
sx?: SxProps;
|
|
5
|
+
}
|
|
6
|
+
export declare const ActivityView: {
|
|
7
|
+
(props: ActivityViewProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export default ActivityView;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ActivityView = void 0;
|
|
8
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
var react_1 = require("react");
|
|
10
|
+
var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
|
|
11
|
+
var PageHeader_1 = __importDefault(require("../../ui/PageHeader"));
|
|
12
|
+
var SwiperControlled_1 = __importDefault(require("../../ui/SwiperControlled"));
|
|
13
|
+
var useActivities_1 = __importDefault(require("../../../hooks/useActivities"));
|
|
14
|
+
var material_1 = require("@mui/material");
|
|
15
|
+
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
16
|
+
var react_2 = require("swiper/react");
|
|
17
|
+
var ActivitiesTypeSlice_1 = __importDefault(require("../../ui/ActivitiesTypeSlice"));
|
|
18
|
+
var ActivityView = function (props) {
|
|
19
|
+
var sx = props.sx;
|
|
20
|
+
var theme = (0, ThemeProvider_1.useTheme)();
|
|
21
|
+
var swiperRef = (0, react_1.useRef)(null);
|
|
22
|
+
var activityTypes = (0, useActivities_1.default)().activityTypes;
|
|
23
|
+
var _a = (0, react_1.useState)(0), activeTab = _a[0], setActiveTab = _a[1];
|
|
24
|
+
var handleSlideChange = function (index) {
|
|
25
|
+
setActiveTab(index);
|
|
26
|
+
};
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Activities" }), sx: sx, children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { ref: swiperRef,
|
|
28
|
+
// tabParamName="activity-tab"
|
|
29
|
+
swiperProps: {
|
|
30
|
+
slidesPerView: 1,
|
|
31
|
+
spaceBetween: 40,
|
|
32
|
+
}, onTabChange: handleSlideChange, tabs: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: type.name, value: index, "data-index": index, sx: {
|
|
34
|
+
padding: "".concat(theme.mixins.customPadding.p8, " ").concat(theme.mixins.customPadding.p16),
|
|
35
|
+
minHeight: "unset",
|
|
36
|
+
minWidth: "unset",
|
|
37
|
+
textTransform: "capitalize",
|
|
38
|
+
color: theme.palette.text.accent2,
|
|
39
|
+
transition: "all 0.3s linear",
|
|
40
|
+
fontSize: theme.typography.fontSize12,
|
|
41
|
+
borderColor: "currentcolor",
|
|
42
|
+
"&.Mui-selected": {
|
|
43
|
+
color: theme.palette.text.primary,
|
|
44
|
+
},
|
|
45
|
+
"&.Mui-selected::after": {
|
|
46
|
+
content: "''",
|
|
47
|
+
position: "absolute",
|
|
48
|
+
bottom: 0,
|
|
49
|
+
left: 0,
|
|
50
|
+
},
|
|
51
|
+
} }, index));
|
|
52
|
+
}), sx: {
|
|
53
|
+
height: "100%",
|
|
54
|
+
}, swiperStyle: {
|
|
55
|
+
flex: 1,
|
|
56
|
+
}, children: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: {
|
|
58
|
+
position: "relative",
|
|
59
|
+
}, children: (0, jsx_runtime_1.jsx)(ActivitiesTypeSlice_1.default, { type: type, isActive: activeTab === index }) }, index));
|
|
60
|
+
}) }) }));
|
|
61
|
+
};
|
|
62
|
+
exports.ActivityView = ActivityView;
|
|
63
|
+
exports.ActivityView.displayName = "Activities";
|
|
64
|
+
exports.default = exports.ActivityView;
|
|
@@ -11,6 +11,50 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
return __assign.apply(this, arguments);
|
|
13
13
|
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
14
58
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
59
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
60
|
};
|
|
@@ -28,20 +72,22 @@ var AmountGroupAndChart_1 = __importDefault(require("../../ui/AmountGroupAndChar
|
|
|
28
72
|
var link_1 = __importDefault(require("next/link"));
|
|
29
73
|
var react_1 = require("react");
|
|
30
74
|
var TekWalletProvider_1 = require("../../../providers/TekWalletProvider");
|
|
31
|
-
var ReceiveFunction_1 =
|
|
75
|
+
var ReceiveFunction_1 = __importStar(require("../../ui/ReceiveFunction"));
|
|
32
76
|
var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
|
|
33
77
|
var Menu_1 = __importDefault(require("./Menu"));
|
|
78
|
+
var ActivitiesTypeSlice_1 = __importDefault(require("../../ui/ActivitiesTypeSlice"));
|
|
79
|
+
var const_1 = require("../../../providers/ActivitiesProvider/const");
|
|
80
|
+
var Icon_1 = __importDefault(require("../../ui/Icon"));
|
|
34
81
|
var AssetView = function (props) {
|
|
82
|
+
var sx = props.sx, rest = __rest(props, ["sx"]);
|
|
35
83
|
var isInitPasscode = (0, useWalletData_1.default)().isInitPasscode;
|
|
36
84
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
37
85
|
var options = (0, TekWalletProvider_1.useWalletConfig)().options;
|
|
38
86
|
var basePath = (0, react_1.useMemo)(function () {
|
|
39
87
|
return (options === null || options === void 0 ? void 0 : options.basePath) || "";
|
|
40
88
|
}, [options]);
|
|
41
|
-
return ((0, jsx_runtime_1.jsxs)(ChildPageLayout_1.default, { children: [!isInitPasscode && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionDescription), children: "Please connect your wallet to get asset information" })), !!isInitPasscode && ((0, jsx_runtime_1.jsxs)(DefaultPageLayout_1.default, __assign({},
|
|
42
|
-
|
|
43
|
-
}, items: [
|
|
44
|
-
(0, jsx_runtime_1.jsx)(ReceiveFunction_1.default, { children: (0, jsx_runtime_1.jsx)(material_1.ListItem, { sx: {
|
|
89
|
+
return ((0, jsx_runtime_1.jsxs)(ChildPageLayout_1.default, { children: [!isInitPasscode && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionDescription), children: "Please connect your wallet to get asset information" })), !!isInitPasscode && ((0, jsx_runtime_1.jsxs)(DefaultPageLayout_1.default, __assign({}, rest, { sx: __assign({ display: "flex", flexDirection: "column", gap: theme.mixins.gaps.g20 }, sx), children: [(0, jsx_runtime_1.jsx)(AmountGroupAndChart_1.default, {}), (0, jsx_runtime_1.jsx)(Menu_1.default, { items: [
|
|
90
|
+
(0, jsx_runtime_1.jsx)(ReceiveFunction_1.default, { functionsList: Object.values(ReceiveFunction_1.ReceiveMethods), children: (0, jsx_runtime_1.jsx)(material_1.ListItem, { sx: {
|
|
45
91
|
borderRight: "1px solid ".concat(theme.palette.border.accent3),
|
|
46
92
|
placeContent: "center",
|
|
47
93
|
columnSpan: 1,
|
|
@@ -62,7 +108,24 @@ var AssetView = function (props) {
|
|
|
62
108
|
placeContent: "center",
|
|
63
109
|
columnSpan: 1,
|
|
64
110
|
}, children: (0, jsx_runtime_1.jsx)(FunctionItem_1.default, { icon: "IC_SWAP_FC", label: "Swap", sx: { width: "100%" } }) }) }, "swap"),
|
|
65
|
-
] }), (0, jsx_runtime_1.
|
|
111
|
+
] }), (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: {
|
|
112
|
+
display: "flex",
|
|
113
|
+
gap: theme.mixins.gaps.g20,
|
|
114
|
+
}, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionTitle), children: "Activity" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: link_1.default, href: "".concat(basePath, "/tek-wallet/activity"), sx: {
|
|
115
|
+
marginLeft: "auto",
|
|
116
|
+
display: "flex",
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
}, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
119
|
+
fontSize: theme.typography.fontSize13,
|
|
120
|
+
fontWeight: theme.typography.fontWeight400,
|
|
121
|
+
color: theme.palette.text.black,
|
|
122
|
+
cursor: "pointer",
|
|
123
|
+
}, children: "View all" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { iconKey: "IC_ARROW_RIGHT", width: 18, height: 18 })] })] }), (0, jsx_runtime_1.jsx)(ActivitiesTypeSlice_1.default, { type: const_1.ACTIVITIES_TYPE_ALL, limitItems: 4, isActive: true, sx: {
|
|
124
|
+
paddingBottom: 0,
|
|
125
|
+
paddingTop: 0,
|
|
126
|
+
paddingLeft: 0,
|
|
127
|
+
paddingRight: 0,
|
|
128
|
+
} })] }), (0, jsx_runtime_1.jsx)(TokensBoard_1.default, {})] })))] }));
|
|
66
129
|
};
|
|
67
130
|
exports.AssetView = AssetView;
|
|
68
131
|
exports.default = exports.AssetView;
|
|
@@ -11,6 +11,6 @@ function TekWalletView() {
|
|
|
11
11
|
var pathnameArray = (0, react_1.useMemo)(function () { return (typeof pathname === "string" ? [pathname] : pathname); }, [pathname]);
|
|
12
12
|
var pathnameFull = (0, react_1.useMemo)(function () { return pathnameArray === null || pathnameArray === void 0 ? void 0 : pathnameArray.join("/"); }, [pathnameArray]);
|
|
13
13
|
console.warn("🚀 ~ TekWalletView ~ pathnameFull:", pathname, pathnameFull);
|
|
14
|
-
var View = (0, react_1.useMemo)(function () { return (pathname === undefined ? (0, routes_1.getView)("/") : (0, routes_1.getView)(
|
|
14
|
+
var View = (0, react_1.useMemo)(function () { return (pathname === undefined ? (0, routes_1.getView)("/") : (0, routes_1.getView)("/".concat(pathnameFull))); }, [pathnameFull, pathname]);
|
|
15
15
|
return (0, jsx_runtime_1.jsx)(View, {});
|
|
16
16
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ComponentType } from "react";
|
|
2
2
|
export declare enum TekWalletViewRoutes {
|
|
3
|
-
SEND_INTERNAL = "send/internal",
|
|
4
|
-
SEND_EXTERNAL = "send/external",
|
|
5
|
-
SWAP = "swap",
|
|
3
|
+
SEND_INTERNAL = "/send/internal",
|
|
4
|
+
SEND_EXTERNAL = "/send/external",
|
|
5
|
+
SWAP = "/swap",
|
|
6
6
|
ASSET = "/",
|
|
7
|
-
NOT_FOUND = "not-found"
|
|
7
|
+
NOT_FOUND = "/not-found",
|
|
8
|
+
ACTIVITY = "/activity"
|
|
8
9
|
}
|
|
9
10
|
export declare const getView: (path: string) => ComponentType;
|
|
@@ -40,11 +40,12 @@ exports.getView = exports.TekWalletViewRoutes = void 0;
|
|
|
40
40
|
var dynamic_1 = __importDefault(require("next/dynamic"));
|
|
41
41
|
var TekWalletViewRoutes;
|
|
42
42
|
(function (TekWalletViewRoutes) {
|
|
43
|
-
TekWalletViewRoutes["SEND_INTERNAL"] = "send/internal";
|
|
44
|
-
TekWalletViewRoutes["SEND_EXTERNAL"] = "send/external";
|
|
45
|
-
TekWalletViewRoutes["SWAP"] = "swap";
|
|
43
|
+
TekWalletViewRoutes["SEND_INTERNAL"] = "/send/internal";
|
|
44
|
+
TekWalletViewRoutes["SEND_EXTERNAL"] = "/send/external";
|
|
45
|
+
TekWalletViewRoutes["SWAP"] = "/swap";
|
|
46
46
|
TekWalletViewRoutes["ASSET"] = "/";
|
|
47
|
-
TekWalletViewRoutes["NOT_FOUND"] = "not-found";
|
|
47
|
+
TekWalletViewRoutes["NOT_FOUND"] = "/not-found";
|
|
48
|
+
TekWalletViewRoutes["ACTIVITY"] = "/activity";
|
|
48
49
|
})(TekWalletViewRoutes || (exports.TekWalletViewRoutes = TekWalletViewRoutes = {}));
|
|
49
50
|
var getView = function (path) {
|
|
50
51
|
if (path.startsWith(TekWalletViewRoutes.SEND_INTERNAL)) {
|
|
@@ -62,11 +63,16 @@ var getView = function (path) {
|
|
|
62
63
|
ssr: false,
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
|
-
if (path
|
|
66
|
+
if (path === TekWalletViewRoutes.ASSET) {
|
|
66
67
|
return (0, dynamic_1.default)(function () { return Promise.resolve().then(function () { return __importStar(require("../AssetView")); }); }, {
|
|
67
68
|
ssr: false,
|
|
68
69
|
});
|
|
69
70
|
}
|
|
71
|
+
if (path.startsWith(TekWalletViewRoutes.ACTIVITY)) {
|
|
72
|
+
return (0, dynamic_1.default)(function () { return Promise.resolve().then(function () { return __importStar(require("../ActivityView")); }); }, {
|
|
73
|
+
ssr: false,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
70
76
|
return (0, dynamic_1.default)(function () { return Promise.resolve().then(function () { return __importStar(require("../NotFoundView")); }); }, {
|
|
71
77
|
ssr: false,
|
|
72
78
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const APP_NAME = "TekWallet";
|
|
@@ -5,7 +5,7 @@ export * from "./components/ui/ReceiveFunction";
|
|
|
5
5
|
export * from "./components/ui/LockToken";
|
|
6
6
|
export * from "./components/views/AssetView";
|
|
7
7
|
export * from "./hooks/useWallet";
|
|
8
|
-
export * from "./components/
|
|
8
|
+
export * from "./components/views/ActivityView";
|
|
9
9
|
export * from "./components/ui/SwapToken";
|
|
10
10
|
export * from "./components/ui/TransferInternal";
|
|
11
11
|
export * from "./components/ui/WithdrawFunction";
|
|
@@ -21,7 +21,7 @@ __exportStar(require("./components/ui/ReceiveFunction"), exports);
|
|
|
21
21
|
__exportStar(require("./components/ui/LockToken"), exports);
|
|
22
22
|
__exportStar(require("./components/views/AssetView"), exports);
|
|
23
23
|
__exportStar(require("./hooks/useWallet"), exports);
|
|
24
|
-
__exportStar(require("./components/
|
|
24
|
+
__exportStar(require("./components/views/ActivityView"), exports);
|
|
25
25
|
__exportStar(require("./components/ui/SwapToken"), exports);
|
|
26
26
|
__exportStar(require("./components/ui/TransferInternal"), exports);
|
|
27
27
|
__exportStar(require("./components/ui/WithdrawFunction"), exports);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ACTIVITIES_TYPE_ALL = exports.ACTIVITIES_PAGE_SIZE = void 0;
|
|
4
4
|
var type_1 = require("../../services/axios/get-activities-service/type");
|
|
5
|
-
exports.ACTIVITIES_PAGE_SIZE =
|
|
5
|
+
exports.ACTIVITIES_PAGE_SIZE = 4;
|
|
6
6
|
exports.ACTIVITIES_TYPE_ALL = {
|
|
7
7
|
id: -1,
|
|
8
8
|
status: "all",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function sortActivity(activities) {
|
|
4
|
+
return activities.sort(function (a, b) {
|
|
5
|
+
return new Date(b.date_created).getTime() - new Date(a.date_created).getTime();
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
exports.default = sortActivity;
|
|
@@ -98,9 +98,9 @@ exports.ActivitiesProvider = ActivitiesProvider;
|
|
|
98
98
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
99
99
|
var react_1 = __importStar(require("react"));
|
|
100
100
|
var useWalletData_1 = __importDefault(require("../../hooks/useWalletData"));
|
|
101
|
-
var type_1 = require("./type");
|
|
102
101
|
var get_activities_service_1 = __importDefault(require("../../services/axios/get-activities-service"));
|
|
103
102
|
var const_1 = require("./const");
|
|
103
|
+
var sortActivity_1 = __importDefault(require("./functions/sortActivity"));
|
|
104
104
|
exports.initialActivities = {
|
|
105
105
|
isLoadingActivities: {},
|
|
106
106
|
activities: undefined,
|
|
@@ -108,7 +108,7 @@ exports.initialActivities = {
|
|
|
108
108
|
return [2 /*return*/];
|
|
109
109
|
}); }); },
|
|
110
110
|
activityTypes: [const_1.ACTIVITIES_TYPE_ALL],
|
|
111
|
-
|
|
111
|
+
loadOutActivityType: {},
|
|
112
112
|
loadActivities: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
113
113
|
return [2 /*return*/];
|
|
114
114
|
}); }); },
|
|
@@ -121,15 +121,21 @@ function ActivitiesProvider(_a) {
|
|
|
121
121
|
var _b = (0, react_1.useState)(exports.initialActivities.isLoadingActivities), isLoadingActivities = _b[0], setIsLoadingActivities = _b[1];
|
|
122
122
|
var _c = react_1.default.useState(exports.initialActivities.activities), activities = _c[0], setActivities = _c[1];
|
|
123
123
|
var _d = react_1.default.useState(exports.initialActivities.activityTypes), activityTypes = _d[0], setActivityTypes = _d[1];
|
|
124
|
-
var _e = (0, react_1.useState)(exports.initialActivities.
|
|
124
|
+
var _e = (0, react_1.useState)(exports.initialActivities.loadOutActivityType), loadOutActivityType = _e[0], setLoadOutActivityType = _e[1];
|
|
125
|
+
var getLatestDateCreated = (0, react_1.useCallback)(function (slug) {
|
|
126
|
+
var _a;
|
|
127
|
+
var currentLastActivity = (_a = activities === null || activities === void 0 ? void 0 : activities[slug]) === null || _a === void 0 ? void 0 : _a.at(-1);
|
|
128
|
+
if (!currentLastActivity)
|
|
129
|
+
return null;
|
|
130
|
+
return currentLastActivity === null || currentLastActivity === void 0 ? void 0 : currentLastActivity.date_created;
|
|
131
|
+
}, [activities]);
|
|
125
132
|
var updateActivityTypes = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
126
133
|
var response, newActivityTypes;
|
|
127
134
|
var _a, _b;
|
|
128
135
|
return __generator(this, function (_c) {
|
|
129
136
|
switch (_c.label) {
|
|
130
137
|
case 0: return [4 /*yield*/, (0, get_activities_service_1.default)({
|
|
131
|
-
|
|
132
|
-
take: 1,
|
|
138
|
+
limit: 1,
|
|
133
139
|
})];
|
|
134
140
|
case 1:
|
|
135
141
|
response = _c.sent();
|
|
@@ -140,17 +146,17 @@ function ActivitiesProvider(_a) {
|
|
|
140
146
|
});
|
|
141
147
|
}); }, []);
|
|
142
148
|
var updateActivities = (0, react_1.useCallback)(function (query) { return __awaiter(_this, void 0, void 0, function () {
|
|
143
|
-
var slug, response_1,
|
|
144
|
-
var _a, _b, _c
|
|
145
|
-
return __generator(this, function (
|
|
146
|
-
switch (
|
|
149
|
+
var slug, response_1, loadedActivities_1, error_1;
|
|
150
|
+
var _a, _b, _c;
|
|
151
|
+
return __generator(this, function (_d) {
|
|
152
|
+
switch (_d.label) {
|
|
147
153
|
case 0:
|
|
148
154
|
slug = (_a = query === null || query === void 0 ? void 0 : query.transaction_types) !== null && _a !== void 0 ? _a : const_1.ACTIVITIES_TYPE_ALL.slug;
|
|
149
|
-
if (
|
|
155
|
+
if (loadOutActivityType[slug])
|
|
150
156
|
return [2 /*return*/];
|
|
151
|
-
|
|
157
|
+
_d.label = 1;
|
|
152
158
|
case 1:
|
|
153
|
-
|
|
159
|
+
_d.trys.push([1, 3, , 4]);
|
|
154
160
|
if (!isInitPasscode) {
|
|
155
161
|
throw new Error("Authenticate to get receive tokens");
|
|
156
162
|
}
|
|
@@ -160,26 +166,21 @@ function ActivitiesProvider(_a) {
|
|
|
160
166
|
var _a;
|
|
161
167
|
return (__assign(__assign({}, prev), (_a = {}, _a[slug] = true, _a)));
|
|
162
168
|
});
|
|
163
|
-
return [4 /*yield*/, (0, get_activities_service_1.default)(query)];
|
|
169
|
+
return [4 /*yield*/, (0, get_activities_service_1.default)(__assign({}, query))];
|
|
164
170
|
case 2:
|
|
165
|
-
response_1 =
|
|
166
|
-
|
|
167
|
-
setActivityTypes(__spreadArray([const_1.ACTIVITIES_TYPE_ALL], ((_f = (_e = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _e === void 0 ? void 0 : _e.transaction_types) !== null && _f !== void 0 ? _f : []), true));
|
|
171
|
+
response_1 = _d.sent();
|
|
172
|
+
loadedActivities_1 = (_c = (_b = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _b === void 0 ? void 0 : _b.transactions) !== null && _c !== void 0 ? _c : [];
|
|
168
173
|
setActivities(function (prev) {
|
|
169
174
|
var _a;
|
|
170
|
-
var _b, _c, _d, _e;
|
|
171
|
-
var
|
|
172
|
-
|
|
173
|
-
return !((_a = prev === null || prev === void 0 ? void 0 : prev[slug]) === null || _a === void 0 ? void 0 : _a.some(function (prevActivity) { return prevActivity.id === activity.id; }));
|
|
175
|
+
var _b, _c, _d, _e, _f;
|
|
176
|
+
var retainedActivities = (_c = ((_b = prev === null || prev === void 0 ? void 0 : prev[slug]) !== null && _b !== void 0 ? _b : [])) === null || _c === void 0 ? void 0 : _c.filter(function (activity) {
|
|
177
|
+
return !(loadedActivities_1 === null || loadedActivities_1 === void 0 ? void 0 : loadedActivities_1.some(function (item) { return item.id === activity.id; }));
|
|
174
178
|
});
|
|
175
|
-
var newActivities = __spreadArray(__spreadArray([],
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
page = type_1.MAX_PAGE;
|
|
179
|
-
}
|
|
180
|
-
setPages(function (prev) {
|
|
179
|
+
var newActivities = (0, sortActivity_1.default)(__spreadArray(__spreadArray([], retainedActivities, true), loadedActivities_1, true));
|
|
180
|
+
var isLoadOutActivityType = newActivities.length >= ((_f = (_e = (_d = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _d === void 0 ? void 0 : _d.paginated) === null || _e === void 0 ? void 0 : _e.number_records) !== null && _f !== void 0 ? _f : 0);
|
|
181
|
+
setLoadOutActivityType(function (prev) {
|
|
181
182
|
var _a;
|
|
182
|
-
return (__assign(__assign({}, prev), (_a = {}, _a[slug] =
|
|
183
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[slug] = isLoadOutActivityType, _a)));
|
|
183
184
|
});
|
|
184
185
|
return __assign(__assign({}, (prev !== null && prev !== void 0 ? prev : {})), (_a = {}, _a[slug] = newActivities, _a));
|
|
185
186
|
});
|
|
@@ -189,7 +190,7 @@ function ActivitiesProvider(_a) {
|
|
|
189
190
|
});
|
|
190
191
|
return [3 /*break*/, 4];
|
|
191
192
|
case 3:
|
|
192
|
-
error_1 =
|
|
193
|
+
error_1 = _d.sent();
|
|
193
194
|
console.error("🚀 ~ getBalance ~ error:", error_1);
|
|
194
195
|
setIsLoadingActivities(function (prev) {
|
|
195
196
|
var _a;
|
|
@@ -199,16 +200,16 @@ function ActivitiesProvider(_a) {
|
|
|
199
200
|
case 4: return [2 /*return*/];
|
|
200
201
|
}
|
|
201
202
|
});
|
|
202
|
-
}); }, [isInitPasscode]);
|
|
203
|
+
}); }, [isInitPasscode, isLoadingActivities, loadOutActivityType]);
|
|
203
204
|
var loadActivities = (0, react_1.useCallback)(function (slug) { return __awaiter(_this, void 0, void 0, function () {
|
|
204
|
-
var
|
|
205
|
-
var _a, _b, _c, _d;
|
|
206
|
-
return __generator(this, function (
|
|
207
|
-
switch (
|
|
205
|
+
var lastDateCreated, response, activitiesLoaded, numOfRecords, retainedActivities, newActivities;
|
|
206
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
207
|
+
return __generator(this, function (_h) {
|
|
208
|
+
switch (_h.label) {
|
|
208
209
|
case 0:
|
|
209
210
|
if (!isInitPasscode)
|
|
210
211
|
return [2 /*return*/];
|
|
211
|
-
if (
|
|
212
|
+
if (loadOutActivityType[slug])
|
|
212
213
|
return [2 /*return*/];
|
|
213
214
|
if (isLoadingActivities[slug])
|
|
214
215
|
return [2 /*return*/];
|
|
@@ -216,40 +217,43 @@ function ActivitiesProvider(_a) {
|
|
|
216
217
|
var _a;
|
|
217
218
|
return (__assign(__assign({}, prev), (_a = {}, _a[slug] = true, _a)));
|
|
218
219
|
});
|
|
219
|
-
|
|
220
|
+
lastDateCreated = getLatestDateCreated(slug);
|
|
220
221
|
return [4 /*yield*/, (0, get_activities_service_1.default)({
|
|
221
|
-
|
|
222
|
-
take: const_1.ACTIVITIES_PAGE_SIZE,
|
|
222
|
+
limit: const_1.ACTIVITIES_PAGE_SIZE,
|
|
223
223
|
transaction_types: slug,
|
|
224
|
+
last_date_created: lastDateCreated,
|
|
224
225
|
})];
|
|
225
226
|
case 1:
|
|
226
|
-
response =
|
|
227
|
-
|
|
228
|
-
exceptedActivities = (_d = activitiesLoaded === null || activitiesLoaded === void 0 ? void 0 : activitiesLoaded.filter(function (loadedActivity) {
|
|
227
|
+
response = _h.sent();
|
|
228
|
+
setIsLoadingActivities(function (prev) {
|
|
229
229
|
var _a;
|
|
230
|
-
return
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[slug] = false, _a)));
|
|
231
|
+
});
|
|
232
|
+
activitiesLoaded = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.transactions) !== null && _b !== void 0 ? _b : [];
|
|
233
|
+
numOfRecords = (_e = (_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.paginated) === null || _d === void 0 ? void 0 : _d.number_records) !== null && _e !== void 0 ? _e : 0;
|
|
234
|
+
retainedActivities = (_g = (_f = activities === null || activities === void 0 ? void 0 : activities[slug]) === null || _f === void 0 ? void 0 : _f.filter(function (item) {
|
|
235
|
+
return !(activitiesLoaded === null || activitiesLoaded === void 0 ? void 0 : activitiesLoaded.some(function (activity) { return item.id === activity.id; }));
|
|
236
|
+
})) !== null && _g !== void 0 ? _g : [];
|
|
237
|
+
newActivities = (0, sortActivity_1.default)(__spreadArray(__spreadArray([], retainedActivities, true), activitiesLoaded, true));
|
|
234
238
|
setActivities(function (prev) {
|
|
235
239
|
var _a;
|
|
236
240
|
return (__assign(__assign({}, prev), (_a = {}, _a[slug] = newActivities, _a)));
|
|
237
241
|
});
|
|
238
|
-
if (
|
|
239
|
-
|
|
242
|
+
if (newActivities.length >= numOfRecords) {
|
|
243
|
+
setLoadOutActivityType(function (prev) {
|
|
240
244
|
var _a;
|
|
241
|
-
return (__assign(__assign({}, prev), (_a = {}, _a[slug] =
|
|
245
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[slug] = true, _a)));
|
|
242
246
|
});
|
|
243
247
|
return [2 /*return*/];
|
|
244
248
|
}
|
|
245
|
-
|
|
249
|
+
setLoadOutActivityType(function (prev) {
|
|
246
250
|
var _a;
|
|
247
|
-
return (__assign(__assign({}, prev), (_a = {}, _a[slug] =
|
|
251
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[slug] = false, _a)));
|
|
248
252
|
});
|
|
249
253
|
return [2 /*return*/];
|
|
250
254
|
}
|
|
251
255
|
});
|
|
252
|
-
}); }, [isInitPasscode,
|
|
256
|
+
}); }, [isInitPasscode, loadOutActivityType, isLoadingActivities, getLatestDateCreated, activities]);
|
|
253
257
|
(0, react_1.useEffect)(function () {
|
|
254
258
|
if (!isInitPasscode)
|
|
255
259
|
return;
|
|
@@ -261,7 +265,7 @@ function ActivitiesProvider(_a) {
|
|
|
261
265
|
activities: activities,
|
|
262
266
|
updateActivities: updateActivities,
|
|
263
267
|
activityTypes: activityTypes,
|
|
264
|
-
|
|
268
|
+
loadOutActivityType: loadOutActivityType,
|
|
265
269
|
loadActivities: loadActivities,
|
|
266
270
|
}, children: children }));
|
|
267
271
|
}
|
|
@@ -5,8 +5,8 @@ export interface ActivitiesProviderDataType {
|
|
|
5
5
|
activities: Activities | undefined;
|
|
6
6
|
updateActivities: (query?: GetActivitiesServiceQuery) => Promise<void>;
|
|
7
7
|
activityTypes: ActivityTypes[] | undefined;
|
|
8
|
-
pages: Partial<Record<TransactionSlug, number | typeof MAX_PAGE>>;
|
|
9
8
|
loadActivities: (slug: TransactionSlug) => Promise<void>;
|
|
9
|
+
loadOutActivityType: Partial<Record<TransactionSlug, boolean>>;
|
|
10
10
|
}
|
|
11
11
|
export type Activities = Partial<Record<TransactionSlug, Transaction[]>>;
|
|
12
12
|
export interface ActivityTypes extends TransactionType {
|
|
@@ -101,6 +101,7 @@ exports.initialWalletData = {
|
|
|
101
101
|
createWallet: function () { return Promise.resolve({}); },
|
|
102
102
|
importWallet: function () { return Promise.resolve({}); },
|
|
103
103
|
getSeedPhrase: function () { return Promise.resolve({}); },
|
|
104
|
+
updateBalanceAnalytic: function () { return Promise.resolve(null); },
|
|
104
105
|
};
|
|
105
106
|
exports.WalletDataContext = react_1.default.createContext(exports.initialWalletData);
|
|
106
107
|
function WalletDataProvider(props) {
|
|
@@ -334,6 +335,7 @@ function WalletDataProvider(props) {
|
|
|
334
335
|
createWallet: createWallet,
|
|
335
336
|
importWallet: importWallet,
|
|
336
337
|
getSeedPhrase: getSeedPhrase,
|
|
338
|
+
updateBalanceAnalytic: exports.initialWalletData.updateBalanceAnalytic,
|
|
337
339
|
}, children: children }));
|
|
338
340
|
}
|
|
339
341
|
exports.default = WalletDataProvider;
|