@imtbl/sdk 0.1.7-alpha.2 → 0.1.7-alpha.3

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/index.js CHANGED
@@ -1,7 +1,6 @@
1
+ import globalAxios from 'axios';
1
2
  import { ImmutableX, Config, generateLegacyStarkPrivateKey, createStarkSigner, TransfersApi, OrdersApi, UsersApi, Contracts, TradesApi, ExchangesApi, WithdrawalsApi, MintsApi, DepositsApi, EncodingApi, TokensApi } from '@imtbl/core-sdk';
2
3
  export { createStarkSigner as imxClientCreateStarkSigner, generateLegacyStarkPrivateKey as imxClientGenerateLegacyStarkPrivateKey } from '@imtbl/core-sdk';
3
- import * as guardian from '@imtbl/guardian';
4
- export { guardian };
5
4
  import { UserManager } from 'oidc-client-ts';
6
5
  import { ethers, utils, Contract, BigNumber, constants } from 'ethers';
7
6
  import { Magic } from 'magic-sdk';
@@ -33,25 +32,1283 @@ class ImmutableConfiguration {
33
32
  }
34
33
  }
35
34
 
35
+ /* tslint:disable */
36
+ /* eslint-disable */
37
+ /**
38
+ * Immutable X API
39
+ * Immutable Multi Rollup API
40
+ *
41
+ * The version of the OpenAPI document: 1.0.0
42
+ * Contact: support@immutable.com
43
+ *
44
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
45
+ * https://openapi-generator.tech
46
+ * Do not edit the class manually.
47
+ */
48
+ // Some imports not used depending on template conditions
49
+ // @ts-ignore
50
+ const BASE_PATH = "https://indexer-mr.dev.imtbl.com".replace(/\/+$/, "");
51
+ /**
52
+ *
53
+ * @export
54
+ * @class BaseAPI
55
+ */
56
+ class BaseAPI {
57
+ basePath;
58
+ axios;
59
+ configuration;
60
+ constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
61
+ this.basePath = basePath;
62
+ this.axios = axios;
63
+ if (configuration) {
64
+ this.configuration = configuration;
65
+ this.basePath = configuration.basePath || this.basePath;
66
+ }
67
+ }
68
+ }
69
+ /**
70
+ *
71
+ * @export
72
+ * @class RequiredError
73
+ * @extends {Error}
74
+ */
75
+ class RequiredError extends Error {
76
+ field;
77
+ name = "RequiredError";
78
+ constructor(field, msg) {
79
+ super(msg);
80
+ this.field = field;
81
+ }
82
+ }
83
+
84
+ /* tslint:disable */
85
+ /* eslint-disable */
86
+ /**
87
+ * Immutable X API
88
+ * Immutable Multi Rollup API
89
+ *
90
+ * The version of the OpenAPI document: 1.0.0
91
+ * Contact: support@immutable.com
92
+ *
93
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
94
+ * https://openapi-generator.tech
95
+ * Do not edit the class manually.
96
+ */
97
+ /**
98
+ *
99
+ * @export
100
+ */
101
+ const DUMMY_BASE_URL = 'https://example.com';
102
+ /**
103
+ *
104
+ * @throws {RequiredError}
105
+ * @export
106
+ */
107
+ const assertParamExists = function (functionName, paramName, paramValue) {
108
+ if (paramValue === null || paramValue === undefined) {
109
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
110
+ }
111
+ };
112
+ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
113
+ if (typeof parameter === "object") {
114
+ if (Array.isArray(parameter)) {
115
+ parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
116
+ }
117
+ else {
118
+ Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
119
+ }
120
+ }
121
+ else {
122
+ if (urlSearchParams.has(key)) {
123
+ urlSearchParams.append(key, parameter);
124
+ }
125
+ else {
126
+ urlSearchParams.set(key, parameter);
127
+ }
128
+ }
129
+ }
130
+ /**
131
+ *
132
+ * @export
133
+ */
134
+ const setSearchParams = function (url, ...objects) {
135
+ const searchParams = new URLSearchParams(url.search);
136
+ setFlattenedQueryParams(searchParams, objects);
137
+ url.search = searchParams.toString();
138
+ };
139
+ /**
140
+ *
141
+ * @export
142
+ */
143
+ const toPathString = function (url) {
144
+ return url.pathname + url.search + url.hash;
145
+ };
146
+ /**
147
+ *
148
+ * @export
149
+ */
150
+ const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
151
+ return (axios = globalAxios, basePath = BASE_PATH) => {
152
+ const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url };
153
+ return axios.request(axiosRequestArgs);
154
+ };
155
+ };
156
+
157
+ /* tslint:disable */
158
+ /* eslint-disable */
159
+ /**
160
+ * Immutable X API
161
+ * Immutable Multi Rollup API
162
+ *
163
+ * The version of the OpenAPI document: 1.0.0
164
+ * Contact: support@immutable.com
165
+ *
166
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
167
+ * https://openapi-generator.tech
168
+ * Do not edit the class manually.
169
+ */
170
+ /**
171
+ * ActivitiesApi - axios parameter creator
172
+ * @export
173
+ */
174
+ const ActivitiesApiAxiosParamCreator = function (configuration) {
175
+ return {
176
+ /**
177
+ * Get a single activity by ID
178
+ * @summary Get a single activity by ID
179
+ * @param {string} chainName The name of chain
180
+ * @param {string} activityId The id of activity
181
+ * @param {*} [options] Override http request option.
182
+ * @throws {RequiredError}
183
+ */
184
+ getActivity: async (chainName, activityId, options = {}) => {
185
+ // verify required parameter 'chainName' is not null or undefined
186
+ assertParamExists('getActivity', 'chainName', chainName);
187
+ // verify required parameter 'activityId' is not null or undefined
188
+ assertParamExists('getActivity', 'activityId', activityId);
189
+ const localVarPath = `/v1/chains/{chain_name}/activities/{activity_id}`
190
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
191
+ .replace(`{${"activity_id"}}`, encodeURIComponent(String(activityId)));
192
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
193
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
194
+ let baseOptions;
195
+ if (configuration) {
196
+ baseOptions = configuration.baseOptions;
197
+ }
198
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
199
+ const localVarHeaderParameter = {};
200
+ const localVarQueryParameter = {};
201
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
202
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
203
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
204
+ return {
205
+ url: toPathString(localVarUrlObj),
206
+ options: localVarRequestOptions,
207
+ };
208
+ },
209
+ /**
210
+ * List all activities
211
+ * @summary List all activities
212
+ * @param {string} chainName The name of chain
213
+ * @param {string} [contractAddress] The contract address of NFT or ERC20 Token
214
+ * @param {string} [tokenId] An `uint256` token id as string
215
+ * @param {string} [accountAddress] The account address activity contains
216
+ * @param {ActivityType} [activityType] The activity type
217
+ * @param {string} [fromIndexedAt] From indexed at including given date
218
+ * @param {string} [toIndexedAt] To indexed at including given date
219
+ * @param {string} [transactionHash] The transaction hash of activity
220
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
221
+ * @param {number} [pageSize] Maximum number of items to return
222
+ * @param {*} [options] Override http request option.
223
+ * @throws {RequiredError}
224
+ */
225
+ listActivities: async (chainName, contractAddress, tokenId, accountAddress, activityType, fromIndexedAt, toIndexedAt, transactionHash, pageCursor, pageSize, options = {}) => {
226
+ // verify required parameter 'chainName' is not null or undefined
227
+ assertParamExists('listActivities', 'chainName', chainName);
228
+ const localVarPath = `/v1/chains/{chain_name}/activities`
229
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
230
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
231
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
232
+ let baseOptions;
233
+ if (configuration) {
234
+ baseOptions = configuration.baseOptions;
235
+ }
236
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
237
+ const localVarHeaderParameter = {};
238
+ const localVarQueryParameter = {};
239
+ if (contractAddress !== undefined) {
240
+ localVarQueryParameter['contract_address'] = contractAddress;
241
+ }
242
+ if (tokenId !== undefined) {
243
+ localVarQueryParameter['token_id'] = tokenId;
244
+ }
245
+ if (accountAddress !== undefined) {
246
+ localVarQueryParameter['account_address'] = accountAddress;
247
+ }
248
+ if (activityType !== undefined) {
249
+ localVarQueryParameter['activity_type'] = activityType;
250
+ }
251
+ if (fromIndexedAt !== undefined) {
252
+ localVarQueryParameter['from_indexed_at'] = (fromIndexedAt instanceof Date) ?
253
+ fromIndexedAt.toISOString() :
254
+ fromIndexedAt;
255
+ }
256
+ if (toIndexedAt !== undefined) {
257
+ localVarQueryParameter['to_indexed_at'] = (toIndexedAt instanceof Date) ?
258
+ toIndexedAt.toISOString() :
259
+ toIndexedAt;
260
+ }
261
+ if (transactionHash !== undefined) {
262
+ localVarQueryParameter['transaction_hash'] = transactionHash;
263
+ }
264
+ if (pageCursor !== undefined) {
265
+ localVarQueryParameter['page_cursor'] = pageCursor;
266
+ }
267
+ if (pageSize !== undefined) {
268
+ localVarQueryParameter['page_size'] = pageSize;
269
+ }
270
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
271
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
272
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
273
+ return {
274
+ url: toPathString(localVarUrlObj),
275
+ options: localVarRequestOptions,
276
+ };
277
+ },
278
+ };
279
+ };
280
+ /**
281
+ * ActivitiesApi - functional programming interface
282
+ * @export
283
+ */
284
+ const ActivitiesApiFp = function (configuration) {
285
+ const localVarAxiosParamCreator = ActivitiesApiAxiosParamCreator(configuration);
286
+ return {
287
+ /**
288
+ * Get a single activity by ID
289
+ * @summary Get a single activity by ID
290
+ * @param {string} chainName The name of chain
291
+ * @param {string} activityId The id of activity
292
+ * @param {*} [options] Override http request option.
293
+ * @throws {RequiredError}
294
+ */
295
+ async getActivity(chainName, activityId, options) {
296
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getActivity(chainName, activityId, options);
297
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
298
+ },
299
+ /**
300
+ * List all activities
301
+ * @summary List all activities
302
+ * @param {string} chainName The name of chain
303
+ * @param {string} [contractAddress] The contract address of NFT or ERC20 Token
304
+ * @param {string} [tokenId] An `uint256` token id as string
305
+ * @param {string} [accountAddress] The account address activity contains
306
+ * @param {ActivityType} [activityType] The activity type
307
+ * @param {string} [fromIndexedAt] From indexed at including given date
308
+ * @param {string} [toIndexedAt] To indexed at including given date
309
+ * @param {string} [transactionHash] The transaction hash of activity
310
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
311
+ * @param {number} [pageSize] Maximum number of items to return
312
+ * @param {*} [options] Override http request option.
313
+ * @throws {RequiredError}
314
+ */
315
+ async listActivities(chainName, contractAddress, tokenId, accountAddress, activityType, fromIndexedAt, toIndexedAt, transactionHash, pageCursor, pageSize, options) {
316
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listActivities(chainName, contractAddress, tokenId, accountAddress, activityType, fromIndexedAt, toIndexedAt, transactionHash, pageCursor, pageSize, options);
317
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
318
+ },
319
+ };
320
+ };
36
321
  /**
37
- * Set `sdkVersion` on config
322
+ * ActivitiesApi - object-oriented interface
323
+ * @export
324
+ * @class ActivitiesApi
325
+ * @extends {BaseAPI}
38
326
  */
