crosslightning-evm
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -56,2 +56,3 @@ /// <reference types="node" /> | ||
estimateSynchronizeFee(requiredBlockheight: number): Promise<BN>; | ||
getFeePerBlock(): Promise<BN>; | ||
} |
@@ -302,3 +302,24 @@ "use strict"; | ||
} | ||
getFeePerBlock() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let gasPrice; | ||
try { | ||
const gasPriceData = yield this.provider.provider.getFeeData(); | ||
if (gasPriceData.lastBaseFeePerGas != null) { | ||
gasPrice = gasPriceData.lastBaseFeePerGas; | ||
} | ||
else { | ||
gasPrice = gasPriceData.gasPrice; | ||
} | ||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
if (gasPrice == null) { | ||
gasPrice = yield this.provider.provider.getGasPrice(); | ||
} | ||
return new BN(ethers_1.BigNumber.from(GAS_PER_BLOCKHEADER).mul(gasPrice).toString()); | ||
}); | ||
} | ||
} | ||
exports.EVMBtcRelay = EVMBtcRelay; |
{ | ||
"name": "crosslightning-evm", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "EVM specific base implementation", | ||
@@ -27,3 +27,3 @@ "main": "./dist/index.js", | ||
"bn.js": "^5.2.1", | ||
"crosslightning-base": "^3.0.1", | ||
"crosslightning-base": "^3.0.2", | ||
"ethers": "^5.7.2", | ||
@@ -30,0 +30,0 @@ "typescript": "^4.9.5" |
@@ -348,2 +348,25 @@ import {BitcoinRpc, BtcBlock, BtcRelay, StatePredictorUtils} from "crosslightning-base"; | ||
async getFeePerBlock(): Promise<BN> { | ||
let gasPrice: BigNumber; | ||
try { | ||
const gasPriceData = await this.provider.provider.getFeeData(); | ||
if(gasPriceData.lastBaseFeePerGas!=null) { | ||
gasPrice = gasPriceData.lastBaseFeePerGas; | ||
} else { | ||
gasPrice = gasPriceData.gasPrice; | ||
} | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
if(gasPrice==null) { | ||
gasPrice = await this.provider.provider.getGasPrice(); | ||
} | ||
return new BN(BigNumber.from(GAS_PER_BLOCKHEADER).mul(gasPrice).toString()); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
333640
7955
Updatedcrosslightning-base@^3.0.2