@ocap/types 1.28.9 → 1.29.0
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.
- package/index.d.ts +23 -1
- package/interfaces/base.ts +38 -0
- package/interfaces/config.ts +166 -0
- package/interfaces/index.ts +254 -0
- package/interfaces/indexdb.ts +444 -0
- package/interfaces/pipeline.ts +525 -0
- package/interfaces/resolver.ts +503 -0
- package/interfaces/state.ts +327 -0
- package/interfaces/statedb.ts +193 -0
- package/interfaces/testing.ts +122 -0
- package/lib/enum_pb.d.ts +0 -3
- package/lib/rpc_pb.d.ts +0 -1591
- package/lib/service_pb.d.ts +0 -2
- package/lib/state_pb.d.ts +0 -840
- package/lib/trace-type_pb.d.ts +0 -1304
- package/lib/tx_pb.d.ts +0 -1687
- package/lib/type_pb.d.ts +0 -1781
- package/lib/vendor_pb.d.ts +0 -406
- package/package.json +10 -4
- package/tests/interfaces-reexport.spec.ts +76 -0
- package/tests/interfaces.spec.ts +265 -0
- package/tests/pipeline.spec.ts +249 -0
package/lib/vendor_pb.d.ts
CHANGED
|
@@ -1,349 +1,72 @@
|
|
|
1
1
|
// package: vendor
|
|
2
2
|
// file: vendor.proto
|
|
3
3
|
|
|
4
|
-
import * as jspb from "google-protobuf";
|
|
5
4
|
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
|
|
6
5
|
|
|
7
|
-
export class KVPair extends jspb.Message {
|
|
8
|
-
getKey(): Uint8Array | string;
|
|
9
|
-
getKey_asU8(): Uint8Array;
|
|
10
|
-
getKey_asB64(): string;
|
|
11
|
-
setKey(value: Uint8Array | string): void;
|
|
12
|
-
|
|
13
|
-
getValue(): Uint8Array | string;
|
|
14
|
-
getValue_asU8(): Uint8Array;
|
|
15
|
-
getValue_asB64(): string;
|
|
16
|
-
setValue(value: Uint8Array | string): void;
|
|
17
|
-
|
|
18
|
-
serializeBinary(): Uint8Array;
|
|
19
|
-
toObject(includeInstance?: boolean): TKVPair;
|
|
20
|
-
static toObject(includeInstance: boolean, msg: KVPair): TKVPair;
|
|
21
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
22
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
23
|
-
static serializeBinaryToWriter(message: KVPair, writer: jspb.BinaryWriter): void;
|
|
24
|
-
static deserializeBinary(bytes: Uint8Array): KVPair;
|
|
25
|
-
static deserializeBinaryFromReader(message: KVPair, reader: jspb.BinaryReader): KVPair;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
6
|
export type TKVPair = {
|
|
29
7
|
key: Uint8Array | string,
|
|
30
8
|
value: Uint8Array | string,
|
|
31
9
|
}
|
|
32
10
|
|
|
33
|
-
export class BlockParams extends jspb.Message {
|
|
34
|
-
getMaxBytes(): number;
|
|
35
|
-
setMaxBytes(value: number): void;
|
|
36
|
-
|
|
37
|
-
getMaxGas(): number;
|
|
38
|
-
setMaxGas(value: number): void;
|
|
39
|
-
|
|
40
|
-
serializeBinary(): Uint8Array;
|
|
41
|
-
toObject(includeInstance?: boolean): TBlockParams;
|
|
42
|
-
static toObject(includeInstance: boolean, msg: BlockParams): TBlockParams;
|
|
43
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
44
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
45
|
-
static serializeBinaryToWriter(message: BlockParams, writer: jspb.BinaryWriter): void;
|
|
46
|
-
static deserializeBinary(bytes: Uint8Array): BlockParams;
|
|
47
|
-
static deserializeBinaryFromReader(message: BlockParams, reader: jspb.BinaryReader): BlockParams;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
11
|
export type TBlockParams = {
|
|
51
12
|
maxBytes: number,
|
|
52
13
|
maxGas: number,
|
|
53
14
|
}
|
|
54
15
|
|
|
55
|
-
export class EvidenceParams extends jspb.Message {
|
|
56
|
-
getMaxAge(): number;
|
|
57
|
-
setMaxAge(value: number): void;
|
|
58
|
-
|
|
59
|
-
serializeBinary(): Uint8Array;
|
|
60
|
-
toObject(includeInstance?: boolean): TEvidenceParams;
|
|
61
|
-
static toObject(includeInstance: boolean, msg: EvidenceParams): TEvidenceParams;
|
|
62
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
63
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
64
|
-
static serializeBinaryToWriter(message: EvidenceParams, writer: jspb.BinaryWriter): void;
|
|
65
|
-
static deserializeBinary(bytes: Uint8Array): EvidenceParams;
|
|
66
|
-
static deserializeBinaryFromReader(message: EvidenceParams, reader: jspb.BinaryReader): EvidenceParams;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
16
|
export type TEvidenceParams = {
|
|
70
17
|
maxAge: number,
|
|
71
18
|
}
|
|
72
19
|
|
|
73
|
-
export class ValidatorParams extends jspb.Message {
|
|
74
|
-
clearPubKeyTypesList(): void;
|
|
75
|
-
getPubKeyTypesList(): Array<string>;
|
|
76
|
-
setPubKeyTypesList(value: Array<string>): void;
|
|
77
|
-
addPubKeyTypes(value: string, index?: number): string;
|
|
78
|
-
|
|
79
|
-
serializeBinary(): Uint8Array;
|
|
80
|
-
toObject(includeInstance?: boolean): TValidatorParams;
|
|
81
|
-
static toObject(includeInstance: boolean, msg: ValidatorParams): TValidatorParams;
|
|
82
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
83
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
84
|
-
static serializeBinaryToWriter(message: ValidatorParams, writer: jspb.BinaryWriter): void;
|
|
85
|
-
static deserializeBinary(bytes: Uint8Array): ValidatorParams;
|
|
86
|
-
static deserializeBinaryFromReader(message: ValidatorParams, reader: jspb.BinaryReader): ValidatorParams;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
20
|
export type TValidatorParams = {
|
|
90
21
|
pubKeyTypes: Array<string>,
|
|
91
22
|
}
|
|
92
23
|
|
|
93
|
-
export class ConsensusParams extends jspb.Message {
|
|
94
|
-
hasBlock(): boolean;
|
|
95
|
-
clearBlock(): void;
|
|
96
|
-
getBlock(): TBlockParams | undefined;
|
|
97
|
-
setBlock(value?: TBlockParams): void;
|
|
98
|
-
|
|
99
|
-
hasEvidence(): boolean;
|
|
100
|
-
clearEvidence(): void;
|
|
101
|
-
getEvidence(): TEvidenceParams | undefined;
|
|
102
|
-
setEvidence(value?: TEvidenceParams): void;
|
|
103
|
-
|
|
104
|
-
hasValidator(): boolean;
|
|
105
|
-
clearValidator(): void;
|
|
106
|
-
getValidator(): TValidatorParams | undefined;
|
|
107
|
-
setValidator(value?: TValidatorParams): void;
|
|
108
|
-
|
|
109
|
-
serializeBinary(): Uint8Array;
|
|
110
|
-
toObject(includeInstance?: boolean): TConsensusParams;
|
|
111
|
-
static toObject(includeInstance: boolean, msg: ConsensusParams): TConsensusParams;
|
|
112
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
113
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
114
|
-
static serializeBinaryToWriter(message: ConsensusParams, writer: jspb.BinaryWriter): void;
|
|
115
|
-
static deserializeBinary(bytes: Uint8Array): ConsensusParams;
|
|
116
|
-
static deserializeBinaryFromReader(message: ConsensusParams, reader: jspb.BinaryReader): ConsensusParams;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
24
|
export type TConsensusParams = {
|
|
120
25
|
block?: TBlockParams,
|
|
121
26
|
evidence?: TEvidenceParams,
|
|
122
27
|
validator?: TValidatorParams,
|
|
123
28
|
}
|
|
124
29
|
|
|
125
|
-
export class LastCommitInfo extends jspb.Message {
|
|
126
|
-
getRound(): number;
|
|
127
|
-
setRound(value: number): void;
|
|
128
|
-
|
|
129
|
-
clearVotesList(): void;
|
|
130
|
-
getVotesList(): Array<TVoteInfo>;
|
|
131
|
-
setVotesList(value: Array<TVoteInfo>): void;
|
|
132
|
-
addVotes(value?: VoteInfo, index?: number): VoteInfo;
|
|
133
|
-
|
|
134
|
-
serializeBinary(): Uint8Array;
|
|
135
|
-
toObject(includeInstance?: boolean): TLastCommitInfo;
|
|
136
|
-
static toObject(includeInstance: boolean, msg: LastCommitInfo): TLastCommitInfo;
|
|
137
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
138
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
139
|
-
static serializeBinaryToWriter(message: LastCommitInfo, writer: jspb.BinaryWriter): void;
|
|
140
|
-
static deserializeBinary(bytes: Uint8Array): LastCommitInfo;
|
|
141
|
-
static deserializeBinaryFromReader(message: LastCommitInfo, reader: jspb.BinaryReader): LastCommitInfo;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
30
|
export type TLastCommitInfo = {
|
|
145
31
|
round: number,
|
|
146
32
|
votes: Array<TVoteInfo>,
|
|
147
33
|
}
|
|
148
34
|
|
|
149
|
-
export class Version extends jspb.Message {
|
|
150
|
-
getBlock(): number;
|
|
151
|
-
setBlock(value: number): void;
|
|
152
|
-
|
|
153
|
-
getApp(): number;
|
|
154
|
-
setApp(value: number): void;
|
|
155
|
-
|
|
156
|
-
serializeBinary(): Uint8Array;
|
|
157
|
-
toObject(includeInstance?: boolean): TVersion;
|
|
158
|
-
static toObject(includeInstance: boolean, msg: Version): TVersion;
|
|
159
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
160
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
161
|
-
static serializeBinaryToWriter(message: Version, writer: jspb.BinaryWriter): void;
|
|
162
|
-
static deserializeBinary(bytes: Uint8Array): Version;
|
|
163
|
-
static deserializeBinaryFromReader(message: Version, reader: jspb.BinaryReader): Version;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
35
|
export type TVersion = {
|
|
167
36
|
block: number,
|
|
168
37
|
app: number,
|
|
169
38
|
}
|
|
170
39
|
|
|
171
|
-
export class BlockID extends jspb.Message {
|
|
172
|
-
getHash(): Uint8Array | string;
|
|
173
|
-
getHash_asU8(): Uint8Array;
|
|
174
|
-
getHash_asB64(): string;
|
|
175
|
-
setHash(value: Uint8Array | string): void;
|
|
176
|
-
|
|
177
|
-
hasPartsHeader(): boolean;
|
|
178
|
-
clearPartsHeader(): void;
|
|
179
|
-
getPartsHeader(): TPartSetHeader | undefined;
|
|
180
|
-
setPartsHeader(value?: TPartSetHeader): void;
|
|
181
|
-
|
|
182
|
-
serializeBinary(): Uint8Array;
|
|
183
|
-
toObject(includeInstance?: boolean): TBlockID;
|
|
184
|
-
static toObject(includeInstance: boolean, msg: BlockID): TBlockID;
|
|
185
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
186
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
187
|
-
static serializeBinaryToWriter(message: BlockID, writer: jspb.BinaryWriter): void;
|
|
188
|
-
static deserializeBinary(bytes: Uint8Array): BlockID;
|
|
189
|
-
static deserializeBinaryFromReader(message: BlockID, reader: jspb.BinaryReader): BlockID;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
40
|
export type TBlockID = {
|
|
193
41
|
hash: Uint8Array | string,
|
|
194
42
|
partsHeader?: TPartSetHeader,
|
|
195
43
|
}
|
|
196
44
|
|
|
197
|
-
export class PartSetHeader extends jspb.Message {
|
|
198
|
-
getTotal(): number;
|
|
199
|
-
setTotal(value: number): void;
|
|
200
|
-
|
|
201
|
-
getHash(): Uint8Array | string;
|
|
202
|
-
getHash_asU8(): Uint8Array;
|
|
203
|
-
getHash_asB64(): string;
|
|
204
|
-
setHash(value: Uint8Array | string): void;
|
|
205
|
-
|
|
206
|
-
serializeBinary(): Uint8Array;
|
|
207
|
-
toObject(includeInstance?: boolean): TPartSetHeader;
|
|
208
|
-
static toObject(includeInstance: boolean, msg: PartSetHeader): TPartSetHeader;
|
|
209
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
210
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
211
|
-
static serializeBinaryToWriter(message: PartSetHeader, writer: jspb.BinaryWriter): void;
|
|
212
|
-
static deserializeBinary(bytes: Uint8Array): PartSetHeader;
|
|
213
|
-
static deserializeBinaryFromReader(message: PartSetHeader, reader: jspb.BinaryReader): PartSetHeader;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
45
|
export type TPartSetHeader = {
|
|
217
46
|
total: number,
|
|
218
47
|
hash: Uint8Array | string,
|
|
219
48
|
}
|
|
220
49
|
|
|
221
|
-
export class Validator extends jspb.Message {
|
|
222
|
-
getAddress(): Uint8Array | string;
|
|
223
|
-
getAddress_asU8(): Uint8Array;
|
|
224
|
-
getAddress_asB64(): string;
|
|
225
|
-
setAddress(value: Uint8Array | string): void;
|
|
226
|
-
|
|
227
|
-
getPower(): number;
|
|
228
|
-
setPower(value: number): void;
|
|
229
|
-
|
|
230
|
-
serializeBinary(): Uint8Array;
|
|
231
|
-
toObject(includeInstance?: boolean): TValidator;
|
|
232
|
-
static toObject(includeInstance: boolean, msg: Validator): TValidator;
|
|
233
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
234
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
235
|
-
static serializeBinaryToWriter(message: Validator, writer: jspb.BinaryWriter): void;
|
|
236
|
-
static deserializeBinary(bytes: Uint8Array): Validator;
|
|
237
|
-
static deserializeBinaryFromReader(message: Validator, reader: jspb.BinaryReader): Validator;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
50
|
export type TValidator = {
|
|
241
51
|
address: Uint8Array | string,
|
|
242
52
|
power: number,
|
|
243
53
|
}
|
|
244
54
|
|
|
245
|
-
export class ValidatorUpdate extends jspb.Message {
|
|
246
|
-
hasPubKey(): boolean;
|
|
247
|
-
clearPubKey(): void;
|
|
248
|
-
getPubKey(): TPubKey | undefined;
|
|
249
|
-
setPubKey(value?: TPubKey): void;
|
|
250
|
-
|
|
251
|
-
getPower(): number;
|
|
252
|
-
setPower(value: number): void;
|
|
253
|
-
|
|
254
|
-
serializeBinary(): Uint8Array;
|
|
255
|
-
toObject(includeInstance?: boolean): TValidatorUpdate;
|
|
256
|
-
static toObject(includeInstance: boolean, msg: ValidatorUpdate): TValidatorUpdate;
|
|
257
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
258
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
259
|
-
static serializeBinaryToWriter(message: ValidatorUpdate, writer: jspb.BinaryWriter): void;
|
|
260
|
-
static deserializeBinary(bytes: Uint8Array): ValidatorUpdate;
|
|
261
|
-
static deserializeBinaryFromReader(message: ValidatorUpdate, reader: jspb.BinaryReader): ValidatorUpdate;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
55
|
export type TValidatorUpdate = {
|
|
265
56
|
pubKey?: TPubKey,
|
|
266
57
|
power: number,
|
|
267
58
|
}
|
|
268
59
|
|
|
269
|
-
export class VoteInfo extends jspb.Message {
|
|
270
|
-
hasValidator(): boolean;
|
|
271
|
-
clearValidator(): void;
|
|
272
|
-
getValidator(): TValidator | undefined;
|
|
273
|
-
setValidator(value?: TValidator): void;
|
|
274
|
-
|
|
275
|
-
getSignedLastBlock(): boolean;
|
|
276
|
-
setSignedLastBlock(value: boolean): void;
|
|
277
|
-
|
|
278
|
-
serializeBinary(): Uint8Array;
|
|
279
|
-
toObject(includeInstance?: boolean): TVoteInfo;
|
|
280
|
-
static toObject(includeInstance: boolean, msg: VoteInfo): TVoteInfo;
|
|
281
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
282
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
283
|
-
static serializeBinaryToWriter(message: VoteInfo, writer: jspb.BinaryWriter): void;
|
|
284
|
-
static deserializeBinary(bytes: Uint8Array): VoteInfo;
|
|
285
|
-
static deserializeBinaryFromReader(message: VoteInfo, reader: jspb.BinaryReader): VoteInfo;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
60
|
export type TVoteInfo = {
|
|
289
61
|
validator?: TValidator,
|
|
290
62
|
signedLastBlock: boolean,
|
|
291
63
|
}
|
|
292
64
|
|
|
293
|
-
export class PubKey extends jspb.Message {
|
|
294
|
-
getType(): string;
|
|
295
|
-
setType(value: string): void;
|
|
296
|
-
|
|
297
|
-
getData(): Uint8Array | string;
|
|
298
|
-
getData_asU8(): Uint8Array;
|
|
299
|
-
getData_asB64(): string;
|
|
300
|
-
setData(value: Uint8Array | string): void;
|
|
301
|
-
|
|
302
|
-
serializeBinary(): Uint8Array;
|
|
303
|
-
toObject(includeInstance?: boolean): TPubKey;
|
|
304
|
-
static toObject(includeInstance: boolean, msg: PubKey): TPubKey;
|
|
305
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
306
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
307
|
-
static serializeBinaryToWriter(message: PubKey, writer: jspb.BinaryWriter): void;
|
|
308
|
-
static deserializeBinary(bytes: Uint8Array): PubKey;
|
|
309
|
-
static deserializeBinaryFromReader(message: PubKey, reader: jspb.BinaryReader): PubKey;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
65
|
export type TPubKey = {
|
|
313
66
|
type: string,
|
|
314
67
|
data: Uint8Array | string,
|
|
315
68
|
}
|
|
316
69
|
|
|
317
|
-
export class Evidence extends jspb.Message {
|
|
318
|
-
getType(): string;
|
|
319
|
-
setType(value: string): void;
|
|
320
|
-
|
|
321
|
-
hasValidator(): boolean;
|
|
322
|
-
clearValidator(): void;
|
|
323
|
-
getValidator(): TValidator | undefined;
|
|
324
|
-
setValidator(value?: TValidator): void;
|
|
325
|
-
|
|
326
|
-
getHeight(): number;
|
|
327
|
-
setHeight(value: number): void;
|
|
328
|
-
|
|
329
|
-
hasTime(): boolean;
|
|
330
|
-
clearTime(): void;
|
|
331
|
-
getTime(): google_protobuf_timestamp_pb.Timestamp | undefined;
|
|
332
|
-
setTime(value?: google_protobuf_timestamp_pb.Timestamp): void;
|
|
333
|
-
|
|
334
|
-
getTotalVotingPower(): number;
|
|
335
|
-
setTotalVotingPower(value: number): void;
|
|
336
|
-
|
|
337
|
-
serializeBinary(): Uint8Array;
|
|
338
|
-
toObject(includeInstance?: boolean): TEvidence;
|
|
339
|
-
static toObject(includeInstance: boolean, msg: Evidence): TEvidence;
|
|
340
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
341
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
342
|
-
static serializeBinaryToWriter(message: Evidence, writer: jspb.BinaryWriter): void;
|
|
343
|
-
static deserializeBinary(bytes: Uint8Array): Evidence;
|
|
344
|
-
static deserializeBinaryFromReader(message: Evidence, reader: jspb.BinaryReader): Evidence;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
70
|
export type TEvidence = {
|
|
348
71
|
type: string,
|
|
349
72
|
validator?: TValidator,
|
|
@@ -352,89 +75,6 @@ export type TEvidence = {
|
|
|
352
75
|
totalVotingPower: number,
|
|
353
76
|
}
|
|
354
77
|
|
|
355
|
-
export class Header extends jspb.Message {
|
|
356
|
-
hasVersion(): boolean;
|
|
357
|
-
clearVersion(): void;
|
|
358
|
-
getVersion(): TVersion | undefined;
|
|
359
|
-
setVersion(value?: TVersion): void;
|
|
360
|
-
|
|
361
|
-
getChainId(): string;
|
|
362
|
-
setChainId(value: string): void;
|
|
363
|
-
|
|
364
|
-
getHeight(): number;
|
|
365
|
-
setHeight(value: number): void;
|
|
366
|
-
|
|
367
|
-
hasTime(): boolean;
|
|
368
|
-
clearTime(): void;
|
|
369
|
-
getTime(): google_protobuf_timestamp_pb.Timestamp | undefined;
|
|
370
|
-
setTime(value?: google_protobuf_timestamp_pb.Timestamp): void;
|
|
371
|
-
|
|
372
|
-
getNumTxs(): number;
|
|
373
|
-
setNumTxs(value: number): void;
|
|
374
|
-
|
|
375
|
-
getTotalTxs(): number;
|
|
376
|
-
setTotalTxs(value: number): void;
|
|
377
|
-
|
|
378
|
-
hasLastBlockId(): boolean;
|
|
379
|
-
clearLastBlockId(): void;
|
|
380
|
-
getLastBlockId(): TBlockID | undefined;
|
|
381
|
-
setLastBlockId(value?: TBlockID): void;
|
|
382
|
-
|
|
383
|
-
getLastCommitHash(): Uint8Array | string;
|
|
384
|
-
getLastCommitHash_asU8(): Uint8Array;
|
|
385
|
-
getLastCommitHash_asB64(): string;
|
|
386
|
-
setLastCommitHash(value: Uint8Array | string): void;
|
|
387
|
-
|
|
388
|
-
getDataHash(): Uint8Array | string;
|
|
389
|
-
getDataHash_asU8(): Uint8Array;
|
|
390
|
-
getDataHash_asB64(): string;
|
|
391
|
-
setDataHash(value: Uint8Array | string): void;
|
|
392
|
-
|
|
393
|
-
getValidatorsHash(): Uint8Array | string;
|
|
394
|
-
getValidatorsHash_asU8(): Uint8Array;
|
|
395
|
-
getValidatorsHash_asB64(): string;
|
|
396
|
-
setValidatorsHash(value: Uint8Array | string): void;
|
|
397
|
-
|
|
398
|
-
getNextValidatorsHash(): Uint8Array | string;
|
|
399
|
-
getNextValidatorsHash_asU8(): Uint8Array;
|
|
400
|
-
getNextValidatorsHash_asB64(): string;
|
|
401
|
-
setNextValidatorsHash(value: Uint8Array | string): void;
|
|
402
|
-
|
|
403
|
-
getConsensusHash(): Uint8Array | string;
|
|
404
|
-
getConsensusHash_asU8(): Uint8Array;
|
|
405
|
-
getConsensusHash_asB64(): string;
|
|
406
|
-
setConsensusHash(value: Uint8Array | string): void;
|
|
407
|
-
|
|
408
|
-
getAppHash(): Uint8Array | string;
|
|
409
|
-
getAppHash_asU8(): Uint8Array;
|
|
410
|
-
getAppHash_asB64(): string;
|
|
411
|
-
setAppHash(value: Uint8Array | string): void;
|
|
412
|
-
|
|
413
|
-
getLastResultsHash(): Uint8Array | string;
|
|
414
|
-
getLastResultsHash_asU8(): Uint8Array;
|
|
415
|
-
getLastResultsHash_asB64(): string;
|
|
416
|
-
setLastResultsHash(value: Uint8Array | string): void;
|
|
417
|
-
|
|
418
|
-
getEvidenceHash(): Uint8Array | string;
|
|
419
|
-
getEvidenceHash_asU8(): Uint8Array;
|
|
420
|
-
getEvidenceHash_asB64(): string;
|
|
421
|
-
setEvidenceHash(value: Uint8Array | string): void;
|
|
422
|
-
|
|
423
|
-
getProposerAddress(): Uint8Array | string;
|
|
424
|
-
getProposerAddress_asU8(): Uint8Array;
|
|
425
|
-
getProposerAddress_asB64(): string;
|
|
426
|
-
setProposerAddress(value: Uint8Array | string): void;
|
|
427
|
-
|
|
428
|
-
serializeBinary(): Uint8Array;
|
|
429
|
-
toObject(includeInstance?: boolean): THeader;
|
|
430
|
-
static toObject(includeInstance: boolean, msg: Header): THeader;
|
|
431
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
432
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
433
|
-
static serializeBinaryToWriter(message: Header, writer: jspb.BinaryWriter): void;
|
|
434
|
-
static deserializeBinary(bytes: Uint8Array): Header;
|
|
435
|
-
static deserializeBinaryFromReader(message: Header, reader: jspb.BinaryReader): Header;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
78
|
export type THeader = {
|
|
439
79
|
version?: TVersion,
|
|
440
80
|
chainId: string,
|
|
@@ -454,37 +94,6 @@ export type THeader = {
|
|
|
454
94
|
proposerAddress: Uint8Array | string,
|
|
455
95
|
}
|
|
456
96
|
|
|
457
|
-
export class RequestBeginBlock extends jspb.Message {
|
|
458
|
-
getHash(): Uint8Array | string;
|
|
459
|
-
getHash_asU8(): Uint8Array;
|
|
460
|
-
getHash_asB64(): string;
|
|
461
|
-
setHash(value: Uint8Array | string): void;
|
|
462
|
-
|
|
463
|
-
hasHeader(): boolean;
|
|
464
|
-
clearHeader(): void;
|
|
465
|
-
getHeader(): THeader | undefined;
|
|
466
|
-
setHeader(value?: THeader): void;
|
|
467
|
-
|
|
468
|
-
hasLastCommitInfo(): boolean;
|
|
469
|
-
clearLastCommitInfo(): void;
|
|
470
|
-
getLastCommitInfo(): TLastCommitInfo | undefined;
|
|
471
|
-
setLastCommitInfo(value?: TLastCommitInfo): void;
|
|
472
|
-
|
|
473
|
-
clearByzantineValidatorsList(): void;
|
|
474
|
-
getByzantineValidatorsList(): Array<TEvidence>;
|
|
475
|
-
setByzantineValidatorsList(value: Array<TEvidence>): void;
|
|
476
|
-
addByzantineValidators(value?: Evidence, index?: number): Evidence;
|
|
477
|
-
|
|
478
|
-
serializeBinary(): Uint8Array;
|
|
479
|
-
toObject(includeInstance?: boolean): TRequestBeginBlock;
|
|
480
|
-
static toObject(includeInstance: boolean, msg: RequestBeginBlock): TRequestBeginBlock;
|
|
481
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
482
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
483
|
-
static serializeBinaryToWriter(message: RequestBeginBlock, writer: jspb.BinaryWriter): void;
|
|
484
|
-
static deserializeBinary(bytes: Uint8Array): RequestBeginBlock;
|
|
485
|
-
static deserializeBinaryFromReader(message: RequestBeginBlock, reader: jspb.BinaryReader): RequestBeginBlock;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
97
|
export type TRequestBeginBlock = {
|
|
489
98
|
hash: Uint8Array | string,
|
|
490
99
|
header?: THeader,
|
|
@@ -492,21 +101,6 @@ export type TRequestBeginBlock = {
|
|
|
492
101
|
byzantineValidators: Array<TEvidence>,
|
|
493
102
|
}
|
|
494
103
|
|
|
495
|
-
export class RequestEndBlock extends jspb.Message {
|
|
496
|
-
getHeight(): number;
|
|
497
|
-
setHeight(value: number): void;
|
|
498
|
-
|
|
499
|
-
serializeBinary(): Uint8Array;
|
|
500
|
-
toObject(includeInstance?: boolean): TRequestEndBlock;
|
|
501
|
-
static toObject(includeInstance: boolean, msg: RequestEndBlock): TRequestEndBlock;
|
|
502
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
503
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
504
|
-
static serializeBinaryToWriter(message: RequestEndBlock, writer: jspb.BinaryWriter): void;
|
|
505
|
-
static deserializeBinary(bytes: Uint8Array): RequestEndBlock;
|
|
506
|
-
static deserializeBinaryFromReader(message: RequestEndBlock, reader: jspb.BinaryReader): RequestEndBlock;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
104
|
export type TRequestEndBlock = {
|
|
510
105
|
height: number,
|
|
511
106
|
}
|
|
512
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "Typescript definitions generated from protobuf",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ocap",
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@types/bn.js": "^5.2.0",
|
|
14
|
+
"bn.js": "5.2.2",
|
|
13
15
|
"google-protobuf": "3.21.0"
|
|
14
16
|
},
|
|
15
17
|
"resolutions": {},
|
|
16
18
|
"devDependencies": {
|
|
17
|
-
"@types/node": "^22.7.5"
|
|
18
|
-
"typescript": "^5.6.2"
|
|
19
|
+
"@types/node": "^22.7.5"
|
|
19
20
|
},
|
|
20
21
|
"author": {
|
|
21
22
|
"name": "wangshijun",
|
|
@@ -32,7 +33,12 @@
|
|
|
32
33
|
"type": "git",
|
|
33
34
|
"url": "git+https://github.com/ArcBlock/blockchain.git"
|
|
34
35
|
},
|
|
35
|
-
"scripts": {
|
|
36
|
+
"scripts": {
|
|
37
|
+
"lint": "biome check",
|
|
38
|
+
"lint:fix": "biome check --write",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"test": "bun test"
|
|
41
|
+
},
|
|
36
42
|
"bugs": {
|
|
37
43
|
"url": "https://github.com/ArcBlock/blockchain/issues"
|
|
38
44
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// core/types/tests/interfaces-reexport.spec.ts
|
|
2
|
+
// Tests for interfaces that extend/re-export Proto types
|
|
3
|
+
|
|
4
|
+
import { describe, expect, test } from 'bun:test';
|
|
5
|
+
// Import from interfaces (user perspective)
|
|
6
|
+
import type { IStateContext } from '../interfaces';
|
|
7
|
+
// Import from Proto
|
|
8
|
+
import type { TMultisig } from '../lib/type_pb';
|
|
9
|
+
|
|
10
|
+
describe('interfaces extending Proto types', () => {
|
|
11
|
+
describe('IStateContext extends TStateContext', () => {
|
|
12
|
+
test('IStateContext should have genesisTx and renaissanceTx from TStateContext', () => {
|
|
13
|
+
const context: IStateContext = {
|
|
14
|
+
genesisTx: 'tx1',
|
|
15
|
+
renaissanceTx: 'tx2',
|
|
16
|
+
};
|
|
17
|
+
expect(context.genesisTx).toBe('tx1');
|
|
18
|
+
expect(context.renaissanceTx).toBe('tx2');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('IStateContext should accept string timestamps', () => {
|
|
22
|
+
const context: IStateContext = {
|
|
23
|
+
genesisTx: 'tx1',
|
|
24
|
+
renaissanceTx: 'tx2',
|
|
25
|
+
genesisTime: '2024-01-01T00:00:00Z',
|
|
26
|
+
renaissanceTime: '2024-01-02T00:00:00Z',
|
|
27
|
+
};
|
|
28
|
+
expect(context.genesisTime).toBe('2024-01-01T00:00:00Z');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('IStateContext should accept Date timestamps', () => {
|
|
32
|
+
const now = new Date();
|
|
33
|
+
const context: IStateContext = {
|
|
34
|
+
genesisTx: 'tx1',
|
|
35
|
+
renaissanceTx: 'tx2',
|
|
36
|
+
genesisTime: now,
|
|
37
|
+
renaissanceTime: now,
|
|
38
|
+
};
|
|
39
|
+
expect(context.genesisTime).toBe(now);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('IStateContext should accept number timestamps', () => {
|
|
43
|
+
const ts = Date.now();
|
|
44
|
+
const context: IStateContext = {
|
|
45
|
+
genesisTx: 'tx1',
|
|
46
|
+
renaissanceTx: 'tx2',
|
|
47
|
+
genesisTime: ts,
|
|
48
|
+
renaissanceTime: ts,
|
|
49
|
+
};
|
|
50
|
+
expect(context.genesisTime).toBe(ts);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('TMultisig from Proto', () => {
|
|
55
|
+
test('TMultisig should accept Uint8Array pk/signature', () => {
|
|
56
|
+
const proto: TMultisig = {
|
|
57
|
+
signer: 'z123',
|
|
58
|
+
pk: new Uint8Array([1, 2, 3]),
|
|
59
|
+
signature: new Uint8Array([4, 5, 6]),
|
|
60
|
+
delegator: 'z456',
|
|
61
|
+
data: { typeUrl: '', value: new Uint8Array() },
|
|
62
|
+
};
|
|
63
|
+
expect(proto.signer).toBe('z123');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('TMultisig should work with string pk/signature', () => {
|
|
67
|
+
const proto: TMultisig = {
|
|
68
|
+
signer: 'z123',
|
|
69
|
+
pk: 'base64pk',
|
|
70
|
+
signature: 'base64sig',
|
|
71
|
+
delegator: '',
|
|
72
|
+
};
|
|
73
|
+
expect(proto.pk).toBe('base64pk');
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|