39
- const production = () => Config.createConfig({
327
+ class ActivitiesApi extends BaseAPI {
328
+ /**
329
+ * Get a single activity by ID
330
+ * @summary Get a single activity by ID
331
+ * @param {ActivitiesApiGetActivityRequest} requestParameters Request parameters.
332
+ * @param {*} [options] Override http request option.
333
+ * @throws {RequiredError}
334
+ * @memberof ActivitiesApi
335
+ */
336
+ getActivity(requestParameters, options) {
337
+ return ActivitiesApiFp(this.configuration).getActivity(requestParameters.chainName, requestParameters.activityId, options).then((request) => request(this.axios, this.basePath));
338
+ }
339
+ /**
340
+ * List all activities
341
+ * @summary List all activities
342
+ * @param {ActivitiesApiListActivitiesRequest} requestParameters Request parameters.
343
+ * @param {*} [options] Override http request option.
344
+ * @throws {RequiredError}
345
+ * @memberof ActivitiesApi
346
+ */
347
+ listActivities(requestParameters, options) {
348
+ return ActivitiesApiFp(this.configuration).listActivities(requestParameters.chainName, requestParameters.contractAddress, requestParameters.tokenId, requestParameters.accountAddress, requestParameters.activityType, requestParameters.fromIndexedAt, requestParameters.toIndexedAt, requestParameters.transactionHash, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
349
+ }
350
+ }
351
+
352
+ /* tslint:disable */
353
+ /* eslint-disable */
354
+ /**
355
+ * Immutable X API
356
+ * Immutable Multi Rollup API
357
+ *
358
+ * The version of the OpenAPI document: 1.0.0
359
+ * Contact: support@immutable.com
360
+ *
361
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
362
+ * https://openapi-generator.tech
363
+ * Do not edit the class manually.
364
+ */
365
+ /**
366
+ * ChainsApi - axios parameter creator
367
+ * @export
368
+ */
369
+ const ChainsApiAxiosParamCreator = function (configuration) {
370
+ return {
371
+ /**
372
+ * List supported chains
373
+ * @summary List supported chains
374
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
375
+ * @param {number} [pageSize] Maximum number of items to return
376
+ * @param {*} [options] Override http request option.
377
+ * @throws {RequiredError}
378
+ */
379
+ listChains: async (pageCursor, pageSize, options = {}) => {
380
+ const localVarPath = `/v1/chains`;
381
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
382
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
383
+ let baseOptions;
384
+ if (configuration) {
385
+ baseOptions = configuration.baseOptions;
386
+ }
387
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
388
+ const localVarHeaderParameter = {};
389
+ const localVarQueryParameter = {};
390
+ if (pageCursor !== undefined) {
391
+ localVarQueryParameter['page_cursor'] = pageCursor;
392
+ }
393
+ if (pageSize !== undefined) {
394
+ localVarQueryParameter['page_size'] = pageSize;
395
+ }
396
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
397
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
398
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
399
+ return {
400
+ url: toPathString(localVarUrlObj),
401
+ options: localVarRequestOptions,
402
+ };
403
+ },
404
+ };
405
+ };
406
+ /**
407
+ * ChainsApi - functional programming interface
408
+ * @export
409
+ */
410
+ const ChainsApiFp = function (configuration) {
411
+ const localVarAxiosParamCreator = ChainsApiAxiosParamCreator(configuration);
412
+ return {
413
+ /**
414
+ * List supported chains
415
+ * @summary List supported chains
416
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
417
+ * @param {number} [pageSize] Maximum number of items to return
418
+ * @param {*} [options] Override http request option.
419
+ * @throws {RequiredError}
420
+ */
421
+ async listChains(pageCursor, pageSize, options) {
422
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listChains(pageCursor, pageSize, options);
423
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
424
+ },
425
+ };
426
+ };
427
+ /**
428
+ * ChainsApi - object-oriented interface
429
+ * @export
430
+ * @class ChainsApi
431
+ * @extends {BaseAPI}
432
+ */
433
+ class ChainsApi extends BaseAPI {
434
+ /**
435
+ * List supported chains
436
+ * @summary List supported chains
437
+ * @param {ChainsApiListChainsRequest} requestParameters Request parameters.
438
+ * @param {*} [options] Override http request option.
439
+ * @throws {RequiredError}
440
+ * @memberof ChainsApi
441
+ */
442
+ listChains(requestParameters = {}, options) {
443
+ return ChainsApiFp(this.configuration).listChains(requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
444
+ }
445
+ }
446
+
447
+ /* tslint:disable */
448
+ /* eslint-disable */
449
+ /**
450
+ * Immutable X API
451
+ * Immutable Multi Rollup API
452
+ *
453
+ * The version of the OpenAPI document: 1.0.0
454
+ * Contact: support@immutable.com
455
+ *
456
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
457
+ * https://openapi-generator.tech
458
+ * Do not edit the class manually.
459
+ */
460
+ /**
461
+ * CollectionsApi - axios parameter creator
462
+ * @export
463
+ */
464
+ const CollectionsApiAxiosParamCreator = function (configuration) {
465
+ return {
466
+ /**
467
+ * Get collection by contract address
468
+ * @summary Get collection by contract address
469
+ * @param {string} contractAddress The address contract
470
+ * @param {string} chainName The name of chain
471
+ * @param {*} [options] Override http request option.
472
+ * @throws {RequiredError}
473
+ */
474
+ getCollection: async (contractAddress, chainName, options = {}) => {
475
+ // verify required parameter 'contractAddress' is not null or undefined
476
+ assertParamExists('getCollection', 'contractAddress', contractAddress);
477
+ // verify required parameter 'chainName' is not null or undefined
478
+ assertParamExists('getCollection', 'chainName', chainName);
479
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}`
480
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
481
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
482
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
483
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
484
+ let baseOptions;
485
+ if (configuration) {
486
+ baseOptions = configuration.baseOptions;
487
+ }
488
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
489
+ const localVarHeaderParameter = {};
490
+ const localVarQueryParameter = {};
491
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
492
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
493
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
494
+ return {
495
+ url: toPathString(localVarUrlObj),
496
+ options: localVarRequestOptions,
497
+ };
498
+ },
499
+ /**
500
+ * List all collections
501
+ * @summary List all collections
502
+ * @param {string} chainName The name of chain
503
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
504
+ * @param {number} [pageSize] Maximum number of items to return
505
+ * @param {*} [options] Override http request option.
506
+ * @throws {RequiredError}
507
+ */
508
+ listCollections: async (chainName, pageCursor, pageSize, options = {}) => {
509
+ // verify required parameter 'chainName' is not null or undefined
510
+ assertParamExists('listCollections', 'chainName', chainName);
511
+ const localVarPath = `/v1/chains/{chain_name}/collections`
512
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
513
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
514
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
515
+ let baseOptions;
516
+ if (configuration) {
517
+ baseOptions = configuration.baseOptions;
518
+ }
519
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
520
+ const localVarHeaderParameter = {};
521
+ const localVarQueryParameter = {};
522
+ if (pageCursor !== undefined) {
523
+ localVarQueryParameter['page_cursor'] = pageCursor;
524
+ }
525
+ if (pageSize !== undefined) {
526
+ localVarQueryParameter['page_size'] = pageSize;
527
+ }
528
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
529
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
530
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
531
+ return {
532
+ url: toPathString(localVarUrlObj),
533
+ options: localVarRequestOptions,
534
+ };
535
+ },
536
+ };
537
+ };
538
+ /**
539
+ * CollectionsApi - functional programming interface
540
+ * @export
541
+ */
542
+ const CollectionsApiFp = function (configuration) {
543
+ const localVarAxiosParamCreator = CollectionsApiAxiosParamCreator(configuration);
544
+ return {
545
+ /**
546
+ * Get collection by contract address
547
+ * @summary Get collection by contract address
548
+ * @param {string} contractAddress The address contract
549
+ * @param {string} chainName The name of chain
550
+ * @param {*} [options] Override http request option.
551
+ * @throws {RequiredError}
552
+ */
553
+ async getCollection(contractAddress, chainName, options) {
554
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getCollection(contractAddress, chainName, options);
555
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
556
+ },
557
+ /**
558
+ * List all collections
559
+ * @summary List all collections
560
+ * @param {string} chainName The name of chain
561
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
562
+ * @param {number} [pageSize] Maximum number of items to return
563
+ * @param {*} [options] Override http request option.
564
+ * @throws {RequiredError}
565
+ */
566
+ async listCollections(chainName, pageCursor, pageSize, options) {
567
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listCollections(chainName, pageCursor, pageSize, options);
568
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
569
+ },
570
+ };
571
+ };
572
+ /**
573
+ * CollectionsApi - object-oriented interface
574
+ * @export
575
+ * @class CollectionsApi
576
+ * @extends {BaseAPI}
577
+ */
578
+ class CollectionsApi extends BaseAPI {
579
+ /**
580
+ * Get collection by contract address
581
+ * @summary Get collection by contract address
582
+ * @param {CollectionsApiGetCollectionRequest} requestParameters Request parameters.
583
+ * @param {*} [options] Override http request option.
584
+ * @throws {RequiredError}
585
+ * @memberof CollectionsApi
586
+ */
587
+ getCollection(requestParameters, options) {
588
+ return CollectionsApiFp(this.configuration).getCollection(requestParameters.contractAddress, requestParameters.chainName, options).then((request) => request(this.axios, this.basePath));
589
+ }
590
+ /**
591
+ * List all collections
592
+ * @summary List all collections
593
+ * @param {CollectionsApiListCollectionsRequest} requestParameters Request parameters.
594
+ * @param {*} [options] Override http request option.
595
+ * @throws {RequiredError}
596
+ * @memberof CollectionsApi
597
+ */
598
+ listCollections(requestParameters, options) {
599
+ return CollectionsApiFp(this.configuration).listCollections(requestParameters.chainName, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
600
+ }
601
+ }
602
+
603
+ /* tslint:disable */
604
+ /* eslint-disable */
605
+ /**
606
+ * Immutable X API
607
+ * Immutable Multi Rollup API
608
+ *
609
+ * The version of the OpenAPI document: 1.0.0
610
+ * Contact: support@immutable.com
611
+ *
612
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
613
+ * https://openapi-generator.tech
614
+ * Do not edit the class manually.
615
+ */
616
+ /**
617
+ * NftOwnersApi - axios parameter creator
618
+ * @export
619
+ */
620
+ const NftOwnersApiAxiosParamCreator = function (configuration) {
621
+ return {
622
+ /**
623
+ * List NFT owners by token ID
624
+ * @summary List NFT owners by token ID
625
+ * @param {string} contractAddress The address of contract
626
+ * @param {string} tokenId An `uint256` token id as string
627
+ * @param {string} chainName The name of chain
628
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
629
+ * @param {number} [pageSize] Maximum number of items to return
630
+ * @param {*} [options] Override http request option.
631
+ * @throws {RequiredError}
632
+ */
633
+ listNFTOwners: async (contractAddress, tokenId, chainName, pageCursor, pageSize, options = {}) => {
634
+ // verify required parameter 'contractAddress' is not null or undefined
635
+ assertParamExists('listNFTOwners', 'contractAddress', contractAddress);
636
+ // verify required parameter 'tokenId' is not null or undefined
637
+ assertParamExists('listNFTOwners', 'tokenId', tokenId);
638
+ // verify required parameter 'chainName' is not null or undefined
639
+ assertParamExists('listNFTOwners', 'chainName', chainName);
640
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}/owners`
641
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
642
+ .replace(`{${"token_id"}}`, encodeURIComponent(String(tokenId)))
643
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
644
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
645
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
646
+ let baseOptions;
647
+ if (configuration) {
648
+ baseOptions = configuration.baseOptions;
649
+ }
650
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
651
+ const localVarHeaderParameter = {};
652
+ const localVarQueryParameter = {};
653
+ if (pageCursor !== undefined) {
654
+ localVarQueryParameter['page_cursor'] = pageCursor;
655
+ }
656
+ if (pageSize !== undefined) {
657
+ localVarQueryParameter['page_size'] = pageSize;
658
+ }
659
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
660
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
661
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
662
+ return {
663
+ url: toPathString(localVarUrlObj),
664
+ options: localVarRequestOptions,
665
+ };
666
+ },
667
+ };
668
+ };
669
+ /**
670
+ * NftOwnersApi - functional programming interface
671
+ * @export
672
+ */
673
+ const NftOwnersApiFp = function (configuration) {
674
+ const localVarAxiosParamCreator = NftOwnersApiAxiosParamCreator(configuration);
675
+ return {
676
+ /**
677
+ * List NFT owners by token ID
678
+ * @summary List NFT owners by token ID
679
+ * @param {string} contractAddress The address of contract
680
+ * @param {string} tokenId An `uint256` token id as string
681
+ * @param {string} chainName The name of chain
682
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
683
+ * @param {number} [pageSize] Maximum number of items to return
684
+ * @param {*} [options] Override http request option.
685
+ * @throws {RequiredError}
686
+ */
687
+ async listNFTOwners(contractAddress, tokenId, chainName, pageCursor, pageSize, options) {
688
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listNFTOwners(contractAddress, tokenId, chainName, pageCursor, pageSize, options);
689
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
690
+ },
691
+ };
692
+ };
693
+ /**
694
+ * NftOwnersApi - object-oriented interface
695
+ * @export
696
+ * @class NftOwnersApi
697
+ * @extends {BaseAPI}
698
+ */
699
+ class NftOwnersApi extends BaseAPI {
700
+ /**
701
+ * List NFT owners by token ID
702
+ * @summary List NFT owners by token ID
703
+ * @param {NftOwnersApiListNFTOwnersRequest} requestParameters Request parameters.
704
+ * @param {*} [options] Override http request option.
705
+ * @throws {RequiredError}
706
+ * @memberof NftOwnersApi
707
+ */
708
+ listNFTOwners(requestParameters, options) {
709
+ return NftOwnersApiFp(this.configuration).listNFTOwners(requestParameters.contractAddress, requestParameters.tokenId, requestParameters.chainName, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
710
+ }
711
+ }
712
+
713
+ /* tslint:disable */
714
+ /* eslint-disable */
715
+ /**
716
+ * Immutable X API
717
+ * Immutable Multi Rollup API
718
+ *
719
+ * The version of the OpenAPI document: 1.0.0
720
+ * Contact: support@immutable.com
721
+ *
722
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
723
+ * https://openapi-generator.tech
724
+ * Do not edit the class manually.
725
+ */
726
+ /**
727
+ * NftsApi - axios parameter creator
728
+ * @export
729
+ */
730
+ const NftsApiAxiosParamCreator = function (configuration) {
731
+ return {
732
+ /**
733
+ * Get NFT by token ID
734
+ * @summary Get NFT by token ID
735
+ * @param {string} contractAddress The address of NFT contract
736
+ * @param {string} tokenId An `uint256` token id as string
737
+ * @param {string} chainName The name of chain
738
+ * @param {*} [options] Override http request option.
739
+ * @throws {RequiredError}
740
+ */
741
+ getNFT: async (contractAddress, tokenId, chainName, options = {}) => {
742
+ // verify required parameter 'contractAddress' is not null or undefined
743
+ assertParamExists('getNFT', 'contractAddress', contractAddress);
744
+ // verify required parameter 'tokenId' is not null or undefined
745
+ assertParamExists('getNFT', 'tokenId', tokenId);
746
+ // verify required parameter 'chainName' is not null or undefined
747
+ assertParamExists('getNFT', 'chainName', chainName);
748
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/nfts/{token_id}`
749
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
750
+ .replace(`{${"token_id"}}`, encodeURIComponent(String(tokenId)))
751
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
752
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
753
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
754
+ let baseOptions;
755
+ if (configuration) {
756
+ baseOptions = configuration.baseOptions;
757
+ }
758
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
759
+ const localVarHeaderParameter = {};
760
+ const localVarQueryParameter = {};
761
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
762
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
763
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
764
+ return {
765
+ url: toPathString(localVarUrlObj),
766
+ options: localVarRequestOptions,
767
+ };
768
+ },
769
+ /**
770
+ * List NFTs by contract address
771
+ * @summary List NFTs by contract address
772
+ * @param {string} contractAddress Contract address
773
+ * @param {string} chainName The name of chain
774
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
775
+ * @param {number} [pageSize] Maximum number of items to return
776
+ * @param {*} [options] Override http request option.
777
+ * @throws {RequiredError}
778
+ */
779
+ listNFTs: async (contractAddress, chainName, pageCursor, pageSize, options = {}) => {
780
+ // verify required parameter 'contractAddress' is not null or undefined
781
+ assertParamExists('listNFTs', 'contractAddress', contractAddress);
782
+ // verify required parameter 'chainName' is not null or undefined
783
+ assertParamExists('listNFTs', 'chainName', chainName);
784
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/nfts`
785
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
786
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
787
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
788
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
789
+ let baseOptions;
790
+ if (configuration) {
791
+ baseOptions = configuration.baseOptions;
792
+ }
793
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
794
+ const localVarHeaderParameter = {};
795
+ const localVarQueryParameter = {};
796
+ if (pageCursor !== undefined) {
797
+ localVarQueryParameter['page_cursor'] = pageCursor;
798
+ }
799
+ if (pageSize !== undefined) {
800
+ localVarQueryParameter['page_size'] = pageSize;
801
+ }
802
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
803
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
804
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
805
+ return {
806
+ url: toPathString(localVarUrlObj),
807
+ options: localVarRequestOptions,
808
+ };
809
+ },
810
+ /**
811
+ * List NFTs by account address
812
+ * @summary List NFTs by account address
813
+ * @param {string} accountAddress Account address
814
+ * @param {string} chainName The name of chain
815
+ * @param {string} [contractAddress] The address of contract
816
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
817
+ * @param {number} [pageSize] Maximum number of items to return
818
+ * @param {*} [options] Override http request option.
819
+ * @throws {RequiredError}
820
+ */
821
+ listNFTsByAccountAddress: async (accountAddress, chainName, contractAddress, pageCursor, pageSize, options = {}) => {
822
+ // verify required parameter 'accountAddress' is not null or undefined
823
+ assertParamExists('listNFTsByAccountAddress', 'accountAddress', accountAddress);
824
+ // verify required parameter 'chainName' is not null or undefined
825
+ assertParamExists('listNFTsByAccountAddress', 'chainName', chainName);
826
+ const localVarPath = `/v1/chains/{chain_name}/accounts/{account_address}/nfts`
827
+ .replace(`{${"account_address"}}`, encodeURIComponent(String(accountAddress)))
828
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
829
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
830
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
831
+ let baseOptions;
832
+ if (configuration) {
833
+ baseOptions = configuration.baseOptions;
834
+ }
835
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
836
+ const localVarHeaderParameter = {};
837
+ const localVarQueryParameter = {};
838
+ if (contractAddress !== undefined) {
839
+ localVarQueryParameter['contract_address'] = contractAddress;
840
+ }
841
+ if (pageCursor !== undefined) {
842
+ localVarQueryParameter['page_cursor'] = pageCursor;
843
+ }
844
+ if (pageSize !== undefined) {
845
+ localVarQueryParameter['page_size'] = pageSize;
846
+ }
847
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
848
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
849
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
850
+ return {
851
+ url: toPathString(localVarUrlObj),
852
+ options: localVarRequestOptions,
853
+ };
854
+ },
855
+ };
856
+ };
857
+ /**
858
+ * NftsApi - functional programming interface
859
+ * @export
860
+ */
861
+ const NftsApiFp = function (configuration) {
862
+ const localVarAxiosParamCreator = NftsApiAxiosParamCreator(configuration);
863
+ return {
864
+ /**
865
+ * Get NFT by token ID
866
+ * @summary Get NFT by token ID
867
+ * @param {string} contractAddress The address of NFT contract
868
+ * @param {string} tokenId An `uint256` token id as string
869
+ * @param {string} chainName The name of chain
870
+ * @param {*} [options] Override http request option.
871
+ * @throws {RequiredError}
872
+ */
873
+ async getNFT(contractAddress, tokenId, chainName, options) {
874
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getNFT(contractAddress, tokenId, chainName, options);
875
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
876
+ },
877
+ /**
878
+ * List NFTs by contract address
879
+ * @summary List NFTs by contract address
880
+ * @param {string} contractAddress Contract address
881
+ * @param {string} chainName The name of chain
882
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
883
+ * @param {number} [pageSize] Maximum number of items to return
884
+ * @param {*} [options] Override http request option.
885
+ * @throws {RequiredError}
886
+ */
887
+ async listNFTs(contractAddress, chainName, pageCursor, pageSize, options) {
888
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listNFTs(contractAddress, chainName, pageCursor, pageSize, options);
889
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
890
+ },
891
+ /**
892
+ * List NFTs by account address
893
+ * @summary List NFTs by account address
894
+ * @param {string} accountAddress Account address
895
+ * @param {string} chainName The name of chain
896
+ * @param {string} [contractAddress] The address of contract
897
+ * @param {string} [pageCursor] Base64 encoded page cursor to retrieve previous or next page. Use the value returned in the response.
898
+ * @param {number} [pageSize] Maximum number of items to return
899
+ * @param {*} [options] Override http request option.
900
+ * @throws {RequiredError}
901
+ */
902
+ async listNFTsByAccountAddress(accountAddress, chainName, contractAddress, pageCursor, pageSize, options) {
903
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listNFTsByAccountAddress(accountAddress, chainName, contractAddress, pageCursor, pageSize, options);
904
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
905
+ },
906
+ };
907
+ };
908
+ /**
909
+ * NftsApi - object-oriented interface
910
+ * @export
911
+ * @class NftsApi
912
+ * @extends {BaseAPI}
913
+ */
914
+ class NftsApi extends BaseAPI {
915
+ /**
916
+ * Get NFT by token ID
917
+ * @summary Get NFT by token ID
918
+ * @param {NftsApiGetNFTRequest} requestParameters Request parameters.
919
+ * @param {*} [options] Override http request option.
920
+ * @throws {RequiredError}
921
+ * @memberof NftsApi
922
+ */
923
+ getNFT(requestParameters, options) {
924
+ return NftsApiFp(this.configuration).getNFT(requestParameters.contractAddress, requestParameters.tokenId, requestParameters.chainName, options).then((request) => request(this.axios, this.basePath));
925
+ }
926
+ /**
927
+ * List NFTs by contract address
928
+ * @summary List NFTs by contract address
929
+ * @param {NftsApiListNFTsRequest} requestParameters Request parameters.
930
+ * @param {*} [options] Override http request option.
931
+ * @throws {RequiredError}
932
+ * @memberof NftsApi
933
+ */
934
+ listNFTs(requestParameters, options) {
935
+ return NftsApiFp(this.configuration).listNFTs(requestParameters.contractAddress, requestParameters.chainName, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
936
+ }
937
+ /**
938
+ * List NFTs by account address
939
+ * @summary List NFTs by account address
940
+ * @param {NftsApiListNFTsByAccountAddressRequest} requestParameters Request parameters.
941
+ * @param {*} [options] Override http request option.
942
+ * @throws {RequiredError}
943
+ * @memberof NftsApi
944
+ */
945
+ listNFTsByAccountAddress(requestParameters, options) {
946
+ return NftsApiFp(this.configuration).listNFTsByAccountAddress(requestParameters.accountAddress, requestParameters.chainName, requestParameters.contractAddress, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
947
+ }
948
+ }
949
+
950
+ /* tslint:disable */
951
+ /* eslint-disable */
952
+ /**
953
+ * Immutable X API
954
+ * Immutable Multi Rollup API
955
+ *
956
+ * The version of the OpenAPI document: 1.0.0
957
+ * Contact: support@immutable.com
958
+ *
959
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
960
+ * https://openapi-generator.tech
961
+ * Do not edit the class manually.
962
+ */
963
+ class Configuration {
964
+ /**
965
+ * parameter for apiKey security
966
+ * @param name security name
967
+ * @memberof Configuration
968
+ */
969
+ apiKey;
970
+ /**
971
+ * parameter for basic security
972
+ *
973
+ * @type {string}
974
+ * @memberof Configuration
975
+ */
976
+ username;
977
+ /**
978
+ * parameter for basic security
979
+ *
980
+ * @type {string}
981
+ * @memberof Configuration
982
+ */
983
+ password;
984
+ /**
985
+ * parameter for oauth2 security
986
+ * @param name security name
987
+ * @param scopes oauth2 scope
988
+ * @memberof Configuration
989
+ */
990
+ accessToken;
991
+ /**
992
+ * override base path
993
+ *
994
+ * @type {string}
995
+ * @memberof Configuration
996
+ */
997
+ basePath;
998
+ /**
999
+ * base options for axios calls
1000
+ *
1001
+ * @type {any}
1002
+ * @memberof Configuration
1003
+ */
1004
+ baseOptions;
1005
+ /**
1006
+ * The FormData constructor that will be used to create multipart form data
1007
+ * requests. You can inject this here so that execution environments that
1008
+ * do not support the FormData class can still run the generated client.
1009
+ *
1010
+ * @type {new () => FormData}
1011
+ */
1012
+ formDataCtor;
1013
+ constructor(param = {}) {
1014
+ this.apiKey = param.apiKey;
1015
+ this.username = param.username;
1016
+ this.password = param.password;
1017
+ this.accessToken = param.accessToken;
1018
+ this.basePath = param.basePath;
1019
+ this.baseOptions = param.baseOptions;
1020
+ this.formDataCtor = param.formDataCtor;
1021
+ }
1022
+ /**
1023
+ * Check if the given MIME is a JSON MIME.
1024
+ * JSON MIME examples:
1025
+ * application/json
1026
+ * application/json; charset=UTF8
1027
+ * APPLICATION/JSON
1028
+ * application/vnd.company+json
1029
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
1030
+ * @return True if the given MIME is JSON, false otherwise.
1031
+ */
1032
+ isJsonMime(mime) {
1033
+ const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
1034
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
1035
+ }
1036
+ }
1037
+
1038
+ /* eslint-disable implicit-arrow-linebreak */
1039
+ const defaultHeaders = {
1040
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.1.7-alpha.3',
1041
+ };
1042
+ /**
1043
+ * createAPIConfiguration to create a custom APIConfiguration
1044
+ * other than the production and sandbox defined below.
1045
+ */
1046
+ const createAPIConfiguration = ({ basePath, headers: baseHeaders, }) => {
1047
+ if (!basePath.trim()) {
1048
+ throw Error('basePath can not be empty');
1049
+ }
1050
+ const headers = { ...(baseHeaders || {}), ...defaultHeaders };
1051
+ const configParams = {
1052
+ basePath,
1053
+ baseOptions: { headers },
1054
+ };
1055
+ return new Configuration(configParams);
1056
+ };
1057
+ const production$1 = () => createAPIConfiguration({
1058
+ basePath: 'https://indexer-mr.dev.imtbl.com/v1', // TODO update before mainnet release
1059
+ });
1060
+ const sandbox$1 = () => createAPIConfiguration({
1061
+ basePath: 'https://indexer-mr.dev.imtbl.com/v1', // TODO update before testnet release
1062
+ });
1063
+ class BlockchainDataConfiguration {
1064
+ apiConfig;
1065
+ baseConfig;
1066
+ constructor({ baseConfig, overrides }) {
1067
+ this.baseConfig = baseConfig;
1068
+ if (overrides) {
1069
+ this.apiConfig = createAPIConfiguration(overrides);
1070
+ }
1071
+ else {
1072
+ switch (baseConfig.environment) {
1073
+ case Environment.SANDBOX: {
1074
+ this.apiConfig = sandbox$1();
1075
+ break;
1076
+ }
1077
+ case Environment.PRODUCTION: {
1078
+ this.apiConfig = production$1();
1079
+ break;
1080
+ }
1081
+ default: {
1082
+ this.apiConfig = sandbox$1();
1083
+ }
1084
+ }
1085
+ }
1086
+ }
1087
+ }
1088
+
1089
+ /**
1090
+ * Custom Error class that is returned from the API when a request fails
1091
+ */
1092
+ class APIError extends Error {
1093
+ code;
1094
+ details;
1095
+ link;
1096
+ traceId;
1097
+ constructor({ message, code, details, link, trace_id: traceId, }) {
1098
+ super(message);
1099
+ this.code = code;
1100
+ this.details = details;
1101
+ this.link = link;
1102
+ this.traceId = traceId;
1103
+ }
1104
+ }
1105
+
1106
+ /* eslint-disable @typescript-eslint/naming-convention */
1107
+ /**
1108
+ * [Formats an error in the APIError shape](https://axios-http.com/docs/handling_errors)
1109
+ * @param error - The Error object thrown by the request
1110
+ * @returns APIError
1111
+ */
1112
+ function formatError(error) {
1113
+ if (globalAxios.isAxiosError(error) && error.response) {
1114
+ const apiError = error.response.data;
1115
+ if (apiError.code && apiError.message) {
1116
+ return new APIError({
1117
+ code: apiError.code,
1118
+ message: apiError.message,
1119
+ details: apiError.details || null,
1120
+ link: apiError.link || '',
1121
+ trace_id: apiError.trace_id || '',
1122
+ });
1123
+ }
1124
+ return new APIError({
1125
+ code: error.code ?? error.response?.status.toString() ?? 'unknown_error_code',
1126
+ message: String(error),
1127
+ details: null,
1128
+ link: '',
1129
+ trace_id: '',
1130
+ });
1131
+ }
1132
+ return new APIError({
1133
+ code: 'unknown_error_code',
1134
+ message: String(error),
1135
+ details: null,
1136
+ link: '',
1137
+ trace_id: '',
1138
+ });
1139
+ }
1140
+
1141
+ class BlockchainData {
1142
+ config;
1143
+ activities;
1144
+ chains;
1145
+ collections;
1146
+ nfts;
1147
+ nftOwners;
1148
+ constructor(moduleConfig) {
1149
+ this.config = new BlockchainDataConfiguration(moduleConfig);
1150
+ this.activities = new ActivitiesApi(this.config.apiConfig);
1151
+ this.chains = new ChainsApi(this.config.apiConfig);
1152
+ this.collections = new CollectionsApi(this.config.apiConfig);
1153
+ this.nfts = new NftsApi(this.config.apiConfig);
1154
+ this.nftOwners = new NftOwnersApi(this.config.apiConfig);
1155
+ }
1156
+ /**
1157
+ * List all activities
1158
+ * @param request - the request object containing the parameters to be provided in the API request
1159
+ * @returns a promise that resolves with a list of activities
1160
+ * @throws {@link index.APIError}
1161
+ */
1162
+ async listActivities(request) {
1163
+ return await this.activities
1164
+ .listActivities(request)
1165
+ .then((res) => res.data)
1166
+ .catch((err) => {
1167
+ throw formatError(err);
1168
+ });
1169
+ }
1170
+ /**
1171
+ * Get a single activity by ID
1172
+ * @param request - the request object containing the parameters to be provided in the API request
1173
+ * @returns a promise that resolves with a single activity
1174
+ * @throws {@link index.APIError}
1175
+ */
1176
+ async getActivity(request) {
1177
+ return await this.activities
1178
+ .getActivity(request)
1179
+ .then((res) => res.data)
1180
+ .catch((err) => {
1181
+ throw formatError(err);
1182
+ });
1183
+ }
1184
+ /**
1185
+ * List supported chains
1186
+ * @param request - the request object containing the parameters to be provided in the API request
1187
+ * @returns a promise that resolves with a list of supported chains
1188
+ * @throws {@link index.APIError}
1189
+ */
1190
+ async listChains(request) {
1191
+ return await this.chains
1192
+ .listChains(request)
1193
+ .then((res) => res.data)
1194
+ .catch((err) => {
1195
+ throw formatError(err);
1196
+ });
1197
+ }
1198
+ /**
1199
+ * List all collections
1200
+ * @param request - the request object containing the parameters to be provided in the API request
1201
+ * @returns a promise that resolves with a list of collections
1202
+ * @throws {@link index.APIError}
1203
+ */
1204
+ async listCollections(request) {
1205
+ return await this.collections
1206
+ .listCollections(request)
1207
+ .then((res) => res.data)
1208
+ .catch((err) => {
1209
+ throw formatError(err);
1210
+ });
1211
+ }
1212
+ /**
1213
+ * Get collection by contract address
1214
+ * @param request - the request object containing the parameters to be provided in the API request
1215
+ * @returns a promise that resolves with a single collection
1216
+ * @throws {@link index.APIError}
1217
+ */
1218
+ async getCollection(request) {
1219
+ return await this.collections
1220
+ .getCollection(request)
1221
+ .then((res) => res.data)
1222
+ .catch((err) => {
1223
+ throw formatError(err);
1224
+ });
1225
+ }
1226
+ /**
1227
+ * Get NFT by token ID
1228
+ * @param request - the request object containing the parameters to be provided in the API request
1229
+ * @returns a promise that resolves with a single NFT
1230
+ * @throws {@link index.APIError}
1231
+ */
1232
+ async getNFT(request) {
1233
+ return await this.nfts
1234
+ .getNFT(request)
1235
+ .then((res) => res.data)
1236
+ .catch((err) => {
1237
+ throw formatError(err);
1238
+ });
1239
+ }
1240
+ /**
1241
+ * List NFTs by contract address
1242
+ * @param request - the request object containing the parameters to be provided in the API request
1243
+ * @returns a promise that resolves with a list of NFTs
1244
+ * @throws {@link index.APIError}
1245
+ */
1246
+ async listNFTs(request) {
1247
+ return await this.nfts
1248
+ .listNFTs(request)
1249
+ .then((res) => res.data)
1250
+ .catch((err) => {
1251
+ throw formatError(err);
1252
+ });
1253
+ }
1254
+ /**
1255
+ * List NFTs by account address
1256
+ * @param request - the request object containing the parameters to be provided in the API request
1257
+ * @returns a promise that resolves with a list of NFTs
1258
+ * @throws {@link index.APIError}
1259
+ */
1260
+ async listNFTsByAccountAddress(request) {
1261
+ return await this.nfts
1262
+ .listNFTsByAccountAddress(request)
1263
+ .then((res) => res.data)
1264
+ .catch((err) => {
1265
+ throw formatError(err);
1266
+ });
1267
+ }
1268
+ /**
1269
+ * List NFT owners by token ID
1270
+ * @param request - the request object containing the parameters to be provided in the API request
1271
+ * @returns a promise that resolves with a list of NFT owners
1272
+ * @throws {@link index.APIError}
1273
+ */
1274
+ async listNFTOwners(request) {
1275
+ return await this.nftOwners
1276
+ .listNFTOwners(request)
1277
+ .then((res) => res.data)
1278
+ .catch((err) => {
1279
+ throw formatError(err);
1280
+ });
1281
+ }
1282
+ }
1283
+
1284
+ /**
1285
+ * createImmutableXConfiguration to create a custom ImmutableXConfiguration
1286
+ * other than the production and sandbox defined below.
1287
+ */
1288
+ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress, registrationContractAddress, }) => Config.createConfig({
1289
+ basePath,
1290
+ chainID,
1291
+ coreContractAddress,
1292
+ registrationContractAddress,
1293
+ sdkVersion: 'ts-immutable-sdk-0.1.7-alpha.3',
1294
+ });
1295
+ /**
1296
+ * Sets `sdkVersion` at the time of build
1297
+ */
1298
+ const production = () => createImmutableXConfiguration({
40
1299
  basePath: 'https://api.x.immutable.com',
41
1300
  chainID: 1,
42
1301
  coreContractAddress: '0x5FDCCA53617f4d2b9134B29090C87D01058e27e9',
43
1302
  registrationContractAddress: '0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c',
44
- sdkVersion: 'ts-immutable-sdk-0.1.7-alpha.2',
45
1303
  });
46
1304
  /**
47
- * Set `sdkVersion` on config
1305
+ * Sets `sdkVersion` at the time of build
48
1306
  */
49
- const sandbox = () => Config.createConfig({
1307
+ const sandbox = () => createImmutableXConfiguration({
50
1308
  basePath: 'https://api.sandbox.x.immutable.com',
51
1309
  chainID: 5,
52
1310
  coreContractAddress: '0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623',
53
1311
  registrationContractAddress: '0x1C97Ada273C9A52253f463042f29117090Cd7D83',
54
- sdkVersion: 'ts-immutable-sdk-0.1.7-alpha.2',
55
1312
  });
56
1313
  class ImxConfiguration {
57
1314
  immutableXConfig;
@@ -800,25 +2057,13 @@ var SendMessage;
800
2057
  })(SendMessage || (SendMessage = {}));
801
2058
  var TransactionTypes;
802
2059
  (function (TransactionTypes) {
803
- // TODO: remove this once the naming has been fixed
804
- // eslint-disable-next-line @typescript-eslint/naming-convention
805
- TransactionTypes["CancelOrder"] = "delete:v1/orders";
806
- // TODO: remove this once the naming has been fixed
807
- // eslint-disable-next-line @typescript-eslint/naming-convention
808
- TransactionTypes["CreateOrder"] = "post:v1/orders";
809
- // TODO: remove this once the naming has been fixed
810
- // eslint-disable-next-line @typescript-eslint/naming-convention
811
- TransactionTypes["CreateTrade"] = "post:v1/trades";
812
- // TODO: remove this once the naming has been fixed
813
- // eslint-disable-next-line @typescript-eslint/naming-convention
814
- TransactionTypes["CreateTransfer"] = "post:v1/transfers";
815
- // TODO: remove this once the naming has been fixed
816
- // eslint-disable-next-line @typescript-eslint/naming-convention
817
- TransactionTypes["CreateBatchTransfer"] = "post:v2/transfers";
2060
+ TransactionTypes["cancelOrder"] = "delete:v1/orders";
2061
+ TransactionTypes["createOrder"] = "post:v1/orders";
2062
+ TransactionTypes["createTrade"] = "post:v1/trades";
2063
+ TransactionTypes["createTransfer"] = "post:v1/transfers";
2064
+ TransactionTypes["createBatchTransfer"] = "post:v2/transfers";
818
2065
  })(TransactionTypes || (TransactionTypes = {}));
819
- // TODO: remove this once the naming has been fixed
820
- // eslint-disable-next-line @typescript-eslint/naming-convention
821
- const PassportEventType = 'imx_passport_confirmation';
2066
+ const PASSPORT_EVENT_TYPE = 'imx_passport_confirmation';
822
2067
 
823
2068
  const openPopupCenter = ({ url, title, width, height, }) => {
824
2069
  const left = Math.max(0, Math.round(window.screenX + (window.outerWidth - width) / 2));
@@ -848,7 +2093,7 @@ class ConfirmationScreen {
848
2093
  }
849
2094
  postMessage(destinationWindow, accessToken, message) {
850
2095
  destinationWindow.postMessage({
851
- eventType: PassportEventType,
2096
+ eventType: PASSPORT_EVENT_TYPE,
852
2097
  accessToken,
853
2098
  ...message,
854
2099
  }, this.config.passportDomain);
@@ -857,7 +2102,7 @@ class ConfirmationScreen {
857
2102
  return new Promise((resolve, reject) => {
858
2103
  const messageHandler = ({ data, origin }) => {
859
2104
  if (origin !== this.config.passportDomain
860
- || data.eventType !== PassportEventType) {
2105
+ || data.eventType !== PASSPORT_EVENT_TYPE) {
861
2106
  return;
862
2107
  }
863
2108
  switch (data.messageType) {
@@ -902,59 +2147,57 @@ class ConfirmationScreen {
902
2147
  }
903
2148
 
904
2149
  const ERC721$1 = 'ERC721';
905
- const transfer$1 = ({ request, transfersApi, starkSigner, user, passportConfig,
906
- // TODO: remove this eslint disable once we have a better solution
907
- // eslint-disable-next-line max-len
908
- }) => withPassportError(async () => {
909
- const transferAmount = request.type === ERC721$1 ? '1' : request.amount;
910
- const getSignableTransferRequest = {
911
- sender: user.etherKey,
912
- token: convertToSignableToken(request),
913
- amount: transferAmount,
914
- receiver: request.receiver,
915
- };
916
- const signableResult = await transfersApi.getSignableTransferV1({
917
- getSignableTransferRequest,
918
- });
919
- const confirmationScreen = new ConfirmationScreen(passportConfig);
920
- const confirmationResult = await confirmationScreen.startTransaction(user.accessToken, {
921
- transactionType: TransactionTypes.CreateTransfer,
922
- transactionData: getSignableTransferRequest,
923
- });
924
- if (!confirmationResult.confirmed) {
925
- throw new Error('Transaction rejected by user');
926
- }
927
- const signableResultData = signableResult.data;
928
- const { payload_hash: payloadHash } = signableResultData;
929
- const starkSignature = await starkSigner.signMessage(payloadHash);
930
- const senderStarkKey = await starkSigner.getAddress();
931
- const transferSigningParams = {
932
- sender_stark_key: signableResultData.sender_stark_key || senderStarkKey,
933
- sender_vault_id: signableResultData.sender_vault_id,
934
- receiver_stark_key: signableResultData.receiver_stark_key,
935
- receiver_vault_id: signableResultData.receiver_vault_id,
936
- asset_id: signableResultData.asset_id,
937
- amount: signableResultData.amount,
938
- nonce: signableResultData.nonce,
939
- expiration_timestamp: signableResultData.expiration_timestamp,
940
- stark_signature: starkSignature,
941
- };
942
- const createTransferRequest = {
943
- createTransferRequest: transferSigningParams,
944
- };
945
- const headers = {
946
- // eslint-disable-next-line @typescript-eslint/naming-convention
947
- Authorization: `Bearer ${user.accessToken}`,
948
- };
949
- const { data: responseData } = await transfersApi.createTransferV1(createTransferRequest, { headers });
950
- return {
951
- sent_signature: responseData.sent_signature,
952
- status: responseData.status?.toString(),
953
- time: responseData.time,
954
- transfer_id: responseData.transfer_id,
955
- };
956
- }, PassportErrorType.TRANSFER_ERROR);
957
- async function batchNftTransfer({ user, starkSigner, request, transfersApi, passportConfig, }) {
2150
+ async function transfer$1({ request, transfersApi, starkSigner, user, confirmationScreen, }) {
2151
+ return withPassportError(async () => {
2152
+ const transferAmount = request.type === ERC721$1 ? '1' : request.amount;
2153
+ const getSignableTransferRequest = {
2154
+ sender: user.etherKey,
2155
+ token: convertToSignableToken(request),
2156
+ amount: transferAmount,
2157
+ receiver: request.receiver,
2158
+ };
2159
+ const signableResult = await transfersApi.getSignableTransferV1({
2160
+ getSignableTransferRequest,
2161
+ });
2162
+ const confirmationResult = await confirmationScreen.startTransaction(user.accessToken, {
2163
+ transactionType: TransactionTypes.createTransfer,
2164
+ transactionData: getSignableTransferRequest,
2165
+ });
2166
+ if (!confirmationResult.confirmed) {
2167
+ throw new Error('Transaction rejected by user');
2168
+ }
2169
+ const signableResultData = signableResult.data;
2170
+ const { payload_hash: payloadHash } = signableResultData;
2171
+ const starkSignature = await starkSigner.signMessage(payloadHash);
2172
+ const senderStarkKey = await starkSigner.getAddress();
2173
+ const transferSigningParams = {
2174
+ sender_stark_key: signableResultData.sender_stark_key || senderStarkKey,
2175
+ sender_vault_id: signableResultData.sender_vault_id,
2176
+ receiver_stark_key: signableResultData.receiver_stark_key,
2177
+ receiver_vault_id: signableResultData.receiver_vault_id,
2178
+ asset_id: signableResultData.asset_id,
2179
+ amount: signableResultData.amount,
2180
+ nonce: signableResultData.nonce,
2181
+ expiration_timestamp: signableResultData.expiration_timestamp,
2182
+ stark_signature: starkSignature,
2183
+ };
2184
+ const createTransferRequest = {
2185
+ createTransferRequest: transferSigningParams,
2186
+ };
2187
+ const headers = {
2188
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2189
+ Authorization: `Bearer ${user.accessToken}`,
2190
+ };
2191
+ const { data: responseData } = await transfersApi.createTransferV1(createTransferRequest, { headers });
2192
+ return {
2193
+ sent_signature: responseData.sent_signature,
2194
+ status: responseData.status?.toString(),
2195
+ time: responseData.time,
2196
+ transfer_id: responseData.transfer_id,
2197
+ };
2198
+ }, PassportErrorType.TRANSFER_ERROR);
2199
+ }
2200
+ async function batchNftTransfer({ user, starkSigner, request, transfersApi, confirmationScreen, }) {
958
2201
  return withPassportError(async () => {
959
2202
  const ethAddress = user.etherKey;
960
2203
  const signableRequests = request.map((nftTransfer) => ({
@@ -973,10 +2216,9 @@ async function batchNftTransfer({ user, starkSigner, request, transfersApi, pass
973
2216
  const signableResult = await transfersApi.getSignableTransfer({
974
2217
  getSignableTransferRequestV2,
975
2218
  });
976
- const confirmationScreen = new ConfirmationScreen(passportConfig);
977
2219
  const popupWindowSize = { width: 480, height: 784 };
978
2220
  const confirmationResult = await confirmationScreen.startTransaction(user.accessToken, {
979
- transactionType: TransactionTypes.CreateBatchTransfer,
2221
+ transactionType: TransactionTypes.createBatchTransfer,
980
2222
  transactionData: getSignableTransferRequestV2,
981
2223
  }, popupWindowSize);
982
2224
  if (!confirmationResult.confirmed) {
@@ -1013,7 +2255,7 @@ async function batchNftTransfer({ user, starkSigner, request, transfersApi, pass
1013
2255
  }
1014
2256
 
1015
2257
  const ERC721$2 = 'ERC721';
1016
- async function createOrder$1({ starkSigner, user, request, ordersApi, passportConfig, }) {
2258
+ async function createOrder$1({ starkSigner, user, request, ordersApi, confirmationScreen, }) {
1017
2259
  return withPassportError(async () => {
1018
2260
  const ethAddress = user.etherKey;
1019
2261
  const amountSell = request.sell.type === ERC721$2 ? '1' : request.sell.amount;
@@ -1030,9 +2272,8 @@ async function createOrder$1({ starkSigner, user, request, ordersApi, passportCo
1030
2272
  const getSignableOrderResponse = await ordersApi.getSignableOrder({
1031
2273
  getSignableOrderRequestV3,
1032
2274
  });
1033
- const confirmationScreen = new ConfirmationScreen(passportConfig);
1034
2275
  const confirmationResult = await confirmationScreen.startTransaction(user.accessToken, {
1035
- transactionType: TransactionTypes.CreateOrder,
2276
+ transactionType: TransactionTypes.createOrder,
1036
2277
  transactionData: getSignableOrderRequestV3,
1037
2278
  });
1038
2279
  if (!confirmationResult.confirmed) {
@@ -1069,7 +2310,7 @@ async function createOrder$1({ starkSigner, user, request, ordersApi, passportCo
1069
2310
  };
1070
2311
  }, PassportErrorType.CREATE_ORDER_ERROR);
1071
2312
  }
1072
- async function cancelOrder$1({ user, starkSigner, request, ordersApi, passportConfig, }) {
2313
+ async function cancelOrder$1({ user, starkSigner, request, ordersApi, confirmationScreen, }) {
1073
2314
  return withPassportError(async () => {
1074
2315
  const getSignableCancelOrderRequest = {
1075
2316
  order_id: request.order_id,
@@ -1077,9 +2318,8 @@ async function cancelOrder$1({ user, starkSigner, request, ordersApi, passportCo
1077
2318
  const getSignableCancelOrderResponse = await ordersApi.getSignableCancelOrder({
1078
2319
  getSignableCancelOrderRequest,
1079
2320
  });
1080
- const confirmationScreen = new ConfirmationScreen(passportConfig);
1081
2321
  const confirmationResult = await confirmationScreen.startTransaction(user.accessToken, {
1082
- transactionType: TransactionTypes.CancelOrder,
2322
+ transactionType: TransactionTypes.cancelOrder,
1083
2323
  transactionData: getSignableCancelOrderRequest,
1084
2324
  });
1085
2325
  if (!confirmationResult.confirmed) {
@@ -1149,7 +2389,7 @@ async function exchangeTransfer$1({ user, starkSigner, request, exchangesApi, })
1149
2389
  }, PassportErrorType.EXCHANGE_TRANSFER_ERROR);
1150
2390
  }
1151
2391
 
1152
- async function createTrade$1({ request, tradesApi, user, starkSigner, passportConfig, }) {
2392
+ async function createTrade$1({ request, tradesApi, user, starkSigner, confirmationScreen, }) {
1153
2393
  return withPassportError(async () => {
1154
2394
  const ethAddress = user.etherKey;
1155
2395
  const getSignableTradeRequest = {
@@ -1161,9 +2401,8 @@ async function createTrade$1({ request, tradesApi, user, starkSigner, passportCo
1161
2401
  const getSignableTradeResponse = await tradesApi.getSignableTrade({
1162
2402
  getSignableTradeRequest,
1163
2403
  });
1164
- const confirmationScreen = new ConfirmationScreen(passportConfig);
1165
2404
  const confirmationResult = await confirmationScreen.startTransaction(user.accessToken, {
1166
- transactionType: TransactionTypes.CreateTrade,
2405
+ transactionType: TransactionTypes.createTrade,
1167
2406
  transactionData: getSignableTradeRequest,
1168
2407
  });
1169
2408
  if (!confirmationResult.confirmed) {
@@ -1202,13 +2441,13 @@ async function createTrade$1({ request, tradesApi, user, starkSigner, passportCo
1202
2441
  class PassportImxProvider {
1203
2442
  user;
1204
2443
  starkSigner;
1205
- passportConfig;
1206
2444
  immutableXClient;
1207
- constructor({ user, starkSigner, passportConfig, immutableXClient, }) {
2445
+ confirmationScreen;
2446
+ constructor({ user, starkSigner, immutableXClient, confirmationScreen, }) {
1208
2447
  this.user = user;
1209
2448
  this.starkSigner = starkSigner;
1210
- this.passportConfig = passportConfig;
1211
2449
  this.immutableXClient = immutableXClient;
2450
+ this.confirmationScreen = confirmationScreen;
1212
2451
  }
1213
2452
  async transfer(request) {
1214
2453
  return transfer$1({
@@ -1216,7 +2455,7 @@ class PassportImxProvider {
1216
2455
  user: this.user,
1217
2456
  starkSigner: this.starkSigner,
1218
2457
  transfersApi: this.immutableXClient.transfersApi,
1219
- passportConfig: this.passportConfig,
2458
+ confirmationScreen: this.confirmationScreen,
1220
2459
  });
1221
2460
  }
1222
2461
  // TODO: Remove once implemented
@@ -1235,7 +2474,7 @@ class PassportImxProvider {
1235
2474
  user: this.user,
1236
2475
  starkSigner: this.starkSigner,
1237
2476
  ordersApi: this.immutableXClient.ordersApi,
1238
- passportConfig: this.passportConfig,
2477
+ confirmationScreen: this.confirmationScreen,
1239
2478
  });
1240
2479
  }
1241
2480
  cancelOrder(request) {
@@ -1244,7 +2483,7 @@ class PassportImxProvider {
1244
2483
  user: this.user,
1245
2484
  starkSigner: this.starkSigner,
1246
2485
  ordersApi: this.immutableXClient.ordersApi,
1247
- passportConfig: this.passportConfig,
2486
+ confirmationScreen: this.confirmationScreen,
1248
2487
  });
1249
2488
  }
1250
2489
  createTrade(request) {
@@ -1253,7 +2492,7 @@ class PassportImxProvider {
1253
2492
  user: this.user,
1254
2493
  starkSigner: this.starkSigner,
1255
2494
  tradesApi: this.immutableXClient.tradesApi,
1256
- passportConfig: this.passportConfig,
2495
+ confirmationScreen: this.confirmationScreen,
1257
2496
  });
1258
2497
  }
1259
2498
  batchNftTransfer(request) {
@@ -1262,7 +2501,7 @@ class PassportImxProvider {
1262
2501
  user: this.user,
1263
2502
  starkSigner: this.starkSigner,
1264
2503
  transfersApi: this.immutableXClient.transfersApi,
1265
- passportConfig: this.passportConfig,
2504
+ confirmationScreen: this.confirmationScreen,
1266
2505
  });
1267
2506
  }
1268
2507
  exchangeTransfer(request) {
@@ -1402,17 +2641,17 @@ async function registerPassport({ ethSigner, starkSigner, usersApi }, authorizat
1402
2641
  }, PassportErrorType.USER_REGISTRATION_ERROR);
1403
2642
  }
1404
2643
 
1405
- // TODO: Remove this once the dependency has been added
1406
- // eslint-disable-next-line import/no-extraneous-dependencies
1407
2644
  class Passport {
1408
2645
  authManager;
1409
2646
  magicAdapter;
1410
2647
  config;
1411
2648
  immutableXClient;
2649
+ confirmationScreen;
1412
2650
  constructor(passportModuleConfiguration) {
1413
2651
  this.config = new PassportConfiguration(passportModuleConfiguration);
1414
2652
  this.authManager = new AuthManager(this.config);
1415
2653
  this.magicAdapter = new MagicAdapter(this.config);
2654
+ this.confirmationScreen = new ConfirmationScreen(this.config);
1416
2655
  this.immutableXClient = passportModuleConfiguration.overrides?.immutableXClient
1417
2656
  || new ImmutableXClient({
1418
2657
  baseConfig: passportModuleConfiguration.baseConfig,
@@ -1430,16 +2669,16 @@ class Passport {
1430
2669
  return new PassportImxProvider({
1431
2670
  user: updatedUser,
1432
2671
  starkSigner,
1433
- passportConfig: this.config,
1434
2672
  immutableXClient: this.immutableXClient,
2673
+ confirmationScreen: this.confirmationScreen,
1435
2674
  });
1436
2675
  }
1437
2676
  const userWithEtherKey = user;
1438
2677
  return new PassportImxProvider({
1439
2678
  user: userWithEtherKey,
1440
2679
  starkSigner,
1441
- passportConfig: this.config,
1442
2680
  immutableXClient: this.immutableXClient,
2681
+ confirmationScreen: this.confirmationScreen,
1443
2682
  });
1444
2683
  }
1445
2684
  async connectImxSilent() {
@@ -1883,10 +3122,10 @@ class OrdersService {
1883
3122
  /**
1884
3123
  * List all orders
1885
3124
  * List all orders
1886
- * @returns Orders OK response.
3125
+ * @returns ListOrdersResult OK response.
1887
3126
  * @throws ApiError
1888
3127
  */
1889
- listOrders({ chainId, pageSize = 100, sortBy, sortDirection, pageCursor, }) {
3128
+ listOrders({ chainId, status, sellItemContractAddress, sellItemTokenId, pageSize, sortBy, sortDirection, pageCursor, }) {
1890
3129
  return this.httpRequest.request({
1891
3130
  method: 'GET',
1892
3131
  url: '/v1/chains/{chain_id}/orders',
@@ -1894,21 +3133,25 @@ class OrdersService {
1894
3133
  'chain_id': chainId,
1895
3134
  },
1896
3135
  query: {
3136
+ 'status': status,
3137
+ 'sell_item_contract_address': sellItemContractAddress,
3138
+ 'sell_item_token_id': sellItemTokenId,
1897
3139
  'page_size': pageSize,
1898
3140
  'sort_by': sortBy,
1899
3141
  'sort_direction': sortDirection,
1900
3142
  'page_cursor': pageCursor,
1901
3143
  },
1902
3144
  errors: {
1903
- 404: `not_found: Resource not found`,
1904
- 500: `internal_error: Internal server error`,
3145
+ 400: `Client error`,
3146
+ 404: `The specified resource was not found`,
3147
+ 500: `Internal server error`,
1905
3148
  },
1906
3149
  });
1907
3150
  }
1908
3151
  /**
1909
3152
  * Create an order
1910
3153
  * Create an order
1911
- * @returns Order Created response.
3154
+ * @returns OrderResult Created response.
1912
3155
  * @throws ApiError
1913
3156
  */
1914
3157
  createOrder({ chainId, requestBody, }) {
@@ -1921,16 +3164,16 @@ class OrdersService {
1921
3164
  body: requestBody,
1922
3165
  mediaType: 'application/json',
1923
3166
  errors: {
1924
- 400: `bad_request: Bad Request`,
1925
- 404: `not_found: Resource not found`,
1926
- 500: `internal_error: Internal server error`,
3167
+ 400: `Client error`,
3168
+ 404: `The specified resource was not found`,
3169
+ 500: `Internal server error`,
1927
3170
  },
1928
3171
  });
1929
3172
  }
1930
3173
  /**
1931
3174
  * Get a single order by ID
1932
3175
  * Get a single order by ID
1933
- * @returns Order OK response.
3176
+ * @returns OrderResult OK response.
1934
3177
  * @throws ApiError
1935
3178
  */
1936
3179
  getOrder({ chainId, orderId, }) {
@@ -1942,8 +3185,9 @@ class OrdersService {
1942
3185
  'order_id': orderId,
1943
3186
  },
1944
3187
  errors: {
1945
- 404: `not_found: Resource not found`,
1946
- 500: `internal_error: Internal server error`,
3188
+ 400: `Client error`,
3189
+ 404: `The specified resource was not found`,
3190
+ 500: `Internal server error`,
1947
3191
  },
1948
3192
  });
1949
3193
  }
@@ -1974,8 +3218,8 @@ class OrderBookClient {
1974
3218
  var BuyItem;
1975
3219
  (function (BuyItem) {
1976
3220
  (function (item_type) {
3221
+ item_type["NATIVE"] = "NATIVE";
1977
3222
  item_type["ERC20"] = "ERC20";
1978
- item_type["IMX"] = "IMX";
1979
3223
  })(BuyItem.item_type || (BuyItem.item_type = {}));
1980
3224
  })(BuyItem || (BuyItem = {}));
1981
3225
 
@@ -1985,7 +3229,7 @@ var BuyItem;
1985
3229
  var CreateOrderProtocolData;
1986
3230
  (function (CreateOrderProtocolData) {
1987
3231
  (function (order_type) {
1988
- order_type["FULL_OPEN"] = "FULL_OPEN";
3232
+ order_type["FULL_RESTRICTED"] = "FULL_RESTRICTED";
1989
3233
  })(CreateOrderProtocolData.order_type || (CreateOrderProtocolData.order_type = {}));
1990
3234
  })(CreateOrderProtocolData || (CreateOrderProtocolData = {}));
1991
3235
 
@@ -2002,18 +3246,18 @@ var Fee;
2002
3246
  /* istanbul ignore file */
2003
3247
  /* tslint:disable */
2004
3248
  /* eslint-disable */
2005
- var Order;
2006
- (function (Order) {
2007
- (function (status) {
2008
- status["PENDING"] = "PENDING";
2009
- status["ACTIVE"] = "ACTIVE";
2010
- status["CANCELLED"] = "CANCELLED";
2011
- status["INACTIVE"] = "INACTIVE";
2012
- status["REJECTED"] = "REJECTED";
2013
- status["FILLED"] = "FILLED";
2014
- status["EXPIRED"] = "EXPIRED";
2015
- })(Order.status || (Order.status = {}));
2016
- })(Order || (Order = {}));
3249
+ /**
3250
+ * The Order status
3251
+ */
3252
+ var OrderStatus;
3253
+ (function (OrderStatus) {
3254
+ OrderStatus["PENDING"] = "PENDING";
3255
+ OrderStatus["ACTIVE"] = "ACTIVE";
3256
+ OrderStatus["INACTIVE"] = "INACTIVE";
3257
+ OrderStatus["FILLED"] = "FILLED";
3258
+ OrderStatus["CANCELLED"] = "CANCELLED";
3259
+ OrderStatus["EXPIRED"] = "EXPIRED";
3260
+ })(OrderStatus || (OrderStatus = {}));
2017
3261
 
2018
3262
  /* istanbul ignore file */
2019
3263
  /* tslint:disable */
@@ -2035,6 +3279,12 @@ class ImmutableApiClient {
2035
3279
  async getOrder(orderId) {
2036
3280
  return this.orderbookService.getOrder({ chainId: this.chainId, orderId });
2037
3281
  }
3282
+ async listOrders(listOrderParams) {
3283
+ return this.orderbookService.listOrders({
3284
+ chainId: this.chainId,
3285
+ ...listOrderParams,
3286
+ });
3287
+ }
2038
3288
  async createOrder({ orderHash, orderComponents, offerer, orderSignature, }) {
2039
3289
  if (orderComponents.offer.length !== 1) {
2040
3290
  throw new Error('Only one item can be listed at a time');
@@ -2054,7 +3304,7 @@ class ImmutableApiClient {
2054
3304
  buy: [
2055
3305
  {
2056
3306
  item_type: Number(orderComponents.consideration[0].itemType) === ItemType.NATIVE
2057
- ? BuyItem.item_type.IMX
3307
+ ? BuyItem.item_type.NATIVE
2058
3308
  : BuyItem.item_type.ERC20,
2059
3309
  start_amount: orderComponents.consideration[0].startAmount,
2060
3310
  }
@@ -2070,7 +3320,7 @@ class ImmutableApiClient {
2070
3320
  : [],
2071
3321
  end_time: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
2072
3322
  protocol_data: {
2073
- order_type: CreateOrderProtocolData.order_type.FULL_OPEN,
3323
+ order_type: CreateOrderProtocolData.order_type.FULL_RESTRICTED,
2074
3324
  zone_address: orderComponents.zone,
2075
3325
  },
2076
3326
  salt: orderComponents.salt,
@@ -3121,6 +4371,7 @@ class Seaport {
3121
4371
  parameters: orderComponents,
3122
4372
  signature: order.signature,
3123
4373
  },
4374
+ extraData: order.protocol_data.operator_signature,
3124
4375
  }],
3125
4376
  });
3126
4377
  let approvalTransaction;
@@ -3242,11 +4493,20 @@ class Orderbook {
3242
4493
  /**
3243
4494
  * Get an order by ID
3244
4495
  * @param {string} orderId - The orderId to find.
3245
- * @return {Order} The returned order.
4496
+ * @return {OrderResult} The returned order result.
3246
4497
  */
3247
4498
  getOrder(orderId) {
3248
4499
  return this.apiClient.getOrder(orderId);
3249
4500
  }
4501
+ /**
4502
+ * List orders. This method is used to get a list of orders filtered by conditions specified
4503
+ * in the params object.
4504
+ * @param {ListOrderParams} listOrderParams - Filtering, ordering and page parameters.
4505
+ * @return {Orders} The paged orders.
4506
+ */
4507
+ listOrders(listOrderParams) {
4508
+ return this.apiClient.listOrders(listOrderParams);
4509
+ }
3250
4510
  /**
3251
4511
  * Get required transactions and messages for signing prior to creating a listing
3252
4512
  * through the createOrder method
@@ -3267,7 +4527,7 @@ class Orderbook {
3267
4527
  /**
3268
4528
  * Create an order
3269
4529
  * @param {CreateOrderParams} createOrderParams - create an order with the given params.
3270
- * @return {Order} The order created in the Immutable services.
4530
+ * @return {OrderResult} The result of the order created in the Immutable services.
3271
4531
  */
3272
4532
  createOrder(createOrderParams) {
3273
4533
  return this.apiClient.createOrder(createOrderParams);
@@ -3281,11 +4541,11 @@ class Orderbook {
3281
4541
  * @return {FulfilOrderResponse} Approval and fulfilment transactions.
3282
4542
  */
3283
4543
  async fulfillOrder(orderId, fulfillerAddress) {
3284
- const order = await this.apiClient.getOrder(orderId);
3285
- if (order.status !== Order.status.ACTIVE) {
3286
- throw new Error(`Cannot fulfil order that is not active. Current status: ${order.status}`);
4544
+ const orderResult = await this.apiClient.getOrder(orderId);
4545
+ if (orderResult.result.status !== OrderStatus.ACTIVE) {
4546
+ throw new Error(`Cannot fulfil order that is not active. Current status: ${orderResult.result.status}`);
3287
4547
  }
3288
- return this.seaport.fulfilOrder(order, fulfillerAddress);
4548
+ return this.seaport.fulfilOrder(orderResult.result, fulfillerAddress);
3289
4549
  }
3290
4550
  /**
3291
4551
  * Get an unsigned cancel order transaction. Orders can only be cancelled by
@@ -3295,16 +4555,16 @@ class Orderbook {
3295
4555
  * @return {CancelOrderResponse} The unsigned cancel order transaction
3296
4556
  */
3297
4557
  async cancelOrder(orderId, accountAddress) {
3298
- const order = await this.apiClient.getOrder(orderId);
3299
- if (order.status !== Order.status.ACTIVE
3300
- && order.status !== Order.status.INACTIVE
3301
- && order.status !== Order.status.PENDING) {
3302
- throw new Error(`Cannot cancel order with status ${order.status}`);
4558
+ const orderResult = await this.apiClient.getOrder(orderId);
4559
+ if (orderResult.result.status !== OrderStatus.ACTIVE
4560
+ && orderResult.result.status !== OrderStatus.INACTIVE
4561
+ && orderResult.result.status !== OrderStatus.PENDING) {
4562
+ throw new Error(`Cannot cancel order with status ${orderResult.result.status}`);
3303
4563
  }
3304
- if (order.account_address !== accountAddress.toLowerCase()) {
3305
- throw new Error(`Only account ${order.account_address} can cancel order ${orderId}`);
4564
+ if (orderResult.result.account_address !== accountAddress.toLowerCase()) {
4565
+ throw new Error(`Only account ${orderResult.result.account_address} can cancel order ${orderId}`);
3306
4566
  }
3307
- const cancelOrderTransaction = await this.seaport.cancelOrder(order, accountAddress);
4567
+ const cancelOrderTransaction = await this.seaport.cancelOrder(orderResult.result, accountAddress);
3308
4568
  return { unsignedCancelOrderTransaction: cancelOrderTransaction };
3309
4569
  }
3310
4570
  }
@@ -4432,6 +5692,19 @@ const $762782b6c862d954$export$db5daa1b5156ccfe = [
4432
5692
  ];
4433
5693
 
4434
5694
 
5695
+ /**
5696
+ * Enum representing the supported chains with their corresponding IDs.
5697
+ */ let $baec09ddc3013323$export$c06e1e7429de6283;
5698
+ (function(ChainId) {
5699
+ ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
5700
+ ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
5701
+ ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 13373] = "IMTBL_ZKEVM_DEVNET";
5702
+ ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13372] = "IMTBL_ZKEVM_TESTNET";
5703
+ ChainId[ChainId["POLYGON_ZKEVM_TESTNET"] = 1442] = "POLYGON_ZKEVM_TESTNET";
5704
+ ChainId[ChainId["POLYGON_ZKEVM"] = 137] = "POLYGON_ZKEVM";
5705
+ })($baec09ddc3013323$export$c06e1e7429de6283 || ($baec09ddc3013323$export$c06e1e7429de6283 = {}));
5706
+
5707
+
4435
5708
 
4436
5709
  const $bc2bfebf768286d3$export$6a2ba3c3bd042990 = {
4437
5710
  baseConfig: {
@@ -4446,18 +5719,10 @@ let $d176a05e966364ba$export$3bfad4d03ada24c4;
4446
5719
  })($d176a05e966364ba$export$3bfad4d03ada24c4 || ($d176a05e966364ba$export$3bfad4d03ada24c4 = {}));
4447
5720
 
4448
5721
 
4449
- let $a47e48dd2c04791b$export$c06e1e7429de6283;
4450
- (function(ChainId) {
4451
- ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
4452
- ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
4453
- ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 13373] = "IMTBL_ZKEVM_DEVNET";
4454
- ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13372] = "IMTBL_ZKEVM_TESTNET";
4455
- ChainId[ChainId["POLYGON_ZKEVM_TESTNET"] = 1442] = "POLYGON_ZKEVM_TESTNET";
4456
- ChainId[ChainId["POLYGON_ZKEVM"] = 137] = "POLYGON_ZKEVM";
4457
- })($a47e48dd2c04791b$export$c06e1e7429de6283 || ($a47e48dd2c04791b$export$c06e1e7429de6283 = {}));
5722
+
4458
5723
  const $a47e48dd2c04791b$export$6f24f3cef7d501c4 = new Map([
4459
5724
  [
4460
- $a47e48dd2c04791b$export$c06e1e7429de6283.ETHEREUM,
5725
+ ($baec09ddc3013323$export$c06e1e7429de6283).ETHEREUM,
4461
5726
  {
4462
5727
  chainIdHex: "0x1",
4463
5728
  chainName: "Ethereum",
@@ -4475,7 +5740,7 @@ const $a47e48dd2c04791b$export$6f24f3cef7d501c4 = new Map([
4475
5740
  }
4476
5741
  ],
4477
5742
  [
4478
- $a47e48dd2c04791b$export$c06e1e7429de6283.IMTBL_ZKEVM_TESTNET,
5743
+ ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_TESTNET,
4479
5744
  {
4480
5745
  chainIdHex: "0x343C",
4481
5746
  chainName: "Immutable zkEVM Testnet",
@@ -4490,7 +5755,7 @@ const $a47e48dd2c04791b$export$6f24f3cef7d501c4 = new Map([
4490
5755
  }
4491
5756
  ],
4492
5757
  [
4493
- $a47e48dd2c04791b$export$c06e1e7429de6283.POLYGON_ZKEVM,
5758
+ ($baec09ddc3013323$export$c06e1e7429de6283).POLYGON_ZKEVM,
4494
5759
  {
4495
5760
  chainIdHex: "0x89",
4496
5761
  chainName: "Polygon zkEVM",
@@ -4510,7 +5775,7 @@ const $a47e48dd2c04791b$export$6f24f3cef7d501c4 = new Map([
4510
5775
  ]);
4511
5776
  const $a47e48dd2c04791b$export$3e81fc0987227f10 = new Map([
4512
5777
  [
4513
- $a47e48dd2c04791b$export$c06e1e7429de6283.SEPOLIA,
5778
+ ($baec09ddc3013323$export$c06e1e7429de6283).SEPOLIA,
4514
5779
  {
4515
5780
  chainIdHex: "0xaa36a7",
4516
5781
  chainName: "Sepolia",
@@ -4528,7 +5793,7 @@ const $a47e48dd2c04791b$export$3e81fc0987227f10 = new Map([
4528
5793
  }
4529
5794
  ],
4530
5795
  [
4531
- $a47e48dd2c04791b$export$c06e1e7429de6283.IMTBL_ZKEVM_DEVNET,
5796
+ ($baec09ddc3013323$export$c06e1e7429de6283).IMTBL_ZKEVM_DEVNET,
4532
5797
  {
4533
5798
  chainIdHex: "0x343D",
4534
5799
  chainName: "Immutable zkEVM Devnet",
@@ -4543,7 +5808,7 @@ const $a47e48dd2c04791b$export$3e81fc0987227f10 = new Map([
4543
5808
  }
4544
5809
  ],
4545
5810
  [
4546
- $a47e48dd2c04791b$export$c06e1e7429de6283.POLYGON_ZKEVM_TESTNET,
5811
+ ($baec09ddc3013323$export$c06e1e7429de6283).POLYGON_ZKEVM_TESTNET,
4547
5812
  {
4548
5813
  chainIdHex: "0x5A2",
4549
5814
  chainName: "Polygon zkEVM Testnet",
@@ -4567,8 +5832,8 @@ let $a47e48dd2c04791b$export$1f05a55fe0680cc7;
4567
5832
  })($a47e48dd2c04791b$export$1f05a55fe0680cc7 || ($a47e48dd2c04791b$export$1f05a55fe0680cc7 = {}));
4568
5833
 
4569
5834
 
4570
- // TODO: fix circular dependency
4571
- // eslint-disable-next-line import/no-cycle
5835
+
5836
+
4572
5837
  let $08d5ddc39acd6833$export$fd9b17d87f4121d2;
4573
5838
  (function(TokenFilterTypes) {
4574
5839
  TokenFilterTypes["SWAP"] = "swap";
@@ -4577,10 +5842,17 @@ let $08d5ddc39acd6833$export$fd9b17d87f4121d2;
4577
5842
  })($08d5ddc39acd6833$export$fd9b17d87f4121d2 || ($08d5ddc39acd6833$export$fd9b17d87f4121d2 = {}));
4578
5843
 
4579
5844
 
5845
+ /**
5846
+ * Interface representing token information.
5847
+ * @property {string} name - The token name.
5848
+ * @property {string} symbol - The token symbol.
5849
+ * @property {number} decimals - The token decimals.
5850
+ * @property {string} [address] - The token contract address.
5851
+ * @property {string} [icon] - The token icon URL/data:image.
5852
+ */
5853
+
4580
5854
 
4581
5855
 
4582
- // TODO: fix circular dependency
4583
- // eslint-disable-next-line import/no-cycle
4584
5856
  let $4f91c5f280efe242$export$35b06f0d33f57e26;
4585
5857
  (function(WalletAction) {
4586
5858
  WalletAction["CHECK_CONNECTION"] = "eth_accounts";
@@ -4612,7 +5884,9 @@ let $4f91c5f280efe242$export$a75605c67ea83a5a;
4612
5884
  CheckoutErrorType["PROVIDER_REQUEST_MISSING_ERROR"] = "PROVIDER_REQUEST_MISSING_ERROR";
4613
5885
  CheckoutErrorType["PROVIDER_REQUEST_FAILED_ERROR"] = "PROVIDER_REQUEST_FAILED_ERROR";
4614
5886
  CheckoutErrorType["USER_REJECTED_REQUEST_ERROR"] = "USER_REJECTED_REQUEST_ERROR";
4615
- CheckoutErrorType["TRANSACTION_ERROR"] = "TRANSACTION_ERROR";
5887
+ CheckoutErrorType["TRANSACTION_FAILED"] = "TRANSACTION_FAILED";
5888
+ CheckoutErrorType["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
5889
+ CheckoutErrorType["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
4616
5890
  })($a8bc256d81a5e2c1$export$e3dc0620abde7f5a || ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a = {}));
4617
5891
  class $a8bc256d81a5e2c1$export$b722478a3cbfa3bc extends Error {
4618
5892
  constructor(message, type, data){
@@ -4772,7 +6046,7 @@ async function $de192de6ef100f9f$export$79f13b4cfaaf0d09(config, provider) {
4772
6046
  async function $de192de6ef100f9f$export$b827d9418aeb5dbd(config, providerPreference, provider, chainId) {
4773
6047
  let currentProvider = provider;
4774
6048
  const { networkMap: networkMap } = config;
4775
- if (!Object.values(($a47e48dd2c04791b$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
6049
+ if (!Object.values(($baec09ddc3013323$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Chain:${chainId} is not a supported chain`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
4776
6050
  if (!currentProvider || !currentProvider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("Incompatible provider", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR, {
4777
6051
  details: "Unsupported provider"
4778
6052
  });
@@ -4900,7 +6174,7 @@ async function $1564e43dde50bb61$export$60e0fe116a0e6ed0(provider, walletAddress
4900
6174
  });
4901
6175
  }
4902
6176
  const $1564e43dde50bb61$export$fee49741664a4d7e = async (config, provider, walletAddress, chainId)=>{
4903
- if (!Object.values(($a47e48dd2c04791b$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`ChainId ${chainId} is not supported`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
6177
+ if (!Object.values(($baec09ddc3013323$export$c06e1e7429de6283)).includes(chainId)) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`ChainId ${chainId} is not supported`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).CHAIN_NOT_SUPPORTED_ERROR);
4904
6178
  if (!provider.provider?.request) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)("provider object is missing request function", ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).PROVIDER_REQUEST_MISSING_ERROR);
4905
6179
  const tokenList = await ($efe60cea83bfc4e8$export$473cec51305fdae8)({
4906
6180
  type: ($08d5ddc39acd6833$export$fd9b17d87f4121d2).ALL,
@@ -4949,16 +6223,20 @@ async function $5cdde2ffe6360fec$export$a822caa90d7eef09({ type: type = ($4f91c5
4949
6223
 
4950
6224
 
4951
6225
 
6226
+
4952
6227
  const $dbe95599a4661140$export$8e0e7ffc78696d30 = async (params)=>{
4953
6228
  const { provider: provider , transaction: transaction } = params;
4954
- return await ($a8bc256d81a5e2c1$export$bacc563de539c6c3)(async ()=>{
6229
+ try {
4955
6230
  const transactionResponse = await provider.getSigner().sendTransaction(transaction);
4956
6231
  return {
4957
6232
  transactionResponse: transactionResponse
4958
6233
  };
4959
- }, {
4960
- type: ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).TRANSACTION_ERROR
4961
- });
6234
+ } catch (err) {
6235
+ if (err.code === (ethers).errors.INSUFFICIENT_FUNDS) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).INSUFFICIENT_FUNDS);
6236
+ if (err.code === (ethers).errors.ACTION_REJECTED) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).USER_REJECTED_REQUEST_ERROR);
6237
+ if (err.code === (ethers).errors.UNPREDICTABLE_GAS_LIMIT) throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).UNPREDICTABLE_GAS_LIMIT);
6238
+ throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(err.message, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).TRANSACTION_FAILED);
6239
+ }
4962
6240
  };
4963
6241
 
4964
6242
 
@@ -5097,9 +6375,7 @@ function $parcel$export(e, n, v, s) {
5097
6375
  var $207ed853f11d19d5$exports = {};
5098
6376
 
5099
6377
  $parcel$export($207ed853f11d19d5$exports, "IMTBLWidgetEvents", () => $207ed853f11d19d5$export$5a0ace85cae72d45);
5100
- /**
5101
- * Enum representing the events emitted by the widgets.
5102
- */ let $207ed853f11d19d5$export$5a0ace85cae72d45;
6378
+ let $207ed853f11d19d5$export$5a0ace85cae72d45;
5103
6379
  (function(IMTBLWidgetEvents) {
5104
6380
  IMTBLWidgetEvents["IMTBL_CONNECT_WIDGET_EVENT"] = "imtbl-connect-widget";
5105
6381
  IMTBLWidgetEvents["IMTBL_WALLET_WIDGET_EVENT"] = "imtbl-wallet-widget";
@@ -5115,23 +6391,21 @@ var $a85ecdbd885c58ad$exports = {};
5115
6391
  $parcel$export($a85ecdbd885c58ad$exports, "ConnectEventType", () => $a85ecdbd885c58ad$export$e72e7f9969a47dd3);
5116
6392
  let $a85ecdbd885c58ad$export$e72e7f9969a47dd3;
5117
6393
  (function(ConnectEventType) {
6394
+ ConnectEventType["CLOSE_WIDGET"] = "close-widget";
5118
6395
  ConnectEventType["SUCCESS"] = "success";
5119
6396
  ConnectEventType["FAILURE"] = "failure";
5120
- ConnectEventType["CLOSE_WIDGET"] = "close-widget";
5121
6397
  })($a85ecdbd885c58ad$export$e72e7f9969a47dd3 || ($a85ecdbd885c58ad$export$e72e7f9969a47dd3 = {}));
5122
6398
 
5123
6399
 
5124
6400
  var $77b6aac5c353d4a9$exports = {};
5125
6401
 
5126
6402
  $parcel$export($77b6aac5c353d4a9$exports, "WalletEventType", () => $77b6aac5c353d4a9$export$d9be06b70b28c742);
5127
- let $77b6aac5c353d4a9$export$d9be06b70b28c742;
6403
+ /**
6404
+ * Enum representing possible Wallet Widget event types.
6405
+ */ let $77b6aac5c353d4a9$export$d9be06b70b28c742;
5128
6406
  (function(WalletEventType) {
5129
6407
  WalletEventType["CLOSE_WIDGET"] = "close-widget";
5130
6408
  WalletEventType["NETWORK_SWITCH"] = "network-switch";
5131
- WalletEventType["ADD_COINS"] = "add-coins";
5132
- WalletEventType["REQUEST_SWAP"] = "request-swap";
5133
- WalletEventType["REQUEST_BRIDGE"] = "request-bridge";
5134
- WalletEventType["REQUEST_ONRAMP"] = "request-onramp";
5135
6409
  WalletEventType["DISCONNECT_WALLET"] = "disconnect-wallet";
5136
6410
  })($77b6aac5c353d4a9$export$d9be06b70b28c742 || ($77b6aac5c353d4a9$export$d9be06b70b28c742 = {}));
5137
6411
 
@@ -5140,14 +6414,13 @@ var $53d219e7f6bf0cd6$exports = {};
5140
6414
 
5141
6415
  $parcel$export($53d219e7f6bf0cd6$exports, "SwapEventType", () => $53d219e7f6bf0cd6$export$140a49745ab55563);
5142
6416
  /**
5143
- * Represents an event object emitted by the Swap Widget.
5144
- * @property {SwapEventType} type - The type of the event.
5145
- * @property {T} data - The data contained in the event.
6417
+ * Enum representing possible Swap Widget event types.
5146
6418
  */ let $53d219e7f6bf0cd6$export$140a49745ab55563;
5147
6419
  (function(SwapEventType) {
6420
+ SwapEventType["CLOSE_WIDGET"] = "close-widget";
5148
6421
  SwapEventType["SUCCESS"] = "success";
5149
6422
  SwapEventType["FAILURE"] = "failure";
5150
- SwapEventType["CLOSE_WIDGET"] = "close-widget";
6423
+ SwapEventType["REJECTED"] = "rejected";
5151
6424
  })($53d219e7f6bf0cd6$export$140a49745ab55563 || ($53d219e7f6bf0cd6$export$140a49745ab55563 = {}));
5152
6425
 
5153
6426
 
@@ -5155,9 +6428,7 @@ var $15cc9e120aa6f3bf$exports = {};
5155
6428
 
5156
6429
  $parcel$export($15cc9e120aa6f3bf$exports, "BridgeEventType", () => $15cc9e120aa6f3bf$export$d1bfa21f7c76447a);
5157
6430
  /**
5158
- * Represents an event object emitted by the Bridge Widget.
5159
- * @property {BridgeEventType} type - The type of the event.
5160
- * @property {T} data - The data associated with the event.
6431
+ * Enum of possible Bridge Widget event types.
5161
6432
  */ let $15cc9e120aa6f3bf$export$d1bfa21f7c76447a;
5162
6433
  (function(BridgeEventType) {
5163
6434
  BridgeEventType["CLOSE_WIDGET"] = "close-widget";
@@ -5170,33 +6441,37 @@ var $98cbcca465beec95$exports = {};
5170
6441
 
5171
6442
  $parcel$export($98cbcca465beec95$exports, "BuyEventType", () => $98cbcca465beec95$export$90db5fe1be5993c1);
5172
6443
  /**
5173
- * Represents an event object emitted by the Buy Widget.
5174
- * @property {BuyEventType} type - The type of the event.
5175
- * @property {T} data - The data contained in the event.
6444
+ * Enum representing possible Buy Widget event types.
5176
6445
  */ let $98cbcca465beec95$export$90db5fe1be5993c1;
5177
6446
  (function(BuyEventType) {
6447
+ BuyEventType["CLOSE_WIDGET"] = "close-widget";
5178
6448
  BuyEventType["SUCCESS"] = "success";
5179
6449
  BuyEventType["FAILURE"] = "failure";
5180
6450
  BuyEventType["NOT_CONNECTED"] = "not_connected";
5181
- BuyEventType["CLOSE"] = "close";
5182
6451
  })($98cbcca465beec95$export$90db5fe1be5993c1 || ($98cbcca465beec95$export$90db5fe1be5993c1 = {}));
5183
6452
 
5184
6453
 
5185
- var $66ceef112c0ee49e$exports = {};
6454
+ var $ad06b030b1a3ba34$exports = {};
5186
6455
 
5187
- $parcel$export($66ceef112c0ee49e$exports, "OnRampEventType", () => $66ceef112c0ee49e$export$66ec39c0924078d8);
5188
- let $66ceef112c0ee49e$export$66ec39c0924078d8;
5189
- $66ceef112c0ee49e$export$66ec39c0924078d8 || ($66ceef112c0ee49e$export$66ec39c0924078d8 = {});
6456
+ $parcel$export($ad06b030b1a3ba34$exports, "OrchestrationEventType", () => $ad06b030b1a3ba34$export$b80d2daf830437b9);
6457
+ let $ad06b030b1a3ba34$export$b80d2daf830437b9;
6458
+ (function(OrchestrationEventType) {
6459
+ OrchestrationEventType["REQUEST_CONNECT"] = "request-connect";
6460
+ OrchestrationEventType["REQUEST_WALLET"] = "request-wallet";
6461
+ OrchestrationEventType["REQUEST_SWAP"] = "request-swap";
6462
+ OrchestrationEventType["REQUEST_BRIDGE"] = "request-bridge";
6463
+ OrchestrationEventType["REQUEST_ONRAMP"] = "request-onramp";
6464
+ })($ad06b030b1a3ba34$export$b80d2daf830437b9 || ($ad06b030b1a3ba34$export$b80d2daf830437b9 = {}));
5190
6465
  /* eslint-disable @typescript-eslint/naming-convention */
5191
6466
 
5192
- var $14d7a2bbb79e0dae$exports = {};
6467
+ var $045213b18e9f1f94$exports = {};
5193
6468
 
5194
- $parcel$export($14d7a2bbb79e0dae$exports, "Network", () => $14d7a2bbb79e0dae$export$95be4ae94445245a);
5195
- $parcel$export($14d7a2bbb79e0dae$exports, "WidgetTheme", () => $14d7a2bbb79e0dae$export$c88931fdc51854eb);
5196
- $parcel$export($14d7a2bbb79e0dae$exports, "CheckoutWidgetTagNames", () => $14d7a2bbb79e0dae$export$75be0f6af9650f2c);
6469
+ $parcel$export($045213b18e9f1f94$exports, "Network", () => $045213b18e9f1f94$export$95be4ae94445245a);
6470
+ $parcel$export($045213b18e9f1f94$exports, "WidgetTheme", () => $045213b18e9f1f94$export$c88931fdc51854eb);
6471
+ $parcel$export($045213b18e9f1f94$exports, "CheckoutWidgetTagNames", () => $045213b18e9f1f94$export$75be0f6af9650f2c);
5197
6472
  /**
5198
6473
  * Enum representing the networks supported by Checkout.
5199
- */ let $14d7a2bbb79e0dae$export$95be4ae94445245a;
6474
+ */ let $045213b18e9f1f94$export$95be4ae94445245a;
5200
6475
  (function(Network) {
5201
6476
  Network["ETHEREUM"] = "Ethereum";
5202
6477
  Network["SEPOLIA"] = "Sepolia";
@@ -5204,14 +6479,14 @@ $parcel$export($14d7a2bbb79e0dae$exports, "CheckoutWidgetTagNames", () => $14d7a
5204
6479
  Network["IMTBL_ZKEVM_DEVNET"] = "Immutable zkEVM Devnet";
5205
6480
  Network["POLYGON_ZKEVM_TESTNET"] = "Polygon zkEVM Testnet";
5206
6481
  Network["POLYGON_ZKEVM"] = "Polygon zkEVM";
5207
- })($14d7a2bbb79e0dae$export$95be4ae94445245a || ($14d7a2bbb79e0dae$export$95be4ae94445245a = {}));
5208
- let $14d7a2bbb79e0dae$export$c88931fdc51854eb;
6482
+ })($045213b18e9f1f94$export$95be4ae94445245a || ($045213b18e9f1f94$export$95be4ae94445245a = {}));
6483
+ let $045213b18e9f1f94$export$c88931fdc51854eb;
5209
6484
  (function(WidgetTheme) {
5210
6485
  WidgetTheme["LIGHT"] = "light";
5211
6486
  WidgetTheme["DARK"] = "dark";
5212
6487
  WidgetTheme["CUSTOM"] = "custom";
5213
- })($14d7a2bbb79e0dae$export$c88931fdc51854eb || ($14d7a2bbb79e0dae$export$c88931fdc51854eb = {}));
5214
- let $14d7a2bbb79e0dae$export$75be0f6af9650f2c;
6488
+ })($045213b18e9f1f94$export$c88931fdc51854eb || ($045213b18e9f1f94$export$c88931fdc51854eb = {}));
6489
+ let $045213b18e9f1f94$export$75be0f6af9650f2c;
5215
6490
  (function(CheckoutWidgetTagNames) {
5216
6491
  CheckoutWidgetTagNames["CONNECT"] = "imtbl-connect";
5217
6492
  CheckoutWidgetTagNames["WALLET"] = "imtbl-wallet";
@@ -5219,7 +6494,7 @@ let $14d7a2bbb79e0dae$export$75be0f6af9650f2c;
5219
6494
  CheckoutWidgetTagNames["BUY"] = "imtbl-buy";
5220
6495
  CheckoutWidgetTagNames["BRIDGE"] = "imtbl-bridge";
5221
6496
  CheckoutWidgetTagNames["EXAMPLE"] = "imtbl-example";
5222
- })($14d7a2bbb79e0dae$export$75be0f6af9650f2c || ($14d7a2bbb79e0dae$export$75be0f6af9650f2c = {}));
6497
+ })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
5223
6498
 
5224
6499
 
5225
6500
  var $1f969328e5988c99$exports = {};
@@ -5364,4 +6639,10 @@ function $430e3eda76fa4d5f$export$931068bc678f0d73(tagName, provider) {
5364
6639
  attemptToSetProvider();
5365
6640
  }
5366
6641
 
5367
- export { $15cc9e120aa6f3bf$export$d1bfa21f7c76447a as BridgeEventType, $1f969328e5988c99$export$30f61ebf204c69f6 as BridgeReact, $98cbcca465beec95$export$90db5fe1be5993c1 as BuyEventType, $f22931ca9e2f35b6$export$d13582032b79b401 as BuyReact, $a47e48dd2c04791b$export$c06e1e7429de6283 as ChainId, $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 as Checkout, $a8bc256d81a5e2c1$export$e3dc0620abde7f5a as CheckoutErrorType, $14d7a2bbb79e0dae$export$75be0f6af9650f2c as CheckoutWidgetTagNames, $430e3eda76fa4d5f$export$af210a0808087845 as CheckoutWidgets, $a85ecdbd885c58ad$export$e72e7f9969a47dd3 as ConnectEventType, $f2083cd30e2f5c56$export$49d62957f420a1e2 as ConnectReact, $d176a05e966364ba$export$3bfad4d03ada24c4 as ConnectionProviders, Environment, $d087956fd1002f80$export$fa517eee6594d26c as ExampleReact, GenericIMXProvider, $207ed853f11d19d5$export$5a0ace85cae72d45 as IMTBLWidgetEvents, ImmutableConfiguration, ImmutableXClient, MetaMaskIMXProvider, $14d7a2bbb79e0dae$export$95be4ae94445245a as Network, $a47e48dd2c04791b$export$1f05a55fe0680cc7 as NetworkFilterTypes, $66ceef112c0ee49e$export$66ec39c0924078d8 as OnRampEventType, Orderbook, Passport, PassportError, ProviderConfiguration, $430e3eda76fa4d5f$export$931068bc678f0d73 as SetProvider, $53d219e7f6bf0cd6$export$140a49745ab55563 as SwapEventType, $a4fbb8e3a6aeff58$export$971e031379577f4 as SwapReact, $08d5ddc39acd6833$export$fd9b17d87f4121d2 as TokenFilterTypes, $430e3eda76fa4d5f$export$bf1548ba7e61c17f as UpdateConfig, $77b6aac5c353d4a9$export$d9be06b70b28c742 as WalletEventType, $4f91c5f280efe242$export$a75605c67ea83a5a as WalletFilterTypes, $89d55ace0f8f1c07$export$ceaac94f34dba154 as WalletReact, $14d7a2bbb79e0dae$export$c88931fdc51854eb as WidgetTheme, module };
6642
+ // only for infrastructure. will be removed once wrapped functions are created
6643
+ const erc20 = 1;
6644
+
6645
+ // only for infrastructure. will be removed once wrapped functions are created
6646
+ const erc721permissionedmintable = 1;
6647
+
6648
+ export { BlockchainData, $15cc9e120aa6f3bf$export$d1bfa21f7c76447a as BridgeEventType, $1f969328e5988c99$export$30f61ebf204c69f6 as BridgeReact, $98cbcca465beec95$export$90db5fe1be5993c1 as BuyEventType, $f22931ca9e2f35b6$export$d13582032b79b401 as BuyReact, $baec09ddc3013323$export$c06e1e7429de6283 as ChainId, $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 as Checkout, $a8bc256d81a5e2c1$export$e3dc0620abde7f5a as CheckoutErrorType, $045213b18e9f1f94$export$75be0f6af9650f2c as CheckoutWidgetTagNames, $430e3eda76fa4d5f$export$af210a0808087845 as CheckoutWidgets, $a85ecdbd885c58ad$export$e72e7f9969a47dd3 as ConnectEventType, $f2083cd30e2f5c56$export$49d62957f420a1e2 as ConnectReact, $d176a05e966364ba$export$3bfad4d03ada24c4 as ConnectionProviders, Environment, $d087956fd1002f80$export$fa517eee6594d26c as ExampleReact, GenericIMXProvider, $207ed853f11d19d5$export$5a0ace85cae72d45 as IMTBLWidgetEvents, ImmutableConfiguration, ImmutableXClient, MetaMaskIMXProvider, $045213b18e9f1f94$export$95be4ae94445245a as Network, $a47e48dd2c04791b$export$1f05a55fe0680cc7 as NetworkFilterTypes, $ad06b030b1a3ba34$export$b80d2daf830437b9 as OrchestrationEventType, Orderbook, Passport, PassportError, ProviderConfiguration, $430e3eda76fa4d5f$export$931068bc678f0d73 as SetProvider, $53d219e7f6bf0cd6$export$140a49745ab55563 as SwapEventType, $a4fbb8e3a6aeff58$export$971e031379577f4 as SwapReact, $08d5ddc39acd6833$export$fd9b17d87f4121d2 as TokenFilterTypes, $430e3eda76fa4d5f$export$bf1548ba7e61c17f as UpdateConfig, $77b6aac5c353d4a9$export$d9be06b70b28c742 as WalletEventType, $4f91c5f280efe242$export$a75605c67ea83a5a as WalletFilterTypes, $89d55ace0f8f1c07$export$ceaac94f34dba154 as WalletReact, $045213b18e9f1f94$export$c88931fdc51854eb as WidgetTheme, erc20, erc721permissionedmintable, module };