mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
parent
316c3f5010
commit
84e39d7222
@ -83,7 +83,7 @@ export class Pool extends PoolFactory {
|
||||
baseTokenWeight,
|
||||
swapFee
|
||||
)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -175,7 +175,7 @@ export class Pool extends PoolFactory {
|
||||
try {
|
||||
estGas = await token.methods
|
||||
.approve(spender, amount)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -566,7 +566,7 @@ export class Pool extends PoolFactory {
|
||||
this.web3.utils.toWei(minAmountOut),
|
||||
maxPrice ? this.web3.utils.toWei(maxPrice) : MaxUint256
|
||||
)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
this.logger.log('Error estimate gas swapExactAmountIn')
|
||||
this.logger.log(e)
|
||||
@ -627,7 +627,7 @@ export class Pool extends PoolFactory {
|
||||
this.web3.utils.toWei(minAmountOut),
|
||||
maxPrice ? this.web3.utils.toWei(maxPrice) : MaxUint256
|
||||
)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
this.logger.log('Error estimate gas swapExactAmountIn')
|
||||
@ -684,7 +684,7 @@ export class Pool extends PoolFactory {
|
||||
try {
|
||||
estGas = await pool.methods
|
||||
.joinPool(this.web3.utils.toWei(poolAmountOut), weiMaxAmountsIn)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -731,7 +731,7 @@ export class Pool extends PoolFactory {
|
||||
try {
|
||||
estGas = await pool.methods
|
||||
.exitPool(this.web3.utils.toWei(poolAmountIn), weiMinAmountsOut)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -774,7 +774,7 @@ export class Pool extends PoolFactory {
|
||||
this.web3.utils.toWei(tokenAmountIn),
|
||||
this.web3.utils.toWei(minPoolAmountOut)
|
||||
)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -826,7 +826,7 @@ export class Pool extends PoolFactory {
|
||||
this.web3.utils.toWei(poolAmountOut),
|
||||
this.web3.utils.toWei(maxAmountIn)
|
||||
)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -877,7 +877,7 @@ export class Pool extends PoolFactory {
|
||||
this.web3.utils.toWei(poolAmountIn),
|
||||
this.web3.utils.toWei(minTokenAmountOut)
|
||||
)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -930,7 +930,7 @@ export class Pool extends PoolFactory {
|
||||
this.web3.utils.toWei(tokenAmountOut),
|
||||
this.web3.utils.toWei(maxPoolAmountIn)
|
||||
)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: account }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ export class DataTokens {
|
||||
try {
|
||||
estGas = await factory.methods
|
||||
.createToken(metadataCacheUri, name, symbol, this.web3.utils.toWei(cap))
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -143,7 +143,7 @@ export class DataTokens {
|
||||
try {
|
||||
estGas = await datatoken.methods
|
||||
.approve(spender, this.web3.utils.toWei(amount))
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -181,7 +181,9 @@ export class DataTokens {
|
||||
try {
|
||||
estGas = await datatoken.methods
|
||||
.mint(toAddress || address, this.web3.utils.toWei(amount))
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) =>
|
||||
err ? gasLimitDefault : estGas
|
||||
)
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -255,7 +257,7 @@ export class DataTokens {
|
||||
try {
|
||||
estGas = await datatoken.methods
|
||||
.transfer(toAddress, amount)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -289,7 +291,7 @@ export class DataTokens {
|
||||
try {
|
||||
estGas = await datatoken.methods
|
||||
.transferFrom(fromAddress, address, this.web3.utils.toWei(amount))
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -423,7 +425,9 @@ export class DataTokens {
|
||||
String(serviceId),
|
||||
mpFeeAddress
|
||||
)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) =>
|
||||
err ? gasLimitDefault : estGas
|
||||
)
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
|
@ -96,7 +96,9 @@ export class OceanFixedRateExchange {
|
||||
try {
|
||||
estGas = await this.contract.methods
|
||||
.create(this.oceanAddress, dataToken, this.web3.utils.toWei(rate))
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) =>
|
||||
err ? gasLimitDefault : estGas
|
||||
)
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -152,7 +154,7 @@ export class OceanFixedRateExchange {
|
||||
try {
|
||||
estGas = await this.contract.methods
|
||||
.swap(exchangeId, this.web3.utils.toWei(String(dataTokenAmount)))
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -199,7 +201,7 @@ export class OceanFixedRateExchange {
|
||||
try {
|
||||
estGas = await this.contract.methods
|
||||
.setRate(exchangeId, this.web3.utils.toWei(String(newRate)))
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -231,7 +233,7 @@ export class OceanFixedRateExchange {
|
||||
try {
|
||||
estGas = await this.contract.methods
|
||||
.toggleExchangeState(exchangeId)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -261,7 +263,7 @@ export class OceanFixedRateExchange {
|
||||
try {
|
||||
estGas = await this.contract.methods
|
||||
.toggleExchangeState(exchangeId)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: address }, (err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
|
@ -111,7 +111,9 @@ export class OnChainMetadata {
|
||||
try {
|
||||
estGas = await this.DDOContract.methods
|
||||
.create(didZeroX(did), flags, data)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: consumerAccount }, (err, estGas) =>
|
||||
err ? gasLimitDefault : estGas
|
||||
)
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
@ -153,7 +155,9 @@ export class OnChainMetadata {
|
||||
try {
|
||||
estGas = await this.DDOContract.methods
|
||||
.update(didZeroX(did), flags, data)
|
||||
.estimateGas((err, estGas) => (err ? gasLimitDefault : estGas))
|
||||
.estimateGas({ from: consumerAccount }, (err, estGas) =>
|
||||
err ? gasLimitDefault : estGas
|
||||
)
|
||||
} catch (e) {
|
||||
estGas = gasLimitDefault
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user