-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.ts
More file actions
45 lines (38 loc) · 1.45 KB
/
model.ts
File metadata and controls
45 lines (38 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { DispatchInfo, Hash } from '@polkadot/types/interfaces';
import HTTPMethod from 'http-method-enum';
import restify from 'restify';
export interface IGroupableController {
// A prefix indicating to which API group the endpoints should belong to. The URLs of all the containing endpoints will begin with this prefix.
readonly prefix?: string;
// A list indicating the endpoints to register to restify.
readonly endpoints: Endpoint[];
}
export class Endpoint {
// HTTP method of the endpoint
private _method: HTTPMethod;
public get method() {
return this._method;
}
// URL after the prefix
private _url: string;
public get url(): string {
return this._url;
}
// A list of Restify request handler functions
private _handlers: restify.RequestHandlerType[];
public get handlers(): restify.RequestHandlerType[] {
return this._handlers;
}
constructor(method: HTTPMethod, url: string, handlers: restify.RequestHandlerType[]) {
this._method = method;
this._url = url;
this._handlers = handlers;
}
}
// Contains all the info to be returned to the client about the result of the transaction execution. All info can be found from the `ISubmmittableResult` instance.
export class TxExecutionResult {
constructor(public readonly txHash: string, public readonly dispatchInfo: DispatchInfo, public readonly inBlockStatus: InBlockStatus) { }
}
export class InBlockStatus {
constructor(public readonly inBlock: Hash, public readonly finalized?: Hash) { }
}