@imtbl/sdk 0.44.2 → 0.44.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.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.2' };
10644
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.44.3' };
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.2',
10716
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.3',
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.2',
11155
+ sdkVersion: 'ts-immutable-sdk-0.44.3',
11156
11156
  });
11157
11157
  /**
11158
11158
  * Sets `sdkVersion` at the time of build
@@ -36448,6 +36448,7 @@ var BridgeMethodsGasLimit;
36448
36448
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_SOURCE"] = 200000] = "MAP_TOKEN_SOURCE";
36449
36449
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["MAP_TOKEN_DESTINATION"] = 200000] = "MAP_TOKEN_DESTINATION";
36450
36450
  BridgeMethodsGasLimit[BridgeMethodsGasLimit["FINALISE_WITHDRAWAL"] = 200000] = "FINALISE_WITHDRAWAL";
36451
+ BridgeMethodsGasLimit[BridgeMethodsGasLimit["APPROVE_TOKEN"] = 55000] = "APPROVE_TOKEN";
36451
36452
  })(BridgeMethodsGasLimit || (BridgeMethodsGasLimit = {}));
36452
36453
  var StatusResponse;
36453
36454
  (function (StatusResponse) {
@@ -36635,8 +36636,12 @@ class TokenBridge {
36635
36636
  throw new BridgeError(`Finalised withdrawals must be on the root chain (${this.config.bridgeInstance.rootChainID})`, BridgeErrorType.UNSUPPORTED_ERROR);
36636
36637
  }
36637
36638
  let sourceChainGas = BigNumber.from(0);
36639
+ let approvalFee = BigNumber.from(0);
36638
36640
  let bridgeFee = BigNumber.from(0);
36639
36641
  const imtblFee = BigNumber.from(0);
36642
+ if ('token' in req && req.token !== 'NATIVE') {
36643
+ approvalFee = await this.getGasEstimates(this.config.rootProvider, BridgeMethodsGasLimit.APPROVE_TOKEN);
36644
+ }
36640
36645
  if (req.action === BridgeFeeActions.FINALISE_WITHDRAWAL) {
36641
36646
  sourceChainGas = await this.getGasEstimates(this.config.rootProvider, BridgeMethodsGasLimit.FINALISE_WITHDRAWAL);
36642
36647
  }
@@ -36647,9 +36652,10 @@ class TokenBridge {
36647
36652
  const feeResult = await this.calculateBridgeFee(req.sourceChainId, req.destinationChainId, BridgeMethodsGasLimit[`${req.action}_DESTINATION`], req.gasMultiplier);
36648
36653
  bridgeFee = feeResult.bridgeFee;
36649
36654
  }
36650
- const totalFees = sourceChainGas.add(bridgeFee).add(imtblFee);
36655
+ const totalFees = sourceChainGas.add(approvalFee).add(bridgeFee).add(imtblFee);
36651
36656
  return {
36652
36657
  sourceChainGas,
36658
+ approvalFee,
36653
36659
  bridgeFee,
36654
36660
  imtblFee,
36655
36661
  totalFees,
@@ -36879,6 +36885,8 @@ class TokenBridge {
36879
36885
  gasMultiplier,
36880
36886
  sourceChainId,
36881
36887
  destinationChainId,
36888
+ token,
36889
+ amount,
36882
36890
  });
36883
36891
  const canReceive = await this.checkReceiver(provider, recipient);
36884
36892
  if (!canReceive) {
@@ -41628,7 +41636,7 @@ async function switchWalletNetwork(config, web3Provider, chainId) {
41628
41636
  // eslint-disable-next-line @typescript-eslint/no-shadow
41629
41637
  }
41630
41638
  catch (err) {
41631
- throw new CheckoutError('User cancelled add network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
41639
+ throw new CheckoutError('User cancelled add network request', CheckoutErrorType.USER_REJECTED_REQUEST_ERROR, { error: err });
41632
41640
  }
41633
41641
  }
41634
41642
  else {
@@ -41992,7 +42000,7 @@ const GAS_OVERRIDES = {
41992
42000
  maxPriorityFeePerGas: ethers.BigNumber.from(101e9),
41993
42001
  };
41994
42002
 
41995
- const SDK_VERSION_MARKER = '0.44.2';
42003
+ const SDK_VERSION_MARKER = '0.44.3';
41996
42004
  // This SDK version is replaced by the `yarn build` command ran on the root level
41997
42005
  const globalPackageVersion = () => SDK_VERSION_MARKER;
41998
42006
 
@@ -42022,8 +42030,8 @@ class RemoteConfigFetcher {
42022
42030
  try {
42023
42031
  responseData = JSON.parse(response.data);
42024
42032
  }
42025
- catch (jsonError) {
42026
- throw new CheckoutError('Invalid configuration', CheckoutErrorType.API_ERROR);
42033
+ catch (err) {
42034
+ throw new CheckoutError('Invalid configuration', CheckoutErrorType.API_ERROR, { error: err });
42027
42035
  }
42028
42036
  }
42029
42037
  return responseData;
@@ -42036,7 +42044,7 @@ class RemoteConfigFetcher {
42036
42044
  response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config`);
42037
42045
  }
42038
42046
  catch (err) {
42039
- throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR);
42047
+ throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR, { error: err });
42040
42048
  }
42041
42049
  // Ensure that the configuration is valid
42042
42050
  this.configCache = this.parseResponse(response);
@@ -42050,7 +42058,7 @@ class RemoteConfigFetcher {
42050
42058
  response = await this.httpClient.get(`${this.getEndpoint()}/${this.version}/config/tokens`);
42051
42059
  }
42052
42060
  catch (err) {
42053
- throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR);
42061
+ throw new CheckoutError(`Error: ${err.message}`, CheckoutErrorType.API_ERROR, { error: err });
42054
42062
  }
42055
42063
  // Ensure that the configuration is valid
42056
42064
  this.tokensCache = this.parseResponse(response);
@@ -42413,7 +42421,7 @@ const getIndexerBalance = async (config, walletAddress, chainId, filterTokens) =
42413
42421
  // means we are safe to assume that a 404 is a missing wallet due to inactivity
42414
42422
  // or simply an incorrect wallet address was provided.
42415
42423
  if (err?.code !== globalAxios$1.HttpStatusCode.NotFound) {
42416
- throw new CheckoutError(err.message || 'InternalServerError | getTokensByWalletAddress', CheckoutErrorType.GET_INDEXER_BALANCE_ERROR, err);
42424
+ throw new CheckoutError(err.message || 'InternalServerError | getTokensByWalletAddress', CheckoutErrorType.GET_INDEXER_BALANCE_ERROR, { error: err });
42417
42425
  }
42418
42426
  }
42419
42427
  };
@@ -42432,7 +42440,7 @@ const getIndexerBalance = async (config, walletAddress, chainId, filterTokens) =
42432
42440
  // means we are safe to assume that a 404 is a missing wallet due to inactivity
42433
42441
  // or simply an incorrect wallet address was provided.
42434
42442
  if (err?.code !== globalAxios$1.HttpStatusCode.NotFound) {
42435
- throw new CheckoutError(err.message || 'InternalServerError | getNativeTokenByWalletAddress', CheckoutErrorType.GET_INDEXER_BALANCE_ERROR, err);
42443
+ throw new CheckoutError(err.message || 'InternalServerError | getNativeTokenByWalletAddress', CheckoutErrorType.GET_INDEXER_BALANCE_ERROR, { error: err });
42436
42444
  }
42437
42445
  }
42438
42446
  };
@@ -42545,6 +42553,7 @@ async function checkIsWalletConnected(web3Provider) {
42545
42553
  }
42546
42554
  catch (err) {
42547
42555
  throw new CheckoutError('Check wallet connection request failed', CheckoutErrorType.PROVIDER_REQUEST_FAILED_ERROR, {
42556
+ error: err,
42548
42557
  rpcMethod: WalletAction.CHECK_CONNECTION,
42549
42558
  });
42550
42559
  }
@@ -42637,7 +42646,7 @@ async function validateProvider(config, web3Provider, validateProviderOptions) {
42637
42646
  }
42638
42647
  }
42639
42648
  catch (err) {
42640
- throw new CheckoutError('Unable to detect the web3Provider network', CheckoutErrorType.WEB3_PROVIDER_ERROR);
42649
+ throw new CheckoutError('Unable to detect the web3Provider network', CheckoutErrorType.WEB3_PROVIDER_ERROR, { error: err });
42641
42650
  }
42642
42651
  if (web3ChainId !== underlyingChainId && !options.allowMistmatchedChainId) {
42643
42652
  throw new CheckoutError('Your wallet has changed network, please switch to a supported network', CheckoutErrorType.WEB3_PROVIDER_ERROR);
@@ -42689,15 +42698,15 @@ const sendTransaction = async (web3Provider, transaction) => {
42689
42698
  }
42690
42699
  catch (err) {
42691
42700
  if (err.code === ethers.ethers.errors.INSUFFICIENT_FUNDS) {
42692
- throw new CheckoutError(err.message, CheckoutErrorType.INSUFFICIENT_FUNDS);
42701
+ throw new CheckoutError(err.message, CheckoutErrorType.INSUFFICIENT_FUNDS, { error: err });
42693
42702
  }
42694
42703
  if (err.code === ethers.ethers.errors.ACTION_REJECTED) {
42695
- throw new CheckoutError(err.message, CheckoutErrorType.USER_REJECTED_REQUEST_ERROR);
42704
+ throw new CheckoutError(err.message, CheckoutErrorType.USER_REJECTED_REQUEST_ERROR, { error: err });
42696
42705
  }
42697
42706
  if (err.code === ethers.ethers.errors.UNPREDICTABLE_GAS_LIMIT) {
42698
- throw new CheckoutError(err.message, CheckoutErrorType.UNPREDICTABLE_GAS_LIMIT);
42707
+ throw new CheckoutError(err.message, CheckoutErrorType.UNPREDICTABLE_GAS_LIMIT, { error: err });
42699
42708
  }
42700
- throw new CheckoutError(err.message, CheckoutErrorType.TRANSACTION_FAILED);
42709
+ throw new CheckoutError(err.message, CheckoutErrorType.TRANSACTION_FAILED, { error: err });
42701
42710
  }
42702
42711
  };
42703
42712
 
@@ -42710,6 +42719,8 @@ async function getBridgeFeeEstimate$1(tokenBridge, fromChainId, toChainId, confi
42710
42719
  gasMultiplier: 1.1,
42711
42720
  sourceChainId: fromChainId.toString(),
42712
42721
  destinationChainId: toChainId.toString(),
42722
+ token: NATIVE.toUpperCase(),
42723
+ amount: ethers.BigNumber.from(0),
42713
42724
  });
42714
42725
  }
42715
42726
 
@@ -42789,6 +42800,7 @@ async function bridgeToL2GasEstimator(readOnlyProviders, config) {
42789
42800
  gasEstimateType: GasEstimateType.BRIDGE_TO_L2,
42790
42801
  fees: {
42791
42802
  sourceChainGas: ethers.BigNumber.from(0),
42803
+ approvalFee: ethers.BigNumber.from(0),
42792
42804
  bridgeFee: ethers.BigNumber.from(0),
42793
42805
  imtblFee: ethers.BigNumber.from(0),
42794
42806
  totalFees: ethers.BigNumber.from(0),
@@ -42938,7 +42950,7 @@ const getERC20Allowance = async (provider, ownerAddress, contractAddress, spende
42938
42950
  return await contract.allowance(ownerAddress, spenderAddress);
42939
42951
  }
42940
42952
  catch (err) {
42941
- throw new CheckoutError('Failed to get the allowance for ERC20', CheckoutErrorType.GET_ERC20_ALLOWANCE_ERROR, { contractAddress });
42953
+ throw new CheckoutError('Failed to get the allowance for ERC20', CheckoutErrorType.GET_ERC20_ALLOWANCE_ERROR, { contractAddress, error: err });
42942
42954
  }
42943
42955
  };
42944
42956
  // Returns the approval transaction for the ERC20 that the owner can sign
@@ -42951,8 +42963,8 @@ const getERC20ApprovalTransaction = async (provider, ownerAddress, contractAddre
42951
42963
  approveTransaction.from = ownerAddress;
42952
42964
  return approveTransaction;
42953
42965
  }
42954
- catch {
42955
- throw new CheckoutError('Failed to get the approval transaction for ERC20', CheckoutErrorType.GET_ERC20_ALLOWANCE_ERROR, { contractAddress });
42966
+ catch (err) {
42967
+ throw new CheckoutError('Failed to get the approval transaction for ERC20', CheckoutErrorType.GET_ERC20_ALLOWANCE_ERROR, { contractAddress, error: err });
42956
42968
  }
42957
42969
  };
42958
42970
  const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
@@ -43024,7 +43036,12 @@ const getERC721ApprovedForAll = async (provider, ownerAddress, contractAddress,
43024
43036
  return await contract.isApprovedForAll(ownerAddress, spenderAddress);
43025
43037
  }
43026
43038
  catch (err) {
43027
- throw new CheckoutError('Failed to check approval for all ERC721s of collection', CheckoutErrorType.GET_ERC721_ALLOWANCE_ERROR, { ownerAddress, contractAddress, spenderAddress });
43039
+ throw new CheckoutError('Failed to check approval for all ERC721s of collection', CheckoutErrorType.GET_ERC721_ALLOWANCE_ERROR, {
43040
+ ownerAddress,
43041
+ contractAddress,
43042
+ spenderAddress,
43043
+ error: err,
43044
+ });
43028
43045
  }
43029
43046
  };
43030
43047
  // Returns a populated transaction to approve the ERC721 for the spender.
@@ -43038,7 +43055,11 @@ const getApproveTransaction = async (provider, ownerAddress, contractAddress, sp
43038
43055
  }
43039
43056
  catch (err) {
43040
43057
  throw new CheckoutError('Failed to get the approval transaction for ERC721', CheckoutErrorType.GET_ERC721_ALLOWANCE_ERROR, {
43041
- id: id.toString(), contractAddress, spenderAddress, ownerAddress,
43058
+ id: id.toString(),
43059
+ contractAddress,
43060
+ spenderAddress,
43061
+ ownerAddress,
43062
+ error: err,
43042
43063
  });
43043
43064
  }
43044
43065
  };
@@ -43050,7 +43071,11 @@ const getERC721ApprovedAddress = async (provider, contractAddress, id) => {
43050
43071
  return await contract.getApproved(id);
43051
43072
  }
43052
43073
  catch (err) {
43053
- throw new CheckoutError('Failed to get approved address for ERC721', CheckoutErrorType.GET_ERC721_ALLOWANCE_ERROR, { id: id.toString(), contractAddress });
43074
+ throw new CheckoutError('Failed to get approved address for ERC721', CheckoutErrorType.GET_ERC721_ALLOWANCE_ERROR, {
43075
+ id: id.toString(),
43076
+ contractAddress,
43077
+ error: err,
43078
+ });
43054
43079
  }
43055
43080
  };
43056
43081
  const convertIdToNumber = (id, contractAddress) => {
@@ -43378,8 +43403,8 @@ const getTokenBalances = async (config, provider, ownerAddress, itemRequirements
43378
43403
  const { balances } = await getAllBalances(config, provider, ownerAddress, getL2ChainId(config));
43379
43404
  return balances.filter((balance) => tokenMap.get((balance.token.address || NATIVE).toLocaleLowerCase()));
43380
43405
  }
43381
- catch (error) {
43382
- throw new CheckoutError('Failed to get balances', CheckoutErrorType.GET_BALANCE_ERROR);
43406
+ catch (err) {
43407
+ throw new CheckoutError('Failed to get balances', CheckoutErrorType.GET_BALANCE_ERROR, { error: err });
43383
43408
  }
43384
43409
  };
43385
43410
  /**
@@ -43417,8 +43442,8 @@ const getERC721Balances = async (provider, ownerAddress, itemRequirements) => {
43417
43442
  });
43418
43443
  });
43419
43444
  }
43420
- catch (error) {
43421
- throw new CheckoutError('Failed to get ERC721 balances', CheckoutErrorType.GET_ERC721_BALANCE_ERROR);
43445
+ catch (err) {
43446
+ throw new CheckoutError('Failed to get ERC721 balances', CheckoutErrorType.GET_ERC721_BALANCE_ERROR, { error: err });
43422
43447
  }
43423
43448
  return erc721Balances;
43424
43449
  };
@@ -43488,7 +43513,7 @@ const estimateGas = async (provider, transaction) => {
43488
43513
  return await provider.estimateGas(transaction);
43489
43514
  }
43490
43515
  catch (err) {
43491
- throw new CheckoutError('Failed to estimate gas for transaction', CheckoutErrorType.UNPREDICTABLE_GAS_LIMIT);
43516
+ throw new CheckoutError('Failed to estimate gas for transaction', CheckoutErrorType.UNPREDICTABLE_GAS_LIMIT, { error: err });
43492
43517
  }
43493
43518
  };
43494
43519
  const getGasItemRequirement = (gas, transactionOrGas) => {
@@ -43552,14 +43577,14 @@ const availabilityService = (isDevelopment, isProduction) => {
43552
43577
  try {
43553
43578
  response = await globalAxios$1.post(`${postEndpoint()}/v1/availability/checkout/swap`);
43554
43579
  }
43555
- catch (error) {
43580
+ catch (err) {
43556
43581
  // The request was made and the server responded with a status code
43557
43582
  // that falls out of the range of 2xx
43558
- response = error.response;
43583
+ response = err.response;
43559
43584
  // If 403 then the service is geo-blocked
43560
43585
  if (response.status === 403)
43561
43586
  return false;
43562
- throw new CheckoutError(`Error fetching from api: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR);
43587
+ throw new CheckoutError(`Error fetching from api: ${response.status} ${response.statusText}`, CheckoutErrorType.API_ERROR, { error: err });
43563
43588
  }
43564
43589
  return true;
43565
43590
  };
@@ -44070,7 +44095,7 @@ const getBridgeFeeEstimate = async (config, readOnlyProviders, fromChainId, toCh
44070
44095
  };
44071
44096
  }
44072
44097
  catch (err) {
44073
- throw new CheckoutError('Error estimating gas for bridge', CheckoutErrorType.BRIDGE_GAS_ESTIMATE_ERROR, { message: err.message });
44098
+ throw new CheckoutError('Error estimating gas for bridge', CheckoutErrorType.BRIDGE_GAS_ESTIMATE_ERROR, { error: err });
44074
44099
  }
44075
44100
  };
44076
44101
 
@@ -44720,7 +44745,7 @@ const routingCalculator = async (config, ownerAddress, balanceRequirements, avai
44720
44745
  readOnlyProviders = await createReadOnlyProviders(config);
44721
44746
  }
44722
44747
  catch (err) {
44723
- throw new CheckoutError('Error occurred while creating read only providers', CheckoutErrorType.PROVIDER_ERROR, { message: err.message });
44748
+ throw new CheckoutError('Error occurred while creating read only providers', CheckoutErrorType.PROVIDER_ERROR, { error: err });
44724
44749
  }
44725
44750
  const tokenBalances = await measureAsyncExecution(config, 'Time to get token balances inside router', getAllTokenBalances(config, readOnlyProviders, ownerAddress, availableRoutingOptions));
44726
44751
  const allowList = await measureAsyncExecution(config, 'Time to get routing allowlist', allowListCheck(config, tokenBalances, availableRoutingOptions));
@@ -44843,9 +44868,7 @@ const signApprovalTransactions = async (provider, approvalTransactions) => {
44843
44868
  receipts = await Promise.all(response.map((transaction) => transaction.transactionResponse.wait()));
44844
44869
  }
44845
44870
  catch (err) {
44846
- throw new CheckoutError('An error occurred while executing the approval transaction', CheckoutErrorType.EXECUTE_APPROVAL_TRANSACTION_ERROR, {
44847
- message: err.message,
44848
- });
44871
+ throw new CheckoutError('An error occurred while executing the approval transaction', CheckoutErrorType.EXECUTE_APPROVAL_TRANSACTION_ERROR, { error: err });
44849
44872
  }
44850
44873
  for (const receipt of receipts) {
44851
44874
  if (receipt.status === 0) {
@@ -44867,9 +44890,7 @@ const signFulfillmentTransactions = async (provider, fulfillmentTransactions) =>
44867
44890
  receipts = await Promise.all(response.map((transaction) => transaction.transactionResponse.wait()));
44868
44891
  }
44869
44892
  catch (err) {
44870
- throw new CheckoutError('An error occurred while executing the fulfillment transaction', CheckoutErrorType.EXECUTE_FULFILLMENT_TRANSACTION_ERROR, {
44871
- message: err.message,
44872
- });
44893
+ throw new CheckoutError('An error occurred while executing the fulfillment transaction', CheckoutErrorType.EXECUTE_FULFILLMENT_TRANSACTION_ERROR, { error: err });
44873
44894
  }
44874
44895
  for (const receipt of receipts) {
44875
44896
  if (receipt.status === 0) {
@@ -44895,9 +44916,7 @@ const signMessage = async (provider, unsignedMessage) => {
44895
44916
  };
44896
44917
  }
44897
44918
  catch (err) {
44898
- throw new CheckoutError('An error occurred while signing the message', CheckoutErrorType.SIGN_MESSAGE_ERROR, {
44899
- message: err.message,
44900
- });
44919
+ throw new CheckoutError('An error occurred while signing the message', CheckoutErrorType.SIGN_MESSAGE_ERROR, { error: err });
44901
44920
  }
44902
44921
  };
44903
44922
 
@@ -45080,8 +45099,8 @@ const buy = async (config, provider, orders, overrides = {
45080
45099
  }
45081
45100
  catch (err) {
45082
45101
  throw new CheckoutError('An error occurred while getting the order listing', CheckoutErrorType.GET_ORDER_LISTING_ERROR, {
45102
+ error: err,
45083
45103
  orderId: id,
45084
- message: err.message,
45085
45104
  });
45086
45105
  }
45087
45106
  if (order.result.buy.length === 0) {
@@ -45120,7 +45139,7 @@ const buy = async (config, provider, orders, overrides = {
45120
45139
  if (!err.message.includes('The fulfiller does not have the balances needed to fulfill')) {
45121
45140
  throw new CheckoutError('Error occurred while trying to fulfill the order', CheckoutErrorType.FULFILL_ORDER_LISTING_ERROR, {
45122
45141
  orderId: id,
45123
- message: err.message,
45142
+ error: err,
45124
45143
  });
45125
45144
  }
45126
45145
  }
@@ -45179,9 +45198,7 @@ const buy = async (config, provider, orders, overrides = {
45179
45198
  }
45180
45199
  }
45181
45200
  catch (err) {
45182
- throw new CheckoutError('Error fetching fulfillment transaction', CheckoutErrorType.FULFILL_ORDER_LISTING_ERROR, {
45183
- message: err.message,
45184
- });
45201
+ throw new CheckoutError('Error fetching fulfillment transaction', CheckoutErrorType.FULFILL_ORDER_LISTING_ERROR, { error: err });
45185
45202
  }
45186
45203
  if (overrides.waitFulfillmentSettlements) {
45187
45204
  const fulfillmentResult = await signFulfillmentTransactions(provider, unsignedFulfillmentTransactions);
@@ -45236,7 +45253,7 @@ const cancel = async (config, provider, orderIds) => {
45236
45253
  catch (err) {
45237
45254
  throw new CheckoutError('An error occurred while cancelling the order listing', CheckoutErrorType.CANCEL_ORDER_LISTING_ERROR, {
45238
45255
  orderId,
45239
- message: err.message,
45256
+ error: err,
45240
45257
  });
45241
45258
  }
45242
45259
  const result = await signFulfillmentTransactions(provider, [unsignedCancelOrderTransaction]);
@@ -45305,7 +45322,7 @@ const sell = async (config, provider, orders) => {
45305
45322
  }
45306
45323
  catch (err) {
45307
45324
  throw new CheckoutError('An error occurred while preparing the listing', CheckoutErrorType.PREPARE_ORDER_LISTING_ERROR, {
45308
- message: err.message,
45325
+ error: err,
45309
45326
  id: sellToken.id,
45310
45327
  collectionAddress: sellToken.collectionAddress,
45311
45328
  });
@@ -45361,7 +45378,7 @@ const sell = async (config, provider, orders) => {
45361
45378
  }
45362
45379
  catch (err) {
45363
45380
  throw new CheckoutError('An error occurred while creating the listing', CheckoutErrorType.CREATE_ORDER_LISTING_ERROR, {
45364
- message: err.message,
45381
+ error: err,
45365
45382
  collectionId: sellToken.id,
45366
45383
  collectionAddress: sellToken.collectionAddress,
45367
45384
  });
@@ -45658,7 +45675,7 @@ class Checkout {
45658
45675
  }
45659
45676
  }
45660
45677
  catch (err) {
45661
- reject(new CheckoutError('Failed to load widgets script', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR, { message: err.message }));
45678
+ reject(new CheckoutError('Failed to load widgets script', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR, { error: err }));
45662
45679
  }
45663
45680
  });
45664
45681
  return factory;
@@ -45824,8 +45841,8 @@ class Checkout {
45824
45841
  try {
45825
45842
  itemRequirements = await getItemRequirementsFromRequirements(web3Provider, params.itemRequirements);
45826
45843
  }
45827
- catch (error) {
45828
- throw new CheckoutError('Failed to map item requirements', CheckoutErrorType.ITEM_REQUIREMENTS_ERROR);
45844
+ catch (err) {
45845
+ throw new CheckoutError('Failed to map item requirements', CheckoutErrorType.ITEM_REQUIREMENTS_ERROR, { error: err });
45829
45846
  }
45830
45847
  return await smartCheckout(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount);
45831
45848
  }
package/dist/index.d.ts CHANGED
@@ -18085,17 +18085,20 @@ interface CheckConnectionResult {
18085
18085
  * @typedef {Object} BridgeFeeResponse
18086
18086
  * @property {ethers.BigNumber} sourceChainGas - Gas cost to send tokens to the bridge contract on the source chain.
18087
18087
  * - priced in the source chain's native token.
18088
+ * @property {ethers.BigNumber} approvalFee - Gas cost to approve bridge contract to spend tokens on the source chain.
18089
+ * - priced in the source chain's native token.
18088
18090
  * @property {ethers.BigNumber} bridgeFee - destinationChainGas + validatorFee.
18089
18091
  * This will be added to the tx.value of the bridge transaction and forwarded to the Axelar Gas Service contract.
18090
18092
  * - priced in the source chain's native token.
18091
18093
  * @property {ethers.BigNumber} imtblFee - The fee charged by Immutable to facilitate the bridge.
18092
18094
  * - priced in the source chain's native token.
18093
18095
  * @property {ethers.BigNumber} totalFees - The total fees the user will be charged which is;
18094
- * sourceChainGas + bridgeFee + imtblFee.
18096
+ * sourceChainGas + approvalFee + bridgeFee + imtblFee.
18095
18097
  * - priced in the source chain's native token.
18096
18098
  */
18097
18099
  interface BridgeFeeResponse {
18098
18100
  sourceChainGas: BigNumber;
18101
+ approvalFee: BigNumber;
18099
18102
  bridgeFee: BigNumber;
18100
18103
  imtblFee: BigNumber;
18101
18104
  totalFees: BigNumber;