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:
parent
244376f6f2
commit
99ddff97bc
@ -22,8 +22,8 @@ before_script:
|
|||||||
- git clone https://github.com/oceanprotocol/barge
|
- git clone https://github.com/oceanprotocol/barge
|
||||||
- cd barge
|
- cd barge
|
||||||
- export AQUARIUS_VERSION=v0.2.2
|
- export AQUARIUS_VERSION=v0.2.2
|
||||||
- export BRIZO_VERSION=v0.3.5
|
- export BRIZO_VERSION=v0.3.6
|
||||||
- export KEEPER_VERSION=v0.9.1
|
- export KEEPER_VERSION=v0.9.7
|
||||||
- export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"
|
- export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"
|
||||||
- bash -x start_ocean.sh --latest --no-pleuston --local-spree-node 2>&1 > start_ocean.log &
|
- bash -x start_ocean.sh --latest --no-pleuston --local-spree-node 2>&1 > start_ocean.log &
|
||||||
- cd ..
|
- cd ..
|
||||||
|
@ -41,7 +41,7 @@ describe("Consume Asset (Brizo)", () => {
|
|||||||
.next((step) => steps.push(step))
|
.next((step) => steps.push(step))
|
||||||
|
|
||||||
assert.isDefined(agreementId)
|
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 () => {
|
it("should consume and store the assets", async () => {
|
||||||
|
@ -4,13 +4,11 @@ import { MetaData } from "../ddo/MetaData"
|
|||||||
import { Service } from "../ddo/Service"
|
import { Service } from "../ddo/Service"
|
||||||
import Account from "./Account"
|
import Account from "./Account"
|
||||||
import DID from "./DID"
|
import DID from "./DID"
|
||||||
import { fillConditionsWithDDO, noZeroX, SubscribablePromise } from "../utils"
|
import { fillConditionsWithDDO, SubscribablePromise, generateId, zeroX } from "../utils"
|
||||||
import { Instantiable, InstantiableConfig } from "../Instantiable.abstract"
|
import { Instantiable, InstantiableConfig } from "../Instantiable.abstract"
|
||||||
|
|
||||||
export enum OrderProgressStep {
|
export enum OrderProgressStep {
|
||||||
Preparing,
|
CreatingAgreement,
|
||||||
Prepared,
|
|
||||||
SendingAgreement,
|
|
||||||
AgreementInitialized,
|
AgreementInitialized,
|
||||||
LockingPayment,
|
LockingPayment,
|
||||||
LockedPayment,
|
LockedPayment,
|
||||||
@ -207,12 +205,7 @@ export class OceanAssets extends Instantiable {
|
|||||||
return new SubscribablePromise(async (observer) => {
|
return new SubscribablePromise(async (observer) => {
|
||||||
const oceanAgreements = this.ocean.agreements
|
const oceanAgreements = this.ocean.agreements
|
||||||
|
|
||||||
observer.next(OrderProgressStep.Preparing)
|
const agreementId = zeroX(generateId())
|
||||||
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 ddo = await this.resolve(did)
|
const ddo = await this.resolve(did)
|
||||||
|
|
||||||
const keeper = this.ocean.keeper
|
const keeper = this.ocean.keeper
|
||||||
@ -251,10 +244,10 @@ export class OceanAssets extends Instantiable {
|
|||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
|
||||||
observer.next(OrderProgressStep.SendingAgreement)
|
observer.next(OrderProgressStep.CreatingAgreement)
|
||||||
this.logger.log("Sending agreement request")
|
this.logger.log("Creating agreement")
|
||||||
await oceanAgreements.send(did, agreementId, serviceDefinitionId, signature, consumer)
|
await oceanAgreements.create(did, agreementId, serviceDefinitionId, undefined, consumer, consumer)
|
||||||
this.logger.log("Agreement request sent")
|
this.logger.log("Agreement created")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await paymentFlow
|
await paymentFlow
|
||||||
|
Loading…
Reference in New Issue
Block a user