mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
fix tests
This commit is contained in:
parent
fc6a515630
commit
0b4417d264
@ -353,31 +353,6 @@ export class DataTokens {
|
||||
return this.web3.utils.fromWei(amount)
|
||||
}
|
||||
|
||||
/** Calculate total fee
|
||||
* @param {String} dataTokenAddress
|
||||
* @param {String} amount
|
||||
* @param {String} mpFeePercentage
|
||||
* @param {String} address
|
||||
* @return {Promise<string>} string
|
||||
*/
|
||||
public async calculateTotalFee(
|
||||
dataTokenAddress: string,
|
||||
amount: string,
|
||||
mpFeePercentage: string,
|
||||
address: string
|
||||
): Promise<string> {
|
||||
const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress, {
|
||||
from: address
|
||||
})
|
||||
const totalFee = await datatoken.methods
|
||||
.calculateTotalFee(
|
||||
this.web3.utils.toWei(amount),
|
||||
this.web3.utils.toWei(mpFeePercentage)
|
||||
)
|
||||
.call()
|
||||
return this.web3.utils.fromWei(totalFee)
|
||||
}
|
||||
|
||||
/** Start Order
|
||||
* @param {String} dataTokenAddress
|
||||
* @param {String} amount
|
||||
@ -398,6 +373,7 @@ export class DataTokens {
|
||||
const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress, {
|
||||
from: address
|
||||
})
|
||||
if (!mpFeeAddress) mpFeeAddress = '0x0000000000000000000000000000000000000000'
|
||||
try {
|
||||
const trxReceipt = await datatoken.methods
|
||||
.startOrder(this.web3.utils.toWei(amount), did, String(serviceId), mpFeeAddress)
|
||||
|
@ -471,7 +471,9 @@ export class Assets extends Instantiable {
|
||||
const balance = new BigNumber(
|
||||
await datatokens.balance(providerData.dataToken, consumerAddress)
|
||||
)
|
||||
const totalCost = new BigNumber(providerData.numTokens)
|
||||
const totalCost = new BigNumber(
|
||||
this.web3.utils.fromWei(String(providerData.numTokens))
|
||||
)
|
||||
if (balance.isLessThanOrEqualTo(totalCost)) {
|
||||
console.error(
|
||||
'Not enough funds. Needed ' +
|
||||
|
Loading…
x
Reference in New Issue
Block a user