@imtbl/blockchain-data 2.0.0-alpha.6 → 2.0.0-alpha.7
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/browser/index.js +501 -3
- package/dist/node/index.cjs +505 -7
- package/dist/node/index.js +501 -3
- package/package.json +3 -3
package/dist/browser/index.js
CHANGED
|
@@ -1,8 +1,506 @@
|
|
|
1
1
|
import { mr } from '@imtbl/generated-clients';
|
|
2
2
|
export { BlockchainData as Types } from '@imtbl/generated-clients';
|
|
3
3
|
import { Environment, addKeysToHeadersOverride } from '@imtbl/config';
|
|
4
|
-
import
|
|
4
|
+
import axios from 'axios';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/index.ts
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/types/errors.ts
|
|
9
|
+
var APIError = class extends Error {
|
|
10
|
+
code;
|
|
11
|
+
details;
|
|
12
|
+
link;
|
|
13
|
+
traceId;
|
|
14
|
+
constructor({
|
|
15
|
+
message,
|
|
16
|
+
code,
|
|
17
|
+
details,
|
|
18
|
+
link,
|
|
19
|
+
trace_id: traceId
|
|
20
|
+
}) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.code = code;
|
|
23
|
+
this.details = details;
|
|
24
|
+
this.link = link;
|
|
25
|
+
this.traceId = traceId;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var defaultHeaders = {
|
|
29
|
+
sdkVersion: "ts-immutable-sdk-multi-rollup-api-client-2.0.0-alpha.7"
|
|
30
|
+
};
|
|
31
|
+
var createAPIConfiguration = (overrides) => {
|
|
32
|
+
const {
|
|
33
|
+
baseConfig,
|
|
34
|
+
basePath,
|
|
35
|
+
headers: baseHeaders
|
|
36
|
+
} = overrides;
|
|
37
|
+
if (!basePath.trim()) {
|
|
38
|
+
throw Error("basePath can not be empty");
|
|
39
|
+
}
|
|
40
|
+
const headers = {
|
|
41
|
+
...baseHeaders || {},
|
|
42
|
+
...addKeysToHeadersOverride(baseConfig, overrides) || {},
|
|
43
|
+
...defaultHeaders
|
|
44
|
+
};
|
|
45
|
+
const configParams = {
|
|
46
|
+
...baseConfig,
|
|
47
|
+
basePath,
|
|
48
|
+
baseOptions: { headers }
|
|
49
|
+
};
|
|
50
|
+
return new mr.Configuration(configParams);
|
|
51
|
+
};
|
|
52
|
+
var BlockchainDataConfiguration = class {
|
|
53
|
+
apiConfig;
|
|
54
|
+
baseConfig;
|
|
55
|
+
constructor({ baseConfig, overrides }) {
|
|
56
|
+
this.baseConfig = baseConfig;
|
|
57
|
+
if (overrides) {
|
|
58
|
+
this.apiConfig = createAPIConfiguration(overrides);
|
|
59
|
+
} else {
|
|
60
|
+
switch (baseConfig.environment) {
|
|
61
|
+
case Environment.SANDBOX: {
|
|
62
|
+
this.apiConfig = createAPIConfiguration({
|
|
63
|
+
basePath: "https://api.sandbox.immutable.com",
|
|
64
|
+
baseConfig
|
|
65
|
+
});
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case Environment.PRODUCTION: {
|
|
69
|
+
this.apiConfig = createAPIConfiguration({
|
|
70
|
+
basePath: "https://api.immutable.com",
|
|
71
|
+
baseConfig
|
|
72
|
+
});
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
default: {
|
|
76
|
+
this.apiConfig = createAPIConfiguration({
|
|
77
|
+
basePath: "https://api.sandbox.immutable.com",
|
|
78
|
+
baseConfig
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function formatError(error) {
|
|
86
|
+
if (axios.isAxiosError(error) && error.response) {
|
|
87
|
+
const apiError = error.response.data;
|
|
88
|
+
if (apiError.code && apiError.message) {
|
|
89
|
+
return new APIError({
|
|
90
|
+
code: apiError.code,
|
|
91
|
+
message: apiError.message,
|
|
92
|
+
details: apiError.details || null,
|
|
93
|
+
link: apiError.link || "",
|
|
94
|
+
trace_id: apiError.trace_id || ""
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return new APIError({
|
|
98
|
+
code: error.code ?? error.response?.status.toString() ?? "unknown_error_code",
|
|
99
|
+
message: String(error),
|
|
100
|
+
details: null,
|
|
101
|
+
link: "",
|
|
102
|
+
trace_id: ""
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return new APIError({
|
|
106
|
+
code: "unknown_error_code",
|
|
107
|
+
message: String(error),
|
|
108
|
+
details: null,
|
|
109
|
+
link: "",
|
|
110
|
+
trace_id: ""
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/blockchain-data.ts
|
|
115
|
+
var BlockchainData = class {
|
|
116
|
+
config;
|
|
117
|
+
activities;
|
|
118
|
+
chains;
|
|
119
|
+
collections;
|
|
120
|
+
nfts;
|
|
121
|
+
nftOwners;
|
|
122
|
+
tokens;
|
|
123
|
+
metadata;
|
|
124
|
+
crafting;
|
|
125
|
+
pricing;
|
|
126
|
+
metadataSearch;
|
|
127
|
+
constructor(moduleConfig) {
|
|
128
|
+
this.config = new BlockchainDataConfiguration(moduleConfig);
|
|
129
|
+
this.activities = new mr.ActivitiesApi(this.config.apiConfig);
|
|
130
|
+
this.chains = new mr.ChainsApi(this.config.apiConfig);
|
|
131
|
+
this.collections = new mr.CollectionsApi(this.config.apiConfig);
|
|
132
|
+
this.nfts = new mr.NftsApi(this.config.apiConfig);
|
|
133
|
+
this.nftOwners = new mr.NftOwnersApi(this.config.apiConfig);
|
|
134
|
+
this.tokens = new mr.TokensApi(this.config.apiConfig);
|
|
135
|
+
this.metadata = new mr.MetadataApi(this.config.apiConfig);
|
|
136
|
+
this.crafting = new mr.CraftingApi(this.config.apiConfig);
|
|
137
|
+
this.pricing = new mr.PricingApi(this.config.apiConfig);
|
|
138
|
+
this.metadataSearch = new mr.MetadataSearchApi(this.config.apiConfig);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* List all activities
|
|
142
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
143
|
+
* @returns a promise that resolves with a list of activities
|
|
144
|
+
* @throws {@link index.APIError}
|
|
145
|
+
*/
|
|
146
|
+
async listActivities(request) {
|
|
147
|
+
return await this.activities.listActivities(request).then((res) => res.data).catch((err) => {
|
|
148
|
+
throw formatError(err);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* List activities sorted by updated_at timestamp ascending, useful for time based data replication
|
|
153
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
154
|
+
* @returns a promise that resolves with a list of activities
|
|
155
|
+
* @throws {@link index.APIError}
|
|
156
|
+
*/
|
|
157
|
+
async listActivityHistory(request) {
|
|
158
|
+
return await this.activities.listActivityHistory(request).then((res) => res.data).catch((err) => {
|
|
159
|
+
throw formatError(err);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get a single activity by ID
|
|
164
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
165
|
+
* @returns a promise that resolves with a single activity
|
|
166
|
+
* @throws {@link index.APIError}
|
|
167
|
+
*/
|
|
168
|
+
async getActivity(request) {
|
|
169
|
+
return await this.activities.getActivity(request).then((res) => res.data).catch((err) => {
|
|
170
|
+
throw formatError(err);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* List supported chains
|
|
175
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
176
|
+
* @returns a promise that resolves with a list of supported chains
|
|
177
|
+
* @throws {@link index.APIError}
|
|
178
|
+
*/
|
|
179
|
+
async listChains(request) {
|
|
180
|
+
return await this.chains.listChains(request).then((res) => res.data).catch((err) => {
|
|
181
|
+
throw formatError(err);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* List all collections
|
|
186
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
187
|
+
* @returns a promise that resolves with a list of collections
|
|
188
|
+
* @throws {@link index.APIError}
|
|
189
|
+
*/
|
|
190
|
+
async listCollections(request) {
|
|
191
|
+
return await this.collections.listCollections(request).then((res) => res.data).catch((err) => {
|
|
192
|
+
throw formatError(err);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* List collections by NFT owner
|
|
197
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
198
|
+
* @returns a promise that resolves with a list of collections
|
|
199
|
+
* @throws {@link index.APIError}
|
|
200
|
+
*/
|
|
201
|
+
async listCollectionsByNFTOwner(request) {
|
|
202
|
+
return await this.collections.listCollectionsByNFTOwner(request).then((res) => res.data).catch((err) => {
|
|
203
|
+
throw formatError(err);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Get a collection by contract address
|
|
208
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
209
|
+
* @returns a promise that resolves with a single collection
|
|
210
|
+
* @throws {@link index.APIError}
|
|
211
|
+
*/
|
|
212
|
+
async getCollection(request) {
|
|
213
|
+
return await this.collections.getCollection(request).then((res) => res.data).catch((err) => {
|
|
214
|
+
throw formatError(err);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get NFT by token ID
|
|
219
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
220
|
+
* @returns a promise that resolves with a single NFT
|
|
221
|
+
* @throws {@link index.APIError}
|
|
222
|
+
*/
|
|
223
|
+
async getNFT(request) {
|
|
224
|
+
return await this.nfts.getNFT(request).then((res) => res.data).catch((err) => {
|
|
225
|
+
throw formatError(err);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* List NFTs by contract address
|
|
230
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
231
|
+
* @returns a promise that resolves with a list of NFTs
|
|
232
|
+
* @throws {@link index.APIError}
|
|
233
|
+
*/
|
|
234
|
+
async listNFTs(request) {
|
|
235
|
+
return await this.nfts.listNFTs(request).then((res) => res.data).catch((err) => {
|
|
236
|
+
throw formatError(err);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* List NFTs by account address
|
|
241
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
242
|
+
* @returns a promise that resolves with a list of NFTs
|
|
243
|
+
* @throws {@link index.APIError}
|
|
244
|
+
*/
|
|
245
|
+
async listNFTsByAccountAddress(request) {
|
|
246
|
+
return await this.nfts.listNFTsByAccountAddress(request).then((res) => res.data).catch((err) => {
|
|
247
|
+
throw formatError(err);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* List All NFTs on a chain
|
|
252
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
253
|
+
* @returns a promise that resolves with a list of NFTs
|
|
254
|
+
* @throws {@link index.APIError}
|
|
255
|
+
*/
|
|
256
|
+
async listAllNFTs(request) {
|
|
257
|
+
return await this.nfts.listAllNFTs(request).then((res) => res.data).catch((err) => {
|
|
258
|
+
throw formatError(err);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Create a mint request to mint a set of NFTs for a given collection
|
|
263
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
264
|
+
* @returns a promise that resolves with the remaining rate limits
|
|
265
|
+
* @throws {@link index.APIError}
|
|
266
|
+
*/
|
|
267
|
+
async createMintRequest(request) {
|
|
268
|
+
return await this.nfts.createMintRequest(request).then((res) => res.data).catch((err) => {
|
|
269
|
+
throw formatError(err);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* List all mint requests for a given contract address
|
|
274
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
275
|
+
* @returns a promise that resolves with a list of mint requests
|
|
276
|
+
* @throws {@link index.APIError}
|
|
277
|
+
*/
|
|
278
|
+
async listMintRequests(request) {
|
|
279
|
+
return await this.nfts.listMintRequests(request).then((res) => res.data).catch((err) => {
|
|
280
|
+
throw formatError(err);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Retrieve the status of a single mint request identified by its reference ID
|
|
285
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
286
|
+
* @returns a promise that resolves with a single mint request
|
|
287
|
+
* @throws {@link index.APIError}
|
|
288
|
+
*/
|
|
289
|
+
async getMintRequest(request) {
|
|
290
|
+
return await this.nfts.getMintRequest(request).then((res) => res.data).catch((err) => {
|
|
291
|
+
throw formatError(err);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* List NFT owners by token ID
|
|
296
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
297
|
+
* @returns a promise that resolves with a list of NFT owners
|
|
298
|
+
* @throws {@link index.APIError}
|
|
299
|
+
*/
|
|
300
|
+
async listNFTOwners(request) {
|
|
301
|
+
return await this.nftOwners.listNFTOwners(request).then((res) => res.data).catch((err) => {
|
|
302
|
+
throw formatError(err);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* List NFT owners by contract address
|
|
307
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
308
|
+
* @returns a promise that resolves with a list of NFT owners
|
|
309
|
+
* @throws {@link index.APIError}
|
|
310
|
+
*/
|
|
311
|
+
async listNFTOwnersByContractAddress(request) {
|
|
312
|
+
return await this.nftOwners.listOwnersByContractAddress(request).then((res) => res.data).catch((err) => {
|
|
313
|
+
throw formatError(err);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* List All NFT owners on a chain
|
|
318
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
319
|
+
* @returns a promise that resolves with a list of NFT owners
|
|
320
|
+
* @throws {@link index.APIError}
|
|
321
|
+
*/
|
|
322
|
+
async listAllNFTOwners(request) {
|
|
323
|
+
return await this.nftOwners.listAllNFTOwners(request).then((res) => res.data).catch((err) => {
|
|
324
|
+
throw formatError(err);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* List ERC20 Token contracts
|
|
329
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
330
|
+
* @returns a promise that resolves with a list of ERC20 Tokens
|
|
331
|
+
* @throws {@link index.APIError}
|
|
332
|
+
*/
|
|
333
|
+
async listTokens(request) {
|
|
334
|
+
return await this.tokens.listERC20Tokens(request).then((res) => res.data).catch((err) => {
|
|
335
|
+
throw formatError(err);
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Get details for an ERC20 Token by contract address
|
|
340
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
341
|
+
* @returns a promise that resolves with a list of ERC20 Tokens
|
|
342
|
+
* @throws {@link index.APIError}
|
|
343
|
+
*/
|
|
344
|
+
async getToken(request) {
|
|
345
|
+
return await this.tokens.getERC20Token(request).then((res) => res.data).catch((err) => {
|
|
346
|
+
throw formatError(err);
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Get metadata by ID
|
|
351
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
352
|
+
* @returns a promise that resolves with a single Metadata
|
|
353
|
+
* @throws {@link index.APIError}
|
|
354
|
+
*/
|
|
355
|
+
async getMetadata(request) {
|
|
356
|
+
return await this.metadata.getMetadata(request).then((res) => res.data).catch((err) => {
|
|
357
|
+
throw formatError(err);
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* List NFT Metadata by contract address
|
|
362
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
363
|
+
* @returns a promise that resolves with a list of Metadata
|
|
364
|
+
* @throws {@link index.APIError}
|
|
365
|
+
*/
|
|
366
|
+
async listNFTMetadataByContractAddress(request) {
|
|
367
|
+
return await this.metadata.listMetadata(request).then((res) => res.data).catch((err) => {
|
|
368
|
+
throw formatError(err);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* List NFT Metadata by chain
|
|
373
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
374
|
+
* @returns a promise that resolves with a list of Metadata
|
|
375
|
+
* @throws {@link index.APIError}
|
|
376
|
+
*/
|
|
377
|
+
async listNFTMetadataByChain(request) {
|
|
378
|
+
return await this.metadata.listMetadataForChain(request).then((res) => res.data).catch((err) => {
|
|
379
|
+
throw formatError(err);
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Refresh collection metadata
|
|
384
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
385
|
+
* @returns a promise that resolves with the updated collection
|
|
386
|
+
* @throws {@link index.APIError}
|
|
387
|
+
*/
|
|
388
|
+
async refreshCollectionMetadata(request) {
|
|
389
|
+
return await this.collections.refreshCollectionMetadata(request).then((res) => res.data).catch((err) => {
|
|
390
|
+
throw formatError(err);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Refresh metadata for specific NFTs
|
|
395
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
396
|
+
* @returns a promise that resolves with the remaining rate limits
|
|
397
|
+
* @throws {@link index.APIError}
|
|
398
|
+
*/
|
|
399
|
+
async refreshNFTMetadata(request) {
|
|
400
|
+
return await this.metadata.refreshNFTMetadataByTokenID(request).then((res) => res.data).catch((err) => {
|
|
401
|
+
throw formatError(err);
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Refresh metadata by ID. This will refresh metadata for all NFTs that reference the given metadata ID.
|
|
406
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
407
|
+
* @returns a promise that resolves with the remaining rate limits
|
|
408
|
+
* @throws {@link index.APIError}
|
|
409
|
+
*/
|
|
410
|
+
async refreshStackedMetadata(request) {
|
|
411
|
+
return await this.metadata.refreshMetadataByID(request).then((res) => res.data).catch((err) => {
|
|
412
|
+
throw formatError(err);
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Sign a crafting payload
|
|
417
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
418
|
+
* @returns a promise that resolves with the signature result
|
|
419
|
+
* @throws {@link index.APIError}
|
|
420
|
+
*/
|
|
421
|
+
async signCraftingPayload(request) {
|
|
422
|
+
return await this.crafting.signCraftingPayload(request).then((res) => res.data).catch((err) => {
|
|
423
|
+
throw formatError(err);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Marketplace APIs
|
|
428
|
+
* - Metadata search
|
|
429
|
+
*/
|
|
430
|
+
/**
|
|
431
|
+
* Get list of metadata filters
|
|
432
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
433
|
+
* @returns a promise that resolves with the a list of metadata filters
|
|
434
|
+
* @throws {@link index.APIError}
|
|
435
|
+
*/
|
|
436
|
+
async listFilters(request) {
|
|
437
|
+
return await this.metadataSearch.listFilters(request).then((res) => res.data).catch((err) => {
|
|
438
|
+
throw formatError(err);
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Search NFTs
|
|
443
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
444
|
+
* @returns a promise that resolves with the a list NFTs with metadata, market and listings information
|
|
445
|
+
* @throws {@link index.APIError}
|
|
446
|
+
*/
|
|
447
|
+
async searchNFTs(request) {
|
|
448
|
+
return await this.metadataSearch.searchNFTs(request).then((res) => res.data).catch((err) => {
|
|
449
|
+
throw formatError(err);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Search NFT stacks
|
|
454
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
455
|
+
* @returns a promise that resolves with the a list NFT stacks with stack count, market and listings information
|
|
456
|
+
* @throws {@link index.APIError}
|
|
457
|
+
*/
|
|
458
|
+
async searchStacks(request) {
|
|
459
|
+
return await this.metadataSearch.searchStacks(request).then((res) => res.data).catch((err) => {
|
|
460
|
+
throw formatError(err);
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Marketplace APIs
|
|
465
|
+
* - Pricing
|
|
466
|
+
*/
|
|
467
|
+
/**
|
|
468
|
+
* Get pricing data for a list of token ids
|
|
469
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
470
|
+
* @returns a promise that resolves with the a list of pricing data for particular NFTs
|
|
471
|
+
* @throws {@link index.APIError}
|
|
472
|
+
*/
|
|
473
|
+
async quotesForNFTs(request) {
|
|
474
|
+
return await this.pricing.quotesForNFTs(request).then((res) => res.data).catch((err) => {
|
|
475
|
+
throw formatError(err);
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Get pricing data for a list of stack ids
|
|
480
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
481
|
+
* @returns a promise that resolves with the a list of pricing data for particular stack ids
|
|
482
|
+
* @throws {@link index.APIError}
|
|
483
|
+
*/
|
|
484
|
+
async quotesForStacks(request) {
|
|
485
|
+
return await this.pricing.quotesForStacks(request).then((res) => res.data).catch((err) => {
|
|
486
|
+
throw formatError(err);
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Marketplace APIs
|
|
491
|
+
* - Metadata
|
|
492
|
+
*/
|
|
493
|
+
/**
|
|
494
|
+
* List NFT stack bundles by stack_id.
|
|
495
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
496
|
+
* @returns a promise that resolves with a list of NFT stacks with stack count, market and listings information
|
|
497
|
+
* @throws {@link index.APIError}
|
|
498
|
+
*/
|
|
499
|
+
async listStacks(request) {
|
|
500
|
+
return await this.metadata.listStacks(request).then((res) => res.data).catch((err) => {
|
|
501
|
+
throw formatError(err);
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
export { APIError, BlockchainData };
|