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

rewrite estimateGas for reuseOrder()

This commit is contained in:
Miquel A. Cabot 2022-04-28 17:37:08 +02:00
parent 0fb3b8ac40
commit 5289996937

View File

@ -949,17 +949,7 @@ export class Datatoken {
this.config
)
// Estimate gas for reuseOrder method
const gasLimitDefault = this.GASLIMIT_DEFAULT
let estGas
try {
estGas = await dtContract.methods
.reuseOrder(orderTxId, providerFees)
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
} catch (e) {
estGas = gasLimitDefault
}
return estGas
return estimateGas(address, dtContract.methods.reuseOrder, orderTxId, providerFees)
}
/** Reuse Order: called by payer or consumer having a valid order, but with expired provider access.
@ -982,12 +972,11 @@ export class Datatoken {
this.config
)
try {
const estGas = await this.estGasReuseOrder(
dtAddress,
const estGas = await estimateGas(
address,
dtContract.methods.reuseOrder,
orderTxId,
providerFees,
dtContract
providerFees
)
const trxReceipt = await dtContract.methods