@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/checkout.js CHANGED
@@ -25961,7 +25961,7 @@ class APIError extends Error {
25961
25961
 
25962
25962
  /* eslint-disable implicit-arrow-linebreak */
25963
25963
  const defaultHeaders = {
25964
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.3',
25964
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.4',
25965
25965
  };
25966
25966
  /**
25967
25967
  * createAPIConfiguration to create a custom Configuration
@@ -27322,7 +27322,7 @@ const GAS_OVERRIDES = {
27322
27322
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
27323
27323
  };
27324
27324
 
27325
- const SDK_VERSION_MARKER = '0.44.3';
27325
+ const SDK_VERSION_MARKER = '0.44.4';
27326
27326
  // This SDK version is replaced by the `yarn build` command ran on the root level
27327
27327
  const globalPackageVersion = () => SDK_VERSION_MARKER;
27328
27328
 
@@ -30559,7 +30559,9 @@ const buy = async (config, provider, orders, overrides = {
30559
30559
  };
30560
30560
  };
30561
30561
 
30562
- const cancel = async (config, provider, orderIds) => {
30562
+ const cancel = async (config, provider, orderIds, overrides = {
30563
+ waitFulfillmentSettlements: true,
30564
+ }) => {
30563
30565
  let unsignedCancelOrderTransaction;
30564
30566
  if (orderIds.length === 0) {
30565
30567
  throw new CheckoutError('No orderIds were provided to the orderIds array. Please provide at least one orderId.', CheckoutErrorType.CANCEL_ORDER_LISTING_ERROR);
@@ -30578,16 +30580,32 @@ const cancel = async (config, provider, orderIds) => {
30578
30580
  error: err,
30579
30581
  });
30580
30582
  }
30581
- const result = await signFulfillmentTransactions(provider, [unsignedCancelOrderTransaction]);
30582
- if (result.type === SignTransactionStatusType.FAILED) {
30583
+ if (overrides.waitFulfillmentSettlements) {
30584
+ const result = await signFulfillmentTransactions(provider, [unsignedCancelOrderTransaction]);
30585
+ if (result.type === SignTransactionStatusType.FAILED) {
30586
+ return {
30587
+ status: CheckoutStatus.FAILED,
30588
+ transactionHash: result.transactionHash,
30589
+ reason: result.reason,
30590
+ };
30591
+ }
30583
30592
  return {
30584
- status: CheckoutStatus.FAILED,
30585
- transactionHash: result.transactionHash,
30586
- reason: result.reason,
30593
+ status: CheckoutStatus.SUCCESS,
30587
30594
  };
30588
30595
  }
30596
+ let transactions;
30597
+ try {
30598
+ const response = await Promise.all([unsignedCancelOrderTransaction].map((transaction) => sendTransaction(provider, transaction)));
30599
+ transactions = response.map((result) => result.transactionResponse);
30600
+ }
30601
+ catch (err) {
30602
+ throw new CheckoutError('An error occurred while executing the fulfillment transaction', CheckoutErrorType.EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
30603
+ message: err.message,
30604
+ });
30605
+ }
30589
30606
  return {
30590
- status: CheckoutStatus.SUCCESS,
30607
+ status: CheckoutStatus.FULFILLMENTS_UNSETTLED,
30608
+ transactions,
30591
30609
  };
30592
30610
  };
30593
30611
 
@@ -31151,7 +31169,7 @@ class Checkout {
31151
31169
  // eslint-disable-next-line no-console
31152
31170
  console.warn('This endpoint currently only processes the first order in the array.');
31153
31171
  const web3Provider = await validateProvider(this.config, params.provider);
31154
- return await cancel(this.config, web3Provider, params.orderIds);
31172
+ return await cancel(this.config, web3Provider, params.orderIds, params.overrides);
31155
31173
  }
31156
31174
  /**
31157
31175
  * Determines the transaction requirements to complete a purchase.
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
17
17
  chainID,
18
18
  coreContractAddress,
19
19
  registrationContractAddress,
20
- sdkVersion: 'ts-immutable-sdk-0.44.3',
20
+ sdkVersion: 'ts-immutable-sdk-0.44.4',
21
21
  });
22
22
  /**
23
23
  * Sets `sdkVersion` at the time of build