Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Added time and description as termination arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Andersen committed Jan 25, 2021
1 parent f36869b commit 56b988f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/DeonApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface IdentifiedDeonApi {
tag?: D.Tag,
): Promise<D.Tag>;

terminateContract(id: string): Promise<void>;
terminateContract(id: string, terminatedAtTime: Date, description: String): Promise<void>;

postReport(
i: D.EvaluateExpressionInput,
Expand Down
2 changes: 1 addition & 1 deletion lib/DeonApiMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const identifiedApiMock: IdentifiedDeonApi = {
_2?: Tag,
): Promise<Tag> => Promise.reject(),

terminateContract: (_0: string): Promise<void> => Promise.reject(),
terminateContract: (_0: string, _1: Date, _2: String): Promise<void> => Promise.reject(),

postReport: (
_0: EvaluateExpressionInput,
Expand Down
11 changes: 11 additions & 0 deletions lib/DeonData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export interface InstantiationOutput {
tag: string;
}

export interface TerminationInput {
terminatedAtTime: Date;
description: string;
}

export interface CheckExpressionInput {
csl: string;
}
Expand All @@ -71,6 +76,11 @@ export interface EvaluateReportInput {
arguments: Value[];
}

export interface TerminationInput {
description: string;
terminatedAtTime: Date;
}

export interface NodeInfoOutput {
ledgerType: string;
nodeName: string;
Expand Down Expand Up @@ -563,6 +573,7 @@ export interface ReifiedValBinding {
/* Contracts */
export interface TerminationDetails {
terminatedAtTime: Date;
description: String;
requestingPeer: ExternalObject;
}

Expand Down
9 changes: 7 additions & 2 deletions lib/DeonRestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
OntologyRequest,
EntrypointSignatureRequest,
OntologyAndEntrypointSignatures,
TerminationInput,
} from './DeonData';
import { HttpClient, Response } from './HttpClient';
import { ExternalObject } from './ExternalObject';
Expand Down Expand Up @@ -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<void> {
return this.http.post(`/contracts/${id}/terminateContract`)
terminateContract(id: string, terminatedAtTime: Date, description: string): Promise<void> {
const terminationInput : TerminationInput = {
terminatedAtTime,
description,
};
return this.http.post(`/contracts/${id}/terminateContract`, terminationInput)
.then(possiblyBadRequestOrNotFound);
}
postReport(i: EvaluateExpressionInput, id?: string): Promise<Value> {
Expand Down

0 comments on commit 56b988f

Please sign in to comment.