@imtbl/sdk 1.7.1 → 1.7.3-alpha.1

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.cjs CHANGED
@@ -142,7 +142,7 @@ const storeDetail$1 = (key, value) => {
142
142
  };
143
143
  setItem$1(Store$1.RUNTIME, RUNTIME_DETAILS$1);
144
144
  };
145
- const getDetail$1 = (key) => {
145
+ const getDetail$1$1 = (key) => {
146
146
  // Handle the scenario where detail is a falsy value
147
147
  if (RUNTIME_DETAILS$1[key] === undefined) {
148
148
  return undefined;
@@ -174,7 +174,7 @@ const flattenProperties$1 = (properties) => {
174
174
  };
175
175
 
176
176
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
177
- const SDK_VERSION$1 = '1.7.1';
177
+ const SDK_VERSION$1 = '1.7.3-alpha.1';
178
178
  const getReferrer$1 = () => {
179
179
  if (isNode$1()) {
180
180
  return '';
@@ -217,7 +217,7 @@ const initialise$2 = async () => {
217
217
  initialised$1 = true;
218
218
  try {
219
219
  const runtimeDetails = flattenProperties$1(getRuntimeDetails$1());
220
- const existingRuntimeId = getDetail$1(Detail$1.RUNTIME_ID);
220
+ const existingRuntimeId = getDetail$1$1(Detail$1.RUNTIME_ID);
221
221
  const body = {
222
222
  version: 1,
223
223
  data: {
@@ -370,6 +370,7 @@ const setPublishableApiKeyFn$1 = (publishableApiKey) => {
370
370
  storeDetail$1(Detail$1.PUBLISHABLE_API_KEY, publishableApiKey);
371
371
  };
372
372
  const setPublishableApiKey = errorBoundary$1(getGlobalisedValue$2('setPublishableApiKey', setPublishableApiKeyFn$1));
373
+ const getDetail = errorBoundary$1(getGlobalisedValue$2('getDetail', getDetail$1$1));
373
374
 
374
375
  var Environment$1;
375
376
  (function (Environment) {
@@ -8440,6 +8441,85 @@ class NftOwnersApi extends BaseAPI$2 {
8440
8441
  */
8441
8442
  const NftsApiAxiosParamCreator = function (configuration) {
8442
8443
  return {
8444
+ /**
8445
+ * Create a mint request to mint a set of NFTs for a given collection
8446
+ * @summary Mint NFTs
8447
+ * @param {string} contractAddress The address of contract
8448
+ * @param {string} chainName The name of chain
8449
+ * @param {CreateMintRequestRequest} createMintRequestRequest the request body
8450
+ * @param {*} [options] Override http request option.
8451
+ * @throws {RequiredError}
8452
+ */
8453
+ createMintRequest: async (contractAddress, chainName, createMintRequestRequest, options = {}) => {
8454
+ // verify required parameter 'contractAddress' is not null or undefined
8455
+ assertParamExists$2('createMintRequest', 'contractAddress', contractAddress);
8456
+ // verify required parameter 'chainName' is not null or undefined
8457
+ assertParamExists$2('createMintRequest', 'chainName', chainName);
8458
+ // verify required parameter 'createMintRequestRequest' is not null or undefined
8459
+ assertParamExists$2('createMintRequest', 'createMintRequestRequest', createMintRequestRequest);
8460
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/nfts/mint-requests`
8461
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
8462
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
8463
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
8464
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$2);
8465
+ let baseOptions;
8466
+ if (configuration) {
8467
+ baseOptions = configuration.baseOptions;
8468
+ }
8469
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
8470
+ const localVarHeaderParameter = {};
8471
+ const localVarQueryParameter = {};
8472
+ // authentication ImmutableApiKey required
8473
+ await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-key", configuration);
8474
+ localVarHeaderParameter['Content-Type'] = 'application/json';
8475
+ setSearchParams$2(localVarUrlObj, localVarQueryParameter);
8476
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8477
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
8478
+ localVarRequestOptions.data = serializeDataIfNeeded$2(createMintRequestRequest, localVarRequestOptions, configuration);
8479
+ return {
8480
+ url: toPathString$2(localVarUrlObj),
8481
+ options: localVarRequestOptions,
8482
+ };
8483
+ },
8484
+ /**
8485
+ * Retrieve the status of a mint request identified by its reference_id
8486
+ * @summary Mint NFTs
8487
+ * @param {string} contractAddress The address of contract
8488
+ * @param {string} chainName The name of chain
8489
+ * @param {string} referenceId The ID of the mint request
8490
+ * @param {*} [options] Override http request option.
8491
+ * @throws {RequiredError}
8492
+ */
8493
+ getMintRequest: async (contractAddress, chainName, referenceId, options = {}) => {
8494
+ // verify required parameter 'contractAddress' is not null or undefined
8495
+ assertParamExists$2('getMintRequest', 'contractAddress', contractAddress);
8496
+ // verify required parameter 'chainName' is not null or undefined
8497
+ assertParamExists$2('getMintRequest', 'chainName', chainName);
8498
+ // verify required parameter 'referenceId' is not null or undefined
8499
+ assertParamExists$2('getMintRequest', 'referenceId', referenceId);
8500
+ const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/nfts/mint-requests/{reference_id}`
8501
+ .replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
8502
+ .replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
8503
+ .replace(`{${"reference_id"}}`, encodeURIComponent(String(referenceId)));
8504
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
8505
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$2);
8506
+ let baseOptions;
8507
+ if (configuration) {
8508
+ baseOptions = configuration.baseOptions;
8509
+ }
8510
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
8511
+ const localVarHeaderParameter = {};
8512
+ const localVarQueryParameter = {};
8513
+ // authentication ImmutableApiKey required
8514
+ await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-key", configuration);
8515
+ setSearchParams$2(localVarUrlObj, localVarQueryParameter);
8516
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
8517
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
8518
+ return {
8519
+ url: toPathString$2(localVarUrlObj),
8520
+ options: localVarRequestOptions,
8521
+ };
8522
+ },
8443
8523
  /**
8444
8524
  * Get NFT by token ID
8445
8525
  * @summary Get NFT by token ID
@@ -8625,6 +8705,32 @@ const NftsApiAxiosParamCreator = function (configuration) {
8625
8705
  const NftsApiFp = function (configuration) {
8626
8706
  const localVarAxiosParamCreator = NftsApiAxiosParamCreator(configuration);
8627
8707
  return {
8708
+ /**
8709
+ * Create a mint request to mint a set of NFTs for a given collection
8710
+ * @summary Mint NFTs
8711
+ * @param {string} contractAddress The address of contract
8712
+ * @param {string} chainName The name of chain
8713
+ * @param {CreateMintRequestRequest} createMintRequestRequest the request body
8714
+ * @param {*} [options] Override http request option.
8715
+ * @throws {RequiredError}
8716
+ */
8717
+ async createMintRequest(contractAddress, chainName, createMintRequestRequest, options) {
8718
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createMintRequest(contractAddress, chainName, createMintRequestRequest, options);
8719
+ return createRequestFunction$2(localVarAxiosArgs, globalAxios$1, BASE_PATH$2, configuration);
8720
+ },
8721
+ /**
8722
+ * Retrieve the status of a mint request identified by its reference_id
8723
+ * @summary Mint NFTs
8724
+ * @param {string} contractAddress The address of contract
8725
+ * @param {string} chainName The name of chain
8726
+ * @param {string} referenceId The ID of the mint request
8727
+ * @param {*} [options] Override http request option.
8728
+ * @throws {RequiredError}
8729
+ */
8730
+ async getMintRequest(contractAddress, chainName, referenceId, options) {
8731
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getMintRequest(contractAddress, chainName, referenceId, options);
8732
+ return createRequestFunction$2(localVarAxiosArgs, globalAxios$1, BASE_PATH$2, configuration);
8733
+ },
8628
8734
  /**
8629
8735
  * Get NFT by token ID
8630
8736
  * @summary Get NFT by token ID
@@ -8692,6 +8798,26 @@ const NftsApiFp = function (configuration) {
8692
8798
  const NftsApiFactory = function (configuration, basePath, axios) {
8693
8799
  const localVarFp = NftsApiFp(configuration);
8694
8800
  return {
8801
+ /**
8802
+ * Create a mint request to mint a set of NFTs for a given collection
8803
+ * @summary Mint NFTs
8804
+ * @param {NftsApiCreateMintRequestRequest} requestParameters Request parameters.
8805
+ * @param {*} [options] Override http request option.
8806
+ * @throws {RequiredError}
8807
+ */
8808
+ createMintRequest(requestParameters, options) {
8809
+ return localVarFp.createMintRequest(requestParameters.contractAddress, requestParameters.chainName, requestParameters.createMintRequestRequest, options).then((request) => request(axios, basePath));
8810
+ },
8811
+ /**
8812
+ * Retrieve the status of a mint request identified by its reference_id
8813
+ * @summary Mint NFTs
8814
+ * @param {NftsApiGetMintRequestRequest} requestParameters Request parameters.
8815
+ * @param {*} [options] Override http request option.
8816
+ * @throws {RequiredError}
8817
+ */
8818
+ getMintRequest(requestParameters, options) {
8819
+ return localVarFp.getMintRequest(requestParameters.contractAddress, requestParameters.chainName, requestParameters.referenceId, options).then((request) => request(axios, basePath));
8820
+ },
8695
8821
  /**
8696
8822
  * Get NFT by token ID
8697
8823
  * @summary Get NFT by token ID
@@ -8741,6 +8867,28 @@ const NftsApiFactory = function (configuration, basePath, axios) {
8741
8867
  * @extends {BaseAPI}
8742
8868
  */
8743
8869
  class NftsApi extends BaseAPI$2 {
8870
+ /**
8871
+ * Create a mint request to mint a set of NFTs for a given collection
8872
+ * @summary Mint NFTs
8873
+ * @param {NftsApiCreateMintRequestRequest} requestParameters Request parameters.
8874
+ * @param {*} [options] Override http request option.
8875
+ * @throws {RequiredError}
8876
+ * @memberof NftsApi
8877
+ */
8878
+ createMintRequest(requestParameters, options) {
8879
+ return NftsApiFp(this.configuration).createMintRequest(requestParameters.contractAddress, requestParameters.chainName, requestParameters.createMintRequestRequest, options).then((request) => request(this.axios, this.basePath));
8880
+ }
8881
+ /**
8882
+ * Retrieve the status of a mint request identified by its reference_id
8883
+ * @summary Mint NFTs
8884
+ * @param {NftsApiGetMintRequestRequest} requestParameters Request parameters.
8885
+ * @param {*} [options] Override http request option.
8886
+ * @throws {RequiredError}
8887
+ * @memberof NftsApi
8888
+ */
8889
+ getMintRequest(requestParameters, options) {
8890
+ return NftsApiFp(this.configuration).getMintRequest(requestParameters.contractAddress, requestParameters.chainName, requestParameters.referenceId, options).then((request) => request(this.axios, this.basePath));
8891
+ }
8744
8892
  /**
8745
8893
  * Get NFT by token ID
8746
8894
  * @summary Get NFT by token ID
@@ -11297,7 +11445,7 @@ class MultiRollupApiClients {
11297
11445
  }
11298
11446
 
11299
11447
  // eslint-disable-next-line @typescript-eslint/naming-convention
11300
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.7.1' };
11448
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.7.3-alpha.1' };
11301
11449
  const createConfig = ({ basePath, headers, }) => {
11302
11450
  if (!basePath.trim()) {
11303
11451
  throw Error('basePath can not be empty');
@@ -11369,7 +11517,7 @@ class APIError extends Error {
11369
11517
 
11370
11518
  /* eslint-disable implicit-arrow-linebreak */
11371
11519
  const defaultHeaders = {
11372
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.7.1',
11520
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.7.3-alpha.1',
11373
11521
  };
11374
11522
  /**
11375
11523
  * createAPIConfiguration to create a custom Configuration
@@ -11802,7 +11950,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11802
11950
  chainID,
11803
11951
  coreContractAddress,
11804
11952
  registrationContractAddress,
11805
- sdkVersion: 'ts-immutable-sdk-1.7.1',
11953
+ sdkVersion: 'ts-immutable-sdk-1.7.3-alpha.1',
11806
11954
  });
11807
11955
  /**
11808
11956
  * Sets `sdkVersion` at the time of build
@@ -16536,10 +16684,20 @@ class AuthManager {
16536
16684
  },
16537
16685
  });
16538
16686
  };
16539
- async login() {
16687
+ /**
16688
+ * login
16689
+ * @param anonymousId Caller can pass an anonymousId if they want to associate their user's identity with immutable's internal instrumentation.
16690
+ */
16691
+ async login(anonymousId) {
16540
16692
  return withPassportError(async () => {
16693
+ const rid = getDetail(Detail$1.RUNTIME_ID);
16541
16694
  const popupWindowFeatures = { width: 410, height: 450 };
16542
16695
  const oidcUser = await this.userManager.signinPopup({
16696
+ extraQueryParams: {
16697
+ ...(this.userManager.settings?.extraQueryParams ?? {}),
16698
+ rid: rid || '',
16699
+ third_party_a_id: anonymousId || '',
16700
+ },
16543
16701
  popupWindowFeatures,
16544
16702
  });
16545
16703
  return AuthManager.mapOidcUserToDomainModel(oidcUser);
@@ -16559,17 +16717,22 @@ class AuthManager {
16559
16717
  async loginCallback() {
16560
16718
  return withPassportError(async () => this.userManager.signinPopupCallback(), PassportErrorType.AUTHENTICATION_ERROR);
16561
16719
  }
16562
- async loginWithDeviceFlow() {
16720
+ /**
16721
+ * loginWithDeviceFlow
16722
+ * @param anonymousId Caller can pass an anonymousId if they want to associate their user's identity with immutable's internal instrumentation.
16723
+ */
16724
+ async loginWithDeviceFlow(anonymousId) {
16563
16725
  return withPassportError(async () => {
16564
16726
  const response = await globalAxios$1.post(`${this.config.authenticationDomain}/oauth/device/code`, {
16565
16727
  client_id: this.config.oidcConfiguration.clientId,
16566
16728
  scope: this.config.oidcConfiguration.scope,
16567
16729
  audience: this.config.oidcConfiguration.audience,
16568
16730
  }, formUrlEncodedHeader);
16731
+ const rid = getDetail(Detail$1.RUNTIME_ID);
16569
16732
  return {
16570
16733
  code: response.data.user_code,
16571
16734
  deviceCode: response.data.device_code,
16572
- url: response.data.verification_uri_complete,
16735
+ url: `${response.data.verification_uri_complete}${rid ? `&rid=${rid}` : ''}${anonymousId ? `&third_party_a_id=${anonymousId}` : ''}`,
16573
16736
  interval: response.data.interval,
16574
16737
  };
16575
16738
  }, PassportErrorType.AUTHENTICATION_ERROR);
@@ -37406,7 +37569,7 @@ const storeDetail = (key, value) => {
37406
37569
  };
37407
37570
  setItem(Store.RUNTIME, RUNTIME_DETAILS);
37408
37571
  };
37409
- const getDetail = (key) => {
37572
+ const getDetail$1 = (key) => {
37410
37573
  // Handle the scenario where detail is a falsy value
37411
37574
  if (RUNTIME_DETAILS[key] === undefined) {
37412
37575
  return undefined;
@@ -37438,7 +37601,7 @@ const flattenProperties = (properties) => {
37438
37601
  };
37439
37602
 
37440
37603
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
37441
- const SDK_VERSION = '1.7.1';
37604
+ const SDK_VERSION = '1.7.3-alpha.1';
37442
37605
  const getReferrer = () => {
37443
37606
  if (isNode()) {
37444
37607
  return '';
@@ -37481,7 +37644,7 @@ const initialise = async () => {
37481
37644
  initialised = true;
37482
37645
  try {
37483
37646
  const runtimeDetails = flattenProperties(getRuntimeDetails());
37484
- const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
37647
+ const existingRuntimeId = getDetail$1(Detail.RUNTIME_ID);
37485
37648
  const body = {
37486
37649
  version: 1,
37487
37650
  data: {
@@ -37613,6 +37776,7 @@ const setPublishableApiKeyFn = (publishableApiKey) => {
37613
37776
  storeDetail(Detail.PUBLISHABLE_API_KEY, publishableApiKey);
37614
37777
  };
37615
37778
  errorBoundary(getGlobalisedValue('setPublishableApiKey', setPublishableApiKeyFn));
37779
+ errorBoundary(getGlobalisedValue('getDetail', getDetail$1));
37616
37780
 
37617
37781
  var Environment;
37618
37782
  (function (Environment) {
@@ -42605,7 +42769,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
42605
42769
  maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
42606
42770
  };
42607
42771
 
42608
- const SDK_VERSION_MARKER = '1.7.1';
42772
+ const SDK_VERSION_MARKER = '1.7.3-alpha.1';
42609
42773
  // This SDK version is replaced by the `yarn build` command ran on the root level
42610
42774
  const globalPackageVersion = () => SDK_VERSION_MARKER;
42611
42775