diff --git a/.travis.yml b/.travis.yml index 8e3c94d..f035cfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,9 +24,9 @@ before_script: - git clone https://github.com/oceanprotocol/barge - cd barge - export AQUARIUS_VERSION=v1.0.7 - - export BRIZO_VERSION=v0.9.0 + - export BRIZO_VERSION=v0.9.3 - export KEEPER_VERSION=v0.13.2 - - export EVENTS_HANDLER_VERSION=v0.4.4 + - export EVENTS_HANDLER_VERSION=v0.4.5 - export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260" - rm -rf "${HOME}/.ocean/keeper-contracts/artifacts" - bash -x start_ocean.sh --no-commons --no-dashboard 2>&1 > start_ocean.log & diff --git a/src/brizo/Brizo.ts b/src/brizo/Brizo.ts index 083cfd8..461200a 100644 --- a/src/brizo/Brizo.ts +++ b/src/brizo/Brizo.ts @@ -137,10 +137,10 @@ export class Brizo extends Instantiable { url += `?signature=${signature}` url += `&consumerAddress=${address}` url += `&serviceAgreementId=${noZeroX(serviceAgreementId)}` - url += algorithmDid && `&algorithmDid=${algorithmDid}` || '' - url += algorithmMeta && `&algorithmMeta=${algorithmMeta}` || '' - url += output && `&output=${JSON.stringify(output)}` || '' - url += jobId && `&jobId=${jobId}` || '' + url += (algorithmDid && `&algorithmDid=${algorithmDid}`) || '' + url += (algorithmMeta && `&algorithmMeta=${algorithmMeta}`) || '' + url += (output && `&output=${JSON.stringify(output)}`) || '' + url += (jobId && `&jobId=${jobId}`) || '' // switch fetch method let fetch diff --git a/src/ocean/OceanAssets.ts b/src/ocean/OceanAssets.ts index 82e5ef0..dd94884 100644 --- a/src/ocean/OceanAssets.ts +++ b/src/ocean/OceanAssets.ts @@ -159,12 +159,16 @@ export class OceanAssets extends Instantiable { }) // Overwrite initial service agreement conditions - let rawConditions = await templates.escrowAccessSecretStoreTemplate.getServiceAgreementTemplateConditions() - serviceAgreementTemplate.conditions = fillConditionsWithDDO(rawConditions, ddo) - for (let service of services) { + serviceAgreementTemplate.conditions = fillConditionsWithDDO( + await templates.escrowAccessSecretStoreTemplate.getServiceAgreementTemplateConditions(), + ddo + ) + for (const service of services) { if (service.type === 'compute') { - const rawConditions = await templates.escrowComputeExecutionTemplate.getServiceAgreementTemplateConditions() - service.attributes.serviceAgreementTemplate.conditions = fillConditionsWithDDO(rawConditions, ddo) + service.attributes.serviceAgreementTemplate.conditions = fillConditionsWithDDO( + await templates.escrowComputeExecutionTemplate.getServiceAgreementTemplateConditions(), + ddo + ) } } diff --git a/src/ocean/OceanCompute.ts b/src/ocean/OceanCompute.ts index 921fb77..7a0f171 100644 --- a/src/ocean/OceanCompute.ts +++ b/src/ocean/OceanCompute.ts @@ -6,7 +6,6 @@ import { SubscribablePromise } from '../utils' import { OrderProgressStep } from './utils/ServiceUtils' import { DID } from '../squid' - export const ComputeJobStatus = Object.freeze({ Started: 10, ConfiguringVolumes: 20, @@ -250,7 +249,7 @@ export class OceanCompute extends Instantiable { consumerAccount: Account, agreementId: string, jobId: string - ): Promise { + ): Promise { const computeJobsList = await this.ocean.brizo.compute( 'get', agreementId, diff --git a/test/integration/ocean/AssetOwners.test.ts b/test/integration/ocean/AssetOwners.test.ts index a4c18d4..33297cb 100644 --- a/test/integration/ocean/AssetOwners.test.ts +++ b/test/integration/ocean/AssetOwners.test.ts @@ -86,7 +86,12 @@ describe('Asset Owners', () => { // Granting access try { await account2.requestTokens( - parseInt((+metadata.main.price * 10 ** -(await ocean.keeper.token.decimals())).toString()) + parseInt( + ( + +metadata.main.price * + 10 ** -(await ocean.keeper.token.decimals()) + ).toString() + ) ) } catch {} diff --git a/test/integration/ocean/Compute.test.ts b/test/integration/ocean/Compute.test.ts index 61955b5..893129e 100644 --- a/test/integration/ocean/Compute.test.ts +++ b/test/integration/ocean/Compute.test.ts @@ -70,8 +70,12 @@ describe('Compute', () => { const steps = [] try { await account.requestTokens( - parseInt((+computeService.attributes.main.price * - 10 ** -(await ocean.keeper.token.decimals())).toString()) + parseInt( + ( + +computeService.attributes.main.price * + 10 ** -(await ocean.keeper.token.decimals()) + ).toString() + ) ) agreementId = await ocean.compute diff --git a/test/integration/ocean/ConsumeAsset.test.ts b/test/integration/ocean/ConsumeAsset.test.ts index fc0f555..6d11835 100644 --- a/test/integration/ocean/ConsumeAsset.test.ts +++ b/test/integration/ocean/ConsumeAsset.test.ts @@ -45,8 +45,12 @@ describe('Consume Asset', () => { it('should be able to request tokens for consumer', async () => { const initialBalance = (await consumer.getBalance()).ocn - const claimedTokens = - parseInt((+metadata.main.price * 10 ** -(await ocean.keeper.token.decimals())).toString()) + const claimedTokens = parseInt( + ( + +metadata.main.price * + 10 ** -(await ocean.keeper.token.decimals()) + ).toString() + ) try { await consumer.requestTokens(claimedTokens) diff --git a/test/integration/ocean/ConsumeAssetBrizo.test.ts b/test/integration/ocean/ConsumeAssetBrizo.test.ts index 93d58a8..b87407a 100644 --- a/test/integration/ocean/ConsumeAssetBrizo.test.ts +++ b/test/integration/ocean/ConsumeAssetBrizo.test.ts @@ -54,7 +54,12 @@ describe('Consume Asset (Brizo)', () => { try { await consumer.requestTokens( - parseInt((+metadata.main.price * 10 ** -(await ocean.keeper.token.decimals())).toString()) + parseInt( + ( + +metadata.main.price * + 10 ** -(await ocean.keeper.token.decimals()) + ).toString() + ) ) agreementId = await ocean.assets diff --git a/test/integration/ocean/ConsumeBigAsset.test.ts b/test/integration/ocean/ConsumeBigAsset.test.ts index 17a7997..a2e0567 100644 --- a/test/integration/ocean/ConsumeBigAsset.test.ts +++ b/test/integration/ocean/ConsumeBigAsset.test.ts @@ -52,7 +52,12 @@ xdescribe('Consume Asset (Large size)', () => { it('should order the asset', async () => { try { await consumer.requestTokens( - parseInt((+metadata.main.price * 10 ** -(await ocean.keeper.token.decimals())).toString()) + parseInt( + ( + +metadata.main.price * + 10 ** -(await ocean.keeper.token.decimals()) + ).toString() + ) ) } catch {} diff --git a/test/unit/ocean/OceanCompute.test.ts b/test/unit/ocean/OceanCompute.test.ts index 9026c22..23a57dd 100644 --- a/test/unit/ocean/OceanCompute.test.ts +++ b/test/unit/ocean/OceanCompute.test.ts @@ -27,7 +27,7 @@ describe('OceanCompute', () => { describe('#start()', () => { it('should start a new job', async () => { - sinon.stub(ocean.brizo, 'compute').returns({ jobId: 'my-job-id' } as any) + sinon.stub(ocean.brizo, 'compute').returns([{ jobId: 'my-job-id' }] as any) const response = await compute.start(account, agreementId, 'did:op:0xxx') assert(response.jobId === 'my-job-id') }) @@ -37,7 +37,7 @@ describe('OceanCompute', () => { it('should stop a job', async () => { sinon .stub(ocean.brizo, 'compute') - .returns({ status: ComputeJobStatus.Completed } as any) + .returns([{ status: ComputeJobStatus.Completed }] as any) const response = await compute.stop(account, agreementId, 'xxx') assert(response.status === ComputeJobStatus.Completed) @@ -48,7 +48,7 @@ describe('OceanCompute', () => { it('should restart a job', async () => { sinon .stub(ocean.brizo, 'compute') - .returns({ status: ComputeJobStatus.Started, jobId: 'my-job-id' } as any) + .returns([{ status: ComputeJobStatus.Started, jobId: 'my-job-id' }] as any) const response = await compute.restart(account, agreementId, 'xxx') assert(response.jobId === 'my-job-id') @@ -59,7 +59,7 @@ describe('OceanCompute', () => { it('should delete a job', async () => { sinon .stub(ocean.brizo, 'compute') - .returns({ status: ComputeJobStatus.Deleted } as any) + .returns([{ status: ComputeJobStatus.Deleted }] as any) const response = await compute.delete(account, agreementId, 'xxx') assert(response.status === ComputeJobStatus.Deleted)