tek-wallet 0.0.188 → 0.0.190
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.
|
@@ -35,6 +35,7 @@ var Share_1 = __importDefault(require("../Share"));
|
|
|
35
35
|
var NetworkSelection_1 = __importDefault(require("../NetworkSelection"));
|
|
36
36
|
var TokenSelection_1 = __importDefault(require("../TokenSelection"));
|
|
37
37
|
var CloseModal_1 = __importDefault(require("../CloseModal"));
|
|
38
|
+
var useDepositData_1 = __importDefault(require("../../../hooks/useDepositData"));
|
|
38
39
|
var DepositStep;
|
|
39
40
|
(function (DepositStep) {
|
|
40
41
|
DepositStep[DepositStep["SELECT_TOKEN"] = 1] = "SELECT_TOKEN";
|
|
@@ -53,7 +54,8 @@ var DepositFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
53
54
|
var _a = (0, react_1.useState)(DepositStep.SELECT_TOKEN), currentStep = _a[0], setCurrentStep = _a[1];
|
|
54
55
|
var _b = (0, react_1.useState)(), selectedToken = _b[0], setSelectedToken = _b[1];
|
|
55
56
|
var _c = (0, react_1.useState)(), selectedNetwork = _c[0], setSelectedNetwork = _c[1];
|
|
56
|
-
var
|
|
57
|
+
var _d = (0, useWalletData_1.default)(), tokens = _d.tokens, isAuthenticated = _d.isAuthenticated;
|
|
58
|
+
var _e = (0, useDepositData_1.default)(), depositTokens = _e.depositTokens, updateDepositToken = _e.updateDepositToken;
|
|
57
59
|
var open = function () {
|
|
58
60
|
var _a;
|
|
59
61
|
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
@@ -87,20 +89,24 @@ var DepositFunction = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
87
89
|
setSelectedNetwork(network);
|
|
88
90
|
nextStep();
|
|
89
91
|
};
|
|
92
|
+
(0, react_1.useEffect)(function () {
|
|
93
|
+
if (isAuthenticated && !depositTokens) {
|
|
94
|
+
updateDepositToken();
|
|
95
|
+
}
|
|
96
|
+
}, [isAuthenticated, depositTokens]);
|
|
90
97
|
return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: props.onClose, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { overrideHeader: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { sx: {
|
|
91
98
|
width: "100%",
|
|
92
99
|
paddingBottom: theme.mixins.customPadding.p16,
|
|
93
100
|
display: "flex",
|
|
94
101
|
alignItems: "center",
|
|
95
|
-
my: theme.mixins.customPadding.p24,
|
|
96
102
|
}, overrideBack: handleBack, hideBack: currentStep === DepositStep.SELECT_TOKEN, center: DEPOSIT_STEP_NAME[currentStep], children: (0, jsx_runtime_1.jsx)(CloseModal_1.default, { sx: { marginLeft: "auto" }, onClick: props.onClose }) }), onClose: close, children: (0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: swiperRef, swiperProps: { autoHeight: true, spaceBetween: 32 }, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: tokens === null || tokens === void 0 ? void 0 : tokens.map(function (item) {
|
|
97
103
|
var stringifiedTokenData = JSON.stringify(__assign(__assign({}, item), { name: "Fake", fullname: "Fake fullname" }));
|
|
98
104
|
return ((0, jsx_runtime_1.jsx)(TokenSelection_1.default, { onClick: handleSelectToken, tokenData: stringifiedTokenData, active: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.id) != "kf" }, item.id));
|
|
99
|
-
}) }) }, DepositStep.SELECT_TOKEN), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children:
|
|
105
|
+
}) }) }, DepositStep.SELECT_TOKEN), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: depositTokens === null || depositTokens === void 0 ? void 0 : depositTokens.map(function (item) {
|
|
100
106
|
return ((0, jsx_runtime_1.jsx)(NetworkSelection_1.default, { onClick: handleSelectNetwork, networkData: JSON.stringify({
|
|
101
|
-
name: "network ".concat(item),
|
|
107
|
+
name: "network ".concat(item.id),
|
|
102
108
|
icon: "https://via.placeholder.com/150",
|
|
103
|
-
}) }, item));
|
|
109
|
+
}) }, item.id));
|
|
104
110
|
}) }) }, DepositStep.SELECT_NETWORK), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
105
111
|
display: "flex",
|
|
106
112
|
flexDirection: "column",
|
|
@@ -104,7 +104,7 @@ function DepositProvider(_a) {
|
|
|
104
104
|
case 1:
|
|
105
105
|
response = _a.sent();
|
|
106
106
|
console.warn("🚀 ~ getBalance ~ response:", response);
|
|
107
|
-
setDepositTokens(response === null || response === void 0 ? void 0 : response.
|
|
107
|
+
setDepositTokens(response === null || response === void 0 ? void 0 : response.supported_tokens);
|
|
108
108
|
setIsLoadingDepositToken(false);
|
|
109
109
|
return [3 /*break*/, 3];
|
|
110
110
|
case 2:
|
|
@@ -1,15 +1,4 @@
|
|
|
1
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
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -56,7 +45,11 @@ var getConfigTokenList = function (query) { return __awaiter(void 0, void 0, voi
|
|
|
56
45
|
return __generator(this, function (_a) {
|
|
57
46
|
switch (_a.label) {
|
|
58
47
|
case 0: return [4 /*yield*/, userClientRequest_1.default.get("/platform-config/list-tokens", {
|
|
59
|
-
params:
|
|
48
|
+
params: {
|
|
49
|
+
page: query === null || query === void 0 ? void 0 : query.page,
|
|
50
|
+
take: query === null || query === void 0 ? void 0 : query.take,
|
|
51
|
+
transaction_type: query === null || query === void 0 ? void 0 : query.transactionType,
|
|
52
|
+
},
|
|
60
53
|
})];
|
|
61
54
|
case 1:
|
|
62
55
|
response = _a.sent();
|
|
@@ -170,9 +170,27 @@ export interface DepositTokenListResponse {
|
|
|
170
170
|
timestamp: string;
|
|
171
171
|
}
|
|
172
172
|
export interface DepositTokenList {
|
|
173
|
-
|
|
173
|
+
supported_tokens: DepositCurrency[];
|
|
174
174
|
paginated: Paginated;
|
|
175
175
|
}
|
|
176
|
+
export interface DepositCurrency {
|
|
177
|
+
id: number;
|
|
178
|
+
status: string;
|
|
179
|
+
name: string;
|
|
180
|
+
slug: string;
|
|
181
|
+
is_crypto_token: boolean;
|
|
182
|
+
address: string;
|
|
183
|
+
network: number;
|
|
184
|
+
wallet_integrations_currencies: number;
|
|
185
|
+
wallet_integrations_input_withdrawn: number;
|
|
186
|
+
wallet_integrations_output_withdrawn: number;
|
|
187
|
+
full_name: string;
|
|
188
|
+
icon: string;
|
|
189
|
+
usd_rate: string;
|
|
190
|
+
icon_svg: string;
|
|
191
|
+
network_data: Networkdata;
|
|
192
|
+
balance: string;
|
|
193
|
+
}
|
|
176
194
|
export interface Paginated {
|
|
177
195
|
keyword: string;
|
|
178
196
|
page: number;
|
|
@@ -193,20 +211,3 @@ export interface Networkdata {
|
|
|
193
211
|
slug: string;
|
|
194
212
|
network_type: string;
|
|
195
213
|
}
|
|
196
|
-
export interface DepositCurrency {
|
|
197
|
-
id: number;
|
|
198
|
-
status: string;
|
|
199
|
-
name: string;
|
|
200
|
-
slug: string;
|
|
201
|
-
is_crypto_token: boolean;
|
|
202
|
-
address: string;
|
|
203
|
-
network: number;
|
|
204
|
-
wallet_integrations_currencies: number;
|
|
205
|
-
wallet_integrations_input_withdrawn: number;
|
|
206
|
-
wallet_integrations_output_withdrawn: number;
|
|
207
|
-
full_name: string;
|
|
208
|
-
icon: string;
|
|
209
|
-
usd_rate: string;
|
|
210
|
-
icon_svg: string;
|
|
211
|
-
network_data: Networkdata;
|
|
212
|
-
}
|