@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.js CHANGED
@@ -10619,7 +10619,7 @@ class MultiRollupApiClients {
10619
10619
  }
10620
10620
 
10621
10621
  // eslint-disable-next-line @typescript-eslint/naming-convention
10622
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.3' };
10622
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.4' };
10623
10623
  const createConfig = ({ basePath, headers, }) => {
10624
10624
  if (!basePath.trim()) {
10625
10625
  throw Error('basePath can not be empty');
@@ -10691,7 +10691,7 @@ class APIError extends Error {
10691
10691
 
10692
10692
  /* eslint-disable implicit-arrow-linebreak */
10693
10693
  const defaultHeaders = {
10694
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.3',
10694
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.4',
10695
10695
  };
10696
10696
  /**
10697
10697
  * createAPIConfiguration to create a custom Configuration
@@ -11130,7 +11130,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11130
11130
  chainID,
11131
11131
  coreContractAddress,
11132
11132
  registrationContractAddress,
11133
- sdkVersion: 'ts-immutable-sdk-0.44.3',
11133
+ sdkVersion: 'ts-immutable-sdk-0.44.4',
11134
11134
  });
11135
11135
  /**
11136
11136
  * Sets `sdkVersion` at the time of build
@@ -17880,7 +17880,8 @@ class Passport {
17880
17880
  this.passportEventEmitter = new TypedEventEmitter();
17881
17881
  const imxClientConfig = this.config.baseConfig.environment === Environment$1.PRODUCTION
17882
17882
  ? imxApiConfig.getProduction() : imxApiConfig.getSandbox();
17883
- const imxApiClients = new ImxApiClients(imxClientConfig);
17883
+ const imxApiClients = passportModuleConfiguration.overrides?.imxApiClients
17884
+ || new ImxApiClients(imxClientConfig);
17884
17885
  this.passportImxProviderFactory = new PassportImxProviderFactory({
17885
17886
  authManager: this.authManager,
17886
17887
  config: this.config,
@@ -41978,7 +41979,7 @@ const GAS_OVERRIDES = {
41978
41979
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
41979
41980
  };
41980
41981
 
41981
- const SDK_VERSION_MARKER = '0.44.3';
41982
+ const SDK_VERSION_MARKER = '0.44.4';
41982
41983
  // This SDK version is replaced by the `yarn build` command ran on the root level
41983
41984
  const globalPackageVersion = () => SDK_VERSION_MARKER;
41984
41985
 
@@ -45215,7 +45216,9 @@ const buy = async (config, provider, orders, overrides = {
45215
45216
  };
45216
45217
  };
45217
45218
 
45218
- const cancel = async (config, provider, orderIds) => {
45219
+ const cancel = async (config, provider, orderIds, overrides = {
45220
+ waitFulfillmentSettlements: true,
45221
+ }) => {
45219
45222
  let unsignedCancelOrderTransaction;
45220
45223
  if (orderIds.length === 0) {
45221
45224
  throw new CheckoutError('No orderIds were provided to the orderIds array. Please provide at least one orderId.', CheckoutErrorType.CANCEL_ORDER_LISTING_ERROR);
@@ -45234,16 +45237,32 @@ const cancel = async (config, provider, orderIds) => {
45234
45237
  error: err,
45235
45238
  });
45236
45239
  }
45237
- const result = await signFulfillmentTransactions(provider, [unsignedCancelOrderTransaction]);
45238
- if (result.type === SignTransactionStatusType.FAILED) {
45240
+ if (overrides.waitFulfillmentSettlements) {
45241
+ const result = await signFulfillmentTransactions(provider, [unsignedCancelOrderTransaction]);
45242
+ if (result.type === SignTransactionStatusType.FAILED) {
45243
+ return {
45244
+ status: CheckoutStatus.FAILED,
45245
+ transactionHash: result.transactionHash,
45246
+ reason: result.reason,
45247
+ };
45248
+ }
45239
45249
  return {
45240
- status: CheckoutStatus.FAILED,
45241
- transactionHash: result.transactionHash,
45242
- reason: result.reason,
45250
+ status: CheckoutStatus.SUCCESS,
45243
45251
  };
45244
45252
  }
45253
+ let transactions;
45254
+ try {
45255
+ const response = await Promise.all([unsignedCancelOrderTransaction].map((transaction) => sendTransaction(provider, transaction)));
45256
+ transactions = response.map((result) => result.transactionResponse);
45257
+ }
45258
+ catch (err) {
45259
+ throw new CheckoutError('An error occurred while executing the fulfillment transaction', CheckoutErrorType.EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
45260
+ message: err.message,
45261
+ });
45262
+ }
45245
45263
  return {
45246
- status: CheckoutStatus.SUCCESS,
45264
+ status: CheckoutStatus.FULFILLMENTS_UNSETTLED,
45265
+ transactions,
45247
45266
  };
45248
45267
  };
45249
45268
 
@@ -45807,7 +45826,7 @@ class Checkout {
45807
45826
  // eslint-disable-next-line no-console
45808
45827
  console.warn('This endpoint currently only processes the first order in the array.');
45809
45828
  const web3Provider = await validateProvider(this.config, params.provider);
45810
- return await cancel(this.config, web3Provider, params.orderIds);
45829
+ return await cancel(this.config, web3Provider, params.orderIds, params.overrides);
45811
45830
  }
45812
45831
  /**
45813
45832
  * Determines the transaction requirements to complete a purchase.