crosslightning-evm
Advanced tools
Comparing version 4.0.8 to 4.0.9
@@ -16,3 +16,4 @@ /// <reference types="node" /> | ||
private readonly logBlocksLimit; | ||
constructor(provider: Signer, bitcoinRpc: BitcoinRpc<B>, btcRelayContractAddress: string, logBlocksLimit?: number); | ||
private readonly useEip1559ForFeeEstimate; | ||
constructor(provider: Signer, bitcoinRpc: BitcoinRpc<B>, btcRelayContractAddress: string, logBlocksLimit?: number, useEip1559ForFeeEstimate?: boolean); | ||
saveInitialHeader(header: B, epochStart: number, pastBlocksTimestamps: number[]): Promise<UnsignedTransaction>; | ||
@@ -19,0 +20,0 @@ retrieveLogAndBlockheight(blockData: { |
@@ -23,3 +23,3 @@ "use strict"; | ||
class EVMBtcRelay { | ||
constructor(provider, bitcoinRpc, btcRelayContractAddress, logBlocksLimit) { | ||
constructor(provider, bitcoinRpc, btcRelayContractAddress, logBlocksLimit, useEip1559ForFeeEstimate) { | ||
this.maxHeadersPerTx = 100; | ||
@@ -32,2 +32,3 @@ this.maxForkHeadersPerTx = 50; | ||
this.logBlocksLimit = logBlocksLimit || limit; | ||
this.useEip1559ForFeeEstimate = useEip1559ForFeeEstimate == null ? true : useEip1559ForFeeEstimate; | ||
} | ||
@@ -301,14 +302,15 @@ saveInitialHeader(header, epochStart, pastBlocksTimestamps) { | ||
let gasPrice; | ||
try { | ||
const gasPriceData = yield this.provider.provider.getFeeData(); | ||
if (gasPriceData.lastBaseFeePerGas != null) { | ||
gasPrice = gasPriceData.lastBaseFeePerGas; | ||
if (this.useEip1559ForFeeEstimate) | ||
try { | ||
const gasPriceData = yield this.provider.provider.getFeeData(); | ||
if (gasPriceData.lastBaseFeePerGas != null) { | ||
gasPrice = gasPriceData.lastBaseFeePerGas; | ||
} | ||
else { | ||
gasPrice = gasPriceData.gasPrice; | ||
} | ||
} | ||
else { | ||
gasPrice = gasPriceData.gasPrice; | ||
catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
if (gasPrice == null) { | ||
@@ -323,14 +325,15 @@ gasPrice = yield this.provider.provider.getGasPrice(); | ||
let gasPrice; | ||
try { | ||
const gasPriceData = yield this.provider.provider.getFeeData(); | ||
if (gasPriceData.lastBaseFeePerGas != null) { | ||
gasPrice = gasPriceData.lastBaseFeePerGas; | ||
if (this.useEip1559ForFeeEstimate) | ||
try { | ||
const gasPriceData = yield this.provider.provider.getFeeData(); | ||
if (gasPriceData.lastBaseFeePerGas != null) { | ||
gasPrice = gasPriceData.lastBaseFeePerGas; | ||
} | ||
else { | ||
gasPrice = gasPriceData.gasPrice; | ||
} | ||
} | ||
else { | ||
gasPrice = gasPriceData.gasPrice; | ||
catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
if (gasPrice == null) { | ||
@@ -337,0 +340,0 @@ gasPrice = yield this.provider.provider.getGasPrice(); |
{ | ||
"name": "crosslightning-evm", | ||
"version": "4.0.8", | ||
"version": "4.0.9", | ||
"description": "EVM specific base implementation", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -26,3 +26,5 @@ import {BitcoinRpc, BtcBlock, BtcRelay, StatePredictorUtils} from "crosslightning-base"; | ||
constructor(provider: Signer, bitcoinRpc: BitcoinRpc<B>, btcRelayContractAddress: string, logBlocksLimit?: number) { | ||
private readonly useEip1559ForFeeEstimate: boolean; | ||
constructor(provider: Signer, bitcoinRpc: BitcoinRpc<B>, btcRelayContractAddress: string, logBlocksLimit?: number, useEip1559ForFeeEstimate?: boolean) { | ||
this.provider = provider; | ||
@@ -35,2 +37,4 @@ this.contract = new Contract(btcRelayContractAddress, btcRelayContract.abi, provider); | ||
this.logBlocksLimit = logBlocksLimit || limit; | ||
this.useEip1559ForFeeEstimate = useEip1559ForFeeEstimate==null ? true : useEip1559ForFeeEstimate; | ||
} | ||
@@ -357,3 +361,3 @@ | ||
let gasPrice: BigNumber; | ||
try { | ||
if(this.useEip1559ForFeeEstimate) try { | ||
const gasPriceData = await this.provider.provider.getFeeData(); | ||
@@ -381,3 +385,3 @@ | ||
let gasPrice: BigNumber; | ||
try { | ||
if(this.useEip1559ForFeeEstimate) try { | ||
const gasPriceData = await this.provider.provider.getFeeData(); | ||
@@ -384,0 +388,0 @@ |
350184
8443