1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

add getFairGasPrice() to SmartContract class

This commit is contained in:
Miquel A. Cabot 2022-06-09 09:32:31 +02:00
parent 011b48a9e2
commit ef2e85f811

View File

@ -1,7 +1,7 @@
import Web3 from 'web3' import Web3 from 'web3'
import { AbiItem } from 'web3-utils' import { AbiItem } from 'web3-utils'
import { Config, ConfigHelper } from '../config' import { Config, ConfigHelper } from '../config'
import { amountToUnits, unitsToAmount } from '../utils' import { amountToUnits, getFairGasPrice, unitsToAmount } from '../utils'
export abstract class SmartContract { export abstract class SmartContract {
public web3: Web3 public web3: Web3
@ -43,4 +43,8 @@ export abstract class SmartContract {
): Promise<string> { ): Promise<string> {
return unitsToAmount(this.web3, token, amount, tokenDecimals) return unitsToAmount(this.web3, token, amount, tokenDecimals)
} }
async getFairGasPrice(): Promise<string> {
return getFairGasPrice(this.web3, this.config)
}
} }