From 4890d2f27b204e304d6bb3a5e8b7ca3533d26f7f Mon Sep 17 00:00:00 2001 From: Jernej Pregelj Date: Thu, 21 Mar 2019 12:15:35 +0100 Subject: [PATCH] consume flow --- client/src/config.ts | 2 +- client/src/routes/Details/index.tsx | 26 +++----------------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/client/src/config.ts b/client/src/config.ts index d5ddcb6..18d0700 100644 --- a/client/src/config.ts +++ b/client/src/config.ts @@ -7,7 +7,7 @@ export const nodeHost = 'localhost' export const nodePort = 8545 export const aquariusScheme = 'http' -export const aquariusHost = 'localhost' +export const aquariusHost = 'aquarius' export const aquariusPort = 5000 export const brizoScheme = 'http' diff --git a/client/src/routes/Details/index.tsx b/client/src/routes/Details/index.tsx index 4f5bb12..2efb5f3 100644 --- a/client/src/routes/Details/index.tsx +++ b/client/src/routes/Details/index.tsx @@ -31,29 +31,9 @@ export default class Details extends Component { private purchaseAsset = async (ddo: any) => { try { const account = await this.context.ocean.getAccounts() - const service = ddo.findServiceByType('Access') - const serviceAgreementSignatureResult = await this.context.ocean.signServiceAgreement( - ddo.id, - service.serviceDefinitionId, - account[0] - ) - await this.context.ocean.initializeServiceAgreement( - ddo.id, - service.serviceDefinitionId, - serviceAgreementSignatureResult.agreementId, - serviceAgreementSignatureResult.signature, - (files: any) => { - Logger.log('downloading files', files) - files.forEach((file: any) => { - const parsedUrl: any = queryString.parseUrl(file) - setTimeout(() => { - // eslint-disable-next-line - window.open(parsedUrl.query.url) - }, 100) - }) - }, - account[0] - ) + const accessService = ddo.findServiceByType('Access') + const agreementId = await this.context.ocean.assets.order(ddo.id, accessService.serviceDefinitionId, account[0]) + Logger.log('agreementId', agreementId) } catch (e) { Logger.log('error', e) }