Add finalized block info (#104)

This commit is contained in:
Maciej Hirsz
2019-02-01 15:53:05 +01:00
committed by GitHub
parent 8c70007eef
commit dc71df7911
15 changed files with 165 additions and 28 deletions
+21
View File
@@ -0,0 +1,21 @@
import { Types } from '@dotstats/common';
export default class Block {
public static readonly ZERO = new Block(0 as Types.BlockNumber, '' as Types.BlockHash);
public readonly number: Types.BlockNumber;
public readonly hash: Types.BlockHash;
constructor(number: Types.BlockNumber, hash: Types.BlockHash) {
this.number = number;
this.hash = hash;
}
gt(other: Block): boolean {
return this.number > other.number;
}
eq(other: Block): boolean {
return this.number === other.number && this.hash === other.hash;
}
}