import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between * ICS20 enabled chains. See ICS Spec here: * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures */ export interface MsgTransfer { /** the port on which the packet will be sent */ sourcePort: string; /** the channel by which the packet will be sent */ sourceChannel: string; /** the tokens to be transferred */ token: Coin; /** the sender address */ sender: string; /** the recipient address on the destination chain */ receiver: string; /** * Timeout height relative to the current block height. * The timeout is disabled when set to 0. */ timeoutHeight: Height; /** * Timeout timestamp (in nanoseconds) relative to the current block timestamp. * The timeout is disabled when set to 0. */ timeoutTimestamp: bigint; } export interface MsgTransferProtoMsg { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer"; value: Uint8Array; } /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between * ICS20 enabled chains. See ICS Spec here: * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures */ export interface MsgTransferAmino { /** the port on which the packet will be sent */ source_port?: string; /** the channel by which the packet will be sent */ source_channel?: string; /** the tokens to be transferred */ token?: CoinAmino; /** the sender address */ sender?: string; /** the recipient address on the destination chain */ receiver?: string; /** * Timeout height relative to the current block height. * The timeout is disabled when set to 0. */ timeout_height?: HeightAmino; /** * Timeout timestamp (in nanoseconds) relative to the current block timestamp. * The timeout is disabled when set to 0. */ timeout_timestamp?: string; } export interface MsgTransferAminoMsg { type: "cosmos-sdk/MsgTransfer"; value: MsgTransferAmino; } /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between * ICS20 enabled chains. See ICS Spec here: * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures */ export interface MsgTransferSDKType { source_port: string; source_channel: string; token: CoinSDKType; sender: string; receiver: string; timeout_height: HeightSDKType; timeout_timestamp: bigint; } /** MsgTransferResponse defines the Msg/Transfer response type. */ export interface MsgTransferResponse {} export interface MsgTransferResponseProtoMsg { typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse"; value: Uint8Array; } /** MsgTransferResponse defines the Msg/Transfer response type. */ export interface MsgTransferResponseAmino {} export interface MsgTransferResponseAminoMsg { type: "cosmos-sdk/MsgTransferResponse"; value: MsgTransferResponseAmino; } /** MsgTransferResponse defines the Msg/Transfer response type. */ export interface MsgTransferResponseSDKType {} function createBaseMsgTransfer(): MsgTransfer { return { sourcePort: "", sourceChannel: "", token: Coin.fromPartial({}), sender: "", receiver: "", timeoutHeight: Height.fromPartial({}), timeoutTimestamp: BigInt(0) }; } export const MsgTransfer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", encode(message: MsgTransfer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.sourcePort !== "") { writer.uint32(10).string(message.sourcePort); } if (message.sourceChannel !== "") { writer.uint32(18).string(message.sourceChannel); } if (message.token !== undefined) { Coin.encode(message.token, writer.uint32(26).fork()).ldelim(); } if (message.sender !== "") { writer.uint32(34).string(message.sender); } if (message.receiver !== "") { writer.uint32(42).string(message.receiver); } if (message.timeoutHeight !== undefined) { Height.encode(message.timeoutHeight, writer.uint32(50).fork()).ldelim(); } if (message.timeoutTimestamp !== BigInt(0)) { writer.uint32(56).uint64(message.timeoutTimestamp); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgTransfer { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTransfer(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.sourcePort = reader.string(); break; case 2: message.sourceChannel = reader.string(); break; case 3: message.token = Coin.decode(reader, reader.uint32()); break; case 4: message.sender = reader.string(); break; case 5: message.receiver = reader.string(); break; case 6: message.timeoutHeight = Height.decode(reader, reader.uint32()); break; case 7: message.timeoutTimestamp = reader.uint64(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object: Partial): MsgTransfer { const message = createBaseMsgTransfer(); message.sourcePort = object.sourcePort ?? ""; message.sourceChannel = object.sourceChannel ?? ""; message.token = object.token !== undefined && object.token !== null ? Coin.fromPartial(object.token) : undefined; message.sender = object.sender ?? ""; message.receiver = object.receiver ?? ""; message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Height.fromPartial(object.timeoutHeight) : undefined; message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); return message; }, fromAmino(object: MsgTransferAmino): MsgTransfer { const message = createBaseMsgTransfer(); if (object.source_port !== undefined && object.source_port !== null) { message.sourcePort = object.source_port; } if (object.source_channel !== undefined && object.source_channel !== null) { message.sourceChannel = object.source_channel; } if (object.token !== undefined && object.token !== null) { message.token = Coin.fromAmino(object.token); } if (object.sender !== undefined && object.sender !== null) { message.sender = object.sender; } if (object.receiver !== undefined && object.receiver !== null) { message.receiver = object.receiver; } if (object.timeout_height !== undefined && object.timeout_height !== null) { message.timeoutHeight = Height.fromAmino(object.timeout_height); } if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { message.timeoutTimestamp = BigInt(object.timeout_timestamp); } return message; }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; obj.source_port = message.sourcePort; obj.source_channel = message.sourceChannel; obj.token = message.token ? Coin.toAmino(message.token) : undefined; obj.sender = message.sender; obj.receiver = message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { return MsgTransfer.fromAmino(object.value); }, toAminoMsg(message: MsgTransfer): MsgTransferAminoMsg { return { type: "cosmos-sdk/MsgTransfer", value: MsgTransfer.toAmino(message) }; }, fromProtoMsg(message: MsgTransferProtoMsg): MsgTransfer { return MsgTransfer.decode(message.value); }, toProto(message: MsgTransfer): Uint8Array { return MsgTransfer.encode(message).finish(); }, toProtoMsg(message: MsgTransfer): MsgTransferProtoMsg { return { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", value: MsgTransfer.encode(message).finish() }; } }; function createBaseMsgTransferResponse(): MsgTransferResponse { return {}; } export const MsgTransferResponse = { typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", encode(_: MsgTransferResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): MsgTransferResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgTransferResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_: Partial): MsgTransferResponse { const message = createBaseMsgTransferResponse(); return message; }, fromAmino(_: MsgTransferResponseAmino): MsgTransferResponse { const message = createBaseMsgTransferResponse(); return message; }, toAmino(_: MsgTransferResponse): MsgTransferResponseAmino { const obj: any = {}; return obj; }, fromAminoMsg(object: MsgTransferResponseAminoMsg): MsgTransferResponse { return MsgTransferResponse.fromAmino(object.value); }, toAminoMsg(message: MsgTransferResponse): MsgTransferResponseAminoMsg { return { type: "cosmos-sdk/MsgTransferResponse", value: MsgTransferResponse.toAmino(message) }; }, fromProtoMsg(message: MsgTransferResponseProtoMsg): MsgTransferResponse { return MsgTransferResponse.decode(message.value); }, toProto(message: MsgTransferResponse): Uint8Array { return MsgTransferResponse.encode(message).finish(); }, toProtoMsg(message: MsgTransferResponse): MsgTransferResponseProtoMsg { return { typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", value: MsgTransferResponse.encode(message).finish() }; } };