diff --git a/lib/DeonApi.ts b/lib/DeonApi.ts index f0e2e84..786fb9e 100644 --- a/lib/DeonApi.ts +++ b/lib/DeonApi.ts @@ -41,7 +41,7 @@ export interface IdentifiedDeonApi { tag?: D.Tag, ): Promise; - terminateContract(id: string): Promise; + terminateContract(id: string, terminatedAtTime: Date, description: String): Promise; postReport( i: D.EvaluateExpressionInput, diff --git a/lib/DeonApiMock.ts b/lib/DeonApiMock.ts index f0ddbef..b9c1cd5 100644 --- a/lib/DeonApiMock.ts +++ b/lib/DeonApiMock.ts @@ -70,7 +70,7 @@ export const identifiedApiMock: IdentifiedDeonApi = { _2?: Tag, ): Promise => Promise.reject(), - terminateContract: (_0: string): Promise => Promise.reject(), + terminateContract: (_0: string, _1: Date, _2: String): Promise => Promise.reject(), postReport: ( _0: EvaluateExpressionInput, diff --git a/lib/DeonData.ts b/lib/DeonData.ts index cded14d..07a3249 100644 --- a/lib/DeonData.ts +++ b/lib/DeonData.ts @@ -57,6 +57,11 @@ export interface InstantiationOutput { tag: string; } +export interface TerminationInput { + terminatedAtTime: Date; + description: string; +} + export interface CheckExpressionInput { csl: string; } @@ -71,6 +76,11 @@ export interface EvaluateReportInput { arguments: Value[]; } +export interface TerminationInput { + description: string; + terminatedAtTime: Date; +} + export interface NodeInfoOutput { ledgerType: string; nodeName: string; @@ -563,6 +573,7 @@ export interface ReifiedValBinding { /* Contracts */ export interface TerminationDetails { terminatedAtTime: Date; + description: String; requestingPeer: ExternalObject; } diff --git a/lib/DeonRestClient.ts b/lib/DeonRestClient.ts index 301cd24..2eb4303 100644 --- a/lib/DeonRestClient.ts +++ b/lib/DeonRestClient.ts @@ -32,6 +32,7 @@ import { OntologyRequest, EntrypointSignatureRequest, OntologyAndEntrypointSignatures, + TerminationInput, } from './DeonData'; import { HttpClient, Response } from './HttpClient'; import { ExternalObject } from './ExternalObject'; @@ -206,8 +207,12 @@ export class IdentifiedDeonRestClient implements IdentifiedDeonApi { return this.http.post(`/contracts/${idString(id)}/${tag != null ? `${tag}/` : ''}events`, event) .then(possiblyBadRequestOrNotFound); } - terminateContract(id: string): Promise { - return this.http.post(`/contracts/${id}/terminateContract`) + terminateContract(id: string, terminatedAtTime: Date, description: string): Promise { + const terminationInput : TerminationInput = { + terminatedAtTime, + description, + }; + return this.http.post(`/contracts/${id}/terminateContract`, terminationInput) .then(possiblyBadRequestOrNotFound); } postReport(i: EvaluateExpressionInput, id?: string): Promise {