@freedomofpress/cometbft 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/commit.d.ts +7 -0
  2. package/dist/commit.js +175 -0
  3. package/dist/commit.js.map +1 -0
  4. package/dist/encoding.d.ts +4 -0
  5. package/dist/encoding.js +31 -0
  6. package/dist/encoding.js.map +1 -0
  7. package/dist/lightclient.d.ts +17 -0
  8. package/dist/lightclient.js +141 -0
  9. package/dist/lightclient.js.map +1 -0
  10. package/dist/proto/cometbft/crypto/v1/keys.d.ts +28 -0
  11. package/dist/proto/cometbft/crypto/v1/keys.js +110 -0
  12. package/dist/proto/cometbft/crypto/v1/keys.js.map +1 -0
  13. package/dist/proto/cometbft/crypto/v1/proof.d.ts +60 -0
  14. package/dist/proto/cometbft/crypto/v1/proof.js +416 -0
  15. package/dist/proto/cometbft/crypto/v1/proof.js.map +1 -0
  16. package/dist/proto/cometbft/types/v1/canonical.d.ts +85 -0
  17. package/dist/proto/cometbft/types/v1/canonical.js +586 -0
  18. package/dist/proto/cometbft/types/v1/canonical.js.map +1 -0
  19. package/dist/proto/cometbft/types/v1/types.d.ts +206 -0
  20. package/dist/proto/cometbft/types/v1/types.js +1794 -0
  21. package/dist/proto/cometbft/types/v1/types.js.map +1 -0
  22. package/dist/proto/cometbft/types/v1/validator.d.ts +64 -0
  23. package/dist/proto/cometbft/types/v1/validator.js +382 -0
  24. package/dist/proto/cometbft/types/v1/validator.js.map +1 -0
  25. package/dist/proto/cometbft/version/v1/types.d.ts +41 -0
  26. package/dist/proto/cometbft/version/v1/types.js +154 -0
  27. package/dist/proto/cometbft/version/v1/types.js.map +1 -0
  28. package/dist/proto/gogoproto/gogo.d.ts +1 -0
  29. package/dist/proto/gogoproto/gogo.js +8 -0
  30. package/dist/proto/gogoproto/gogo.js.map +1 -0
  31. package/dist/proto/google/protobuf/descriptor.d.ts +1228 -0
  32. package/dist/proto/google/protobuf/descriptor.js +5056 -0
  33. package/dist/proto/google/protobuf/descriptor.js.map +1 -0
  34. package/dist/proto/google/protobuf/timestamp.d.ts +128 -0
  35. package/dist/proto/google/protobuf/timestamp.js +83 -0
  36. package/dist/proto/google/protobuf/timestamp.js.map +1 -0
  37. package/dist/tests/commit.test.d.ts +1 -0
  38. package/dist/tests/commit.test.js +219 -0
  39. package/dist/tests/commit.test.js.map +1 -0
  40. package/dist/tests/encoding.test.d.ts +1 -0
  41. package/dist/tests/encoding.test.js +31 -0
  42. package/dist/tests/encoding.test.js.map +1 -0
  43. package/dist/tests/fixtures/commit-12.json +64 -0
  44. package/dist/tests/fixtures/validators-12.json +41 -0
  45. package/dist/tests/fixtures/webcat.json +71 -0
  46. package/dist/tests/lightclient.test.d.ts +1 -0
  47. package/dist/tests/lightclient.test.js +227 -0
  48. package/dist/tests/lightclient.test.js.map +1 -0
  49. package/dist/tests/validators.test.d.ts +1 -0
  50. package/dist/tests/validators.test.js +184 -0
  51. package/dist/tests/validators.test.js.map +1 -0
  52. package/dist/tests/webcat.test.d.ts +1 -0
  53. package/dist/tests/webcat.test.js +86 -0
  54. package/dist/tests/webcat.test.js.map +1 -0
  55. package/dist/types.d.ts +62 -0
  56. package/dist/types.js +2 -0
  57. package/dist/types.js.map +1 -0
  58. package/dist/validators.d.ts +6 -0
  59. package/dist/validators.js +55 -0
  60. package/dist/validators.js.map +1 -0
  61. package/package.json +1 -1
