UNPKG

interchainjs

Version:

InterchainJS is a JavaScript library for interacting with Cosmos SDK based blockchains.

179 lines (178 loc) 6.25 kB
import { Any } from "../../../google/protobuf/any"; import { BaseAccount } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { GlobalDecoderRegistry } from "../../../registry"; function createBaseQueryLegacyAccount() { return {}; } /** * QueryLegacyAccount defines a query that can be implemented by an x/account * to return an auth understandable representation of an account. * This query is only used for accounts retro-compatibility at gRPC * level, the state machine must not make any assumptions around this. * @name QueryLegacyAccount * @package cosmos.auth.v1beta1 * @see proto type: cosmos.auth.v1beta1.QueryLegacyAccount */ export const QueryLegacyAccount = { typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccount", aminoType: "cosmos-sdk/QueryLegacyAccount", is(o) { return o && o.$typeUrl === QueryLegacyAccount.typeUrl; }, isAmino(o) { return o && o.$typeUrl === QueryLegacyAccount.typeUrl; }, encode(_, writer = BinaryWriter.create()) { 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 = createBaseQueryLegacyAccount(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_) { const message = createBaseQueryLegacyAccount(); return message; }, fromAmino(_) { const message = createBaseQueryLegacyAccount(); return message; }, toAmino(_) { const obj = {}; return obj; }, fromAminoMsg(object) { return QueryLegacyAccount.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/QueryLegacyAccount", value: QueryLegacyAccount.toAmino(message) }; }, fromProtoMsg(message) { return QueryLegacyAccount.decode(message.value); }, toProto(message) { return QueryLegacyAccount.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccount", value: QueryLegacyAccount.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseQueryLegacyAccountResponse() { return { account: undefined, base: undefined }; } /** * QueryLegacyAccountResponse defines the response type of the * `QueryLegacyAccount` query. * @name QueryLegacyAccountResponse * @package cosmos.auth.v1beta1 * @see proto type: cosmos.auth.v1beta1.QueryLegacyAccountResponse */ export const QueryLegacyAccountResponse = { typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccountResponse", aminoType: "cosmos-sdk/QueryLegacyAccountResponse", is(o) { return o && o.$typeUrl === QueryLegacyAccountResponse.typeUrl; }, isAmino(o) { return o && o.$typeUrl === QueryLegacyAccountResponse.typeUrl; }, encode(message, writer = BinaryWriter.create()) { if (message.account !== undefined) { Any.encode(message.account, writer.uint32(10).fork()).ldelim(); } if (message.base !== undefined) { BaseAccount.encode(message.base, writer.uint32(18).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 = createBaseQueryLegacyAccountResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.account = Any.decode(reader, reader.uint32()); break; case 2: message.base = BaseAccount.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseQueryLegacyAccountResponse(); message.account = object.account !== undefined && object.account !== null ? Any.fromPartial(object.account) : undefined; message.base = object.base !== undefined && object.base !== null ? BaseAccount.fromPartial(object.base) : undefined; return message; }, fromAmino(object) { const message = createBaseQueryLegacyAccountResponse(); if (object.account !== undefined && object.account !== null) { message.account = Any.fromAmino(object.account); } if (object.base !== undefined && object.base !== null) { message.base = BaseAccount.fromAmino(object.base); } return message; }, toAmino(message) { const obj = {}; obj.account = message.account ? Any.toAmino(message.account) : undefined; obj.base = message.base ? BaseAccount.toAmino(message.base) : undefined; return obj; }, fromAminoMsg(object) { return QueryLegacyAccountResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/QueryLegacyAccountResponse", value: QueryLegacyAccountResponse.toAmino(message) }; }, fromProtoMsg(message) { return QueryLegacyAccountResponse.decode(message.value); }, toProto(message) { return QueryLegacyAccountResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccountResponse", value: QueryLegacyAccountResponse.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryLegacyAccountResponse.typeUrl)) { return; } BaseAccount.registerTypeUrl(); } };