@imtbl/sdk 0.35.1 → 0.35.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/README.md +8 -10
- package/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout/sdk.js +3 -3
- package/dist/browser/checkout/widgets.js +48 -48
- package/dist/checkout.js +21 -19
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +24 -22
- package/dist/index.js +24 -22
- package/dist/passport.js +3 -3
- package/package.json +8 -1
package/dist/checkout.js
CHANGED
|
@@ -15134,36 +15134,38 @@ startTokenIn = tokenIn) => {
|
|
|
15134
15134
|
return routes;
|
|
15135
15135
|
};
|
|
15136
15136
|
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
|
|
15145
|
-
|
|
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 {
|
|
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 {
|
|
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
|
|
15160
|
+
const feeData = await getFeeData(provider).catch(() => null);
|
|
15156
15161
|
if (!feeData)
|
|
15157
15162
|
return null;
|
|
15158
|
-
|
|
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 {
|
|
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.
|
|
20989
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.2',
|
|
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.
|
|
22266
|
+
const SDK_VERSION_MARKER = '0.35.2';
|
|
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.
|
|
20
|
+
sdkVersion: 'ts-immutable-sdk-0.35.2',
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Sets `sdkVersion` at the time of build
|