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

Using new generic gas estimate function

This commit is contained in:
Jamie Hewitt 2022-05-18 16:28:32 +03:00
parent 9070b61111
commit cd8f892d38

View File

@ -1330,23 +1330,16 @@ export class Datatoken {
address: string
): Promise<number> {
// Estimate gas cost for publishMarketFeeAddress method
const gasLimitDefault = this.GASLIMIT_DEFAULT
const dtContract = new this.web3.eth.Contract(this.datatokensAbi, datatokenAddress, {
from: address
})
let estGas
try {
estGas = await dtContract.methods
.setPublishingMarketFee(
return estimateGas(
address,
dtContract.methods.setPublishingMarketFee,
publishMarketFeeAddress,
publishMarketFeeToken,
publishMarketFeeAmount
)
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
} catch (error) {
estGas = gasLimitDefault
}
return estGas
}
/**