-
Notifications
You must be signed in to change notification settings - Fork 0
/
anchor.ts
45 lines (42 loc) · 930 Bytes
/
anchor.ts
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 * as proto from "../../bridge/proto/integrity_entities";
import { AnchorNetwork } from "./anchor_network";
/**
* Represents information about an anchor.
*/
export class Anchor {
id: number;
blockRoots: string[];
networks: AnchorNetwork[];
root: string;
status: string;
/**
* Constructs an Anchor object with the specified parameters.
* @param id
* @param blockRoots
* @param networks
* @param root
* @param status
*/
constructor(
id: number,
blockRoots: string[],
networks: AnchorNetwork[],
root: string,
status: string
) {
this.id = id;
this.blockRoots = blockRoots;
this.networks = networks;
this.root = root;
this.status = status;
}
static fromProto(a: proto.Anchor): Anchor {
return new Anchor(
a.id,
a.blockRoots,
a.networks.map(n => AnchorNetwork.fromProto(n)),
a.root,
a.status
);
}
}