getgems 1.0.0

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.
@@ -0,0 +1,100 @@
1
+ import { ApiService, AfterParameter, LimitParameter, MinTimeParameter, MaxTimeParameter, ECollectionsTopKind } from "../api-service";
2
+ import { BuyNftFixPriceRequest, CheckTxPayload, CollectionsTopResponse, DefaultErrorObject, EHistoryType, FailedResponse, NftCollectionAttributesResponse, NftCollectionFloorResponse, NftCollectionFullResponse, NftCollectionOwnersTopResponse, NftCollectionsFullResponse, NftCollectionStatsCountResponse, NftCollectionStatsResponse, NftItemFullResponse, NftItemHistoryResponse, NftItemsByAddressRequestBody, NftItemsFullNoCursorResponse, NftItemsFullResponse, NftItemsUpdateResponse, NftStickerCollectionsFullResponse, PutUpNftForSaleRequest, ReindexResponse, TonTxStatusResponse, TransactionResponse, UserTradingInfoResponse } from "../schemas";
3
+ export declare class ReadApiService extends ApiService {
4
+ constructor(API_KEY: string);
5
+ getCollectionByAddress(collectionAddress: string): Promise<FailedResponse | NftCollectionFullResponse>;
6
+ getNftByAddress(nftAddress: string): Promise<FailedResponse | NftItemFullResponse>;
7
+ getCollectionNfts(collectionAddress: string, queryParams?: {
8
+ after?: AfterParameter;
9
+ limit?: LimitParameter;
10
+ }): Promise<FailedResponse | NftItemsFullResponse>;
11
+ getOwnerNfts(ownerAddress: string, queryParams?: {
12
+ after?: AfterParameter;
13
+ limit?: LimitParameter;
14
+ }): Promise<FailedResponse | NftItemsFullResponse>;
15
+ getCollectionOwnerNfts(collectionAddress: string, ownerAddress: string, queryParams?: {
16
+ after?: AfterParameter;
17
+ limit?: LimitParameter;
18
+ }): Promise<FailedResponse | NftItemsFullResponse>;
19
+ getNftsOnSale(collectionAddress: string, queryParams?: {
20
+ after?: AfterParameter;
21
+ limit?: LimitParameter;
22
+ }): Promise<DefaultErrorObject | NftItemsFullResponse>;
23
+ getOffchainNftsOnSale(collectionAddress: string, queryParams?: {
24
+ after?: AfterParameter;
25
+ limit?: LimitParameter;
26
+ }): Promise<DefaultErrorObject | NftItemsFullResponse>;
27
+ getOffchainGiftsOnSale(queryParams?: {
28
+ after?: AfterParameter;
29
+ limit?: LimitParameter;
30
+ }): Promise<DefaultErrorObject | NftItemsFullResponse>;
31
+ getNftsByAddresses(body: NftItemsByAddressRequestBody): Promise<DefaultErrorObject | NftItemsFullNoCursorResponse>;
32
+ getNftsUpdates(queryParams?: {
33
+ after?: AfterParameter;
34
+ limit?: LimitParameter;
35
+ }): Promise<FailedResponse | NftItemsUpdateResponse>;
36
+ getCollectionStats(collectionAddress: string): Promise<FailedResponse | NftCollectionStatsResponse>;
37
+ getNftHistory(nftAddress: string, queryParams?: {
38
+ minTime?: MinTimeParameter;
39
+ maxTime?: MaxTimeParameter;
40
+ after?: AfterParameter;
41
+ limit?: LimitParameter;
42
+ types?: EHistoryType[];
43
+ reverse?: boolean;
44
+ }): Promise<FailedResponse | NftItemHistoryResponse>;
45
+ getNftCollectionHistory(collectionAddress: string, queryParams?: {
46
+ minTime?: MinTimeParameter;
47
+ maxTime?: MaxTimeParameter;
48
+ after?: AfterParameter;
49
+ limit?: LimitParameter;
50
+ types?: EHistoryType[];
51
+ reverse?: boolean;
52
+ }): Promise<FailedResponse | NftItemHistoryResponse>;
53
+ getGiftsHistory(queryParams?: {
54
+ minTime?: MinTimeParameter;
55
+ maxTime?: MaxTimeParameter;
56
+ after?: AfterParameter;
57
+ limit?: LimitParameter;
58
+ types?: EHistoryType[];
59
+ reverse?: boolean;
60
+ }): Promise<FailedResponse | NftItemHistoryResponse>;
61
+ getStickersHistory(queryParams?: {
62
+ minTime?: MinTimeParameter;
63
+ maxTime?: MaxTimeParameter;
64
+ after?: AfterParameter;
65
+ limit?: LimitParameter;
66
+ types?: EHistoryType[];
67
+ reverse?: boolean;
68
+ }): Promise<FailedResponse | NftItemHistoryResponse>;
69
+ buyNftFixPrice(nftAddress: string, body: BuyNftFixPriceRequest): Promise<FailedResponse | TransactionResponse>;
70
+ putUpNftForSaleFixPrice(nftAddress: string, body: PutUpNftForSaleRequest): Promise<FailedResponse | TransactionResponse>;
71
+ getCollectionStatsCount(collectionAddress: string): Promise<FailedResponse | NftCollectionStatsCountResponse>;
72
+ getCollectionTopOwners(collectionAddress: string, queryParams?: {
73
+ after?: AfterParameter;
74
+ limit?: LimitParameter;
75
+ }): Promise<FailedResponse | NftCollectionOwnersTopResponse>;
76
+ getCollectionAttributes(collectionAddress: string): Promise<FailedResponse | NftCollectionAttributesResponse>;
77
+ getCollectionBasicInfo(collectionAddress: string): Promise<FailedResponse | NftCollectionFloorResponse>;
78
+ reindexNftCollection(collectionAddress: string): Promise<FailedResponse | ReindexResponse>;
79
+ reindexNftItem(nftAddress: string): Promise<FailedResponse | ReindexResponse>;
80
+ getUserTradingInfo(userAddress: string): Promise<FailedResponse | UserTradingInfoResponse>;
81
+ getGiftCollections(queryParams?: {
82
+ after?: AfterParameter;
83
+ limit?: LimitParameter;
84
+ }): Promise<FailedResponse | NftCollectionsFullResponse>;
85
+ getStickerCollections(queryParams: {
86
+ after?: AfterParameter;
87
+ limit?: LimitParameter;
88
+ }): Promise<FailedResponse | NftStickerCollectionsFullResponse>;
89
+ checkTxStatus(body: CheckTxPayload): Promise<FailedResponse | TonTxStatusResponse>;
90
+ getCollectionTop(queryParams?: {
91
+ kind?: ECollectionsTopKind;
92
+ after?: AfterParameter;
93
+ limit?: LimitParameter;
94
+ }): Promise<FailedResponse | CollectionsTopResponse>;
95
+ getGiftTop(queryParams?: {
96
+ kind?: ECollectionsTopKind;
97
+ after?: AfterParameter;
98
+ limit?: LimitParameter;
99
+ }): Promise<FailedResponse | CollectionsTopResponse>;
100
+ }
@@ -0,0 +1,328 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ReadApiService = void 0;
13
+ const api_service_1 = require("../api-service");
14
+ class ReadApiService extends api_service_1.ApiService {
15
+ constructor(API_KEY) {
16
+ super(API_KEY);
17
+ }
18
+ //Get NFT collection info
19
+ getCollectionByAddress(collectionAddress) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ return this.makeApiRequest({
22
+ method: api_service_1.EApiRequestMethod.GET,
23
+ path: `/v1/collection/${collectionAddress}`,
24
+ });
25
+ });
26
+ }
27
+ //Get info about NFT by address. If there is no such NFT, you will receive error 404.
28
+ getNftByAddress(nftAddress) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ return this.makeApiRequest({
31
+ method: api_service_1.EApiRequestMethod.GET,
32
+ path: `/v1/nft/${nftAddress}`
33
+ });
34
+ });
35
+ }
36
+ //Get NFTs in specified collection
37
+ getCollectionNfts(collectionAddress, queryParams) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ return this.makeApiRequest({
40
+ method: api_service_1.EApiRequestMethod.GET,
41
+ path: `/v1/nfts/collection/${collectionAddress}`,
42
+ queryParams
43
+ });
44
+ });
45
+ }
46
+ //Get NFTs of specified address
47
+ getOwnerNfts(ownerAddress, queryParams) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ return this.makeApiRequest({
50
+ method: api_service_1.EApiRequestMethod.GET,
51
+ path: `/v1/nfts/owner/${ownerAddress}`,
52
+ queryParams
53
+ });
54
+ });
55
+ }
56
+ ;
57
+ //Get collection NFTs by specified owner address
58
+ getCollectionOwnerNfts(collectionAddress, ownerAddress, queryParams) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ return this.makeApiRequest({
61
+ method: api_service_1.EApiRequestMethod.GET,
62
+ path: `/v1/nfts/collection/${collectionAddress}/owner/${ownerAddress}`,
63
+ queryParams
64
+ });
65
+ });
66
+ }
67
+ ;
68
+ //Get Collection NFTs on sale
69
+ getNftsOnSale(collectionAddress, queryParams) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ return this.makeApiRequest({
72
+ method: api_service_1.EApiRequestMethod.GET,
73
+ path: `/v1/nfts/on-sale/${collectionAddress}`,
74
+ queryParams
75
+ });
76
+ });
77
+ }
78
+ ;
79
+ //Get Collection offchain NFTs on sale
80
+ getOffchainNftsOnSale(collectionAddress, queryParams) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ return this.makeApiRequest({
83
+ method: api_service_1.EApiRequestMethod.GET,
84
+ path: `/v1/nfts/offchain/on-sale/${collectionAddress}`,
85
+ queryParams
86
+ });
87
+ });
88
+ }
89
+ ;
90
+ //Get all offchain Telegram Gifts on sale
91
+ getOffchainGiftsOnSale(queryParams) {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ return this.makeApiRequest({
94
+ method: api_service_1.EApiRequestMethod.GET,
95
+ path: `/v1/nfts/offchain/on-sale/gifts`,
96
+ queryParams
97
+ });
98
+ });
99
+ }
100
+ ;
101
+ //Get NFTs by addresses
102
+ getNftsByAddresses(body) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ return this.makeApiRequest({
105
+ method: api_service_1.EApiRequestMethod.POST,
106
+ path: `/v1/nfts/list`,
107
+ body: JSON.stringify(body)
108
+ });
109
+ });
110
+ }
111
+ ;
112
+ //Get NFTs sorted by lastReindexAtCursor for incremental synchronization
113
+ getNftsUpdates(queryParams) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ return this.makeApiRequest({
116
+ method: api_service_1.EApiRequestMethod.GET,
117
+ path: `/v1/nfts/updates`,
118
+ queryParams
119
+ });
120
+ });
121
+ }
122
+ ;
123
+ //Get collection stats
124
+ getCollectionStats(collectionAddress) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ return this.makeApiRequest({
127
+ method: api_service_1.EApiRequestMethod.GET,
128
+ path: `/v1/collection/stats/${collectionAddress}`
129
+ });
130
+ });
131
+ }
132
+ ;
133
+ //Get NFT history
134
+ getNftHistory(nftAddress, queryParams) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ return this.makeApiRequest({
137
+ method: api_service_1.EApiRequestMethod.GET,
138
+ path: `/v1/nft/history/${nftAddress}`,
139
+ queryParams
140
+ });
141
+ });
142
+ }
143
+ ;
144
+ //Get Collection history
145
+ getNftCollectionHistory(collectionAddress, queryParams) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ return this.makeApiRequest({
148
+ method: api_service_1.EApiRequestMethod.GET,
149
+ path: `/v1/collection/history/${collectionAddress}`,
150
+ queryParams
151
+ });
152
+ });
153
+ }
154
+ ;
155
+ //Get Telegram Gifts history
156
+ getGiftsHistory(queryParams) {
157
+ return __awaiter(this, void 0, void 0, function* () {
158
+ return this.makeApiRequest({
159
+ method: api_service_1.EApiRequestMethod.GET,
160
+ path: `/v1/nfts/history/gifts`,
161
+ queryParams
162
+ });
163
+ });
164
+ }
165
+ ;
166
+ //Get Telegram Stickers history
167
+ getStickersHistory(queryParams) {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ return this.makeApiRequest({
170
+ method: api_service_1.EApiRequestMethod.GET,
171
+ path: `/v1/nfts/history/stickers`,
172
+ queryParams
173
+ });
174
+ });
175
+ }
176
+ ;
177
+ //Create transaction to buy NFT on sale
178
+ buyNftFixPrice(nftAddress, body) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ return this.makeApiRequest({
181
+ method: api_service_1.EApiRequestMethod.POST,
182
+ path: `/v1/nfts/buy-fix-price/${nftAddress}`,
183
+ body: JSON.stringify(body)
184
+ });
185
+ });
186
+ }
187
+ ;
188
+ //Create transaction to put up NFT for sale (fix price)
189
+ putUpNftForSaleFixPrice(nftAddress, body) {
190
+ return __awaiter(this, void 0, void 0, function* () {
191
+ return this.makeApiRequest({
192
+ method: api_service_1.EApiRequestMethod.POST,
193
+ path: `/v1/nfts/put-on-sale-fix-price/${nftAddress}`,
194
+ body: JSON.stringify(body)
195
+ });
196
+ });
197
+ }
198
+ ;
199
+ //Get collection owners statistics
200
+ getCollectionStatsCount(collectionAddress) {
201
+ return __awaiter(this, void 0, void 0, function* () {
202
+ return this.makeApiRequest({
203
+ method: api_service_1.EApiRequestMethod.GET,
204
+ path: `/v1/collection/stats-count/${collectionAddress}`
205
+ });
206
+ });
207
+ }
208
+ ;
209
+ //Get collection owners top
210
+ getCollectionTopOwners(collectionAddress, queryParams) {
211
+ return __awaiter(this, void 0, void 0, function* () {
212
+ return this.makeApiRequest({
213
+ method: api_service_1.EApiRequestMethod.GET,
214
+ path: `/v1/collection/top-owners/${collectionAddress}`,
215
+ queryParams
216
+ });
217
+ });
218
+ }
219
+ ;
220
+ //Get collection attributes
221
+ getCollectionAttributes(collectionAddress) {
222
+ return __awaiter(this, void 0, void 0, function* () {
223
+ return this.makeApiRequest({
224
+ method: api_service_1.EApiRequestMethod.GET,
225
+ path: `/v1/collection/attributes/${collectionAddress}`
226
+ });
227
+ });
228
+ }
229
+ ;
230
+ //NOT IMPLEMENTED. Get user NFTs in specified collection
231
+ //async userSearch() { };
232
+ //Get collection basic info data
233
+ getCollectionBasicInfo(collectionAddress) {
234
+ return __awaiter(this, void 0, void 0, function* () {
235
+ return this.makeApiRequest({
236
+ method: api_service_1.EApiRequestMethod.GET,
237
+ path: `/v1/collection/basic-info/${collectionAddress}`
238
+ });
239
+ });
240
+ }
241
+ ;
242
+ //Reindex Nft collection metadata
243
+ reindexNftCollection(collectionAddress) {
244
+ return __awaiter(this, void 0, void 0, function* () {
245
+ return this.makeApiRequest({
246
+ method: api_service_1.EApiRequestMethod.POST,
247
+ path: `/v1/collection/reindex/${collectionAddress}`
248
+ });
249
+ });
250
+ }
251
+ ;
252
+ //Reindex Nft metadata
253
+ reindexNftItem(nftAddress) {
254
+ return __awaiter(this, void 0, void 0, function* () {
255
+ return this.makeApiRequest({
256
+ method: api_service_1.EApiRequestMethod.POST,
257
+ path: `/v1/nft/reindex/${nftAddress}`
258
+ });
259
+ });
260
+ }
261
+ ;
262
+ //Get user trading info
263
+ getUserTradingInfo(userAddress) {
264
+ return __awaiter(this, void 0, void 0, function* () {
265
+ return this.makeApiRequest({
266
+ method: api_service_1.EApiRequestMethod.GET,
267
+ path: `/v1/user-trading-info/${userAddress}`
268
+ });
269
+ });
270
+ }
271
+ ;
272
+ //Get gift collections
273
+ getGiftCollections(queryParams) {
274
+ return __awaiter(this, void 0, void 0, function* () {
275
+ return this.makeApiRequest({
276
+ method: api_service_1.EApiRequestMethod.GET,
277
+ path: `/v1/gifts/collections`,
278
+ queryParams
279
+ });
280
+ });
281
+ }
282
+ ;
283
+ //Get sticker collections
284
+ getStickerCollections(queryParams) {
285
+ return __awaiter(this, void 0, void 0, function* () {
286
+ return this.makeApiRequest({
287
+ method: api_service_1.EApiRequestMethod.GET,
288
+ path: `/v1/stickers/collections`,
289
+ queryParams
290
+ });
291
+ });
292
+ }
293
+ ;
294
+ //Check transaction status
295
+ checkTxStatus(body) {
296
+ return __awaiter(this, void 0, void 0, function* () {
297
+ return this.makeApiRequest({
298
+ method: api_service_1.EApiRequestMethod.POST,
299
+ path: `/v1/check-tx-status`,
300
+ body: JSON.stringify(body)
301
+ });
302
+ });
303
+ }
304
+ ;
305
+ //Get top collections
306
+ getCollectionTop(queryParams) {
307
+ return __awaiter(this, void 0, void 0, function* () {
308
+ return this.makeApiRequest({
309
+ method: api_service_1.EApiRequestMethod.GET,
310
+ path: `/v1/collections/top`,
311
+ queryParams
312
+ });
313
+ });
314
+ }
315
+ ;
316
+ //Get top gift collections
317
+ getGiftTop(queryParams) {
318
+ return __awaiter(this, void 0, void 0, function* () {
319
+ return this.makeApiRequest({
320
+ method: api_service_1.EApiRequestMethod.GET,
321
+ path: `/v1/gifts/collections/top`,
322
+ queryParams
323
+ });
324
+ });
325
+ }
326
+ ;
327
+ }
328
+ exports.ReadApiService = ReadApiService;