@bandprotocol/bandchain.js
Version:
Library for interacting with BandChain in browser and Node.js environments
532 lines (531 loc) • 19.5 kB
text/typescript
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.20.3
* source: tendermint/crypto/proof.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../gogoproto/gogo";
import * as pb_1 from "google-protobuf";
export namespace tendermint.crypto {
export class Proof extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
total?: number;
index?: number;
leaf_hash?: Uint8Array;
aunts?: Uint8Array[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("total" in data && data.total != undefined) {
this.total = data.total;
}
if ("index" in data && data.index != undefined) {
this.index = data.index;
}
if ("leaf_hash" in data && data.leaf_hash != undefined) {
this.leaf_hash = data.leaf_hash;
}
if ("aunts" in data && data.aunts != undefined) {
this.aunts = data.aunts;
}
}
}
get total() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set total(value: number) {
pb_1.Message.setField(this, 1, value);
}
get index() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set index(value: number) {
pb_1.Message.setField(this, 2, value);
}
get leaf_hash() {
return pb_1.Message.getFieldWithDefault(this, 3, new Uint8Array(0)) as Uint8Array;
}
set leaf_hash(value: Uint8Array) {
pb_1.Message.setField(this, 3, value);
}
get aunts() {
return pb_1.Message.getFieldWithDefault(this, 4, []) as Uint8Array[];
}
set aunts(value: Uint8Array[]) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
total?: number;
index?: number;
leaf_hash?: Uint8Array;
aunts?: Uint8Array[];
}): Proof {
const message = new Proof({});
if (data.total != null) {
message.total = data.total;
}
if (data.index != null) {
message.index = data.index;
}
if (data.leaf_hash != null) {
message.leaf_hash = data.leaf_hash;
}
if (data.aunts != null) {
message.aunts = data.aunts;
}
return message;
}
toObject() {
const data: {
total?: number;
index?: number;
leaf_hash?: Uint8Array;
aunts?: Uint8Array[];
} = {};
if (this.total != null) {
data.total = this.total;
}
if (this.index != null) {
data.index = this.index;
}
if (this.leaf_hash != null) {
data.leaf_hash = this.leaf_hash;
}
if (this.aunts != null) {
data.aunts = this.aunts;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.total != 0)
writer.writeInt64(1, this.total);
if (this.index != 0)
writer.writeInt64(2, this.index);
if (this.leaf_hash.length)
writer.writeBytes(3, this.leaf_hash);
if (this.aunts.length)
writer.writeRepeatedBytes(4, this.aunts);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Proof {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Proof();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.total = reader.readInt64();
break;
case 2:
message.index = reader.readInt64();
break;
case 3:
message.leaf_hash = reader.readBytes();
break;
case 4:
pb_1.Message.addToRepeatedField(message, 4, reader.readBytes());
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Proof {
return Proof.deserialize(bytes);
}
}
export class ValueOp extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
key?: Uint8Array;
proof?: Proof;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("key" in data && data.key != undefined) {
this.key = data.key;
}
if ("proof" in data && data.proof != undefined) {
this.proof = data.proof;
}
}
}
get key() {
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
}
set key(value: Uint8Array) {
pb_1.Message.setField(this, 1, value);
}
get proof() {
return pb_1.Message.getWrapperField(this, Proof, 2) as Proof;
}
set proof(value: Proof) {
pb_1.Message.setWrapperField(this, 2, value);
}
get has_proof() {
return pb_1.Message.getField(this, 2) != null;
}
static fromObject(data: {
key?: Uint8Array;
proof?: ReturnType<typeof Proof.prototype.toObject>;
}): ValueOp {
const message = new ValueOp({});
if (data.key != null) {
message.key = data.key;
}
if (data.proof != null) {
message.proof = Proof.fromObject(data.proof);
}
return message;
}
toObject() {
const data: {
key?: Uint8Array;
proof?: ReturnType<typeof Proof.prototype.toObject>;
} = {};
if (this.key != null) {
data.key = this.key;
}
if (this.proof != null) {
data.proof = this.proof.toObject();
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.key.length)
writer.writeBytes(1, this.key);
if (this.has_proof)
writer.writeMessage(2, this.proof, () => this.proof.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ValueOp {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ValueOp();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.key = reader.readBytes();
break;
case 2:
reader.readMessage(message.proof, () => message.proof = Proof.deserialize(reader));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): ValueOp {
return ValueOp.deserialize(bytes);
}
}
export class DominoOp extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
key?: string;
input?: string;
output?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("key" in data && data.key != undefined) {
this.key = data.key;
}
if ("input" in data && data.input != undefined) {
this.input = data.input;
}
if ("output" in data && data.output != undefined) {
this.output = data.output;
}
}
}
get key() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set key(value: string) {
pb_1.Message.setField(this, 1, value);
}
get input() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set input(value: string) {
pb_1.Message.setField(this, 2, value);
}
get output() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set output(value: string) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
key?: string;
input?: string;
output?: string;
}): DominoOp {
const message = new DominoOp({});
if (data.key != null) {
message.key = data.key;
}
if (data.input != null) {
message.input = data.input;
}
if (data.output != null) {
message.output = data.output;
}
return message;
}
toObject() {
const data: {
key?: string;
input?: string;
output?: string;
} = {};
if (this.key != null) {
data.key = this.key;
}
if (this.input != null) {
data.input = this.input;
}
if (this.output != null) {
data.output = this.output;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.key.length)
writer.writeString(1, this.key);
if (this.input.length)
writer.writeString(2, this.input);
if (this.output.length)
writer.writeString(3, this.output);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DominoOp {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DominoOp();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.key = reader.readString();
break;
case 2:
message.input = reader.readString();
break;
case 3:
message.output = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): DominoOp {
return DominoOp.deserialize(bytes);
}
}
export class ProofOp extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
type?: string;
key?: Uint8Array;
data?: Uint8Array;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("type" in data && data.type != undefined) {
this.type = data.type;
}
if ("key" in data && data.key != undefined) {
this.key = data.key;
}
if ("data" in data && data.data != undefined) {
this.data = data.data;
}
}
}
get type() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set type(value: string) {
pb_1.Message.setField(this, 1, value);
}
get key() {
return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array;
}
set key(value: Uint8Array) {
pb_1.Message.setField(this, 2, value);
}
get data() {
return pb_1.Message.getFieldWithDefault(this, 3, new Uint8Array(0)) as Uint8Array;
}
set data(value: Uint8Array) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
type?: string;
key?: Uint8Array;
data?: Uint8Array;
}): ProofOp {
const message = new ProofOp({});
if (data.type != null) {
message.type = data.type;
}
if (data.key != null) {
message.key = data.key;
}
if (data.data != null) {
message.data = data.data;
}
return message;
}
toObject() {
const data: {
type?: string;
key?: Uint8Array;
data?: Uint8Array;
} = {};
if (this.type != null) {
data.type = this.type;
}
if (this.key != null) {
data.key = this.key;
}
if (this.data != null) {
data.data = this.data;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.type.length)
writer.writeString(1, this.type);
if (this.key.length)
writer.writeBytes(2, this.key);
if (this.data.length)
writer.writeBytes(3, this.data);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProofOp {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProofOp();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.type = reader.readString();
break;
case 2:
message.key = reader.readBytes();
break;
case 3:
message.data = reader.readBytes();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): ProofOp {
return ProofOp.deserialize(bytes);
}
}
export class ProofOps extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
ops?: ProofOp[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("ops" in data && data.ops != undefined) {
this.ops = data.ops;
}
}
}
get ops() {
return pb_1.Message.getRepeatedWrapperField(this, ProofOp, 1) as ProofOp[];
}
set ops(value: ProofOp[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
static fromObject(data: {
ops?: ReturnType<typeof ProofOp.prototype.toObject>[];
}): ProofOps {
const message = new ProofOps({});
if (data.ops != null) {
message.ops = data.ops.map(item => ProofOp.fromObject(item));
}
return message;
}
toObject() {
const data: {
ops?: ReturnType<typeof ProofOp.prototype.toObject>[];
} = {};
if (this.ops != null) {
data.ops = this.ops.map((item: ProofOp) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.ops.length)
writer.writeRepeatedMessage(1, this.ops, (item: ProofOp) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProofOps {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProofOps();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.ops, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProofOp.deserialize(reader), ProofOp));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): ProofOps {
return ProofOps.deserialize(bytes);
}
}
}