@bandprotocol/bandchain.js
Version:
Library for interacting with BandChain in browser and Node.js environments
144 lines (143 loc) • 5.7 kB
text/typescript
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.20.3
* source: ibc/lightclients/wasm/v1/genesis.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 ibc.lightclients.wasm.v1 {
export class GenesisState extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
contracts?: Contract[];
}) {
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 ("contracts" in data && data.contracts != undefined) {
this.contracts = data.contracts;
}
}
}
get contracts() {
return pb_1.Message.getRepeatedWrapperField(this, Contract, 1) as Contract[];
}
set contracts(value: Contract[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
static fromObject(data: {
contracts?: ReturnType<typeof Contract.prototype.toObject>[];
}): GenesisState {
const message = new GenesisState({});
if (data.contracts != null) {
message.contracts = data.contracts.map(item => Contract.fromObject(item));
}
return message;
}
toObject() {
const data: {
contracts?: ReturnType<typeof Contract.prototype.toObject>[];
} = {};
if (this.contracts != null) {
data.contracts = this.contracts.map((item: Contract) => 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.contracts.length)
writer.writeRepeatedMessage(1, this.contracts, (item: Contract) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GenesisState {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GenesisState();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.contracts, () => pb_1.Message.addToRepeatedWrapperField(message, 1, Contract.deserialize(reader), Contract));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): GenesisState {
return GenesisState.deserialize(bytes);
}
}
export class Contract extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
code_bytes?: 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 ("code_bytes" in data && data.code_bytes != undefined) {
this.code_bytes = data.code_bytes;
}
}
}
get code_bytes() {
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
}
set code_bytes(value: Uint8Array) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
code_bytes?: Uint8Array;
}): Contract {
const message = new Contract({});
if (data.code_bytes != null) {
message.code_bytes = data.code_bytes;
}
return message;
}
toObject() {
const data: {
code_bytes?: Uint8Array;
} = {};
if (this.code_bytes != null) {
data.code_bytes = this.code_bytes;
}
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.code_bytes.length)
writer.writeBytes(1, this.code_bytes);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Contract {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Contract();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.code_bytes = reader.readBytes();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Contract {
return Contract.deserialize(bytes);
}
}
}