@@ -0,0 +1,206 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { Timestamp } from "../../../google/protobuf/timestamp";
3
+ import { Proof } from "../../crypto/v1/proof";
4
+ import { Consensus } from "../../version/v1/types";
5
+ import { BlockIDFlag, ValidatorSet } from "./validator";
6
+ export declare const protobufPackage = "cometbft.types.v1";
7
+ /** SignedMsgType is a type of signed message in the consensus. */
8
+ export declare enum SignedMsgType {
9
+ /** SIGNED_MSG_TYPE_UNKNOWN - Unknown */
10
+ SIGNED_MSG_TYPE_UNKNOWN = 0,
11
+ /** SIGNED_MSG_TYPE_PREVOTE - Prevote */
12
+ SIGNED_MSG_TYPE_PREVOTE = 1,
13
+ /** SIGNED_MSG_TYPE_PRECOMMIT - Precommit */
14
+ SIGNED_MSG_TYPE_PRECOMMIT = 2,
15
+ /** SIGNED_MSG_TYPE_PROPOSAL - Proposal */
16
+ SIGNED_MSG_TYPE_PROPOSAL = 32,
17
+ UNRECOGNIZED = -1
18
+ }
19
+ export declare function signedMsgTypeFromJSON(object: any): SignedMsgType;
20
+ export declare function signedMsgTypeToJSON(object: SignedMsgType): string;
21
+ /** Header of the parts set for a block. */
22
+ export interface PartSetHeader {
23
+ total: number;
24
+ hash: Uint8Array;
25
+ }
26
+ /** Part of the block. */
27
+ export interface Part {
28
+ index: number;
29
+ bytes: Uint8Array;
30
+ proof?: Proof | undefined;
31
+ }
32
+ /** BlockID defines the unique ID of a block as its hash and its `PartSetHeader`. */
33
+ export interface BlockID {
34
+ hash: Uint8Array;
35
+ partSetHeader?: PartSetHeader | undefined;
36
+ }
37
+ /** Header defines the structure of a block header. */
38
+ export interface Header {
39
+ /** basic block info */
40
+ version?: Consensus | undefined;
41
+ chainId: string;
42
+ height: bigint;
43
+ time?: Timestamp | undefined;
44
+ /** prev block info */
45
+ lastBlockId?: BlockID | undefined;
46
+ /** hashes of block data */
47
+ lastCommitHash: Uint8Array;
48
+ /** transactions */
49
+ dataHash: Uint8Array;
50
+ /** hashes from the app output from the prev block */
51
+ validatorsHash: Uint8Array;
52
+ /** validators for the next block */
53
+ nextValidatorsHash: Uint8Array;
54
+ /** consensus params for current block */
55
+ consensusHash: Uint8Array;
56
+ /** state after txs from the previous block */
57
+ appHash: Uint8Array;
58
+ /** root hash of all results from the txs from the previous block */
59
+ lastResultsHash: Uint8Array;
60
+ /** consensus info */
61
+ evidenceHash: Uint8Array;
62
+ /** original proposer of the block */
63
+ proposerAddress: Uint8Array;
64
+ }
65
+ /** Data contains the set of transactions included in the block */
66
+ export interface Data {
67
+ /**
68
+ * Txs that will be applied by state @ block.Height+1.
69
+ * NOTE: not all txs here are valid. We're just agreeing on the order first.
70
+ * This means that block.AppHash does not include these txs.
71
+ */
72
+ txs: Uint8Array[];
73
+ }
74
+ /**
75
+ * Vote represents a prevote or precommit vote from validators for
76
+ * consensus.
77
+ */
78
+ export interface Vote {
79
+ type: SignedMsgType;
80
+ height: bigint;
81
+ round: number;
82
+ /** zero if vote is nil. */
83
+ blockId?: BlockID | undefined;
84
+ timestamp?: Timestamp | undefined;
85
+ validatorAddress: Uint8Array;
86
+ validatorIndex: number;
87
+ /**
88
+ * Vote signature by the validator if they participated in consensus for the
89
+ * associated block.
90
+ */
91
+ signature: Uint8Array;
92
+ /**
93
+ * Vote extension provided by the application. Only valid for precommit
94
+ * messages.
95
+ */
96
+ extension: Uint8Array;
97
+ /**
98
+ * Vote extension signature by the validator if they participated in
99
+ * consensus for the associated block.
100
+ * Only valid for precommit messages.
101
+ */
102
+ extensionSignature: Uint8Array;
103
+ }
104
+ /** Commit contains the evidence that a block was committed by a set of validators. */
105
+ export interface Commit {
106
+ height: bigint;
107
+ round: number;
108
+ blockId?: BlockID | undefined;
109
+ signatures: CommitSig[];
110
+ }
111
+ /** CommitSig is a part of the Vote included in a Commit. */
112
+ export interface CommitSig {
113
+ blockIdFlag: BlockIDFlag;
114
+ validatorAddress: Uint8Array;
115
+ timestamp?: Timestamp | undefined;
116
+ signature: Uint8Array;
117
+ }
118
+ /** ExtendedCommit is a Commit with ExtendedCommitSig. */
119
+ export interface ExtendedCommit {
120
+ height: bigint;
121
+ round: number;
122
+ blockId?: BlockID | undefined;
123
+ extendedSignatures: ExtendedCommitSig[];
124
+ }
125
+ /**
126
+ * ExtendedCommitSig retains all the same fields as CommitSig but adds vote
127
+ * extension-related fields. We use two signatures to ensure backwards compatibility.
128
+ * That is the digest of the original signature is still the same in prior versions
129
+ */
130
+ export interface ExtendedCommitSig {
131
+ blockIdFlag: BlockIDFlag;
132
+ validatorAddress: Uint8Array;
133
+ timestamp?: Timestamp | undefined;
134
+ signature: Uint8Array;
135
+ /** Vote extension data */
136
+ extension: Uint8Array;
137
+ /** Vote extension signature */
138
+ extensionSignature: Uint8Array;
139
+ }
140
+ /** Block proposal. */
141
+ export interface Proposal {
142
+ type: SignedMsgType;
143
+ height: bigint;
144
+ round: number;
145
+ polRound: number;
146
+ blockId?: BlockID | undefined;
147
+ timestamp?: Timestamp | undefined;
148
+ signature: Uint8Array;
149
+ }
150
+ /** SignedHeader contains a Header(H) and Commit(H+1) with signatures of validators who signed it. */
151
+ export interface SignedHeader {
152
+ header?: Header | undefined;
153
+ commit?: Commit | undefined;
154
+ }
155
+ /** LightBlock is a combination of SignedHeader and ValidatorSet. It is used by light clients. */
156
+ export interface LightBlock {
157
+ signedHeader?: SignedHeader | undefined;
158
+ validatorSet?: ValidatorSet | undefined;
159
+ }
160
+ /** BlockMeta contains meta information about a block. */
161
+ export interface BlockMeta {
162
+ blockId?: BlockID | undefined;
163
+ blockSize: bigint;
164
+ header?: Header | undefined;
165
+ numTxs: bigint;
166
+ }
167
+ /** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */
168
+ export interface TxProof {
169
+ rootHash: Uint8Array;
170
+ data: Uint8Array;
171
+ proof?: Proof | undefined;
172
+ }
173
+ export declare const PartSetHeader: MessageFns<PartSetHeader>;
174
+ export declare const Part: MessageFns<Part>;
175
+ export declare const BlockID: MessageFns<BlockID>;
176
+ export declare const Header: MessageFns<Header>;
177
+ export declare const Data: MessageFns<Data>;
178
+ export declare const Vote: MessageFns<Vote>;
179
+ export declare const Commit: MessageFns<Commit>;
180
+ export declare const CommitSig: MessageFns<CommitSig>;
181
+ export declare const ExtendedCommit: MessageFns<ExtendedCommit>;
182
+ export declare const ExtendedCommitSig: MessageFns<ExtendedCommitSig>;
183
+ export declare const Proposal: MessageFns<Proposal>;
184
+ export declare const SignedHeader: MessageFns<SignedHeader>;
185
+ export declare const LightBlock: MessageFns<LightBlock>;
186
+ export declare const BlockMeta: MessageFns<BlockMeta>;
187
+ export declare const TxProof: MessageFns<TxProof>;
188
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
189
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
190
+ [K in keyof T]?: DeepPartial<T[K]>;
191
+ } : Partial<T>;
192
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
193
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
194
+ [K in keyof P]: Exact<P[K], I[K]>;
195
+ } & {
196
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
197
+ };
198
+ export interface MessageFns<T> {
199
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
200
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
201
+ fromJSON(object: any): T;
202
+ toJSON(message: T): unknown;
203
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
204
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
205
+ }
206
+ export {};