mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
replaced missed send calls
This commit is contained in:
parent
7500f51f46
commit
585316e34e
@ -57,19 +57,19 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
if (estimateGas) return estGas
|
||||
|
||||
// Call createFixedRate contract method
|
||||
const trxReceipt = await this.contract.methods
|
||||
.create(
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
this.web3.utils.toWei(maxBalance),
|
||||
address,
|
||||
allowedSwapper
|
||||
)
|
||||
.send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await this.getFairGasPrice()
|
||||
})
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.contract.methods.create,
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
this.web3.utils.toWei(maxBalance),
|
||||
address,
|
||||
allowedSwapper
|
||||
)
|
||||
|
||||
return trxReceipt
|
||||
}
|
||||
|
||||
@ -97,17 +97,17 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
)
|
||||
if (estimateGas) return estGas
|
||||
|
||||
const trxReceipt = await this.contract.methods
|
||||
.activate(
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
this.web3.utils.toWei(maxBalance)
|
||||
)
|
||||
.send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await this.getFairGasPrice()
|
||||
})
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.contract.methods.activate,
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(maxTokens),
|
||||
this.web3.utils.toWei(maxBalance)
|
||||
)
|
||||
|
||||
return trxReceipt
|
||||
}
|
||||
|
||||
@ -129,11 +129,15 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
)
|
||||
if (estimateGas) return estGas
|
||||
|
||||
const trxReceipt = await this.contract.methods.deactivate(dtAddress).send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await this.getFairGasPrice()
|
||||
})
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.contract.methods.deactivate,
|
||||
dtAddress
|
||||
)
|
||||
|
||||
return trxReceipt
|
||||
}
|
||||
|
||||
@ -158,13 +162,15 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
)
|
||||
if (estimateGas) return estGas
|
||||
|
||||
const trxReceipt = await this.contract.methods
|
||||
.setAllowedSwapper(dtAddress, newAllowedSwapper)
|
||||
.send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await this.getFairGasPrice()
|
||||
})
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.contract.methods.setAllowedSwapper,
|
||||
dtAddress,
|
||||
newAllowedSwapper
|
||||
)
|
||||
return trxReceipt
|
||||
}
|
||||
|
||||
@ -194,13 +200,16 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
)
|
||||
if (estimateGas) return estGas
|
||||
|
||||
const trxReceipt = await this.contract.methods
|
||||
.dispense(dtAddress, this.web3.utils.toWei(amount), destination)
|
||||
.send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await this.getFairGasPrice()
|
||||
})
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.contract.methods.dispense,
|
||||
dtAddress,
|
||||
this.web3.utils.toWei(amount),
|
||||
destination
|
||||
)
|
||||
return trxReceipt
|
||||
}
|
||||
|
||||
@ -222,11 +231,15 @@ export class Dispenser extends SmartContractWithAddress {
|
||||
)
|
||||
if (estimateGas) return estGas
|
||||
|
||||
const trxReceipt = await this.contract.methods.ownerWithdraw(dtAddress).send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await this.getFairGasPrice()
|
||||
})
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
this.contract.methods.ownerWithdraw,
|
||||
dtAddress
|
||||
)
|
||||
|
||||
return trxReceipt
|
||||
}
|
||||
|
||||
|
@ -770,12 +770,15 @@ export class Nft extends SmartContract {
|
||||
valueHex
|
||||
)
|
||||
|
||||
// Call setData function of the contract
|
||||
const trxReceipt = await nftContract.methods.setNewData(keyHash, valueHex).send({
|
||||
from: address,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await this.getFairGasPrice()
|
||||
})
|
||||
const trxReceipt = await sendTx(
|
||||
address,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
nftContract.methods.setNewData,
|
||||
keyHash,
|
||||
valueHex
|
||||
)
|
||||
|
||||
return trxReceipt
|
||||
}
|
||||
|
@ -96,11 +96,15 @@ export async function approveWei<G extends boolean = false>(
|
||||
if (estimateGas) return estGas
|
||||
|
||||
try {
|
||||
result = await tokenContract.methods.approve(spender, amount).send({
|
||||
from: account,
|
||||
gas: estGas + 1,
|
||||
gasPrice: await getFairGasPrice(web3, null)
|
||||
})
|
||||
result = await sendTx(
|
||||
account,
|
||||
estGas + 1,
|
||||
this.web3,
|
||||
this.config,
|
||||
tokenContract.methods.approve,
|
||||
spender,
|
||||
amount
|
||||
)
|
||||
} catch (e) {
|
||||
LoggerInstance.error(
|
||||
`ERROR: Failed to approve spender to spend tokens : ${e.message}`
|
||||
|
Loading…
x
Reference in New Issue
Block a user