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

Fix lint errors.

This commit is contained in:
ssallam 2020-01-17 16:39:44 +01:00
parent 48c4f64599
commit 7b5b110cec
7 changed files with 39 additions and 47 deletions

View File

@ -24,7 +24,7 @@ import { objectPromiseAll } from '../utils'
import { EventHandler } from './EventHandler'
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
import { AgreementTemplateBase } from "./contracts/templates/AgreementTemplateBase";
import { AgreementTemplateBase } from './contracts/templates/AgreementTemplateBase'
/**
* Interface with Ocean Keeper contracts.

View File

@ -93,5 +93,4 @@ export class AgreementStoreManager extends ContractBase {
agreementId: zeroX(agreementId)
})
}
}

View File

@ -30,10 +30,7 @@ export class TemplateStoreManager extends ContractBase {
}
public generateId(templateName: string) {
const args: any = [
{ type: 'string', value: templateName },
]
const args: any = [{ type: 'string', value: templateName }]
return this.web3.utils.soliditySha3(...args)
}
@ -41,7 +38,11 @@ export class TemplateStoreManager extends ContractBase {
return this.call('owner', [])
}
public async proposeTemplate(templateId: string, from?: string, ignoreExists?: boolean) {
public async proposeTemplate(
templateId: string,
from?: string,
ignoreExists?: boolean
) {
const template = await this.getTemplate(templateId)
if (template.blockNumberUpdated !== 0) {
this.logger.warn(`Template "${templateId}" already exist.`)
@ -85,10 +86,7 @@ export class TemplateStoreManager extends ContractBase {
}
public async getActorTypeValue(actorTypeId: string) {
const typeValue = await this.call(
"getTemplateActorTypeValue",
[actorTypeId]
)
const typeValue = await this.call('getTemplateActorTypeValue', [actorTypeId])
return typeValue
}
@ -108,7 +106,6 @@ export class TemplateStoreManager extends ContractBase {
blockNumberUpdated: +blockNumberUpdated,
conditionTypes,
actorTypeIds
} as TemplateMetadata
}
}

View File

@ -1,5 +1,8 @@
import { escrowAccessServiceAgreementTemplate } from './EscrowAccess.serviceAgreementTemplate'
import {TemplateStoreManager, AgreementStoreManager, ConditionStoreManager} from '../managers'
import {
TemplateStoreManager,
AgreementStoreManager,
ConditionStoreManager
} from '../managers'
import DIDRegistry from '../DIDRegistry'
import { LockRewardCondition } from '../conditions/LockRewardCondition'
import { AccessSecretStoreCondition } from '../conditions/AccessSecretStoreCondition'
@ -7,8 +10,12 @@ import { EscrowReward } from '../conditions/EscrowReward'
import { DDO } from '../../../ddo/DDO'
import { generateId, LoggerInstance, Logger, zeroX } from '../../../utils'
import {ComputeExecutionCondition, Condition, ConditionState, conditionStateNames} from '../conditions'
import {
ComputeExecutionCondition,
Condition,
ConditionState,
conditionStateNames
} from '../conditions'
export interface Conditions {
lockRewardCondition: LockRewardCondition
@ -17,7 +24,6 @@ export interface Conditions {
escrowReward: EscrowReward
}
export interface AgreementConditionsStatus {
[condition: string]: {
condition: string
@ -28,7 +34,6 @@ export interface AgreementConditionsStatus {
}
}
export class AgreementTemplateBase {
public templateName: string
@ -77,7 +82,7 @@ export class AgreementTemplateBase {
consumer: string,
from?: string
) {
return await this.createFullAgreementData(
return this.createFullAgreementData(
agreementId,
ddo.shortId(),
ddo.findServiceByType('metadata').attributes.main.price,
@ -145,7 +150,7 @@ export class AgreementTemplateBase {
* @return {Promise<string[]>} Conditions address.
*/
public async getConditionTypes(): Promise<string[]> {
return await this.templateManager.getConditionTypes(this.getId())
return this.templateManager.getConditionTypes(this.getId())
}
/**
@ -186,12 +191,13 @@ export class AgreementTemplateBase {
* @return {Promise} Conditions status.
*/
public async getAgreementStatus(
agreementId: string, conditionStoreManager: ConditionStoreManager
agreementId: string,
conditionStoreManager: ConditionStoreManager
): Promise<AgreementConditionsStatus | false> {
const dependencies = await this.getServiceAgreementTemplateDependencies()
const { conditionIds } = await this.agreementStoreManager.getAgreement(agreementId)
const { conditionIds } = await this.agreementStoreManager.getAgreement(
agreementId
)
if (!conditionIds.length) {
// this.logger.error(`Agreement not creeated yet: "${agreementId}"`)
return false
@ -243,7 +249,10 @@ export class AgreementTemplateBase {
* @param {string} agreementId Agreement ID.
* @param {ConditionStoreManager} conditionStoreManager
*/
public async printAgreementStatus(agreementId: string, conditionStoreManager: ConditionStoreManager) {
public async printAgreementStatus(
agreementId: string,
conditionStoreManager: ConditionStoreManager
) {
const status = await this.getAgreementStatus(agreementId, conditionStoreManager)
this.logger.bypass('-'.repeat(80))

View File

@ -21,7 +21,6 @@ export class EscrowAccessSecretStoreTemplate extends AgreementTemplateBase {
} = this.conditions
const publisher = await this.didRegistry.getDIDOwner(did)
const lockRewardConditionId = await lockRewardCondition.generateIdHash(
agreementId,
await escrowReward.getAddress(),
@ -40,11 +39,6 @@ export class EscrowAccessSecretStoreTemplate extends AgreementTemplateBase {
lockRewardConditionId,
accessSecretStoreConditionId
)
return [
lockRewardConditionId,
accessSecretStoreConditionId,
escrowRewardId
]
return [lockRewardConditionId, accessSecretStoreConditionId, escrowRewardId]
}
}

View File

@ -40,11 +40,6 @@ export class EscrowComputeExecutionTemplate extends AgreementTemplateBase {
lockRewardConditionId,
computeExecutionConditionId
)
return [
lockRewardConditionId,
computeExecutionConditionId,
escrowRewardId
]
return [lockRewardConditionId, computeExecutionConditionId, escrowRewardId]
}
}

View File

@ -87,9 +87,8 @@ export default class TestContractHandler extends ContractHandler {
didRegistry.options.address
]
)
// Conditions
await TestContractHandler.deployContract(
const lockCondition = await TestContractHandler.deployContract(
'LockRewardCondition',
deployerAddress,
[
@ -98,7 +97,7 @@ export default class TestContractHandler extends ContractHandler {
token.options.address
]
)
await TestContractHandler.deployContract(
const accessCondition = await TestContractHandler.deployContract(
'AccessSecretStoreCondition',
deployerAddress,
[
@ -107,9 +106,8 @@ export default class TestContractHandler extends ContractHandler {
agreementStoreManager.options.address
]
)
// Conditions rewards
await TestContractHandler.deployContract(
const escrowCondition = await TestContractHandler.deployContract(
'EscrowReward',
deployerAddress,
[
@ -118,7 +116,7 @@ export default class TestContractHandler extends ContractHandler {
token.options.address
]
)
Logger.log(lockCondition, accessCondition, escrowCondition)
}
private static async deployContract(