tek-wallet 0.0.830 → 0.0.831
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/AssetsBoard/index.js +7 -2
- package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.js +1 -1
- package/dist/components/TekWallet/hooks/data/useNfts/api.d.ts +2 -2
- package/dist/components/TekWallet/hooks/data/useNfts/api.js +5 -4
- package/dist/components/TekWallet/hooks/data/useNfts/index.d.ts +37 -31
- package/dist/components/TekWallet/hooks/data/useNfts/index.js +28 -2
- package/dist/components/TekWallet/hooks/data/useNfts/useNft.d.ts +2 -2
- package/dist/components/TekWallet/hooks/data/useNfts/useNft.js +12 -12
- package/dist/components/TekWallet/providers/EventHandlerProvider/index.js +8 -2
- package/dist/components/TekWallet/providers/RealtimeProvider/type.d.ts +2 -1
- package/dist/components/TekWallet/services/axios/get-activities-service/type.d.ts +3 -1
- package/dist/components/TekWallet/services/axios/get-activities-service/type.js +1 -0
- package/package.json +1 -1
|
@@ -25,12 +25,13 @@ var ASSETS_TABS = [
|
|
|
25
25
|
var AssetsBoard = function () {
|
|
26
26
|
var theme = (0, mui_1.useTheme)();
|
|
27
27
|
var swiperRef = (0, react_2.useRef)(null);
|
|
28
|
+
var _a = (0, react_2.useState)(0), totalNfts = _a[0], setTotalNfts = _a[1];
|
|
28
29
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { ref: swiperRef, swiperProps: {
|
|
29
30
|
slidesPerView: 1,
|
|
30
31
|
spaceBetween: 40,
|
|
31
32
|
autoHeight: true,
|
|
32
33
|
}, tabParamName: "assets-tab", tabs: ASSETS_TABS === null || ASSETS_TABS === void 0 ? void 0 : ASSETS_TABS.map(function (type, index) {
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: type.name, value: index, "data-index": index, sx: {
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: "".concat(type.name).concat(type.value === "nfts" ? " (".concat(totalNfts, ")") : ""), value: index, "data-index": index, sx: {
|
|
34
35
|
padding: "".concat(theme.styleMixins.customPadding.p8, " ").concat(theme.styleMixins.customPadding.p16),
|
|
35
36
|
minHeight: "unset",
|
|
36
37
|
minWidth: "unset",
|
|
@@ -56,7 +57,11 @@ var AssetsBoard = function () {
|
|
|
56
57
|
}, children: ASSETS_TABS === null || ASSETS_TABS === void 0 ? void 0 : ASSETS_TABS.map(function (type, index) {
|
|
57
58
|
return ((0, jsx_runtime_1.jsxs)(react_1.SwiperSlide, { style: {
|
|
58
59
|
position: "relative",
|
|
59
|
-
}, children: [type.value === "tokens" && ((0, jsx_runtime_1.jsx)(TokensBoard_1.default, { onDataChanged: function () { var _a; return (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.update(); } })), type.value === "nfts" && ((0, jsx_runtime_1.jsx)(NftsBoard_1.default, { onDataChanged: function () {
|
|
60
|
+
}, children: [type.value === "tokens" && ((0, jsx_runtime_1.jsx)(TokensBoard_1.default, { onDataChanged: function () { var _a; return (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.update(); } })), type.value === "nfts" && ((0, jsx_runtime_1.jsx)(NftsBoard_1.default, { onDataChanged: function (nfts) {
|
|
61
|
+
var _a;
|
|
62
|
+
setTotalNfts((nfts === null || nfts === void 0 ? void 0 : nfts.length) || 0);
|
|
63
|
+
(_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.update();
|
|
64
|
+
} }))] }, index));
|
|
60
65
|
}) }) }));
|
|
61
66
|
};
|
|
62
67
|
exports.AssetsBoard = AssetsBoard;
|
|
@@ -152,7 +152,7 @@ var ConfirmSendExternal = function (_a) {
|
|
|
152
152
|
(0, react_1.useEffect)(function () {
|
|
153
153
|
if (transaction &&
|
|
154
154
|
transaction.id === thisTransactionId.current &&
|
|
155
|
-
transaction.
|
|
155
|
+
transaction.transaction_status !== type_1.TransactionStatus.Processing) {
|
|
156
156
|
setResponse(transaction);
|
|
157
157
|
}
|
|
158
158
|
}, [transaction]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GetNftsServiceQuery,
|
|
1
|
+
import { GetNftsServiceQuery, MintNfsPayload, Nft, NftData, SendNftPayload } from "./service.type";
|
|
2
2
|
import { Transaction } from "../../../services/axios/get-activities-service/type";
|
|
3
|
-
export declare const getNftsServices: (query?: GetNftsServiceQuery) => Promise<
|
|
3
|
+
export declare const getNftsServices: (query?: GetNftsServiceQuery) => Promise<NftData>;
|
|
4
4
|
export declare const mintNftServices: (payload?: MintNfsPayload) => Promise<Nft>;
|
|
5
5
|
export declare const sendNftServices: (payload?: SendNftPayload) => Promise<Transaction>;
|
|
@@ -43,14 +43,15 @@ exports.sendNftServices = exports.mintNftServices = exports.getNftsServices = vo
|
|
|
43
43
|
var userClientRequest_1 = __importDefault(require("../../../services/axios/clients/userClientRequest"));
|
|
44
44
|
var getNftsServices = function (query) { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
45
|
var response;
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
var _a;
|
|
47
|
+
return __generator(this, function (_b) {
|
|
48
|
+
switch (_b.label) {
|
|
48
49
|
case 0: return [4 /*yield*/, userClientRequest_1.default.get("/nft", {
|
|
49
50
|
params: query,
|
|
50
51
|
})];
|
|
51
52
|
case 1:
|
|
52
|
-
response =
|
|
53
|
-
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
|
|
53
|
+
response = _b.sent();
|
|
54
|
+
return [2 /*return*/, (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data];
|
|
54
55
|
}
|
|
55
56
|
});
|
|
56
57
|
}); };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nft, NftData } from "./service.type";
|
|
2
2
|
declare function useNfts(enabled?: boolean): {
|
|
3
3
|
error: Error;
|
|
4
4
|
isError: true;
|
|
@@ -9,8 +9,8 @@ declare function useNfts(enabled?: boolean): {
|
|
|
9
9
|
isSuccess: false;
|
|
10
10
|
isPlaceholderData: false;
|
|
11
11
|
status: "error";
|
|
12
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
13
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
12
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
13
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
14
14
|
hasNextPage: boolean;
|
|
15
15
|
hasPreviousPage: boolean;
|
|
16
16
|
isFetchNextPageError: boolean;
|
|
@@ -30,10 +30,11 @@ declare function useNfts(enabled?: boolean): {
|
|
|
30
30
|
isRefetching: boolean;
|
|
31
31
|
isStale: boolean;
|
|
32
32
|
isEnabled: boolean;
|
|
33
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
33
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
34
34
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
35
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
36
|
-
nfts:
|
|
35
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<NftData, unknown>>;
|
|
36
|
+
nfts: Nft[];
|
|
37
|
+
insertNft: (nft: Nft) => void;
|
|
37
38
|
} | {
|
|
38
39
|
error: null;
|
|
39
40
|
isError: false;
|
|
@@ -46,8 +47,8 @@ declare function useNfts(enabled?: boolean): {
|
|
|
46
47
|
isSuccess: true;
|
|
47
48
|
isPlaceholderData: false;
|
|
48
49
|
status: "success";
|
|
49
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
50
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
50
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
51
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
51
52
|
hasNextPage: boolean;
|
|
52
53
|
hasPreviousPage: boolean;
|
|
53
54
|
isFetchingNextPage: boolean;
|
|
@@ -65,10 +66,11 @@ declare function useNfts(enabled?: boolean): {
|
|
|
65
66
|
isRefetching: boolean;
|
|
66
67
|
isStale: boolean;
|
|
67
68
|
isEnabled: boolean;
|
|
68
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
69
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
69
70
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
70
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
71
|
-
nfts:
|
|
71
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<NftData, unknown>>;
|
|
72
|
+
nfts: Nft[];
|
|
73
|
+
insertNft: (nft: Nft) => void;
|
|
72
74
|
} | {
|
|
73
75
|
error: Error;
|
|
74
76
|
isError: true;
|
|
@@ -81,8 +83,8 @@ declare function useNfts(enabled?: boolean): {
|
|
|
81
83
|
isSuccess: false;
|
|
82
84
|
isPlaceholderData: false;
|
|
83
85
|
status: "error";
|
|
84
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
85
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
86
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
87
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
86
88
|
hasNextPage: boolean;
|
|
87
89
|
hasPreviousPage: boolean;
|
|
88
90
|
isFetchingNextPage: boolean;
|
|
@@ -100,10 +102,11 @@ declare function useNfts(enabled?: boolean): {
|
|
|
100
102
|
isRefetching: boolean;
|
|
101
103
|
isStale: boolean;
|
|
102
104
|
isEnabled: boolean;
|
|
103
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
105
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
104
106
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
105
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
106
|
-
nfts:
|
|
107
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<NftData, unknown>>;
|
|
108
|
+
nfts: Nft[];
|
|
109
|
+
insertNft: (nft: Nft) => void;
|
|
107
110
|
} | {
|
|
108
111
|
error: null;
|
|
109
112
|
isError: false;
|
|
@@ -116,8 +119,8 @@ declare function useNfts(enabled?: boolean): {
|
|
|
116
119
|
isSuccess: false;
|
|
117
120
|
isPlaceholderData: false;
|
|
118
121
|
status: "pending";
|
|
119
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
120
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
122
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
123
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
121
124
|
hasNextPage: boolean;
|
|
122
125
|
hasPreviousPage: boolean;
|
|
123
126
|
isFetchingNextPage: boolean;
|
|
@@ -135,10 +138,11 @@ declare function useNfts(enabled?: boolean): {
|
|
|
135
138
|
isRefetching: boolean;
|
|
136
139
|
isStale: boolean;
|
|
137
140
|
isEnabled: boolean;
|
|
138
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
141
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
139
142
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
140
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
141
|
-
nfts:
|
|
143
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<NftData, unknown>>;
|
|
144
|
+
nfts: Nft[];
|
|
145
|
+
insertNft: (nft: Nft) => void;
|
|
142
146
|
} | {
|
|
143
147
|
error: null;
|
|
144
148
|
isError: false;
|
|
@@ -150,8 +154,8 @@ declare function useNfts(enabled?: boolean): {
|
|
|
150
154
|
isSuccess: false;
|
|
151
155
|
isPlaceholderData: false;
|
|
152
156
|
status: "pending";
|
|
153
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
154
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
157
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
158
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
155
159
|
hasNextPage: boolean;
|
|
156
160
|
hasPreviousPage: boolean;
|
|
157
161
|
isFetchingNextPage: boolean;
|
|
@@ -170,10 +174,11 @@ declare function useNfts(enabled?: boolean): {
|
|
|
170
174
|
isRefetching: boolean;
|
|
171
175
|
isStale: boolean;
|
|
172
176
|
isEnabled: boolean;
|
|
173
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
177
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
174
178
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
175
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
176
|
-
nfts:
|
|
179
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<NftData, unknown>>;
|
|
180
|
+
nfts: Nft[];
|
|
181
|
+
insertNft: (nft: Nft) => void;
|
|
177
182
|
} | {
|
|
178
183
|
isError: false;
|
|
179
184
|
error: null;
|
|
@@ -186,8 +191,8 @@ declare function useNfts(enabled?: boolean): {
|
|
|
186
191
|
isFetchNextPageError: false;
|
|
187
192
|
isFetchPreviousPageError: false;
|
|
188
193
|
status: "success";
|
|
189
|
-
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
190
|
-
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
194
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
195
|
+
fetchPreviousPage: (options?: import("@tanstack/react-query").FetchPreviousPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
191
196
|
hasNextPage: boolean;
|
|
192
197
|
hasPreviousPage: boolean;
|
|
193
198
|
isFetchingNextPage: boolean;
|
|
@@ -205,9 +210,10 @@ declare function useNfts(enabled?: boolean): {
|
|
|
205
210
|
isRefetching: boolean;
|
|
206
211
|
isStale: boolean;
|
|
207
212
|
isEnabled: boolean;
|
|
208
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<
|
|
213
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<NftData, unknown>, Error>>;
|
|
209
214
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
210
|
-
promise: Promise<import("@tanstack/react-query").InfiniteData<
|
|
211
|
-
nfts:
|
|
215
|
+
promise: Promise<import("@tanstack/react-query").InfiniteData<NftData, unknown>>;
|
|
216
|
+
nfts: Nft[];
|
|
217
|
+
insertNft: (nft: Nft) => void;
|
|
212
218
|
};
|
|
213
219
|
export default useNfts;
|
|
@@ -21,6 +21,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
}
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
25
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26
|
+
if (ar || !(i in from)) {
|
|
27
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
28
|
+
ar[i] = from[i];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
|
+
};
|
|
24
33
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
34
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
35
|
};
|
|
@@ -30,10 +39,12 @@ var api_1 = require("./api");
|
|
|
30
39
|
var useQueryKeyDependenceOnAccount_1 = __importDefault(require("../../store/useQueryKeys/useQueryKeyDependenceOnAccount"));
|
|
31
40
|
var type_1 = require("../../store/useQueryKeys/type");
|
|
32
41
|
var react_1 = require("react");
|
|
42
|
+
var useEditPageQuery_1 = __importDefault(require("../../utils/useEditPageQuery"));
|
|
33
43
|
var LIMIT = 20;
|
|
34
44
|
function useNfts(enabled) {
|
|
35
45
|
if (enabled === void 0) { enabled = true; }
|
|
36
46
|
var _a = (0, useQueryKeyDependenceOnAccount_1.default)(type_1.QueryKeyNames.NFTs), queryKeyAccount = _a.queryKey, isReadyAccount = _a.isReady;
|
|
47
|
+
var editPageQuery = (0, useEditPageQuery_1.default)().editPageQuery;
|
|
37
48
|
var _b = (0, react_query_1.useInfiniteQuery)({
|
|
38
49
|
queryKey: queryKeyAccount,
|
|
39
50
|
queryFn: function (_a) {
|
|
@@ -47,9 +58,24 @@ function useNfts(enabled) {
|
|
|
47
58
|
initialPageParam: undefined,
|
|
48
59
|
enabled: enabled && isReadyAccount,
|
|
49
60
|
}), data = _b.data, rest = __rest(_b, ["data"]);
|
|
61
|
+
var insertNft = (0, react_1.useCallback)(function (nft) {
|
|
62
|
+
if (!nft)
|
|
63
|
+
return;
|
|
64
|
+
editPageQuery(queryKeyAccount, function (page, index, pages) {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
var isLastPage = index === ((pages === null || pages === void 0 ? void 0 : pages.length) || 0) - 1;
|
|
67
|
+
if (!isLastPage)
|
|
68
|
+
return __assign(__assign({}, page), { paginated: __assign(__assign({}, page === null || page === void 0 ? void 0 : page.paginated), { total: ((_a = page === null || page === void 0 ? void 0 : page.paginated) === null || _a === void 0 ? void 0 : _a.total) + 1 }) });
|
|
69
|
+
var newPage = {
|
|
70
|
+
nfts: __spreadArray(__spreadArray([], page === null || page === void 0 ? void 0 : page.nfts, true), [nft], false),
|
|
71
|
+
paginated: __assign(__assign({}, page === null || page === void 0 ? void 0 : page.paginated), { total: ((_b = page === null || page === void 0 ? void 0 : page.paginated) === null || _b === void 0 ? void 0 : _b.total) + 1 }),
|
|
72
|
+
};
|
|
73
|
+
return newPage;
|
|
74
|
+
});
|
|
75
|
+
}, [editPageQuery, queryKeyAccount]);
|
|
50
76
|
var nfts = (0, react_1.useMemo)(function () {
|
|
51
|
-
return (data === null || data === void 0 ? void 0 : data.pages.flatMap(function (page) {
|
|
77
|
+
return (data === null || data === void 0 ? void 0 : data.pages.flatMap(function (page) { return page === null || page === void 0 ? void 0 : page.nfts; })) || [];
|
|
52
78
|
}, [data]);
|
|
53
|
-
return __assign({ nfts: nfts }, rest);
|
|
79
|
+
return __assign({ nfts: nfts, insertNft: insertNft }, rest);
|
|
54
80
|
}
|
|
55
81
|
exports.default = useNfts;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Nft,
|
|
1
|
+
import { Nft, SendNftPayload, NftData } from "./service.type";
|
|
2
2
|
import { ReactEventHandler } from "react";
|
|
3
3
|
import { Voucher } from "../useVouchers/service.type";
|
|
4
4
|
import { InfiniteData } from "@tanstack/react-query";
|
|
5
5
|
import { Transaction } from "../../../services/axios/get-activities-service/type";
|
|
6
6
|
type MintNftContext = {
|
|
7
|
-
previousData?: InfiniteData<
|
|
7
|
+
previousData?: InfiniteData<NftData>;
|
|
8
8
|
};
|
|
9
9
|
declare function useNft(id?: string, useSnapshot?: boolean): {
|
|
10
10
|
metadataAttributes: Voucher | null;
|
|
@@ -99,10 +99,10 @@ function useNft(id, useSnapshot) {
|
|
|
99
99
|
return __generator(this, function (_a) {
|
|
100
100
|
switch (_a.label) {
|
|
101
101
|
case 0: return [4 /*yield*/, editPageQuery(queryKey, function (page) {
|
|
102
|
-
var _a
|
|
103
|
-
return __assign(__assign({}, page), {
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
var _a;
|
|
103
|
+
return __assign(__assign({}, page), { nfts: (_a = page === null || page === void 0 ? void 0 : page.nfts) === null || _a === void 0 ? void 0 : _a.map(function (item) {
|
|
104
|
+
return item.id === (nft === null || nft === void 0 ? void 0 : nft.id) ? __assign(__assign({}, item), { status: service_type_1.NftStatus.MINTING }) : item;
|
|
105
|
+
}) });
|
|
106
106
|
})];
|
|
107
107
|
case 1:
|
|
108
108
|
previousData = (_a.sent()).previousData;
|
|
@@ -117,8 +117,8 @@ function useNft(id, useSnapshot) {
|
|
|
117
117
|
type: "success",
|
|
118
118
|
});
|
|
119
119
|
editPageQuery(queryKey, function (page) {
|
|
120
|
-
var _a
|
|
121
|
-
return __assign(__assign({}, page), {
|
|
120
|
+
var _a;
|
|
121
|
+
return __assign(__assign({}, page), { nfts: (_a = page === null || page === void 0 ? void 0 : page.nfts) === null || _a === void 0 ? void 0 : _a.map(function (item) { return (item.id === (nft === null || nft === void 0 ? void 0 : nft.id) ? newNft : item); }) });
|
|
122
122
|
});
|
|
123
123
|
},
|
|
124
124
|
onError: function (_, __, context) {
|
|
@@ -139,10 +139,10 @@ function useNft(id, useSnapshot) {
|
|
|
139
139
|
return __generator(this, function (_a) {
|
|
140
140
|
switch (_a.label) {
|
|
141
141
|
case 0: return [4 /*yield*/, editPageQuery(queryKey, function (page) {
|
|
142
|
-
var _a
|
|
143
|
-
return __assign(__assign({}, page), {
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
var _a;
|
|
143
|
+
return __assign(__assign({}, page), { nfts: (_a = page === null || page === void 0 ? void 0 : page.nfts) === null || _a === void 0 ? void 0 : _a.map(function (item) {
|
|
144
|
+
return item.id === (nft === null || nft === void 0 ? void 0 : nft.id) ? __assign(__assign({}, item), { status: service_type_1.NftStatus.SENDING }) : item;
|
|
145
|
+
}) });
|
|
146
146
|
})];
|
|
147
147
|
case 1:
|
|
148
148
|
previousData = (_a.sent()).previousData;
|
|
@@ -152,8 +152,8 @@ function useNft(id, useSnapshot) {
|
|
|
152
152
|
}); },
|
|
153
153
|
onSuccess: function (transaction, variables) {
|
|
154
154
|
editPageQuery(queryKey, function (page) {
|
|
155
|
-
var _a
|
|
156
|
-
return __assign(__assign({}, page), {
|
|
155
|
+
var _a;
|
|
156
|
+
return __assign(__assign({}, page), { nfts: (_a = page === null || page === void 0 ? void 0 : page.nfts) === null || _a === void 0 ? void 0 : _a.filter(function (item) { return item.id !== (variables === null || variables === void 0 ? void 0 : variables.id); }) });
|
|
157
157
|
});
|
|
158
158
|
},
|
|
159
159
|
onError: function (_, __, context) {
|
|
@@ -25,21 +25,27 @@ var useCustomRouter_1 = __importDefault(require("../../hooks/useCustomRouter"));
|
|
|
25
25
|
var type_1 = require("../../services/axios/get-activities-service/type");
|
|
26
26
|
var components_1 = require("../../components");
|
|
27
27
|
var useRefetchOnWindowFocused_1 = require("../../hooks/useRefetchOnWindowFocused");
|
|
28
|
+
var useNfts_1 = __importDefault(require("../../hooks/data/useNfts"));
|
|
28
29
|
function EventHandlerProvider(props) {
|
|
29
30
|
var _a = (0, useEventHandler_1.useEventHandler)(), transactionHandler = _a.transactionHandler, walletInfoHandler = _a.walletInfoHandler, updateData = _a.updateData;
|
|
30
31
|
var _b = (0, useRealtime_1.default)(), pushNotification = _b.pushNotification, transaction = _b.transaction, walletHandlerInfo = _b.walletHandlerInfo;
|
|
32
|
+
var insertNft = (0, useNfts_1.default)().insertNft;
|
|
31
33
|
var router = (0, useCustomRouter_1.default)();
|
|
32
34
|
var options = (0, TekWalletProvider_1.useWalletSetup)().options;
|
|
33
35
|
(0, react_1.useEffect)(function () {
|
|
34
36
|
router.prefetch("".concat(options === null || options === void 0 ? void 0 : options.basePath, "/tek-wallet/activities/abc"));
|
|
35
37
|
}, [router, options === null || options === void 0 ? void 0 : options.basePath]);
|
|
36
38
|
(0, react_1.useEffect)(function () {
|
|
37
|
-
var _a;
|
|
39
|
+
var _a, _b;
|
|
38
40
|
if (!transactionHandler || !transaction)
|
|
39
41
|
return;
|
|
42
|
+
if (((_a = transaction.transaction_type) === null || _a === void 0 ? void 0 : _a.slug) === type_1.TransactionSlug.RECEIVE_NFT) {
|
|
43
|
+
insertNft(transaction);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
40
46
|
var theMessage = transactionHandler(transaction);
|
|
41
47
|
if (theMessage) {
|
|
42
|
-
if ((
|
|
48
|
+
if ((_b = theMessage.id) === null || _b === void 0 ? void 0 : _b.includes("processing")) {
|
|
43
49
|
return;
|
|
44
50
|
}
|
|
45
51
|
var onClickNotification = function () {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { Transaction } from "../../services/axios/get-activities-service/type";
|
|
2
3
|
export interface RealtimeProviderDataType {
|
|
3
|
-
transaction:
|
|
4
|
+
transaction: Transaction | undefined;
|
|
4
5
|
walletHandlerInfo: any;
|
|
5
6
|
isConnected: boolean;
|
|
6
7
|
pushNotification: (notification: NotificationType) => void;
|
|
@@ -40,6 +40,7 @@ export interface Transaction {
|
|
|
40
40
|
to_currency_data?: ToCurrencyData;
|
|
41
41
|
to_amount?: string;
|
|
42
42
|
message?: string;
|
|
43
|
+
order_id?: string;
|
|
43
44
|
}
|
|
44
45
|
export interface ToCurrencyData {
|
|
45
46
|
decimal: number;
|
|
@@ -82,7 +83,8 @@ export declare enum TransactionSlug {
|
|
|
82
83
|
CAPITAL_ADJUSTMENT = "capital-adjustment",
|
|
83
84
|
LOCKED_BALANCE = "locked_balance",
|
|
84
85
|
UNLOCKED_BALANCE = "unlock-balances",
|
|
85
|
-
INSTRUCTION = "instruction"
|
|
86
|
+
INSTRUCTION = "instruction",
|
|
87
|
+
RECEIVE_NFT = "receive-nft"
|
|
86
88
|
}
|
|
87
89
|
export declare enum TransactionStatus {
|
|
88
90
|
Processing = "processing",
|
|
@@ -15,6 +15,7 @@ var TransactionSlug;
|
|
|
15
15
|
TransactionSlug["LOCKED_BALANCE"] = "locked_balance";
|
|
16
16
|
TransactionSlug["UNLOCKED_BALANCE"] = "unlock-balances";
|
|
17
17
|
TransactionSlug["INSTRUCTION"] = "instruction";
|
|
18
|
+
TransactionSlug["RECEIVE_NFT"] = "receive-nft";
|
|
18
19
|
})(TransactionSlug || (exports.TransactionSlug = TransactionSlug = {}));
|
|
19
20
|
var TransactionStatus;
|
|
20
21
|
(function (TransactionStatus) {
|