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

exchange.create returns TransactionReceipt

This commit is contained in:
alexcos20 2020-10-21 03:38:03 -07:00
parent 11271a970b
commit 93f0d53c5a
2 changed files with 5 additions and 4 deletions

View File

@ -73,14 +73,14 @@ export class OceanFixedRateExchange {
* @param {Number} rate exchange rate
* @param {String} address User address
* @param {String} amount Optional, amount of datatokens to be approved for the exchange
* @return {Promise<string>} exchangeId
* @return {Promise<TransactionReceipt>} TransactionReceipt
*/
public create(
dataToken: string,
rate: string,
address: string,
amount?: string
): SubscribablePromise<FixedRateCreateProgressStep, string> {
): SubscribablePromise<FixedRateCreateProgressStep, TransactionReceipt> {
return new SubscribablePromise(async (observer) => {
observer.next(FixedRateCreateProgressStep.CreatingExchange)
let estGas
@ -116,7 +116,7 @@ export class OceanFixedRateExchange {
observer.next(FixedRateCreateProgressStep.ApprovingDatatoken)
this.datatokens.approve(dataToken, this.fixedRateExchangeAddress, amount, address)
}
return exchangeId
return trxReceipt
})
}

View File

@ -168,7 +168,8 @@ describe('FixedRateExchange flow', () => {
if (consoleDebug) console.log('Bob ocean allowance:' + balance)
})
it('Alice creates a new FixedRate Exchange with a rate of 0.5', async () => {
aliceExchangeId = await FixedRateClass.create(tokenAddress, fixedPriceRate, alice)
const trxReceipt = await FixedRateClass.create(tokenAddress, fixedPriceRate, alice)
aliceExchangeId = trxReceipt.events.ExchangeCreated.returnValues[0]
if (consoleDebug) console.log('aliceExchangeId:' + aliceExchangeId)
})
it('Bob should find the exchange', async () => {