// @generated by protobuf-ts 2.9.0 // @generated from protobuf file "ack.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"; /** * * Acknowledgment data * * @generated from protobuf message pb.Ack */ export interface Ack { /** * user timestamp of request in UNIX milliseconds. * * @generated from protobuf field: uint64 timestamp = 1; */ timestamp: bigint; /** * node public key where gas was used * * @generated from protobuf field: bytes publicKey = 2; */ publicKey: Uint8Array; /** * confirmed used gas * * @generated from protobuf field: uint64 gas = 3; */ gas: bigint; /** * nonce for avoiding ack duplicates * * @generated from protobuf field: bytes nonce = 4; */ nonce: Uint8Array; /** * request id for log record * * @generated from protobuf field: string requestId = 5; */ requestId: string; /** * The CID of the piece. * * @generated from protobuf field: string cid = 6; */ cid: string; /** * session id * * @generated from protobuf field: bytes sessionId = 7; */ sessionId: Uint8Array; /** * signature of acknowledgment data * sign(CID(requestId) + timestamp + gas + nonce + sessionID) * * @generated from protobuf field: bytes signature = 8; */ signature: Uint8Array; /** * The name of the signature scheme (sr25519, ed25519). * Default and recommended value: "" or "sr25519". * * @generated from protobuf field: string scheme = 9; */ scheme: string; /** * The ID of the hashing algorithm as per multiformats/multihash. * Default and recommended value: 0 or 0xb220, meaning blake2b-256. * * @generated from protobuf field: uint64 multiHashType = 10; */ multiHashType: bigint; /** * list of chunk cIds, requested by client * * @generated from protobuf field: repeated string chunks = 11; */ chunks: string[]; } /** * @generated from protobuf message pb.AckRecord */ export interface AckRecord { /** * acknowledgment data * * @generated from protobuf field: pb.Ack ack = 1; */ ack?: Ack; /** * user public key * * @generated from protobuf field: bytes publicKey = 2; */ publicKey: Uint8Array; /** * timestamp when record was saved in UNIX nanoseconds * * @generated from protobuf field: uint64 timestamp = 3 [jstype = JS_STRING]; */ timestamp: string; } /** * * A ack records list * * @generated from protobuf message pb.AckRecordList */ export interface AckRecordList { /** * @generated from protobuf field: repeated pb.AckRecord ackRecords = 1; */ ackRecords: AckRecord[]; } // @generated message type with reflection information, may provide speed optimized methods class Ack$Type extends MessageType { constructor() { super("pb.Ack", [ { no: 1, name: "timestamp", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 2, name: "publicKey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 3, name: "gas", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 4, name: "nonce", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 5, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 6, name: "cid", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 7, name: "sessionId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 8, name: "signature", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 9, name: "scheme", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 10, name: "multiHashType", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 11, name: "chunks", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ } ]); } create(value?: PartialMessage): Ack { const message = { timestamp: 0n, publicKey: new Uint8Array(0), gas: 0n, nonce: new Uint8Array(0), requestId: "", cid: "", sessionId: new Uint8Array(0), signature: new Uint8Array(0), scheme: "", multiHashType: 0n, chunks: [] }; 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?: Ack): Ack { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* uint64 timestamp */ 1: message.timestamp = reader.uint64().toBigInt(); break; case /* bytes publicKey */ 2: message.publicKey = reader.bytes(); break; case /* uint64 gas */ 3: message.gas = reader.uint64().toBigInt(); break; case /* bytes nonce */ 4: message.nonce = reader.bytes(); break; case /* string requestId */ 5: message.requestId = reader.string(); break; case /* string cid */ 6: message.cid = reader.string(); break; case /* bytes sessionId */ 7: message.sessionId = reader.bytes(); break; case /* bytes signature */ 8: message.signature = reader.bytes(); break; case /* string scheme */ 9: message.scheme = reader.string(); break; case /* uint64 multiHashType */ 10: message.multiHashType = reader.uint64().toBigInt(); break; case /* repeated string chunks */ 11: message.chunks.push(reader.string()); 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: Ack, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* uint64 timestamp = 1; */ if (message.timestamp !== 0n) writer.tag(1, WireType.Varint).uint64(message.timestamp); /* bytes publicKey = 2; */ if (message.publicKey.length) writer.tag(2, WireType.LengthDelimited).bytes(message.publicKey); /* uint64 gas = 3; */ if (message.gas !== 0n) writer.tag(3, WireType.Varint).uint64(message.gas); /* bytes nonce = 4; */ if (message.nonce.length) writer.tag(4, WireType.LengthDelimited).bytes(message.nonce); /* string requestId = 5; */ if (message.requestId !== "") writer.tag(5, WireType.LengthDelimited).string(message.requestId); /* string cid = 6; */ if (message.cid !== "") writer.tag(6, WireType.LengthDelimited).string(message.cid); /* bytes sessionId = 7; */ if (message.sessionId.length) writer.tag(7, WireType.LengthDelimited).bytes(message.sessionId); /* bytes signature = 8; */ if (message.signature.length) writer.tag(8, WireType.LengthDelimited).bytes(message.signature); /* string scheme = 9; */ if (message.scheme !== "") writer.tag(9, WireType.LengthDelimited).string(message.scheme); /* uint64 multiHashType = 10; */ if (message.multiHashType !== 0n) writer.tag(10, WireType.Varint).uint64(message.multiHashType); /* repeated string chunks = 11; */ for (let i = 0; i < message.chunks.length; i++) writer.tag(11, WireType.LengthDelimited).string(message.chunks[i]); let u = options.writeUnknownFields; if (u !== false) (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message pb.Ack */ export const Ack = new Ack$Type(); // @generated message type with reflection information, may provide speed optimized methods class AckRecord$Type extends MessageType { constructor() { super("pb.AckRecord", [ { no: 1, name: "ack", kind: "message", T: () => Ack }, { no: 2, name: "publicKey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, { no: 3, name: "timestamp", kind: "scalar", T: 4 /*ScalarType.UINT64*/ } ]); } create(value?: PartialMessage): AckRecord { const message = { publicKey: new Uint8Array(0), timestamp: "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?: AckRecord): AckRecord { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* pb.Ack ack */ 1: message.ack = Ack.internalBinaryRead(reader, reader.uint32(), options, message.ack); break; case /* bytes publicKey */ 2: message.publicKey = reader.bytes(); break; case /* uint64 timestamp = 3 [jstype = JS_STRING];*/ 3: message.timestamp = reader.uint64().toString(); 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: AckRecord, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* pb.Ack ack = 1; */ if (message.ack) Ack.internalBinaryWrite(message.ack, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); /* bytes publicKey = 2; */ if (message.publicKey.length) writer.tag(2, WireType.LengthDelimited).bytes(message.publicKey); /* uint64 timestamp = 3 [jstype = JS_STRING]; */ if (message.timestamp !== "0") writer.tag(3, 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.AckRecord */ export const AckRecord = new AckRecord$Type(); // @generated message type with reflection information, may provide speed optimized methods class AckRecordList$Type extends MessageType { constructor() { super("pb.AckRecordList", [ { no: 1, name: "ackRecords", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => AckRecord } ]); } create(value?: PartialMessage): AckRecordList { const message = { ackRecords: [] }; 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?: AckRecordList): AckRecordList { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* repeated pb.AckRecord ackRecords */ 1: message.ackRecords.push(AckRecord.internalBinaryRead(reader, reader.uint32(), options)); 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: AckRecordList, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { /* repeated pb.AckRecord ackRecords = 1; */ for (let i = 0; i < message.ackRecords.length; i++) AckRecord.internalBinaryWrite(message.ackRecords[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); let u = options.writeUnknownFields; if (u !== false) (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message pb.AckRecordList */ export const AckRecordList = new AckRecordList$Type();