tek-wallet 0.0.575 → 0.0.576

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.
@@ -75,10 +75,15 @@ function ActivityDetail(props) {
75
75
  }, [isIncrease, theme]);
76
76
  if (!activityData)
77
77
  return null;
78
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g16, alignItems: "center" }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: "-0.5rem" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: currency === null || currency === void 0 ? void 0 : currency.link, width: 64, sx: {
78
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g16, alignItems: "center" }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { mr: "0.5rem" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: currency === null || currency === void 0 ? void 0 : currency.link, width: 64, sx: {
79
79
  borderRadius: theme.mixins.customRadius.full,
80
- border: "2px white solid",
81
- } }), (swapToCurrency === null || swapToCurrency === void 0 ? void 0 : swapToCurrency.link) && ((0, jsx_runtime_1.jsx)(Icon_1.default, { src: swapToCurrency === null || swapToCurrency === void 0 ? void 0 : swapToCurrency.link, width: 64, sx: { borderRadius: theme.mixins.customRadius.full, border: "2px white solid" } }))] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { width: "fit-content", gap: theme.mixins.gaps.g4, alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeightBold, fontSize: theme.typography.fontSize24, color: getAmountColor(), opacity: isSwap ? 0.5 : 1 }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { start: isIncrease ? "+" : "-", value: activityData.amount, unit: " ".concat(currency === null || currency === void 0 ? void 0 : currency.name) }) }), isSwap && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeightBold, fontSize: theme.typography.fontSize24, color: theme.palette.text.successStatus }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { start: "+", value: swapToCurrency === null || swapToCurrency === void 0 ? void 0 : swapToCurrency.swap_total_amount, unit: " ".concat(swapToCurrency === null || swapToCurrency === void 0 ? void 0 : swapToCurrency.name) }) })), (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: {
80
+ border: isSwap ? "0.25rem white solid" : "none",
81
+ ml: "-0.5rem",
82
+ } }), (swapToCurrency === null || swapToCurrency === void 0 ? void 0 : swapToCurrency.link) && ((0, jsx_runtime_1.jsx)(Icon_1.default, { src: swapToCurrency === null || swapToCurrency === void 0 ? void 0 : swapToCurrency.link, width: 64, sx: {
83
+ borderRadius: theme.mixins.customRadius.full,
84
+ border: isSwap ? "0.25rem white solid" : "none",
85
+ ml: "-0.5rem",
86
+ } }))] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { width: "fit-content", gap: theme.mixins.gaps.g4, alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeightBold, fontSize: theme.typography.fontSize24, color: getAmountColor(), opacity: isSwap ? 0.5 : 1 }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { start: isIncrease ? "+" : "-", value: activityData.amount, unit: " ".concat(currency === null || currency === void 0 ? void 0 : currency.name) }) }), isSwap && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontWeight: theme.typography.fontWeightBold, fontSize: theme.typography.fontSize24, color: theme.palette.text.successStatus }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { start: "+", value: swapToCurrency === null || swapToCurrency === void 0 ? void 0 : swapToCurrency.swap_total_amount, unit: " ".concat(swapToCurrency === null || swapToCurrency === void 0 ? void 0 : swapToCurrency.name) }) })), (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: {
82
87
  fontSize: theme.typography.fontSize12,
83
88
  textTransform: "capitalize",
84
89
  color: getStatusColor(),
@@ -78,10 +78,14 @@ var jsx_runtime_1 = require("react/jsx-runtime");
78
78
  var react_1 = __importStar(require("react"));
79
79
  var get_lock_tokens_list_service_1 = __importDefault(require("../../services/axios/get-lock-tokens-list-service"));
80
80
  var useWalletData_1 = __importDefault(require("../../hooks/useWalletData"));
81
+ var get_locked_tokens_service_1 = __importDefault(require("../../services/axios/get-locked-tokens-service"));
81
82
  exports.initialLockTokens = {
82
83
  isLoadingLockToken: false,
83
84
  lockTokens: undefined,
84
85
  updateLockToken: function () { },
86
+ lockedTokens: undefined,
87
+ updateLockedToken: function () { },
88
+ isLoadingLockedToken: false,
85
89
  };
86
90
  exports.LockTokensContext = react_1.default.createContext(exports.initialLockTokens);
87
91
  function LockTokensProvider(_a) {
@@ -90,8 +94,38 @@ function LockTokensProvider(_a) {
90
94
  var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
91
95
  var _b = (0, react_1.useState)(exports.initialLockTokens.isLoadingLockToken), isLoadingLockToken = _b[0], setIsLoadingLockToken = _b[1];
92
96
  var _c = react_1.default.useState(exports.initialLockTokens.lockTokens), lockTokens = _c[0], setLockTokens = _c[1];
93
- var updateLockToken = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
97
+ var _d = react_1.default.useState(exports.initialLockTokens.lockedTokens), lockedTokens = _d[0], setLockedTokens = _d[1];
98
+ var _e = (0, react_1.useState)(exports.initialLockTokens.isLoadingLockedToken), isLoadingLockedToken = _e[0], setIsLoadingLockedToken = _e[1];
99
+ var updateLockedToken = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
94
100
  var response, error_1;
101
+ var _a;
102
+ return __generator(this, function (_b) {
103
+ switch (_b.label) {
104
+ case 0:
105
+ _b.trys.push([0, 2, , 3]);
106
+ if (isLoadingLockedToken)
107
+ return [2 /*return*/];
108
+ if (!isAuthenticated) {
109
+ throw new Error("Authenticate to get lock tokens");
110
+ }
111
+ setIsLoadingLockedToken(true);
112
+ return [4 /*yield*/, (0, get_locked_tokens_service_1.default)()];
113
+ case 1:
114
+ response = _b.sent();
115
+ setLockedTokens((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.locked_balances);
116
+ setIsLoadingLockedToken(false);
117
+ return [3 /*break*/, 3];
118
+ case 2:
119
+ error_1 = _b.sent();
120
+ console.error("🚀 ~ getBalance ~ error:", error_1);
121
+ setIsLoadingLockedToken(false);
122
+ return [3 /*break*/, 3];
123
+ case 3: return [2 /*return*/];
124
+ }
125
+ });
126
+ }); }, [isAuthenticated, isLoadingLockedToken]);
127
+ var updateLockToken = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
128
+ var response, error_2;
95
129
  return __generator(this, function (_a) {
96
130
  switch (_a.label) {
97
131
  case 0:
@@ -109,8 +143,8 @@ function LockTokensProvider(_a) {
109
143
  setIsLoadingLockToken(false);
110
144
  return [3 /*break*/, 3];
111
145
  case 2:
112
- error_1 = _a.sent();
113
- console.error("🚀 ~ getBalance ~ error:", error_1);
146
+ error_2 = _a.sent();
147
+ console.error("🚀 ~ getBalance ~ error:", error_2);
114
148
  setIsLoadingLockToken(false);
115
149
  return [3 /*break*/, 3];
116
150
  case 3: return [2 /*return*/];
@@ -126,6 +160,9 @@ function LockTokensProvider(_a) {
126
160
  isLoadingLockToken: isLoadingLockToken,
127
161
  lockTokens: lockTokens,
128
162
  updateLockToken: updateLockToken,
163
+ lockedTokens: lockedTokens,
164
+ updateLockedToken: updateLockedToken,
165
+ isLoadingLockedToken: isLoadingLockedToken,
129
166
  }, children: children }));
130
167
  }
131
168
  exports.default = LockTokensProvider;
@@ -1,6 +1,10 @@
1
1
  import { LockCurrency } from "../../services/axios/get-lock-tokens-list-service/type";
2
+ import { LockedToken } from "../../services/axios/get-locked-tokens-service/type";
2
3
  export interface LockTokensProviderDataType {
3
4
  isLoadingLockToken: boolean;
4
5
  lockTokens: LockCurrency[] | undefined;
5
6
  updateLockToken: () => void;
7
+ lockedTokens: LockedToken[] | undefined;
8
+ updateLockedToken: () => void;
9
+ isLoadingLockedToken: boolean;
6
10
  }
@@ -0,0 +1,3 @@
1
+ import { GetLockedServiceQuery, GetLockedServiceResponse } from "./type";
2
+ declare const getLockedServices: (query?: GetLockedServiceQuery) => Promise<GetLockedServiceResponse>;
3
+ export default getLockedServices;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var userClientRequest_1 = __importDefault(require("../clients/userClientRequest"));
43
+ var getLockedServices = function (query) { return __awaiter(void 0, void 0, void 0, function () {
44
+ var response;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0: return [4 /*yield*/, userClientRequest_1.default.get("/locked-balances/list", {
48
+ params: query,
49
+ })];
50
+ case 1:
51
+ response = _a.sent();
52
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
53
+ }
54
+ });
55
+ }); };
56
+ exports.default = getLockedServices;
@@ -0,0 +1,44 @@
1
+ import { Paginated, Currency } from "../type";
2
+ export interface GetLockedServiceQuery {
3
+ page?: number;
4
+ take?: number;
5
+ from_date?: string;
6
+ to_date?: string;
7
+ }
8
+ export interface GetLockedServiceResponse {
9
+ success: boolean;
10
+ message: string;
11
+ data: Data;
12
+ timestamp: string;
13
+ }
14
+ export interface Data {
15
+ locked_balances: LockedToken[];
16
+ paginated: Paginated;
17
+ }
18
+ export interface LockedToken {
19
+ id: string;
20
+ balance_id: string;
21
+ locked_value: string;
22
+ locked_total_value: string;
23
+ locked_balance_status: string;
24
+ description: null;
25
+ user_created: string;
26
+ user_updated: string;
27
+ date_created: string;
28
+ date_updated: null;
29
+ locked_from_app_slug: string;
30
+ balances: Balances;
31
+ currency: Currency[];
32
+ assets: number;
33
+ }
34
+ export interface Balances {
35
+ id: string;
36
+ master_wallet_id: string;
37
+ currency_slug: string;
38
+ current_value: string;
39
+ total_value: string;
40
+ user_created: string;
41
+ user_updated: string;
42
+ date_created: string;
43
+ date_updated: null;
44
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.575",
3
+ "version": "0.0.576",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",