@imtbl/sdk 0.35.1 → 0.35.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.
@@ -10590,8 +10590,6 @@ declare class Passport {
10590
10590
  */
10591
10591
  connectImxSilent(): Promise<IMXProvider | null>;
10592
10592
  connectImx(): Promise<IMXProvider>;
10593
- getPKCEAuthorizationUrl(): string;
10594
- connectImxPKCEFlow(authorizationCode: string, state: string): Promise<IMXProvider | null>;
10595
10593
  connectEvm(): Provider;
10596
10594
  /**
10597
10595
  *
@@ -10607,6 +10605,8 @@ declare class Passport {
10607
10605
  loginCallback(): Promise<void>;
10608
10606
  loginWithDeviceFlow(): Promise<DeviceConnectResponse>;
10609
10607
  loginWithDeviceFlowCallback(deviceCode: string, interval: number, timeoutMs?: number): Promise<UserProfile>;
10608
+ loginWithPKCEFlow(): string;
10609
+ loginWithPKCEFlowCallback(authorizationCode: string, state: string): Promise<UserProfile>;
10610
10610
  logout(): Promise<void>;
10611
10611
  /**
10612
10612
  * Logs the user out of Passport when using device flow authentication.
package/dist/checkout.js CHANGED
@@ -15134,36 +15134,38 @@ startTokenIn = tokenIn) => {
15134
15134
  return routes;
15135
15135
  };
15136
15136
 
15137
- /**
15138
- * Determines whether or not the chain supports EIP-1559 by checking for the existence
15139
- * of {@link FeeData.maxFeePerGas} and {@link FeeData.maxPriorityFeePerGas}
15140
- *
15141
- * @param {FeeData} fee - The fee data for the chain
15142
- */
15143
- const doesChainSupportEIP1559$1 = (fee) => {
15144
- const supportsEIP1559 = !!fee.maxFeePerGas && !!fee.maxPriorityFeePerGas;
15145
- return supportsEIP1559;
15137
+ const getFeeData = async (provider) => {
15138
+ const [block, maxPriorityFeePerGas] = await Promise.all([
15139
+ provider.getBlock('latest'),
15140
+ provider.send('eth_maxPriorityFeePerGas', []),
15141
+ ]);
15142
+ if (!block.baseFeePerGas)
15143
+ throw new Error('Base fee per gas not found in block');
15144
+ return {
15145
+ // https://www.blocknative.com/blog/eip-1559-fees
15146
+ maxFeePerGas: block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas),
15147
+ maxPriorityFeePerGas,
15148
+ lastBaseFeePerGas: block.baseFeePerGas,
15149
+ };
15146
15150
  };
15147
15151
  /**
15148
15152
  * Fetch the current gas price estimate. Supports both EIP-1559 and non-EIP1559 chains
15149
- * @param {JsonRpcProvider} provider - The JSON RPC provider used to fetch fee data
15153
+ * @param {Provider} provider - The JSON RPC provider used to fetch fee data
15150
15154
  * @param {Native} nativeToken - The native token of the chain. Gas prices will be denominated in this token
15151
- * @returns {Amount | null} - The gas price in the smallest denomination of the chain's currency,
15155
+ * @returns {CoinAmount<Native> | null} - The gas price in the smallest denomination of the chain's currency,
15152
15156
  * or null if no gas price is available
15153
15157
  */
15158
+ // eslint-disable-next-line max-len
15154
15159
  const fetchGasPrice = async (provider, nativeToken) => {
15155
- const feeData = await provider.getFeeData().catch(() => null);
15160
+ const feeData = await getFeeData(provider).catch(() => null);
15156
15161
  if (!feeData)
15157
15162
  return null;
15158
- if (doesChainSupportEIP1559$1(feeData)) {
15159
- return newAmount(feeData.maxFeePerGas.add(feeData.maxPriorityFeePerGas), nativeToken);
15160
- }
15161
- return feeData.gasPrice ? newAmount(feeData.gasPrice, nativeToken) : null;
15163
+ return newAmount(feeData.maxFeePerGas, nativeToken);
15162
15164
  };
15163
15165
  /**
15164
15166
  * Calculate the gas fee from the gas price and gas units used for the transaction
15165
15167
  *
15166
- * @param {Amount} gasPrice - The price of gas
15168
+ * @param {CoinAmount<Native>} gasPrice - The price of gas
15167
15169
  * @param {BigNumber} gasEstimate - The total gas units that will be used for the transaction
15168
15170
  * @returns - The cost of the transaction in the gas token's smallest denomination (e.g. WEI)
15169
15171
  */
@@ -20984,7 +20986,7 @@ class APIError extends Error {
20984
20986
 
20985
20987
  /* eslint-disable implicit-arrow-linebreak */
20986
20988
  const defaultHeaders = {
20987
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.1',
20989
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.3',
20988
20990
  };
20989
20991
  /**
20990
20992
  * createAPIConfiguration to create a custom Configuration
@@ -22261,7 +22263,7 @@ const GAS_OVERRIDES = {
22261
22263
  maxPriorityFeePerGas: BigNumber$1.from(101e9),
22262
22264
  };
22263
22265
 
22264
- const SDK_VERSION_MARKER = '0.35.1';
22266
+ const SDK_VERSION_MARKER = '0.35.3';
22265
22267
  // This SDK version is replaced by the `yarn build` command ran on the root level
22266
22268
  const globalPackageVersion = () => SDK_VERSION_MARKER;
22267
22269
 
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
17
17
  chainID,
18
18
  coreContractAddress,
19
19
  registrationContractAddress,
20
- sdkVersion: 'ts-immutable-sdk-0.35.1',
20
+ sdkVersion: 'ts-immutable-sdk-0.35.3',
21
21
  });
22
22
  /**
23
23
  * Sets `sdkVersion` at the time of build