// @generated by protobuf-ts 2.9.0 // @generated from protobuf file "session_status.proto" (package "pb", syntax proto3) // tslint:disable import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; import type { IBinaryWriter } from "@protobuf-ts/runtime"; import { WireType } from "@protobuf-ts/runtime"; import type { BinaryReadOptions } from "@protobuf-ts/runtime"; import type { IBinaryReader } from "@protobuf-ts/runtime"; import { UnknownFieldHandler } from "@protobuf-ts/runtime"; import type { PartialMessage } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime"; /** * * Session status update request * * @generated from protobuf message pb.SessionStatus */ export interface SessionStatus { /** * Node public key * * @generated from protobuf field: bytes publicKey = 1; */ publicKey: Uint8Array; /** * Reserved gas number (incremental after each status update) * * @generated from protobuf field: uint32 gas = 2; */ gas: number; /** * Session identifier (secret value) * * @generated from protobuf field: bytes sessionId = 3; */ sessionId: Uint8Array; /** * Session expiration time in UNIX milliseconds * * @generated from protobuf field: uint64 endOfEpoch = 4; */ endOfEpoch: bigint; /** * Bucket Id for which session * * @generated from protobuf field: uint32 bucketId = 5; */ bucketId: number; } /** * * Session status record in storage * * @generated from protobuf message pb.SessionStatusRecord */ export interface SessionStatusRecord { /** * Session status * * @generated from protobuf field: pb.SessionStatus sessionStatus = 1; */ sessionStatus?: SessionStatus; /** * Payer publicKey * * @generated from protobuf field: bytes publicKey = 2; */ publicKey: Uint8Array; /** * Payer signature * * @generated from protobuf field: bytes signature = 3; */ signature: Uint8Array; /** * timestamp of request in UNIX milliseconds. * * @generated from protobuf field: uint64 timestamp = 4; */ timestamp: bigint; } // @generated message type with reflection information, may provide speed optimized methods class SessionStatus$Type extends MessageType { constructor() { super("pb.SessionStatus", [ { no: 1, name: "publicKey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 2, name: "gas", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, { no: 3, name: "sessionId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 4, name: "endOfEpoch", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 5, name: "bucketId", kind: "scalar", T: 13 /*ScalarType.UINT32*/ } ]); } create(value?: PartialMessage): SessionStatus { const message = { publicKey: new Uint8Array(0), gas: 0, sessionId: new Uint8Array(0), endOfEpoch: 0n, bucketId: 0 }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SessionStatus): SessionStatus { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* bytes publicKey */ 1: message.publicKey = reader.bytes(); break; case /* uint32 gas */ 2: message.gas = reader.uint32(); break; case /* bytes sessionId */ 3: message.sessionId = reader.bytes(); break; case /* uint64 endOfEpoch */ 4: message.endOfEpoch = reader.uint64().toBigInt(); break; case /* uint32 bucketId */ 5: message.bucketId = reader.uint32(); break; default: let u = options.readUnknownField; if (u === "throw") throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); let d = reader.skip(wireType); if (u !== false) (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message: SessionStatus, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* bytes publicKey = 1; */ if (message.publicKey.length) writer.tag(1, WireType.LengthDelimited).bytes(message.publicKey); /* uint32 gas = 2; */ if (message.gas !== 0) writer.tag(2, WireType.Varint).uint32(message.gas); /* bytes sessionId = 3; */ if (message.sessionId.length) writer.tag(3, WireType.LengthDelimited).bytes(message.sessionId); /* uint64 endOfEpoch = 4; */ if (message.endOfEpoch !== 0n) writer.tag(4, WireType.Varint).uint64(message.endOfEpoch); /* uint32 bucketId = 5; */ if (message.bucketId !== 0) writer.tag(5, WireType.Varint).uint32(message.bucketId); let u = options.writeUnknownFields; if (u !== false) (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message pb.SessionStatus */ export const SessionStatus = new SessionStatus$Type(); // @generated message type with reflection information, may provide speed optimized methods class SessionStatusRecord$Type extends MessageType { constructor() { super("pb.SessionStatusRecord", [ { no: 1, name: "sessionStatus", kind: "message", T: () => SessionStatus }, { no: 2, name: "publicKey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 3, name: "signature", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 4, name: "timestamp", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ } ]); } create(value?: PartialMessage): SessionStatusRecord { const message = { publicKey: new Uint8Array(0), signature: new Uint8Array(0), timestamp: 0n }; globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) reflectionMergePartial(this, message, value); return message; } internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SessionStatusRecord): SessionStatusRecord { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* pb.SessionStatus sessionStatus */ 1: message.sessionStatus = SessionStatus.internalBinaryRead(reader, reader.uint32(), options, message.sessionStatus); break; case /* bytes publicKey */ 2: message.publicKey = reader.bytes(); break; case /* bytes signature */ 3: message.signature = reader.bytes(); break; case /* uint64 timestamp */ 4: message.timestamp = reader.uint64().toBigInt(); break; default: let u = options.readUnknownField; if (u === "throw") throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); let d = reader.skip(wireType); if (u !== false) (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message: SessionStatusRecord, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* pb.SessionStatus sessionStatus = 1; */ if (message.sessionStatus) SessionStatus.internalBinaryWrite(message.sessionStatus, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); /* bytes publicKey = 2; */ if (message.publicKey.length) writer.tag(2, WireType.LengthDelimited).bytes(message.publicKey); /* bytes signature = 3; */ if (message.signature.length) writer.tag(3, WireType.LengthDelimited).bytes(message.signature); /* uint64 timestamp = 4; */ if (message.timestamp !== 0n) writer.tag(4, WireType.Varint).uint64(message.timestamp); let u = options.writeUnknownFields; if (u !== false) (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message pb.SessionStatusRecord */ export const SessionStatusRecord = new SessionStatusRecord$Type();