@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/index.cjs
CHANGED
|
@@ -3791,7 +3791,7 @@ class MultiRollupApiClients {
|
|
|
3791
3791
|
}
|
|
3792
3792
|
|
|
3793
3793
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3794
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.35.
|
|
3794
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.35.2' };
|
|
3795
3795
|
const createConfig = ({ basePath, headers, }) => {
|
|
3796
3796
|
if (!basePath.trim()) {
|
|
3797
3797
|
throw Error('basePath can not be empty');
|
|
@@ -3851,7 +3851,7 @@ class APIError extends Error {
|
|
|
3851
3851
|
|
|
3852
3852
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3853
3853
|
const defaultHeaders = {
|
|
3854
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.
|
|
3854
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.2',
|
|
3855
3855
|
};
|
|
3856
3856
|
/**
|
|
3857
3857
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4262,7 +4262,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4262
4262
|
chainID,
|
|
4263
4263
|
coreContractAddress,
|
|
4264
4264
|
registrationContractAddress,
|
|
4265
|
-
sdkVersion: 'ts-immutable-sdk-0.35.
|
|
4265
|
+
sdkVersion: 'ts-immutable-sdk-0.35.2',
|
|
4266
4266
|
});
|
|
4267
4267
|
/**
|
|
4268
4268
|
* Sets `sdkVersion` at the time of build
|
|
@@ -8790,7 +8790,7 @@ var ChainId$1;
|
|
|
8790
8790
|
(function (ChainId) {
|
|
8791
8791
|
ChainId[ChainId["IMTBL_ZKEVM_MAINNET"] = 13371] = "IMTBL_ZKEVM_MAINNET";
|
|
8792
8792
|
ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13473] = "IMTBL_ZKEVM_TESTNET";
|
|
8793
|
-
ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] =
|
|
8793
|
+
ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 15003] = "IMTBL_ZKEVM_DEVNET";
|
|
8794
8794
|
ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
|
|
8795
8795
|
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
|
|
8796
8796
|
})(ChainId$1 || (ChainId$1 = {}));
|
|
@@ -28900,36 +28900,38 @@ startTokenIn = tokenIn) => {
|
|
|
28900
28900
|
return routes;
|
|
28901
28901
|
};
|
|
28902
28902
|
|
|
28903
|
-
|
|
28904
|
-
|
|
28905
|
-
|
|
28906
|
-
|
|
28907
|
-
|
|
28908
|
-
|
|
28909
|
-
|
|
28910
|
-
|
|
28911
|
-
|
|
28903
|
+
const getFeeData = async (provider) => {
|
|
28904
|
+
const [block, maxPriorityFeePerGas] = await Promise.all([
|
|
28905
|
+
provider.getBlock('latest'),
|
|
28906
|
+
provider.send('eth_maxPriorityFeePerGas', []),
|
|
28907
|
+
]);
|
|
28908
|
+
if (!block.baseFeePerGas)
|
|
28909
|
+
throw new Error('Base fee per gas not found in block');
|
|
28910
|
+
return {
|
|
28911
|
+
// https://www.blocknative.com/blog/eip-1559-fees
|
|
28912
|
+
maxFeePerGas: block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas),
|
|
28913
|
+
maxPriorityFeePerGas,
|
|
28914
|
+
lastBaseFeePerGas: block.baseFeePerGas,
|
|
28915
|
+
};
|
|
28912
28916
|
};
|
|
28913
28917
|
/**
|
|
28914
28918
|
* Fetch the current gas price estimate. Supports both EIP-1559 and non-EIP1559 chains
|
|
28915
|
-
* @param {
|
|
28919
|
+
* @param {Provider} provider - The JSON RPC provider used to fetch fee data
|
|
28916
28920
|
* @param {Native} nativeToken - The native token of the chain. Gas prices will be denominated in this token
|
|
28917
|
-
* @returns {
|
|
28921
|
+
* @returns {CoinAmount<Native> | null} - The gas price in the smallest denomination of the chain's currency,
|
|
28918
28922
|
* or null if no gas price is available
|
|
28919
28923
|
*/
|
|
28924
|
+
// eslint-disable-next-line max-len
|
|
28920
28925
|
const fetchGasPrice = async (provider, nativeToken) => {
|
|
28921
|
-
const feeData = await
|
|
28926
|
+
const feeData = await getFeeData(provider).catch(() => null);
|
|
28922
28927
|
if (!feeData)
|
|
28923
28928
|
return null;
|
|
28924
|
-
|
|
28925
|
-
return newAmount(feeData.maxFeePerGas.add(feeData.maxPriorityFeePerGas), nativeToken);
|
|
28926
|
-
}
|
|
28927
|
-
return feeData.gasPrice ? newAmount(feeData.gasPrice, nativeToken) : null;
|
|
28929
|
+
return newAmount(feeData.maxFeePerGas, nativeToken);
|
|
28928
28930
|
};
|
|
28929
28931
|
/**
|
|
28930
28932
|
* Calculate the gas fee from the gas price and gas units used for the transaction
|
|
28931
28933
|
*
|
|
28932
|
-
* @param {
|
|
28934
|
+
* @param {CoinAmount<Native>} gasPrice - The price of gas
|
|
28933
28935
|
* @param {BigNumber} gasEstimate - The total gas units that will be used for the transaction
|
|
28934
28936
|
* @returns - The cost of the transaction in the gas token's smallest denomination (e.g. WEI)
|
|
28935
28937
|
*/
|
|
@@ -30569,7 +30571,7 @@ const GAS_OVERRIDES = {
|
|
|
30569
30571
|
maxPriorityFeePerGas: ethers.BigNumber.from(101e9),
|
|
30570
30572
|
};
|
|
30571
30573
|
|
|
30572
|
-
const SDK_VERSION_MARKER = '0.35.
|
|
30574
|
+
const SDK_VERSION_MARKER = '0.35.2';
|
|
30573
30575
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
30574
30576
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
30575
30577
|
|
package/dist/index.js
CHANGED
|
@@ -3769,7 +3769,7 @@ class MultiRollupApiClients {
|
|
|
3769
3769
|
}
|
|
3770
3770
|
|
|
3771
3771
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3772
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.35.
|
|
3772
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.35.2' };
|
|
3773
3773
|
const createConfig = ({ basePath, headers, }) => {
|
|
3774
3774
|
if (!basePath.trim()) {
|
|
3775
3775
|
throw Error('basePath can not be empty');
|
|
@@ -3829,7 +3829,7 @@ class APIError extends Error {
|
|
|
3829
3829
|
|
|
3830
3830
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3831
3831
|
const defaultHeaders = {
|
|
3832
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.
|
|
3832
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.2',
|
|
3833
3833
|
};
|
|
3834
3834
|
/**
|
|
3835
3835
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4240,7 +4240,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4240
4240
|
chainID,
|
|
4241
4241
|
coreContractAddress,
|
|
4242
4242
|
registrationContractAddress,
|
|
4243
|
-
sdkVersion: 'ts-immutable-sdk-0.35.
|
|
4243
|
+
sdkVersion: 'ts-immutable-sdk-0.35.2',
|
|
4244
4244
|
});
|
|
4245
4245
|
/**
|
|
4246
4246
|
* Sets `sdkVersion` at the time of build
|
|
@@ -8768,7 +8768,7 @@ var ChainId$1;
|
|
|
8768
8768
|
(function (ChainId) {
|
|
8769
8769
|
ChainId[ChainId["IMTBL_ZKEVM_MAINNET"] = 13371] = "IMTBL_ZKEVM_MAINNET";
|
|
8770
8770
|
ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13473] = "IMTBL_ZKEVM_TESTNET";
|
|
8771
|
-
ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] =
|
|
8771
|
+
ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 15003] = "IMTBL_ZKEVM_DEVNET";
|
|
8772
8772
|
ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
|
|
8773
8773
|
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
|
|
8774
8774
|
})(ChainId$1 || (ChainId$1 = {}));
|
|
@@ -28878,36 +28878,38 @@ startTokenIn = tokenIn) => {
|
|
|
28878
28878
|
return routes;
|
|
28879
28879
|
};
|
|
28880
28880
|
|
|
28881
|
-
|
|
28882
|
-
|
|
28883
|
-
|
|
28884
|
-
|
|
28885
|
-
|
|
28886
|
-
|
|
28887
|
-
|
|
28888
|
-
|
|
28889
|
-
|
|
28881
|
+
const getFeeData = async (provider) => {
|
|
28882
|
+
const [block, maxPriorityFeePerGas] = await Promise.all([
|
|
28883
|
+
provider.getBlock('latest'),
|
|
28884
|
+
provider.send('eth_maxPriorityFeePerGas', []),
|
|
28885
|
+
]);
|
|
28886
|
+
if (!block.baseFeePerGas)
|
|
28887
|
+
throw new Error('Base fee per gas not found in block');
|
|
28888
|
+
return {
|
|
28889
|
+
// https://www.blocknative.com/blog/eip-1559-fees
|
|
28890
|
+
maxFeePerGas: block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas),
|
|
28891
|
+
maxPriorityFeePerGas,
|
|
28892
|
+
lastBaseFeePerGas: block.baseFeePerGas,
|
|
28893
|
+
};
|
|
28890
28894
|
};
|
|
28891
28895
|
/**
|
|
28892
28896
|
* Fetch the current gas price estimate. Supports both EIP-1559 and non-EIP1559 chains
|
|
28893
|
-
* @param {
|
|
28897
|
+
* @param {Provider} provider - The JSON RPC provider used to fetch fee data
|
|
28894
28898
|
* @param {Native} nativeToken - The native token of the chain. Gas prices will be denominated in this token
|
|
28895
|
-
* @returns {
|
|
28899
|
+
* @returns {CoinAmount<Native> | null} - The gas price in the smallest denomination of the chain's currency,
|
|
28896
28900
|
* or null if no gas price is available
|
|
28897
28901
|
*/
|
|
28902
|
+
// eslint-disable-next-line max-len
|
|
28898
28903
|
const fetchGasPrice = async (provider, nativeToken) => {
|
|
28899
|
-
const feeData = await
|
|
28904
|
+
const feeData = await getFeeData(provider).catch(() => null);
|
|
28900
28905
|
if (!feeData)
|
|
28901
28906
|
return null;
|
|
28902
|
-
|
|
28903
|
-
return newAmount(feeData.maxFeePerGas.add(feeData.maxPriorityFeePerGas), nativeToken);
|
|
28904
|
-
}
|
|
28905
|
-
return feeData.gasPrice ? newAmount(feeData.gasPrice, nativeToken) : null;
|
|
28907
|
+
return newAmount(feeData.maxFeePerGas, nativeToken);
|
|
28906
28908
|
};
|
|
28907
28909
|
/**
|
|
28908
28910
|
* Calculate the gas fee from the gas price and gas units used for the transaction
|
|
28909
28911
|
*
|
|
28910
|
-
* @param {
|
|
28912
|
+
* @param {CoinAmount<Native>} gasPrice - The price of gas
|
|
28911
28913
|
* @param {BigNumber} gasEstimate - The total gas units that will be used for the transaction
|
|
28912
28914
|
* @returns - The cost of the transaction in the gas token's smallest denomination (e.g. WEI)
|
|
28913
28915
|
*/
|
|
@@ -30547,7 +30549,7 @@ const GAS_OVERRIDES = {
|
|
|
30547
30549
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
30548
30550
|
};
|
|
30549
30551
|
|
|
30550
|
-
const SDK_VERSION_MARKER = '0.35.
|
|
30552
|
+
const SDK_VERSION_MARKER = '0.35.2';
|
|
30551
30553
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
30552
30554
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
30553
30555
|
|
package/dist/passport.js
CHANGED
|
@@ -2191,7 +2191,7 @@ class MultiRollupApiClients {
|
|
|
2191
2191
|
}
|
|
2192
2192
|
|
|
2193
2193
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2194
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.35.
|
|
2194
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.35.2' };
|
|
2195
2195
|
const createConfig = ({ basePath, headers, }) => {
|
|
2196
2196
|
if (!basePath.trim()) {
|
|
2197
2197
|
throw Error('basePath can not be empty');
|
|
@@ -2247,7 +2247,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
2247
2247
|
chainID,
|
|
2248
2248
|
coreContractAddress,
|
|
2249
2249
|
registrationContractAddress,
|
|
2250
|
-
sdkVersion: 'ts-immutable-sdk-0.35.
|
|
2250
|
+
sdkVersion: 'ts-immutable-sdk-0.35.2',
|
|
2251
2251
|
});
|
|
2252
2252
|
/**
|
|
2253
2253
|
* Sets `sdkVersion` at the time of build
|
|
@@ -6758,7 +6758,7 @@ var ChainId;
|
|
|
6758
6758
|
(function (ChainId) {
|
|
6759
6759
|
ChainId[ChainId["IMTBL_ZKEVM_MAINNET"] = 13371] = "IMTBL_ZKEVM_MAINNET";
|
|
6760
6760
|
ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13473] = "IMTBL_ZKEVM_TESTNET";
|
|
6761
|
-
ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] =
|
|
6761
|
+
ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 15003] = "IMTBL_ZKEVM_DEVNET";
|
|
6762
6762
|
ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
|
|
6763
6763
|
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
|
|
6764
6764
|
})(ChainId || (ChainId = {}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/sdk",
|
|
3
3
|
"description": "Immutable Unified SDK",
|
|
4
|
-
"version": "0.35.
|
|
4
|
+
"version": "0.35.2",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"browser": "./dist/index.browser.js",
|
|
7
7
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
@@ -115,11 +115,18 @@
|
|
|
115
115
|
"license": "Apache-2.0",
|
|
116
116
|
"main": "./dist/index.cjs",
|
|
117
117
|
"module": "./dist/index.js",
|
|
118
|
+
"overrides": {
|
|
119
|
+
"@openzeppelin/contracts": "3.4.2-solc-0.7"
|
|
120
|
+
},
|
|
118
121
|
"peerDependencies": {
|
|
119
122
|
"react": "^18.2.0",
|
|
120
123
|
"react-dom": "^18.2.0"
|
|
121
124
|
},
|
|
122
125
|
"repository": "immutable/ts-immutable-sdk.git",
|
|
126
|
+
"resolutions": {
|
|
127
|
+
"@biom3/design-tokens": "0.2.4-beta",
|
|
128
|
+
"@openzeppelin/contracts": "3.4.2-solc-0.7"
|
|
129
|
+
},
|
|
123
130
|
"scripts": {
|
|
124
131
|
"build": "yarn packageList && yarn updateDependencies && yarn regenModules && rm -rf dist && NODE_ENV=production rollup --config rollup.config.js && rm -rf dist/types",
|
|
125
132
|
"build:only": "rm -rf dist && NODE_ENV=production rollup --config rollup.config.js && rm -rf dist/types",
|