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

Merge branch 'develop' into fix/circular_dep

This commit is contained in:
Dimitri De Jonghe 2018-12-17 18:44:05 +01:00 committed by GitHub
commit 3bd8c75db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,6 @@ import Config from "../models/Config"
import ValueType from "../models/ValueType" import ValueType from "../models/ValueType"
import SecretStoreProvider from "../secretstore/SecretStoreProvider" import SecretStoreProvider from "../secretstore/SecretStoreProvider"
import Logger from "../utils/Logger" import Logger from "../utils/Logger"
import WebServiceConnectorProvider from "../utils/WebServiceConnectorProvider"
import Account from "./Account" import Account from "./Account"
import DID from "./DID" import DID from "./DID"
import IdGenerator from "./IdGenerator" import IdGenerator from "./IdGenerator"
@ -221,7 +220,6 @@ export default class Ocean {
accessEvent.listenOnce(async () => { accessEvent.listenOnce(async () => {
Logger.log("Awesome; got a AccessGranted Event. Let's download the asset files.") Logger.log("Awesome; got a AccessGranted Event. Let's download the asset files.")
const webConnector = WebServiceConnectorProvider.getConnector()
const contentUrls = await SecretStoreProvider const contentUrls = await SecretStoreProvider
.getSecretStore() .getSecretStore()
.decryptDocument(d.getId(), metadataService.metadata.base.contentUrls[0]) .decryptDocument(d.getId(), metadataService.metadata.base.contentUrls[0])
@ -233,15 +231,8 @@ export default class Ocean {
let url: string = serviceUrl + `?url=${cUrl}` let url: string = serviceUrl + `?url=${cUrl}`
url = url + `&serviceAgreementId=${serviceAgreementId}` url = url + `&serviceAgreementId=${serviceAgreementId}`
url = url + `&consumerAddress=${consumer.getId()}` url = url + `&consumerAddress=${consumer.getId()}`
Logger.log("Fetching asset from: ", url) files.push(url)
const response: any = await webConnector.get(url)
const responseBuffer: Buffer = await response.buffer()
const urlParts: string[] = cUrl.split("/")
const filename: string = urlParts[urlParts.length - 1]
Logger.debug(`Got response: filename is ${filename}, url is ${response.url}`)
files.push(responseBuffer.toString("utf8"))
} }
Logger.log("Done downloading asset files.")
cb(files) cb(files)
}) })