@imtbl/sdk 0.44.3 → 0.44.4

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
@@ -10641,7 +10641,7 @@ class MultiRollupApiClients {
10641
10641
  }
10642
10642
 
10643
10643
  // eslint-disable-next-line @typescript-eslint/naming-convention
10644
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.3' };
10644
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.4' };
10645
10645
  const createConfig = ({ basePath, headers, }) => {
10646
10646
  if (!basePath.trim()) {
10647
10647
  throw Error('basePath can not be empty');
@@ -10713,7 +10713,7 @@ class APIError extends Error {
10713
10713
 
10714
10714
  /* eslint-disable implicit-arrow-linebreak */
10715
10715
  const defaultHeaders = {
10716
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.3',
10716
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.4',
10717
10717
  };
10718
10718
  /**
10719
10719
  * createAPIConfiguration to create a custom Configuration
@@ -11152,7 +11152,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11152
11152
  chainID,
11153
11153
  coreContractAddress,
11154
11154
  registrationContractAddress,
11155
- sdkVersion: 'ts-immutable-sdk-0.44.3',
11155
+ sdkVersion: 'ts-immutable-sdk-0.44.4',
11156
11156
  });
11157
11157
  /**
11158
11158
  * Sets `sdkVersion` at the time of build
@@ -17902,7 +17902,8 @@ class Passport {
17902
17902
  this.passportEventEmitter = new TypedEventEmitter();
17903
17903
  const imxClientConfig = this.config.baseConfig.environment === Environment$1.PRODUCTION
17904
17904
  ? imxApiConfig.getProduction() : imxApiConfig.getSandbox();
17905
- const imxApiClients = new ImxApiClients(imxClientConfig);
17905
+ const imxApiClients = passportModuleConfiguration.overrides?.imxApiClients
17906
+ || new ImxApiClients(imxClientConfig);
17906
17907
  this.passportImxProviderFactory = new PassportImxProviderFactory({
17907
17908
  authManager: this.authManager,
17908
17909
  config: this.config,
@@ -42000,7 +42001,7 @@ const GAS_OVERRIDES = {
42000
42001
  maxPriorityFeePerGas: ethers.BigNumber.from(101e9),
42001
42002
  };
42002
42003
 
42003
- const SDK_VERSION_MARKER = '0.44.3';
42004
+ const SDK_VERSION_MARKER = '0.44.4';
42004
42005
  // This SDK version is replaced by the `yarn build` command ran on the root level
42005
42006
  const globalPackageVersion = () => SDK_VERSION_MARKER;
42006
42007
 
@@ -45237,7 +45238,9 @@ const buy = async (config, provider, orders, overrides = {
45237
45238
  };
45238
45239
  };
45239
45240
 
45240
- const cancel = async (config, provider, orderIds) => {
45241
+ const cancel = async (config, provider, orderIds, overrides = {
45242
+ waitFulfillmentSettlements: true,
45243
+ }) => {
45241
45244
  let unsignedCancelOrderTransaction;
45242
45245
  if (orderIds.length === 0) {
45243
45246
  throw new CheckoutError('No orderIds were provided to the orderIds array. Please provide at least one orderId.', CheckoutErrorType.CANCEL_ORDER_LISTING_ERROR);
@@ -45256,16 +45259,32 @@ const cancel = async (config, provider, orderIds) => {
45256
45259
  error: err,
45257
45260
  });
45258
45261
  }
45259
- const result = await signFulfillmentTransactions(provider, [unsignedCancelOrderTransaction]);
45260
- if (result.type === SignTransactionStatusType.FAILED) {
45262
+ if (overrides.waitFulfillmentSettlements) {
45263
+ const result = await signFulfillmentTransactions(provider, [unsignedCancelOrderTransaction]);
45264
+ if (result.type === SignTransactionStatusType.FAILED) {
45265
+ return {
45266
+ status: CheckoutStatus.FAILED,
45267
+ transactionHash: result.transactionHash,
45268
+ reason: result.reason,
45269
+ };
45270
+ }
45261
45271
  return {
45262
- status: CheckoutStatus.FAILED,
45263
- transactionHash: result.transactionHash,
45264
- reason: result.reason,
45272
+ status: CheckoutStatus.SUCCESS,
45265
45273
  };
45266
45274
  }
45275
+ let transactions;
45276
+ try {
45277
+ const response = await Promise.all([unsignedCancelOrderTransaction].map((transaction) => sendTransaction(provider, transaction)));
45278
+ transactions = response.map((result) => result.transactionResponse);
45279
+ }
45280
+ catch (err) {
45281
+ throw new CheckoutError('An error occurred while executing the fulfillment transaction', CheckoutErrorType.EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
45282
+ message: err.message,
45283
+ });
45284
+ }
45267
45285
  return {
45268
- status: CheckoutStatus.SUCCESS,
45286
+ status: CheckoutStatus.FULFILLMENTS_UNSETTLED,
45287
+ transactions,
45269
45288
  };
45270
45289
  };
45271
45290
 
@@ -45829,7 +45848,7 @@ class Checkout {
45829
45848
  // eslint-disable-next-line no-console
45830
45849
  console.warn('This endpoint currently only processes the first order in the array.');
45831
45850
  const web3Provider = await validateProvider(this.config, params.provider);
45832
- return await cancel(this.config, web3Provider, params.orderIds);
45851
+ return await cancel(this.config, web3Provider, params.orderIds, params.overrides);
45833
45852
  }
45834
45853
  /**
45835
45854
  * Determines the transaction requirements to complete a purchase.