@bandprotocol/bandchain.js
Version:
TypeScript library for Cosmos SDK and BandChain
76 lines (75 loc) • 2.48 kB
JavaScript
//@ts-nocheck
import { GrantAuthorization } from "./authz";
import { BinaryReader, BinaryWriter } from "../../../binary";
function createBaseGenesisState() {
return {
authorization: []
};
}
export const GenesisState = {
typeUrl: "/cosmos.authz.v1beta1.GenesisState",
encode(message, writer = BinaryWriter.create()) {
for (const v of message.authorization) {
GrantAuthorization.encode(v, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGenesisState();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.authorization.push(GrantAuthorization.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseGenesisState();
message.authorization = object.authorization?.map(e => GrantAuthorization.fromPartial(e)) || [];
return message;
},
fromAmino(object) {
const message = createBaseGenesisState();
message.authorization = object.authorization?.map(e => GrantAuthorization.fromAmino(e)) || [];
return message;
},
toAmino(message) {
const obj = {};
if (message.authorization) {
obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toAmino(e) : undefined);
}
else {
obj.authorization = message.authorization;
}
return obj;
},
fromAminoMsg(object) {
return GenesisState.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/GenesisState",
value: GenesisState.toAmino(message)
};
},
fromProtoMsg(message) {
return GenesisState.decode(message.value);
},
toProto(message) {
return GenesisState.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/cosmos.authz.v1beta1.GenesisState",
value: GenesisState.encode(message).finish()
};
}
};