1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Update order flow using Brizo.

This commit is contained in:
Pedro Gutiérrez 2019-04-30 15:31:24 +02:00
parent 244376f6f2
commit 99ddff97bc
3 changed files with 10 additions and 17 deletions

View File

@ -22,8 +22,8 @@ before_script:
- git clone https://github.com/oceanprotocol/barge
- cd barge
- export AQUARIUS_VERSION=v0.2.2
- export BRIZO_VERSION=v0.3.5
- export KEEPER_VERSION=v0.9.1
- export BRIZO_VERSION=v0.3.6
- export KEEPER_VERSION=v0.9.7
- export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"
- bash -x start_ocean.sh --latest --no-pleuston --local-spree-node 2>&1 > start_ocean.log &
- cd ..

View File

@ -41,7 +41,7 @@ describe("Consume Asset (Brizo)", () => {
.next((step) => steps.push(step))
assert.isDefined(agreementId)
assert.deepEqual(steps, [0, 1, 2, 3, 4, 5])
assert.deepEqual(steps, [0, 1, 2, 3])
})
it("should consume and store the assets", async () => {

View File

@ -4,13 +4,11 @@ import { MetaData } from "../ddo/MetaData"
import { Service } from "../ddo/Service"
import Account from "./Account"
import DID from "./DID"
import { fillConditionsWithDDO, noZeroX, SubscribablePromise } from "../utils"
import { fillConditionsWithDDO, SubscribablePromise, generateId, zeroX } from "../utils"
import { Instantiable, InstantiableConfig } from "../Instantiable.abstract"
export enum OrderProgressStep {
Preparing,
Prepared,
SendingAgreement,
CreatingAgreement,
AgreementInitialized,
LockingPayment,
LockedPayment,
@ -207,12 +205,7 @@ export class OceanAssets extends Instantiable {
return new SubscribablePromise(async (observer) => {
const oceanAgreements = this.ocean.agreements
observer.next(OrderProgressStep.Preparing)
this.logger.log("Asking for agreement signature")
const {agreementId, signature} = await oceanAgreements.prepare(did, serviceDefinitionId, consumer)
this.logger.log(`Agreement ${agreementId} signed`)
observer.next(OrderProgressStep.Prepared)
const agreementId = zeroX(generateId())
const ddo = await this.resolve(did)
const keeper = this.ocean.keeper
@ -251,10 +244,10 @@ export class OceanAssets extends Instantiable {
resolve()
})
observer.next(OrderProgressStep.SendingAgreement)
this.logger.log("Sending agreement request")
await oceanAgreements.send(did, agreementId, serviceDefinitionId, signature, consumer)
this.logger.log("Agreement request sent")
observer.next(OrderProgressStep.CreatingAgreement)
this.logger.log("Creating agreement")
await oceanAgreements.create(did, agreementId, serviceDefinitionId, undefined, consumer, consumer)
this.logger.log("Agreement created")
try {
await paymentFlow