-
Notifications
You must be signed in to change notification settings - Fork 1
/
bytes-data.ts
47 lines (37 loc) · 1.1 KB
/
bytes-data.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
// Code generated by protoc-gen-as. DO NOT EDIT.
// Versions:
// protoc-gen-as v1.3.0
// protoc v4.25.1
import { Protobuf, Reader, Writer } from 'as-proto/assembly';
export class BytesData {
static encode(message: BytesData, writer: Writer): void {
writer.uint32(10);
writer.bytes(message.data);
}
static decode(reader: Reader, length: i32): BytesData {
const end: usize = length < 0 ? reader.end : reader.ptr + length;
const message = new BytesData();
while (reader.ptr < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.data = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
}
data: Uint8Array;
constructor(data: Uint8Array = new Uint8Array(0)) {
this.data = data;
}
}
export function encodeBytesData(message: BytesData): Uint8Array {
return Protobuf.encode(message, BytesData.encode);
}
export function decodeBytesData(buffer: Uint8Array): BytesData {
return Protobuf.decode<BytesData>(buffer, BytesData.decode);
}