@imtbl/sdk 0.45.0 → 0.45.2

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.45.0',
25964
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.45.2',
25965
25965
  };
25966
25966
  /**
25967
25967
  * createAPIConfiguration to create a custom Configuration
@@ -27316,13 +27316,13 @@ const ERC721ABI = [
27316
27316
  },
27317
27317
  ];
27318
27318
  // Gas overrides -- Anti-spam mechanism for when the baseFee drops low
27319
- // https://github.com/immutable/imx-docs/blob/main/docs/main/zkEVM/overview/gas-configuration.md
27320
- const GAS_OVERRIDES = {
27321
- maxFeePerGas: BigNumber$1.from(102e9),
27322
- maxPriorityFeePerGas: BigNumber$1.from(101e9),
27319
+ // https://docs.immutable.com/docs/zkEVM/architecture/gas-config
27320
+ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
27321
+ maxFeePerGas: BigNumber$1.from(15e9),
27322
+ maxPriorityFeePerGas: BigNumber$1.from(10e9),
27323
27323
  };
27324
27324
 
27325
- const SDK_VERSION_MARKER = '0.45.0';
27325
+ const SDK_VERSION_MARKER = '0.45.2';
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
 
@@ -27470,6 +27470,9 @@ class CheckoutConfiguration {
27470
27470
  }
27471
27471
 
27472
27472
  const isMatchingAddress = (addressA = '', addressB = '') => (addressA.toLowerCase() === addressB.toLowerCase());
27473
+ const isZkEvmChainId = (chainId) => chainId === ChainId.IMTBL_ZKEVM_DEVNET
27474
+ || chainId === ChainId.IMTBL_ZKEVM_TESTNET
27475
+ || chainId === ChainId.IMTBL_ZKEVM_MAINNET;
27473
27476
 
27474
27477
  const getTokenAllowList = async (config, { type = TokenFilterTypes.ALL, chainId, exclude, }) => {
27475
27478
  let tokens = [];
@@ -28006,16 +28009,19 @@ async function getWalletAllowList(params) {
28006
28009
  };
28007
28010
  }
28008
28011
 
28009
- const setTransactionGasLimits = (transaction) => {
28012
+ const setTransactionGasLimits = async (web3Provider, transaction) => {
28010
28013
  const rawTx = transaction;
28011
- rawTx.maxFeePerGas = GAS_OVERRIDES.maxFeePerGas;
28012
- rawTx.maxPriorityFeePerGas = GAS_OVERRIDES.maxPriorityFeePerGas;
28014
+ const { chainId } = await web3Provider.getNetwork();
28015
+ if (!isZkEvmChainId(chainId))
28016
+ return rawTx;
28017
+ rawTx.maxFeePerGas = IMMUTABLE_ZKVEM_GAS_OVERRIDES.maxFeePerGas;
28018
+ rawTx.maxPriorityFeePerGas = IMMUTABLE_ZKVEM_GAS_OVERRIDES.maxPriorityFeePerGas;
28013
28019
  return rawTx;
28014
28020
  };
28015
28021
  const sendTransaction = async (web3Provider, transaction) => {
28016
28022
  try {
28017
28023
  const signer = web3Provider.getSigner();
28018
- const rawTx = setTransactionGasLimits(transaction);
28024
+ const rawTx = await setTransactionGasLimits(web3Provider, transaction);
28019
28025
  const transactionResponse = await signer.sendTransaction(rawTx);
28020
28026
  return {
28021
28027
  transactionResponse,