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

fixed error related to asset consuming #114

This commit is contained in:
Pedro Gutiérrez 2019-01-23 12:29:56 +01:00
parent 1ecbb69937
commit 83cf56b57e

View File

@ -245,7 +245,7 @@ export default class Ocean {
const event: ContractEvent = EventListener.subscribe( const event: ContractEvent = EventListener.subscribe(
accessService.serviceAgreementContract.contractName, accessService.serviceAgreementContract.contractName,
accessService.serviceAgreementContract.events[0].name, { accessService.serviceAgreementContract.events[0].name, {
serviceAgreementId, serviceAgreementId: `0x${serviceAgreementId}`,
}) })
event.listenOnce(async (data) => { event.listenOnce(async (data) => {
@ -296,7 +296,7 @@ export default class Ocean {
const accessEvent: ContractEvent = EventListener.subscribe( const accessEvent: ContractEvent = EventListener.subscribe(
accessService.conditions[1].contractName, accessService.conditions[1].contractName,
accessService.conditions[1].events[1].name, {}) accessService.conditions[1].events[1].name, {})
const files = new Promise(resolve => {
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 contentUrls = await SecretStoreProvider const contentUrls = await SecretStoreProvider
@ -314,6 +314,8 @@ export default class Ocean {
} }
cb(files) cb(files)
resolve(files)
})
}) })
await BrizoProvider await BrizoProvider
@ -324,6 +326,8 @@ export default class Ocean {
serviceDefinitionId, serviceDefinitionId,
serviceAgreementSignature, serviceAgreementSignature,
consumer.getId()) consumer.getId())
await files
} }
/** /**