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:
parent
9070b61111
commit
cd8f892d38
@ -1330,23 +1330,16 @@ export class Datatoken {
|
|||||||
address: string
|
address: string
|
||||||
): Promise<number> {
|
): Promise<number> {
|
||||||
// Estimate gas cost for publishMarketFeeAddress method
|
// Estimate gas cost for publishMarketFeeAddress method
|
||||||
const gasLimitDefault = this.GASLIMIT_DEFAULT
|
|
||||||
const dtContract = new this.web3.eth.Contract(this.datatokensAbi, datatokenAddress, {
|
const dtContract = new this.web3.eth.Contract(this.datatokensAbi, datatokenAddress, {
|
||||||
from: address
|
from: address
|
||||||
})
|
})
|
||||||
let estGas
|
return estimateGas(
|
||||||
try {
|
address,
|
||||||
estGas = await dtContract.methods
|
dtContract.methods.setPublishingMarketFee,
|
||||||
.setPublishingMarketFee(
|
publishMarketFeeAddress,
|
||||||
publishMarketFeeAddress,
|
publishMarketFeeToken,
|
||||||
publishMarketFeeToken,
|
publishMarketFeeAmount
|
||||||
publishMarketFeeAmount
|
)
|
||||||
)
|
|
||||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
|
||||||
} catch (error) {
|
|
||||||
estGas = gasLimitDefault
|
|
||||||
}
|
|
||||||
return estGas
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user