Skip to content

Commit

Permalink
fix: wrong types
Browse files Browse the repository at this point in the history
  • Loading branch information
r-marques committed Oct 4, 2023
1 parent 4b4d1e4 commit b7a6a4b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/ddo/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,9 @@ export interface ServicePlugin<T extends Service> {
// Process agreement for provider
process(params: ValidationParams, from: Account, txparams?: TxParameters): Promise<void>
// Check if service can be granted without agreement
accept(params: ValidationParams): boolean
accept(params: ValidationParams): Promise<boolean>
// It registers the usage of a service
track(params: ValidationParams, from: Account, txparams?: TxParameters): boolean
track(params: ValidationParams, from: Account, txparams?: TxParameters): Promise<boolean>
}

export interface ServiceAgreementTemplateParameter {
Expand Down
8 changes: 4 additions & 4 deletions src/keeper/contracts/conditions/Condition.abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ export abstract class Condition<
public abstract paramsFromDDO(
ctx: Ctx,
...args: ConditionInstanceSmall[]
): Promise<ConditionParameters<Extra>>
): ConditionParameters<Extra>

public async instanceFromDDO(
public instanceFromDDO(
agreementId: string,
ctx: Ctx,
...args: ConditionInstanceSmall[]
): Promise<ConditionInstance<Extra>> {
return this.instance(agreementId, await this.paramsFromDDO(ctx, ...args))
return this.instance(agreementId, this.paramsFromDDO(ctx, ...args))
}

public async fulfillInstance(
Expand All @@ -169,7 +169,7 @@ export abstract class Condition<
additionalParams: Extra,
from?: Account,
txParams?: TxParameters,
): Promise<ContractTransactionReceipt | void>
): Promise<ContractTransactionReceipt> | void

public async instance(
agreementId: string,
Expand Down
2 changes: 1 addition & 1 deletion src/keeper/contracts/defi/AaveCreditTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface AaveCreditTemplateParams {
}

export class AaveCreditTemplate extends BaseTemplate<AaveCreditTemplateParams, ServiceAaveCredit> {
public paramsGen(_params: ValidationParams): Promise<AaveCreditTemplateParams> {
public paramsGen(_params: ValidationParams): AaveCreditTemplateParams {
throw new Error('Method not implemented.')
}
public name(): string {
Expand Down
14 changes: 9 additions & 5 deletions src/keeper/contracts/templates/BaseTemplate.abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,22 @@ export abstract class BaseTemplate<Params, S extends Service>
* Specialize params
* @param params - Generic parameters
*/
public abstract paramsGen(params: ValidationParams): Promise<Params>
public abstract paramsGen(params: ValidationParams): Params

public extraGen(_params: ValidationParams): Pick<ValidationParams, 'service_index'> {
return { service_index: _params.service_index }
}

public accept(_params: ValidationParams): boolean {
return false
public accept(_params: ValidationParams): Promise<boolean> {
return new Promise(() => false)
}

public track(_params: ValidationParams, _from: Account, _txparams?: TxParameters): boolean {
return false
public track(
_params: ValidationParams,
_from: Account,
_txparams?: TxParameters,
): Promise<boolean> {
return new Promise(() => false)
}

public async process(
Expand Down
1 change: 0 additions & 1 deletion test/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { LoggerInstance } from '../src/utils'

LoggerInstance.setLevel(LogLevel.Error)


const config = {
marketplaceUri: 'http://localhost:3100',
neverminedNodeUri: 'http://localhost:8030',
Expand Down

0 comments on commit b7a6a4b

Please sign in to comment.