mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Remove try...catch from Datatoken
This commit is contained in:
parent
59eb56b9ee
commit
792387cc6c
@ -491,7 +491,7 @@ export class Datatoken extends SmartContract {
|
|||||||
estimateGas?: G
|
estimateGas?: G
|
||||||
): Promise<G extends false ? TransactionReceipt : number> {
|
): Promise<G extends false ? TransactionReceipt : number> {
|
||||||
const dtContract = this.getContract(dtAddress)
|
const dtContract = this.getContract(dtAddress)
|
||||||
try {
|
|
||||||
const estGas = await calculateEstimatedGas(
|
const estGas = await calculateEstimatedGas(
|
||||||
address,
|
address,
|
||||||
dtContract.methods.transfer,
|
dtContract.methods.transfer,
|
||||||
@ -507,10 +507,6 @@ export class Datatoken extends SmartContract {
|
|||||||
gasPrice: await this.getFairGasPrice()
|
gasPrice: await this.getFairGasPrice()
|
||||||
})
|
})
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
} catch (e) {
|
|
||||||
LoggerInstance.error(`ERROR: Failed to transfer tokens: ${e.message}`)
|
|
||||||
throw new Error(`Failed Failed to transfer tokens: ${e.message}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Start Order: called by payer or consumer prior ordering a service consume on a marketplace.
|
/** Start Order: called by payer or consumer prior ordering a service consume on a marketplace.
|
||||||
@ -539,7 +535,7 @@ export class Datatoken extends SmartContract {
|
|||||||
consumeMarketFeeAmount: '0'
|
consumeMarketFeeAmount: '0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const estGas = await calculateEstimatedGas(
|
const estGas = await calculateEstimatedGas(
|
||||||
address,
|
address,
|
||||||
dtContract.methods.startOrder,
|
dtContract.methods.startOrder,
|
||||||
@ -558,10 +554,6 @@ export class Datatoken extends SmartContract {
|
|||||||
gasPrice: await this.getFairGasPrice()
|
gasPrice: await this.getFairGasPrice()
|
||||||
})
|
})
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
} catch (e) {
|
|
||||||
LoggerInstance.error(`ERROR: Failed to start order : ${e.message}`)
|
|
||||||
throw new Error(`Failed to start order: ${e.message}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Reuse Order: called by payer or consumer having a valid order, but with expired provider access.
|
/** Reuse Order: called by payer or consumer having a valid order, but with expired provider access.
|
||||||
@ -581,7 +573,7 @@ export class Datatoken extends SmartContract {
|
|||||||
estimateGas?: G
|
estimateGas?: G
|
||||||
): Promise<G extends false ? TransactionReceipt : number> {
|
): Promise<G extends false ? TransactionReceipt : number> {
|
||||||
const dtContract = this.getContract(dtAddress)
|
const dtContract = this.getContract(dtAddress)
|
||||||
try {
|
|
||||||
const estGas = await calculateEstimatedGas(
|
const estGas = await calculateEstimatedGas(
|
||||||
address,
|
address,
|
||||||
dtContract.methods.reuseOrder,
|
dtContract.methods.reuseOrder,
|
||||||
@ -590,18 +582,12 @@ export class Datatoken extends SmartContract {
|
|||||||
)
|
)
|
||||||
if (estimateGas) return estGas
|
if (estimateGas) return estGas
|
||||||
|
|
||||||
const trxReceipt = await dtContract.methods
|
const trxReceipt = await dtContract.methods.reuseOrder(orderTxId, providerFees).send({
|
||||||
.reuseOrder(orderTxId, providerFees)
|
|
||||||
.send({
|
|
||||||
from: address,
|
from: address,
|
||||||
gas: estGas + 1,
|
gas: estGas + 1,
|
||||||
gasPrice: await this.getFairGasPrice()
|
gasPrice: await this.getFairGasPrice()
|
||||||
})
|
})
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
} catch (e) {
|
|
||||||
LoggerInstance.error(`ERROR: Failed to call reuse order order : ${e.message}`)
|
|
||||||
throw new Error(`Failed to start order: ${e.message}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Buys 1 DT from the FRE and then startsOrder, while burning that DT
|
/** Buys 1 DT from the FRE and then startsOrder, while burning that DT
|
||||||
@ -619,7 +605,7 @@ export class Datatoken extends SmartContract {
|
|||||||
estimateGas?: G
|
estimateGas?: G
|
||||||
): Promise<G extends false ? TransactionReceipt : number> {
|
): Promise<G extends false ? TransactionReceipt : number> {
|
||||||
const dtContract = this.getContract(dtAddress, null, this.abiEnterprise)
|
const dtContract = this.getContract(dtAddress, null, this.abiEnterprise)
|
||||||
try {
|
|
||||||
const freContractParams = this.getFreOrderParams(freParams)
|
const freContractParams = this.getFreOrderParams(freParams)
|
||||||
|
|
||||||
const estGas = await calculateEstimatedGas(
|
const estGas = await calculateEstimatedGas(
|
||||||
@ -638,10 +624,6 @@ export class Datatoken extends SmartContract {
|
|||||||
gasPrice: await this.getFairGasPrice()
|
gasPrice: await this.getFairGasPrice()
|
||||||
})
|
})
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
} catch (e) {
|
|
||||||
LoggerInstance.error(`ERROR: Failed to buy DT From Fre And Order : ${e.message}`)
|
|
||||||
throw new Error(`Failed to buy DT From Fre And Order: ${e.message}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets DT from dispenser and then startsOrder, while burning that DT
|
/** Gets DT from dispenser and then startsOrder, while burning that DT
|
||||||
@ -659,7 +641,7 @@ export class Datatoken extends SmartContract {
|
|||||||
estimateGas?: G
|
estimateGas?: G
|
||||||
): Promise<G extends false ? TransactionReceipt : number> {
|
): Promise<G extends false ? TransactionReceipt : number> {
|
||||||
const dtContract = this.getContract(dtAddress, null, this.abiEnterprise)
|
const dtContract = this.getContract(dtAddress, null, this.abiEnterprise)
|
||||||
try {
|
|
||||||
const estGas = await calculateEstimatedGas(
|
const estGas = await calculateEstimatedGas(
|
||||||
address,
|
address,
|
||||||
dtContract.methods.buyFromDispenserAndOrder,
|
dtContract.methods.buyFromDispenserAndOrder,
|
||||||
@ -676,10 +658,6 @@ export class Datatoken extends SmartContract {
|
|||||||
gasPrice: await this.getFairGasPrice()
|
gasPrice: await this.getFairGasPrice()
|
||||||
})
|
})
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
} catch (e) {
|
|
||||||
LoggerInstance.error(`ERROR: Failed to buy DT From Fre And Order : ${e.message}`)
|
|
||||||
throw new Error(`Failed to buy DT From Fre And Order: ${e.message}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** setData
|
/** setData
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user