@toruslabs/ethereum-controllers 4.9.0 → 4.10.0
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/ethereumControllers.cjs.js +12 -7
- package/dist/ethereumControllers.cjs.js.map +1 -1
- package/dist/ethereumControllers.esm.js +11 -7
- package/dist/ethereumControllers.esm.js.map +1 -1
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/ethereumControllers.umd.min.js.map +1 -1
- package/dist/types/Gas/GasFeeController.d.ts +1 -0
- package/dist/types/Network/createJsonRpcClient.d.ts +2 -1
- package/dist/types/utils/interfaces.d.ts +2 -2
- package/package.json +7 -7
- package/src/Gas/GasFeeController.ts +8 -1
- package/src/Network/NetworkController.ts +1 -1
- package/src/Network/createJsonRpcClient.ts +6 -2
- package/src/utils/interfaces.ts +2 -1
|
@@ -1910,6 +1910,8 @@ class GasFeeController extends base_controllers_namespaceObject.BaseController {
|
|
|
1910
1910
|
state
|
|
1911
1911
|
});
|
|
1912
1912
|
defineProperty_default()(this, "name", "GasFeeController");
|
|
1913
|
+
// https://0x.org/docs/introduction/0x-cheat-sheet#swap-api-endpoints
|
|
1914
|
+
defineProperty_default()(this, "API_SUPPORTED_CHAINIDS", new Set(["0x1", "0x5", "0x13881", "0xa4b1", "0xa86a", "0x2105", "0x38", "0xfa", "0xa", "0x89"]));
|
|
1913
1915
|
defineProperty_default()(this, "intervalId", void 0);
|
|
1914
1916
|
defineProperty_default()(this, "provider", void 0);
|
|
1915
1917
|
defineProperty_default()(this, "currentChainId", void 0);
|
|
@@ -2013,7 +2015,11 @@ class GasFeeController extends base_controllers_namespaceObject.BaseController {
|
|
|
2013
2015
|
if (isEIP1559Compatible) {
|
|
2014
2016
|
let estimates;
|
|
2015
2017
|
try {
|
|
2016
|
-
|
|
2018
|
+
if (this.API_SUPPORTED_CHAINIDS.has(chainId)) {
|
|
2019
|
+
estimates = await this.fetchGasEstimates(this.config.EIP1559APIEndpoint.replace("<chain_id>", `${chainIdInt}`));
|
|
2020
|
+
} else {
|
|
2021
|
+
throw new Error("ChainId not supported by api");
|
|
2022
|
+
}
|
|
2017
2023
|
} catch (error) {
|
|
2018
2024
|
estimates = await this.fetchGasEstimatesViaEthFeeHistory(this.provider);
|
|
2019
2025
|
}
|
|
@@ -3363,6 +3369,7 @@ function createEthereumMiddleware(providerHandlers) {
|
|
|
3363
3369
|
|
|
3364
3370
|
|
|
3365
3371
|
|
|
3372
|
+
|
|
3366
3373
|
function createChainIdMiddleware(chainId) {
|
|
3367
3374
|
return (req, res, next, end) => {
|
|
3368
3375
|
if (req.method === "eth_chainId") {
|
|
@@ -3386,7 +3393,7 @@ function createProviderConfigMiddleware(providerConfig) {
|
|
|
3386
3393
|
return next();
|
|
3387
3394
|
};
|
|
3388
3395
|
}
|
|
3389
|
-
function createJsonRpcClient(providerConfig) {
|
|
3396
|
+
function createJsonRpcClient(providerConfig, networkConfig) {
|
|
3390
3397
|
const {
|
|
3391
3398
|
chainId,
|
|
3392
3399
|
rpcTarget
|
|
@@ -3396,9 +3403,9 @@ function createJsonRpcClient(providerConfig) {
|
|
|
3396
3403
|
});
|
|
3397
3404
|
const blockProvider = (0,openlogin_jrpc_namespaceObject.providerFromMiddleware)(fetchMiddleware);
|
|
3398
3405
|
const blockTracker = new Block_PollingBlockTracker({
|
|
3399
|
-
config: {
|
|
3406
|
+
config: objectSpread2_default()(objectSpread2_default()({}, networkConfig), {}, {
|
|
3400
3407
|
provider: blockProvider
|
|
3401
|
-
},
|
|
3408
|
+
}),
|
|
3402
3409
|
state: {}
|
|
3403
3410
|
});
|
|
3404
3411
|
const networkMiddleware = (0,openlogin_jrpc_namespaceObject.mergeMiddleware)([createChainIdMiddleware(chainId), createProviderConfigMiddleware(providerConfig),
|
|
@@ -3600,7 +3607,7 @@ class NetworkController extends base_controllers_namespaceObject.BaseController
|
|
|
3600
3607
|
this.blockTracker = blockTracker;
|
|
3601
3608
|
}
|
|
3602
3609
|
configureStandardProvider(providerConfig) {
|
|
3603
|
-
const networkClient = createJsonRpcClient(providerConfig);
|
|
3610
|
+
const networkClient = createJsonRpcClient(providerConfig, this.config);
|
|
3604
3611
|
external_loglevel_default().info("networkClient", networkClient);
|
|
3605
3612
|
this.setNetworkClient(networkClient);
|
|
3606
3613
|
}
|
|
@@ -5609,7 +5616,6 @@ function getFinalStates() {
|
|
|
5609
5616
|
base_controllers_namespaceObject.TransactionStatus.dropped // the tx nonce was already used
|
|
5610
5617
|
];
|
|
5611
5618
|
}
|
|
5612
|
-
|
|
5613
5619
|
function parseStandardTokenTransactionData(data) {
|
|
5614
5620
|
try {
|
|
5615
5621
|
const txDesc = erc20Interface.parseTransaction({
|
|
@@ -6072,7 +6078,6 @@ class TransactionController extends TransactionStateManager {
|
|
|
6072
6078
|
getConfirmedTransactions: this.getConfirmedTransactions.bind(this),
|
|
6073
6079
|
getPendingTransactions: this.getSubmittedTransactions.bind(this) // nonce tracker should only care about submitted transactions
|
|
6074
6080
|
});
|
|
6075
|
-
|
|
6076
6081
|
this.pendingTxTracker = new PendingTransactionTracker({
|
|
6077
6082
|
provider,
|
|
6078
6083
|
nonceTracker: this.nonceTracker,
|