UNPKG

2.12 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="pouchdb-core" />
3import { BinaryWriter, ECPoint, PrivateKey, UInt256, UInt256Hex } from '@neo-one/client-common';
4import { Equals, EquatableKey } from '../Equatable';
5import { DeserializeWireBaseOptions, DeserializeWireOptions, SerializableWire } from '../Serializable';
6import { VerifyScript } from '../vm';
7import { Witness } from '../Witness';
8import { UnsignedConsensusPayload, UnsignedConsensusPayloadAdd } from './UnsignedConsensusPayload';
9export interface ConsensusPayloadAdd extends UnsignedConsensusPayloadAdd {
10 readonly script: Witness;
11}
12export interface ConsensusPayloadGetScriptHashesForVerifyingOptions {
13 readonly getValidators: () => Promise<readonly ECPoint[]>;
14 readonly currentBlockHash: UInt256;
15}
16export interface ConsensusPayloadVerifyOptions extends ConsensusPayloadGetScriptHashesForVerifyingOptions {
17 readonly currentIndex: number;
18 readonly verifyScript: VerifyScript;
19}
20export declare class ConsensusPayload extends UnsignedConsensusPayload implements SerializableWire<ConsensusPayload>, EquatableKey {
21 static sign(payload: UnsignedConsensusPayload, key: PrivateKey): ConsensusPayload;
22 static deserializeWireBase(options: DeserializeWireBaseOptions): ConsensusPayload;
23 static deserializeWire(options: DeserializeWireOptions): ConsensusPayload;
24 readonly script: Witness;
25 readonly toKeyString: () => string;
26 readonly equals: Equals;
27 readonly getScriptHashesForVerifying: (input: ConsensusPayloadGetScriptHashesForVerifyingOptions) => Promise<Set<string>>;
28 private readonly hashInternal;
29 private readonly hashHexInternal;
30 private readonly messageInternal;
31 constructor({ version, previousHash, blockIndex, validatorIndex, timestamp, consensusMessage, script, }: ConsensusPayloadAdd);
32 readonly hash: UInt256;
33 readonly hashHex: UInt256Hex;
34 readonly message: Buffer;
35 serializeUnsigned(): Buffer;
36 serializeWireBase(writer: BinaryWriter): void;
37 verify({ verifyScript, getValidators, currentBlockHash, currentIndex, }: ConsensusPayloadVerifyOptions): Promise<void>;
38}