-
Notifications
You must be signed in to change notification settings - Fork 1
/
msg.d.ts
58 lines (58 loc) · 1.72 KB
/
msg.d.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
46
47
48
49
50
51
52
53
54
55
56
57
58
/// <reference types="node" />
/**
* Peer-to-Peer Network Message
* ============================
*
* A message on the bitcoin p2p network.
*/
import { Br } from './br';
import { Bw } from './bw';
import { NetworkConstants } from './constants';
import { Struct } from './struct';
export declare class Msg extends Struct {
constants: NetworkConstants;
magicNum: number;
cmdbuf: Buffer;
datasize: number;
checksumbuf: Buffer;
dataBuf: Buffer;
constructor(magicNum?: number, cmdbuf?: Buffer, datasize?: number, checksumbuf?: Buffer, dataBuf?: Buffer, constants?: NetworkConstants);
setCmd(cmdname: string): this;
getCmd(): string;
static checksum(dataBuf: Buffer): Buffer;
static asyncChecksum(dataBuf: Buffer): Promise<Buffer>;
setData(dataBuf: Buffer): this;
asyncSetData(dataBuf: Buffer): Promise<this>;
/**
* An iterator to produce a message from a series of buffers. Set opts.strict
* to throw an error if an invalid message occurs in stream.
*/
genFromBuffers(opts?: {
strict?: boolean;
}): Generator<number, any, Buffer>;
fromBr(br: Br): this;
toBw(bw?: Bw): Bw;
fromJSON(json: {
magicNum: number;
cmdbuf: string;
datasize: number;
checksumbuf: string;
dataBuf: string;
}): this;
toJSON(): {
magicNum: number;
cmdbuf: string;
datasize: number;
checksumbuf: string;
dataBuf: string;
};
isValid(): boolean;
asyncIsValid(): Promise<boolean>;
validate(): this;
asyncValidate(): Promise<void>;
static Mainnet: typeof Msg;
static Testnet: typeof Msg;
static Regtest: typeof Msg;
static STN: typeof Msg;
}
//# sourceMappingURL=msg.d.ts.map