From db910aaaa288de92c2cddf232049a4a6c707cb53 Mon Sep 17 00:00:00 2001 From: Sebastian Gerske Date: Thu, 1 Nov 2018 09:28:17 +0100 Subject: [PATCH] optimize --- src/ocean/ServiceAgreementTemplate.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/ocean/ServiceAgreementTemplate.ts b/src/ocean/ServiceAgreementTemplate.ts index 330ac76..c0ac0aa 100644 --- a/src/ocean/ServiceAgreementTemplate.ts +++ b/src/ocean/ServiceAgreementTemplate.ts @@ -33,24 +33,14 @@ export default class ServiceAgreementTemplate extends OceanBase { templateOwner) } - /** - * gets the status of a service agreement template - */ - public async getStatus(): Promise { - - const serviceAgreement: ServiceAgreement = await ServiceAgreement.getInstance() - - return serviceAgreement.getTemplateStatus(this.getId()) - } - private static generateConditionsKeys(serviceAgreementTemplateId: string, methodReflections: MethodReflection[]): string[] { const conditions = [] - for (let i = 0; i < methodReflections.length; i++) { + for (const methodReflection of methodReflections) { const values = [ {type: "bytes32", value: serviceAgreementTemplateId}, - {type: "address", value: methodReflections[i].address}, - {type: "bytes4", value: methodReflections[i].signature}, + {type: "address", value: methodReflection.address}, + {type: "bytes4", value: methodReflection.signature}, ] conditions.push(Web3Provider.getWeb3().utils.soliditySha3(...values).toString("hex")) } @@ -61,6 +51,16 @@ export default class ServiceAgreementTemplate extends OceanBase { super(id) } + /** + * gets the status of a service agreement template + */ + public async getStatus(): Promise { + + const serviceAgreement: ServiceAgreement = await ServiceAgreement.getInstance() + + return serviceAgreement.getTemplateStatus(this.getId()) + } + public getOwner(): Account { return this.owner }