//@ts-nocheck
import { Description, DescriptionAmino, DescriptionSDKType, CommissionRates, CommissionRatesAmino, CommissionRatesSDKType } from "./staking";
import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any";
import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin";
import { Timestamp } from "../../../google/protobuf/timestamp";
import { BinaryReader, BinaryWriter } from "../../../binary";
import { isSet, toTimestamp, fromTimestamp, fromJsonTimestamp } from "../../../helpers";
import { JsonSafe } from "../../../json-safe";
import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing";
import { GlobalDecoderRegistry } from "../../../registry";
import { Decimal } from "@cosmjs/math";
/** MsgCreateValidator defines a SDK message for creating a new validator. */
export interface MsgCreateValidator {
description: Description;
commission: CommissionRates;
minSelfDelegation: string;
delegatorAddress: string;
validatorAddress: string;
pubkey?: Any | undefined;
value: Coin;
}
export interface MsgCreateValidatorProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator";
value: Uint8Array;
}
export type MsgCreateValidatorEncoded = Omit<MsgCreateValidator, "pubkey"> & {
pubkey?: AnyProtoMsg | undefined;
};
/** MsgCreateValidator defines a SDK message for creating a new validator. */
export interface MsgCreateValidatorAmino {
description?: DescriptionAmino;
commission?: CommissionRatesAmino;
min_self_delegation?: string;
delegator_address?: string;
validator_address?: string;
pubkey?: AnyAmino;
value?: CoinAmino;
}
export interface MsgCreateValidatorAminoMsg {
type: "cosmos-sdk/MsgCreateValidator";
value: MsgCreateValidatorAmino;
}
/** MsgCreateValidator defines a SDK message for creating a new validator. */
export interface MsgCreateValidatorSDKType {
description: DescriptionSDKType;
commission: CommissionRatesSDKType;
min_self_delegation: string;
delegator_address: string;
validator_address: string;
pubkey?: AnySDKType | undefined;
value: CoinSDKType;
}
/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */
export interface MsgCreateValidatorResponse {}
export interface MsgCreateValidatorResponseProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse";
value: Uint8Array;
}
/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */
export interface MsgCreateValidatorResponseAmino {}
export interface MsgCreateValidatorResponseAminoMsg {
type: "cosmos-sdk/MsgCreateValidatorResponse";
value: MsgCreateValidatorResponseAmino;
}
/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */
export interface MsgCreateValidatorResponseSDKType {}
/** MsgEditValidator defines a SDK message for editing an existing validator. */
export interface MsgEditValidator {
description: Description;
validatorAddress: string;
/**
* We pass a reference to the new commission rate and min self delegation as
* it's not mandatory to update. If not updated, the deserialized rate will be
* zero with no way to distinguish if an update was intended.
* REF: #2373
*/
commissionRate: string;
minSelfDelegation: string;
}
export interface MsgEditValidatorProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator";
value: Uint8Array;
}
/** MsgEditValidator defines a SDK message for editing an existing validator. */
export interface MsgEditValidatorAmino {
description?: DescriptionAmino;
validator_address?: string;
/**
* We pass a reference to the new commission rate and min self delegation as
* it's not mandatory to update. If not updated, the deserialized rate will be
* zero with no way to distinguish if an update was intended.
* REF: #2373
*/
commission_rate?: string;
min_self_delegation?: string;
}
export interface MsgEditValidatorAminoMsg {
type: "cosmos-sdk/MsgEditValidator";
value: MsgEditValidatorAmino;
}
/** MsgEditValidator defines a SDK message for editing an existing validator. */
export interface MsgEditValidatorSDKType {
description: DescriptionSDKType;
validator_address: string;
commission_rate: string;
min_self_delegation: string;
}
/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */
export interface MsgEditValidatorResponse {}
export interface MsgEditValidatorResponseProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse";
value: Uint8Array;
}
/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */
export interface MsgEditValidatorResponseAmino {}
export interface MsgEditValidatorResponseAminoMsg {
type: "cosmos-sdk/MsgEditValidatorResponse";
value: MsgEditValidatorResponseAmino;
}
/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */
export interface MsgEditValidatorResponseSDKType {}
/**
* MsgDelegate defines a SDK message for performing a delegation of coins
* from a delegator to a validator.
*/
export interface MsgDelegate {
delegatorAddress: string;
validatorAddress: string;
amount: Coin;
}
export interface MsgDelegateProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgDelegate";
value: Uint8Array;
}
/**
* MsgDelegate defines a SDK message for performing a delegation of coins
* from a delegator to a validator.
*/
export interface MsgDelegateAmino {
delegator_address?: string;
validator_address?: string;
amount?: CoinAmino;
}
export interface MsgDelegateAminoMsg {
type: "cosmos-sdk/MsgDelegate";
value: MsgDelegateAmino;
}
/**
* MsgDelegate defines a SDK message for performing a delegation of coins
* from a delegator to a validator.
*/
export interface MsgDelegateSDKType {
delegator_address: string;
validator_address: string;
amount: CoinSDKType;
}
/** MsgDelegateResponse defines the Msg/Delegate response type. */
export interface MsgDelegateResponse {}
export interface MsgDelegateResponseProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse";
value: Uint8Array;
}
/** MsgDelegateResponse defines the Msg/Delegate response type. */
export interface MsgDelegateResponseAmino {}
export interface MsgDelegateResponseAminoMsg {
type: "cosmos-sdk/MsgDelegateResponse";
value: MsgDelegateResponseAmino;
}
/** MsgDelegateResponse defines the Msg/Delegate response type. */
export interface MsgDelegateResponseSDKType {}
/**
* MsgBeginRedelegate defines a SDK message for performing a redelegation
* of coins from a delegator and source validator to a destination validator.
*/
export interface MsgBeginRedelegate {
delegatorAddress: string;
validatorSrcAddress: string;
validatorDstAddress: string;
amount: Coin;
}
export interface MsgBeginRedelegateProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate";
value: Uint8Array;
}
/**
* MsgBeginRedelegate defines a SDK message for performing a redelegation
* of coins from a delegator and source validator to a destination validator.
*/
export interface MsgBeginRedelegateAmino {
delegator_address?: string;
validator_src_address?: string;
validator_dst_address?: string;
amount?: CoinAmino;
}
export interface MsgBeginRedelegateAminoMsg {
type: "cosmos-sdk/MsgBeginRedelegate";
value: MsgBeginRedelegateAmino;
}
/**
* MsgBeginRedelegate defines a SDK message for performing a redelegation
* of coins from a delegator and source validator to a destination validator.
*/
export interface MsgBeginRedelegateSDKType {
delegator_address: string;
validator_src_address: string;
validator_dst_address: string;
amount: CoinSDKType;
}
/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */
export interface MsgBeginRedelegateResponse {
completionTime: Date;
}
export interface MsgBeginRedelegateResponseProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse";
value: Uint8Array;
}
/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */
export interface MsgBeginRedelegateResponseAmino {
completion_time?: string;
}
export interface MsgBeginRedelegateResponseAminoMsg {
type: "cosmos-sdk/MsgBeginRedelegateResponse";
value: MsgBeginRedelegateResponseAmino;
}
/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */
export interface MsgBeginRedelegateResponseSDKType {
completion_time: Date;
}
/**
* MsgUndelegate defines a SDK message for performing an undelegation from a
* delegate and a validator.
*/
export interface MsgUndelegate {
delegatorAddress: string;
validatorAddress: string;
amount: Coin;
}
export interface MsgUndelegateProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate";
value: Uint8Array;
}
/**
* MsgUndelegate defines a SDK message for performing an undelegation from a
* delegate and a validator.
*/
export interface MsgUndelegateAmino {
delegator_address?: string;
validator_address?: string;
amount?: CoinAmino;
}
export interface MsgUndelegateAminoMsg {
type: "cosmos-sdk/MsgUndelegate";
value: MsgUndelegateAmino;
}
/**
* MsgUndelegate defines a SDK message for performing an undelegation from a
* delegate and a validator.
*/
export interface MsgUndelegateSDKType {
delegator_address: string;
validator_address: string;
amount: CoinSDKType;
}
/** MsgUndelegateResponse defines the Msg/Undelegate response type. */
export interface MsgUndelegateResponse {
completionTime: Date;
}
export interface MsgUndelegateResponseProtoMsg {
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse";
value: Uint8Array;
}
/** MsgUndelegateResponse defines the Msg/Undelegate response type. */
export interface MsgUndelegateResponseAmino {
completion_time?: string;
}
export interface MsgUndelegateResponseAminoMsg {
type: "cosmos-sdk/MsgUndelegateResponse";
value: MsgUndelegateResponseAmino;
}
/** MsgUndelegateResponse defines the Msg/Undelegate response type. */
export interface MsgUndelegateResponseSDKType {
completion_time: Date;
}
function createBaseMsgCreateValidator(): MsgCreateValidator {
return {
description: Description.fromPartial({}),
commission: CommissionRates.fromPartial({}),
minSelfDelegation: "",
delegatorAddress: "",
validatorAddress: "",
pubkey: undefined,
value: Coin.fromPartial({})
};
}
export const MsgCreateValidator = {
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator",
aminoType: "cosmos-sdk/MsgCreateValidator",
is(o: any): o is MsgCreateValidator {
return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.is(o.description) && CommissionRates.is(o.commission) && typeof o.minSelfDelegation === "string" && typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.value));
},
isSDK(o: any): o is MsgCreateValidatorSDKType {
return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.isSDK(o.description) && CommissionRates.isSDK(o.commission) && typeof o.min_self_delegation === "string" && typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.value));
},
isAmino(o: any): o is MsgCreateValidatorAmino {
return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.isAmino(o.description) && CommissionRates.isAmino(o.commission) && typeof o.min_self_delegation === "string" && typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.value));
},
encode(message: MsgCreateValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.description !== undefined) {
Description.encode(message.description, writer.uint32(10).fork()).ldelim();
}
if (message.commission !== undefined) {
CommissionRates.encode(message.commission, writer.uint32(18).fork()).ldelim();
}
if (message.minSelfDelegation !== "") {
writer.uint32(26).string(message.minSelfDelegation);
}
if (message.delegatorAddress !== "") {
writer.uint32(34).string(message.delegatorAddress);
}
if (message.validatorAddress !== "") {
writer.uint32(42).string(message.validatorAddress);
}
if (message.pubkey !== undefined) {
Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(50).fork()).ldelim();
}
if (message.value !== undefined) {
Coin.encode(message.value, writer.uint32(58).fork()).ldelim();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgCreateValidator();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.description = Description.decode(reader, reader.uint32());
break;
case 2:
message.commission = CommissionRates.decode(reader, reader.uint32());
break;
case 3:
message.minSelfDelegation = reader.string();
break;
case 4:
message.delegatorAddress = reader.string();
break;
case 5:
message.validatorAddress = reader.string();
break;
case 6:
message.pubkey = GlobalDecoderRegistry.unwrapAny(reader);
break;
case 7:
message.value = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgCreateValidator {
return {
description: isSet(object.description) ? Description.fromJSON(object.description) : undefined,
commission: isSet(object.commission) ? CommissionRates.fromJSON(object.commission) : undefined,
minSelfDelegation: isSet(object.minSelfDelegation) ? String(object.minSelfDelegation) : "",
delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "",
validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "",
pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromJSON(object.pubkey) : undefined,
value: isSet(object.value) ? Coin.fromJSON(object.value) : undefined
};
},
toJSON(message: MsgCreateValidator): JsonSafe<MsgCreateValidator> {
const obj: any = {};
message.description !== undefined && (obj.description = message.description ? Description.toJSON(message.description) : undefined);
message.commission !== undefined && (obj.commission = message.commission ? CommissionRates.toJSON(message.commission) : undefined);
message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation);
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined);
message.value !== undefined && (obj.value = message.value ? Coin.toJSON(message.value) : undefined);
return obj;
},
fromPartial(object: Partial<MsgCreateValidator>): MsgCreateValidator {
const message = createBaseMsgCreateValidator();
message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined;
message.commission = object.commission !== undefined && object.commission !== null ? CommissionRates.fromPartial(object.commission) : undefined;
message.minSelfDelegation = object.minSelfDelegation ?? "";
message.delegatorAddress = object.delegatorAddress ?? "";
message.validatorAddress = object.validatorAddress ?? "";
message.pubkey = object.pubkey !== undefined && object.pubkey !== null ? GlobalDecoderRegistry.fromPartial(object.pubkey) : undefined;
message.value = object.value !== undefined && object.value !== null ? Coin.fromPartial(object.value) : undefined;
return message;
},
fromAmino(object: MsgCreateValidatorAmino): MsgCreateValidator {
const message = createBaseMsgCreateValidator();
if (object.description !== undefined && object.description !== null) {
message.description = Description.fromAmino(object.description);
}
if (object.commission !== undefined && object.commission !== null) {
message.commission = CommissionRates.fromAmino(object.commission);
}
if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) {
message.minSelfDelegation = object.min_self_delegation;
}
if (object.delegator_address !== undefined && object.delegator_address !== null) {
message.delegatorAddress = object.delegator_address;
}
if (object.validator_address !== undefined && object.validator_address !== null) {
message.validatorAddress = object.validator_address;
}
if (object.pubkey !== undefined && object.pubkey !== null) {
message.pubkey = encodePubkey(object.pubkey);
}
if (object.value !== undefined && object.value !== null) {
message.value = Coin.fromAmino(object.value);
}
return message;
},
toAmino(message: MsgCreateValidator): MsgCreateValidatorAmino {
const obj: any = {};
obj.description = message.description ? Description.toAmino(message.description) : undefined;
obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined;
obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation;
obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress;
obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress;
obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined;
obj.value = message.value ? Coin.toAmino(message.value) : undefined;
return obj;
},
fromAminoMsg(object: MsgCreateValidatorAminoMsg): MsgCreateValidator {
return MsgCreateValidator.fromAmino(object.value);
},
toAminoMsg(message: MsgCreateValidator): MsgCreateValidatorAminoMsg {
return {
type: "cosmos-sdk/MsgCreateValidator",
value: MsgCreateValidator.toAmino(message)
};
},
fromProtoMsg(message: MsgCreateValidatorProtoMsg): MsgCreateValidator {
return MsgCreateValidator.decode(message.value);
},
toProto(message: MsgCreateValidator): Uint8Array {
return MsgCreateValidator.encode(message).finish();
},
toProtoMsg(message: MsgCreateValidator): MsgCreateValidatorProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator",
value: MsgCreateValidator.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgCreateValidator.typeUrl, MsgCreateValidator);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateValidator.aminoType, MsgCreateValidator.typeUrl);
function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse {
return {};
}
export const MsgCreateValidatorResponse = {
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse",
aminoType: "cosmos-sdk/MsgCreateValidatorResponse",
is(o: any): o is MsgCreateValidatorResponse {
return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl;
},
isSDK(o: any): o is MsgCreateValidatorResponseSDKType {
return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl;
},
isAmino(o: any): o is MsgCreateValidatorResponseAmino {
return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl;
},
encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgCreateValidatorResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgCreateValidatorResponse {
return {};
},
toJSON(_: MsgCreateValidatorResponse): JsonSafe<MsgCreateValidatorResponse> {
const obj: any = {};
return obj;
},
fromPartial(_: Partial<MsgCreateValidatorResponse>): MsgCreateValidatorResponse {
const message = createBaseMsgCreateValidatorResponse();
return message;
},
fromAmino(_: MsgCreateValidatorResponseAmino): MsgCreateValidatorResponse {
const message = createBaseMsgCreateValidatorResponse();
return message;
},
toAmino(_: MsgCreateValidatorResponse): MsgCreateValidatorResponseAmino {
const obj: any = {};
return obj;
},
fromAminoMsg(object: MsgCreateValidatorResponseAminoMsg): MsgCreateValidatorResponse {
return MsgCreateValidatorResponse.fromAmino(object.value);
},
toAminoMsg(message: MsgCreateValidatorResponse): MsgCreateValidatorResponseAminoMsg {
return {
type: "cosmos-sdk/MsgCreateValidatorResponse",
value: MsgCreateValidatorResponse.toAmino(message)
};
},
fromProtoMsg(message: MsgCreateValidatorResponseProtoMsg): MsgCreateValidatorResponse {
return MsgCreateValidatorResponse.decode(message.value);
},
toProto(message: MsgCreateValidatorResponse): Uint8Array {
return MsgCreateValidatorResponse.encode(message).finish();
},
toProtoMsg(message: MsgCreateValidatorResponse): MsgCreateValidatorResponseProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse",
value: MsgCreateValidatorResponse.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgCreateValidatorResponse.typeUrl, MsgCreateValidatorResponse);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateValidatorResponse.aminoType, MsgCreateValidatorResponse.typeUrl);
function createBaseMsgEditValidator(): MsgEditValidator {
return {
description: Description.fromPartial({}),
validatorAddress: "",
commissionRate: "",
minSelfDelegation: ""
};
}
export const MsgEditValidator = {
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator",
aminoType: "cosmos-sdk/MsgEditValidator",
is(o: any): o is MsgEditValidator {
return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.is(o.description) && typeof o.validatorAddress === "string" && typeof o.commissionRate === "string" && typeof o.minSelfDelegation === "string");
},
isSDK(o: any): o is MsgEditValidatorSDKType {
return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.isSDK(o.description) && typeof o.validator_address === "string" && typeof o.commission_rate === "string" && typeof o.min_self_delegation === "string");
},
isAmino(o: any): o is MsgEditValidatorAmino {
return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.isAmino(o.description) && typeof o.validator_address === "string" && typeof o.commission_rate === "string" && typeof o.min_self_delegation === "string");
},
encode(message: MsgEditValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.description !== undefined) {
Description.encode(message.description, writer.uint32(10).fork()).ldelim();
}
if (message.validatorAddress !== "") {
writer.uint32(18).string(message.validatorAddress);
}
if (message.commissionRate !== "") {
writer.uint32(26).string(Decimal.fromUserInput(message.commissionRate, 18).atomics);
}
if (message.minSelfDelegation !== "") {
writer.uint32(34).string(message.minSelfDelegation);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgEditValidator();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.description = Description.decode(reader, reader.uint32());
break;
case 2:
message.validatorAddress = reader.string();
break;
case 3:
message.commissionRate = Decimal.fromAtomics(reader.string(), 18).toString();
break;
case 4:
message.minSelfDelegation = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgEditValidator {
return {
description: isSet(object.description) ? Description.fromJSON(object.description) : undefined,
validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "",
commissionRate: isSet(object.commissionRate) ? String(object.commissionRate) : "",
minSelfDelegation: isSet(object.minSelfDelegation) ? String(object.minSelfDelegation) : ""
};
},
toJSON(message: MsgEditValidator): JsonSafe<MsgEditValidator> {
const obj: any = {};
message.description !== undefined && (obj.description = message.description ? Description.toJSON(message.description) : undefined);
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
message.commissionRate !== undefined && (obj.commissionRate = message.commissionRate);
message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation);
return obj;
},
fromPartial(object: Partial<MsgEditValidator>): MsgEditValidator {
const message = createBaseMsgEditValidator();
message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined;
message.validatorAddress = object.validatorAddress ?? "";
message.commissionRate = object.commissionRate ?? "";
message.minSelfDelegation = object.minSelfDelegation ?? "";
return message;
},
fromAmino(object: MsgEditValidatorAmino): MsgEditValidator {
const message = createBaseMsgEditValidator();
if (object.description !== undefined && object.description !== null) {
message.description = Description.fromAmino(object.description);
}
if (object.validator_address !== undefined && object.validator_address !== null) {
message.validatorAddress = object.validator_address;
}
if (object.commission_rate !== undefined && object.commission_rate !== null) {
message.commissionRate = object.commission_rate;
}
if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) {
message.minSelfDelegation = object.min_self_delegation;
}
return message;
},
toAmino(message: MsgEditValidator): MsgEditValidatorAmino {
const obj: any = {};
obj.description = message.description ? Description.toAmino(message.description) : undefined;
obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress;
obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate;
obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation;
return obj;
},
fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator {
return MsgEditValidator.fromAmino(object.value);
},
toAminoMsg(message: MsgEditValidator): MsgEditValidatorAminoMsg {
return {
type: "cosmos-sdk/MsgEditValidator",
value: MsgEditValidator.toAmino(message)
};
},
fromProtoMsg(message: MsgEditValidatorProtoMsg): MsgEditValidator {
return MsgEditValidator.decode(message.value);
},
toProto(message: MsgEditValidator): Uint8Array {
return MsgEditValidator.encode(message).finish();
},
toProtoMsg(message: MsgEditValidator): MsgEditValidatorProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator",
value: MsgEditValidator.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgEditValidator.typeUrl, MsgEditValidator);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgEditValidator.aminoType, MsgEditValidator.typeUrl);
function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse {
return {};
}
export const MsgEditValidatorResponse = {
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse",
aminoType: "cosmos-sdk/MsgEditValidatorResponse",
is(o: any): o is MsgEditValidatorResponse {
return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl;
},
isSDK(o: any): o is MsgEditValidatorResponseSDKType {
return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl;
},
isAmino(o: any): o is MsgEditValidatorResponseAmino {
return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl;
},
encode(_: MsgEditValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgEditValidatorResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgEditValidatorResponse {
return {};
},
toJSON(_: MsgEditValidatorResponse): JsonSafe<MsgEditValidatorResponse> {
const obj: any = {};
return obj;
},
fromPartial(_: Partial<MsgEditValidatorResponse>): MsgEditValidatorResponse {
const message = createBaseMsgEditValidatorResponse();
return message;
},
fromAmino(_: MsgEditValidatorResponseAmino): MsgEditValidatorResponse {
const message = createBaseMsgEditValidatorResponse();
return message;
},
toAmino(_: MsgEditValidatorResponse): MsgEditValidatorResponseAmino {
const obj: any = {};
return obj;
},
fromAminoMsg(object: MsgEditValidatorResponseAminoMsg): MsgEditValidatorResponse {
return MsgEditValidatorResponse.fromAmino(object.value);
},
toAminoMsg(message: MsgEditValidatorResponse): MsgEditValidatorResponseAminoMsg {
return {
type: "cosmos-sdk/MsgEditValidatorResponse",
value: MsgEditValidatorResponse.toAmino(message)
};
},
fromProtoMsg(message: MsgEditValidatorResponseProtoMsg): MsgEditValidatorResponse {
return MsgEditValidatorResponse.decode(message.value);
},
toProto(message: MsgEditValidatorResponse): Uint8Array {
return MsgEditValidatorResponse.encode(message).finish();
},
toProtoMsg(message: MsgEditValidatorResponse): MsgEditValidatorResponseProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse",
value: MsgEditValidatorResponse.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgEditValidatorResponse.typeUrl, MsgEditValidatorResponse);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgEditValidatorResponse.aminoType, MsgEditValidatorResponse.typeUrl);
function createBaseMsgDelegate(): MsgDelegate {
return {
delegatorAddress: "",
validatorAddress: "",
amount: Coin.fromPartial({})
};
}
export const MsgDelegate = {
typeUrl: "/cosmos.staking.v1beta1.MsgDelegate",
aminoType: "cosmos-sdk/MsgDelegate",
is(o: any): o is MsgDelegate {
return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.amount));
},
isSDK(o: any): o is MsgDelegateSDKType {
return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.amount));
},
isAmino(o: any): o is MsgDelegateAmino {
return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.amount));
},
encode(message: MsgDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.delegatorAddress !== "") {
writer.uint32(10).string(message.delegatorAddress);
}
if (message.validatorAddress !== "") {
writer.uint32(18).string(message.validatorAddress);
}
if (message.amount !== undefined) {
Coin.encode(message.amount, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgDelegate();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.delegatorAddress = reader.string();
break;
case 2:
message.validatorAddress = reader.string();
break;
case 3:
message.amount = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgDelegate {
return {
delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "",
validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "",
amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined
};
},
toJSON(message: MsgDelegate): JsonSafe<MsgDelegate> {
const obj: any = {};
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined);
return obj;
},
fromPartial(object: Partial<MsgDelegate>): MsgDelegate {
const message = createBaseMsgDelegate();
message.delegatorAddress = object.delegatorAddress ?? "";
message.validatorAddress = object.validatorAddress ?? "";
message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined;
return message;
},
fromAmino(object: MsgDelegateAmino): MsgDelegate {
const message = createBaseMsgDelegate();
if (object.delegator_address !== undefined && object.delegator_address !== null) {
message.delegatorAddress = object.delegator_address;
}
if (object.validator_address !== undefined && object.validator_address !== null) {
message.validatorAddress = object.validator_address;
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromAmino(object.amount);
}
return message;
},
toAmino(message: MsgDelegate): MsgDelegateAmino {
const obj: any = {};
obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress;
obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress;
obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined;
return obj;
},
fromAminoMsg(object: MsgDelegateAminoMsg): MsgDelegate {
return MsgDelegate.fromAmino(object.value);
},
toAminoMsg(message: MsgDelegate): MsgDelegateAminoMsg {
return {
type: "cosmos-sdk/MsgDelegate",
value: MsgDelegate.toAmino(message)
};
},
fromProtoMsg(message: MsgDelegateProtoMsg): MsgDelegate {
return MsgDelegate.decode(message.value);
},
toProto(message: MsgDelegate): Uint8Array {
return MsgDelegate.encode(message).finish();
},
toProtoMsg(message: MsgDelegate): MsgDelegateProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgDelegate",
value: MsgDelegate.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgDelegate.typeUrl, MsgDelegate);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgDelegate.aminoType, MsgDelegate.typeUrl);
function createBaseMsgDelegateResponse(): MsgDelegateResponse {
return {};
}
export const MsgDelegateResponse = {
typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse",
aminoType: "cosmos-sdk/MsgDelegateResponse",
is(o: any): o is MsgDelegateResponse {
return o && o.$typeUrl === MsgDelegateResponse.typeUrl;
},
isSDK(o: any): o is MsgDelegateResponseSDKType {
return o && o.$typeUrl === MsgDelegateResponse.typeUrl;
},
isAmino(o: any): o is MsgDelegateResponseAmino {
return o && o.$typeUrl === MsgDelegateResponse.typeUrl;
},
encode(_: MsgDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgDelegateResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgDelegateResponse {
return {};
},
toJSON(_: MsgDelegateResponse): JsonSafe<MsgDelegateResponse> {
const obj: any = {};
return obj;
},
fromPartial(_: Partial<MsgDelegateResponse>): MsgDelegateResponse {
const message = createBaseMsgDelegateResponse();
return message;
},
fromAmino(_: MsgDelegateResponseAmino): MsgDelegateResponse {
const message = createBaseMsgDelegateResponse();
return message;
},
toAmino(_: MsgDelegateResponse): MsgDelegateResponseAmino {
const obj: any = {};
return obj;
},
fromAminoMsg(object: MsgDelegateResponseAminoMsg): MsgDelegateResponse {
return MsgDelegateResponse.fromAmino(object.value);
},
toAminoMsg(message: MsgDelegateResponse): MsgDelegateResponseAminoMsg {
return {
type: "cosmos-sdk/MsgDelegateResponse",
value: MsgDelegateResponse.toAmino(message)
};
},
fromProtoMsg(message: MsgDelegateResponseProtoMsg): MsgDelegateResponse {
return MsgDelegateResponse.decode(message.value);
},
toProto(message: MsgDelegateResponse): Uint8Array {
return MsgDelegateResponse.encode(message).finish();
},
toProtoMsg(message: MsgDelegateResponse): MsgDelegateResponseProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse",
value: MsgDelegateResponse.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgDelegateResponse.typeUrl, MsgDelegateResponse);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgDelegateResponse.aminoType, MsgDelegateResponse.typeUrl);
function createBaseMsgBeginRedelegate(): MsgBeginRedelegate {
return {
delegatorAddress: "",
validatorSrcAddress: "",
validatorDstAddress: "",
amount: Coin.fromPartial({})
};
}
export const MsgBeginRedelegate = {
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate",
aminoType: "cosmos-sdk/MsgBeginRedelegate",
is(o: any): o is MsgBeginRedelegate {
return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string" && Coin.is(o.amount));
},
isSDK(o: any): o is MsgBeginRedelegateSDKType {
return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Coin.isSDK(o.amount));
},
isAmino(o: any): o is MsgBeginRedelegateAmino {
return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Coin.isAmino(o.amount));
},
encode(message: MsgBeginRedelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.delegatorAddress !== "") {
writer.uint32(10).string(message.delegatorAddress);
}
if (message.validatorSrcAddress !== "") {
writer.uint32(18).string(message.validatorSrcAddress);
}
if (message.validatorDstAddress !== "") {
writer.uint32(26).string(message.validatorDstAddress);
}
if (message.amount !== undefined) {
Coin.encode(message.amount, writer.uint32(34).fork()).ldelim();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgBeginRedelegate();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.delegatorAddress = reader.string();
break;
case 2:
message.validatorSrcAddress = reader.string();
break;
case 3:
message.validatorDstAddress = reader.string();
break;
case 4:
message.amount = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgBeginRedelegate {
return {
delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "",
validatorSrcAddress: isSet(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "",
validatorDstAddress: isSet(object.validatorDstAddress) ? String(object.validatorDstAddress) : "",
amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined
};
},
toJSON(message: MsgBeginRedelegate): JsonSafe<MsgBeginRedelegate> {
const obj: any = {};
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress);
message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress);
message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined);
return obj;
},
fromPartial(object: Partial<MsgBeginRedelegate>): MsgBeginRedelegate {
const message = createBaseMsgBeginRedelegate();
message.delegatorAddress = object.delegatorAddress ?? "";
message.validatorSrcAddress = object.validatorSrcAddress ?? "";
message.validatorDstAddress = object.validatorDstAddress ?? "";
message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined;
return message;
},
fromAmino(object: MsgBeginRedelegateAmino): MsgBeginRedelegate {
const message = createBaseMsgBeginRedelegate();
if (object.delegator_address !== undefined && object.delegator_address !== null) {
message.delegatorAddress = object.delegator_address;
}
if (object.validator_src_address !== undefined && object.validator_src_address !== null) {
message.validatorSrcAddress = object.validator_src_address;
}
if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) {
message.validatorDstAddress = object.validator_dst_address;
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromAmino(object.amount);
}
return message;
},
toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino {
const obj: any = {};
obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress;
obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress;
obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress;
obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined;
return obj;
},
fromAminoMsg(object: MsgBeginRedelegateAminoMsg): MsgBeginRedelegate {
return MsgBeginRedelegate.fromAmino(object.value);
},
toAminoMsg(message: MsgBeginRedelegate): MsgBeginRedelegateAminoMsg {
return {
type: "cosmos-sdk/MsgBeginRedelegate",
value: MsgBeginRedelegate.toAmino(message)
};
},
fromProtoMsg(message: MsgBeginRedelegateProtoMsg): MsgBeginRedelegate {
return MsgBeginRedelegate.decode(message.value);
},
toProto(message: MsgBeginRedelegate): Uint8Array {
return MsgBeginRedelegate.encode(message).finish();
},
toProtoMsg(message: MsgBeginRedelegate): MsgBeginRedelegateProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate",
value: MsgBeginRedelegate.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgBeginRedelegate.typeUrl, MsgBeginRedelegate);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgBeginRedelegate.aminoType, MsgBeginRedelegate.typeUrl);
function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse {
return {
completionTime: new Date()
};
}
export const MsgBeginRedelegateResponse = {
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse",
aminoType: "cosmos-sdk/MsgBeginRedelegateResponse",
is(o: any): o is MsgBeginRedelegateResponse {
return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.is(o.completionTime));
},
isSDK(o: any): o is MsgBeginRedelegateResponseSDKType {
return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.isSDK(o.completion_time));
},
isAmino(o: any): o is MsgBeginRedelegateResponseAmino {
return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.isAmino(o.completion_time));
},
encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.completionTime !== undefined) {
Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgBeginRedelegateResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgBeginRedelegateResponse {
return {
completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined
};
},
toJSON(message: MsgBeginRedelegateResponse): JsonSafe<MsgBeginRedelegateResponse> {
const obj: any = {};
message.completionTime !== undefined && (obj.completionTime = message.completionTime.toISOString());
return obj;
},
fromPartial(object: Partial<MsgBeginRedelegateResponse>): MsgBeginRedelegateResponse {
const message = createBaseMsgBeginRedelegateResponse();
message.completionTime = object.completionTime ?? undefined;
return message;
},
fromAmino(object: MsgBeginRedelegateResponseAmino): MsgBeginRedelegateResponse {
const message = createBaseMsgBeginRedelegateResponse();
if (object.completion_time !== undefined && object.completion_time !== null) {
message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time));
}
return message;
},
toAmino(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAmino {
const obj: any = {};
obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined;
return obj;
},
fromAminoMsg(object: MsgBeginRedelegateResponseAminoMsg): MsgBeginRedelegateResponse {
return MsgBeginRedelegateResponse.fromAmino(object.value);
},
toAminoMsg(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAminoMsg {
return {
type: "cosmos-sdk/MsgBeginRedelegateResponse",
value: MsgBeginRedelegateResponse.toAmino(message)
};
},
fromProtoMsg(message: MsgBeginRedelegateResponseProtoMsg): MsgBeginRedelegateResponse {
return MsgBeginRedelegateResponse.decode(message.value);
},
toProto(message: MsgBeginRedelegateResponse): Uint8Array {
return MsgBeginRedelegateResponse.encode(message).finish();
},
toProtoMsg(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse",
value: MsgBeginRedelegateResponse.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgBeginRedelegateResponse.typeUrl, MsgBeginRedelegateResponse);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgBeginRedelegateResponse.aminoType, MsgBeginRedelegateResponse.typeUrl);
function createBaseMsgUndelegate(): MsgUndelegate {
return {
delegatorAddress: "",
validatorAddress: "",
amount: Coin.fromPartial({})
};
}
export const MsgUndelegate = {
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate",
aminoType: "cosmos-sdk/MsgUndelegate",
is(o: any): o is MsgUndelegate {
return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.amount));
},
isSDK(o: any): o is MsgUndelegateSDKType {
return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isSDK(o.amount));
},
isAmino(o: any): o is MsgUndelegateAmino {
return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.amount));
},
encode(message: MsgUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.delegatorAddress !== "") {
writer.uint32(10).string(message.delegatorAddress);
}
if (message.validatorAddress !== "") {
writer.uint32(18).string(message.validatorAddress);
}
if (message.amount !== undefined) {
Coin.encode(message.amount, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgUndelegate();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.delegatorAddress = reader.string();
break;
case 2:
message.validatorAddress = reader.string();
break;
case 3:
message.amount = Coin.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgUndelegate {
return {
delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "",
validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "",
amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined
};
},
toJSON(message: MsgUndelegate): JsonSafe<MsgUndelegate> {
const obj: any = {};
message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress);
message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress);
message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined);
return obj;
},
fromPartial(object: Partial<MsgUndelegate>): MsgUndelegate {
const message = createBaseMsgUndelegate();
message.delegatorAddress = object.delegatorAddress ?? "";
message.validatorAddress = object.validatorAddress ?? "";
message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined;
return message;
},
fromAmino(object: MsgUndelegateAmino): MsgUndelegate {
const message = createBaseMsgUndelegate();
if (object.delegator_address !== undefined && object.delegator_address !== null) {
message.delegatorAddress = object.delegator_address;
}
if (object.validator_address !== undefined && object.validator_address !== null) {
message.validatorAddress = object.validator_address;
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = Coin.fromAmino(object.amount);
}
return message;
},
toAmino(message: MsgUndelegate): MsgUndelegateAmino {
const obj: any = {};
obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress;
obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress;
obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined;
return obj;
},
fromAminoMsg(object: MsgUndelegateAminoMsg): MsgUndelegate {
return MsgUndelegate.fromAmino(object.value);
},
toAminoMsg(message: MsgUndelegate): MsgUndelegateAminoMsg {
return {
type: "cosmos-sdk/MsgUndelegate",
value: MsgUndelegate.toAmino(message)
};
},
fromProtoMsg(message: MsgUndelegateProtoMsg): MsgUndelegate {
return MsgUndelegate.decode(message.value);
},
toProto(message: MsgUndelegate): Uint8Array {
return MsgUndelegate.encode(message).finish();
},
toProtoMsg(message: MsgUndelegate): MsgUndelegateProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate",
value: MsgUndelegate.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgUndelegate.typeUrl, MsgUndelegate);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgUndelegate.aminoType, MsgUndelegate.typeUrl);
function createBaseMsgUndelegateResponse(): MsgUndelegateResponse {
return {
completionTime: new Date()
};
}
export const MsgUndelegateResponse = {
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse",
aminoType: "cosmos-sdk/MsgUndelegateResponse",
is(o: any): o is MsgUndelegateResponse {
return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.is(o.completionTime));
},
isSDK(o: any): o is MsgUndelegateResponseSDKType {
return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.isSDK(o.completion_time));
},
isAmino(o: any): o is MsgUndelegateResponseAmino {
return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.isAmino(o.completion_time));
},
encode(message: MsgUndelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.completionTime !== undefined) {
Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgUndelegateResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgUndelegateResponse {
return {
completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined
};
},
toJSON(message: MsgUndelegateResponse): JsonSafe<MsgUndelegateResponse> {
const obj: any = {};
message.completionTime !== undefined && (obj.completionTime = message.completionTime.toISOString());
return obj;
},
fromPartial(object: Partial<MsgUndelegateResponse>): MsgUndelegateResponse {
const message = createBaseMsgUndelegateResponse();
message.completionTime = object.completionTime ?? undefined;
return message;
},
fromAmino(object: MsgUndelegateResponseAmino): MsgUndelegateResponse {
const message = createBaseMsgUndelegateResponse();
if (object.completion_time !== undefined && object.completion_time !== null) {
message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time));
}
return message;
},
toAmino(message: MsgUndelegateResponse): MsgUndelegateResponseAmino {
const obj: any = {};
obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined;
return obj;
},
fromAminoMsg(object: MsgUndelegateResponseAminoMsg): MsgUndelegateResponse {
return MsgUndelegateResponse.fromAmino(object.value);
},
toAminoMsg(message: MsgUndelegateResponse): MsgUndelegateResponseAminoMsg {
return {
type: "cosmos-sdk/MsgUndelegateResponse",
value: MsgUndelegateResponse.toAmino(message)
};
},
fromProtoMsg(message: MsgUndelegateResponseProtoMsg): MsgUndelegateResponse {
return MsgUndelegateResponse.decode(message.value);
},
toProto(message: MsgUndelegateResponse): Uint8Array {
return MsgUndelegateResponse.encode(message).finish();
},
toProtoMsg(message: MsgUndelegateResponse): MsgUndelegateResponseProtoMsg {
return {
typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse",
value: MsgUndelegateResponse.encode(message).finish()
};
}
};
GlobalDecoderRegistry.register(MsgUndelegateResponse.typeUrl, MsgUndelegateResponse);
GlobalDecoderRegistry.registerAminoProtoMapping(MsgUndelegateResponse.aminoType, MsgUndelegateResponse.typeUrl);