@toruslabs/ethereum-controllers 4.8.0 → 4.9.1
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 +9 -3
- package/dist/ethereumControllers.cjs.js.map +1 -1
- package/dist/ethereumControllers.esm.js +9 -3
- 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/Keyring/KeyringController.d.ts +1 -1
- package/package.json +6 -6
- package/src/Gas/GasFeeController.ts +8 -1
- package/src/Keyring/KeyringController.ts +1 -1
- package/src/Message/MessageController.ts +1 -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
|
}
|
|
@@ -2148,7 +2154,7 @@ class KeyringController extends base_controllers_namespaceObject.BaseKeyringCont
|
|
|
2148
2154
|
}
|
|
2149
2155
|
|
|
2150
2156
|
// For eth_sign, we need to sign arbitrary data:
|
|
2151
|
-
signMessage(data, address) {
|
|
2157
|
+
async signMessage(data, address) {
|
|
2152
2158
|
const wallet = this._getWalletForAccount(address);
|
|
2153
2159
|
const privKey = this.getBufferPrivateKey(wallet.privateKey);
|
|
2154
2160
|
const messageSig = (0,util_namespaceObject.ecsign)(Buffer.from((0,util_namespaceObject.stripHexPrefix)(data), "hex"), privKey);
|
|
@@ -2685,7 +2691,7 @@ class MessageController extends AbstractMessageController {
|
|
|
2685
2691
|
try {
|
|
2686
2692
|
const msgObject = this.getMessage(messageId);
|
|
2687
2693
|
const cleanMsgParams = await this.approveMessage(messageId, msgObject.messageParams);
|
|
2688
|
-
const rawSig = this.signMessage(cleanMsgParams.data, cleanMsgParams.from);
|
|
2694
|
+
const rawSig = await this.signMessage(cleanMsgParams.data, cleanMsgParams.from);
|
|
2689
2695
|
this.updateMessage(objectSpread2_default()(objectSpread2_default()({}, msgObject), {}, {
|
|
2690
2696
|
rawSig
|
|
2691
2697
|
}));
|