Merge pull request #749 from cosmos/639-msg-transfer

Add IBC MsgTransfer
This commit is contained in:
Will Clark 2021-04-01 10:11:36 +01:00 committed by GitHub
commit 3d8b1ac788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 450 additions and 21 deletions

View File

@ -34,6 +34,7 @@ protoc \
"$COSMOS_PROTO_DIR/cosmos/tx/signing/v1beta1/signing.proto" \
"$COSMOS_PROTO_DIR/cosmos/tx/v1beta1/tx.proto" \
"$COSMOS_PROTO_DIR/cosmos/vesting/v1beta1/vesting.proto" \
"$COSMOS_PROTO_DIR/ibc/applications/transfer/v1/tx.proto" \
"$COSMOS_PROTO_DIR/ibc/core/channel/v1/channel.proto" \
"$COSMOS_PROTO_DIR/ibc/core/channel/v1/query.proto" \
"$COSMOS_PROTO_DIR/ibc/core/channel/v1/tx.proto" \

View File

@ -18,7 +18,7 @@ export interface AminoMsgSend extends AminoMsg {
}
export function isAminoMsgSend(msg: AminoMsg): msg is AminoMsgSend {
return (msg as AminoMsgSend).type === "cosmos-sdk/MsgSend";
return msg.type === "cosmos-sdk/MsgSend";
}
interface Input {
@ -43,7 +43,7 @@ export interface AminoMsgMultiSend extends AminoMsg {
}
export function isAminoMsgMultiSend(msg: AminoMsg): msg is AminoMsgMultiSend {
return (msg as AminoMsgMultiSend).type === "cosmos-sdk/MsgMultiSend";
return msg.type === "cosmos-sdk/MsgMultiSend";
}
// crisis - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/crisis/crisis.proto
@ -60,7 +60,7 @@ export interface AminoMsgVerifyInvariant extends AminoMsg {
}
export function isAminoMsgVerifyInvariant(msg: AminoMsg): msg is AminoMsgVerifyInvariant {
return (msg as AminoMsgVerifyInvariant).type === "cosmos-sdk/MsgVerifyInvariant";
return msg.type === "cosmos-sdk/MsgVerifyInvariant";
}
// distribution - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/distribution/distribution.proto
@ -79,7 +79,7 @@ export interface AminoMsgSetWithdrawAddress extends AminoMsg {
export function isAminoMsgSetWithdrawAddress(msg: AminoMsg): msg is AminoMsgSetWithdrawAddress {
// NOTE: Type string and names diverge here!
return (msg as AminoMsgSetWithdrawAddress).type === "cosmos-sdk/MsgModifyWithdrawAddress";
return msg.type === "cosmos-sdk/MsgModifyWithdrawAddress";
}
/** Message for delegation withdraw from a single validator */
@ -96,7 +96,7 @@ export interface AminoMsgWithdrawDelegatorReward extends AminoMsg {
export function isAminoMsgWithdrawDelegatorReward(msg: AminoMsg): msg is AminoMsgWithdrawDelegatorReward {
// NOTE: Type string and names diverge here!
return (msg as AminoMsgWithdrawDelegatorReward).type === "cosmos-sdk/MsgWithdrawDelegationReward";
return msg.type === "cosmos-sdk/MsgWithdrawDelegationReward";
}
/** Message for validator withdraw */
@ -111,7 +111,7 @@ export interface AminoMsgWithdrawValidatorCommission extends AminoMsg {
export function isAminoMsgWithdrawValidatorCommission(
msg: AminoMsg,
): msg is AminoMsgWithdrawValidatorCommission {
return (msg as AminoMsgWithdrawValidatorCommission).type === "cosmos-sdk/MsgWithdrawValidatorCommission";
return msg.type === "cosmos-sdk/MsgWithdrawValidatorCommission";
}
/** Allows an account to directly fund the community pool. */
@ -125,7 +125,7 @@ export interface AminoMsgFundCommunityPool extends AminoMsg {
}
export function isAminoMsgFundCommunityPool(msg: AminoMsg): msg is AminoMsgFundCommunityPool {
return (msg as AminoMsgFundCommunityPool).type === "cosmos-sdk/MsgFundCommunityPool";
return msg.type === "cosmos-sdk/MsgFundCommunityPool";
}
// evidence - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/evidence/evidence.proto
@ -146,7 +146,7 @@ export interface AminoMsgSubmitEvidence extends AminoMsg {
}
export function isAminoMsgSubmitEvidence(msg: AminoMsg): msg is AminoMsgSubmitEvidence {
return (msg as AminoMsgSubmitEvidence).type === "cosmos-sdk/MsgSubmitEvidence";
return msg.type === "cosmos-sdk/MsgSubmitEvidence";
}
// gov - https://github.com/cosmos/cosmos-sdk/blob/efa73c7edb31a7bd65786501da213b294f89267a/proto/cosmos/gov/gov.proto
@ -163,7 +163,7 @@ export interface AminoMsgSubmitProposal extends AminoMsg {
}
export function isAminoMsgSubmitProposal(msg: AminoMsg): msg is AminoMsgSubmitProposal {
return (msg as AminoMsgSubmitProposal).type === "cosmos-sdk/MsgSubmitProposal";
return msg.type === "cosmos-sdk/MsgSubmitProposal";
}
enum VoteOption {
@ -178,7 +178,7 @@ enum VoteOption {
export interface AminoMsgVote extends AminoMsg {
readonly type: "cosmos-sdk/MsgVote";
readonly value: {
readonly proposal_id: number;
readonly proposal_id: string;
/** Bech32 account address */
readonly voter: string;
readonly option: VoteOption;
@ -186,14 +186,14 @@ export interface AminoMsgVote extends AminoMsg {
}
export function isAminoMsgVote(msg: AminoMsg): msg is AminoMsgVote {
return (msg as AminoMsgVote).type === "cosmos-sdk/MsgVote";
return msg.type === "cosmos-sdk/MsgVote";
}
/** Submits a deposit to an existing proposal */
export interface AminoMsgDeposit extends AminoMsg {
readonly type: "cosmos-sdk/MsgDeposit";
readonly value: {
readonly proposal_id: number;
readonly proposal_id: string;
/** Bech32 account address */
readonly depositor: string;
readonly amount: readonly Coin[];
@ -201,11 +201,9 @@ export interface AminoMsgDeposit extends AminoMsg {
}
export function isAminoMsgDeposit(msg: AminoMsg): msg is AminoMsgDeposit {
return (msg as AminoMsgDeposit).type === "cosmos-sdk/MsgDeposit";
return msg.type === "cosmos-sdk/MsgDeposit";
}
// ibc
// mint (no messages) - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/mint/mint.proto
// params (no messages) - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/params/params.proto
@ -222,7 +220,7 @@ export interface AminoMsgUnjail extends AminoMsg {
}
export function isAminoMsgUnjail(msg: AminoMsg): msg is AminoMsgUnjail {
return (msg as AminoMsgUnjail).type === "cosmos-sdk/MsgUnjail";
return msg.type === "cosmos-sdk/MsgUnjail";
}
// staking - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/staking/staking.proto
@ -261,7 +259,7 @@ export interface AminoMsgCreateValidator extends AminoMsg {
}
export function isAminoMsgCreateValidator(msg: AminoMsg): msg is AminoMsgCreateValidator {
return (msg as AminoMsgCreateValidator).type === "cosmos-sdk/MsgCreateValidator";
return msg.type === "cosmos-sdk/MsgCreateValidator";
}
/** Edits an existing validator. */
@ -277,7 +275,7 @@ export interface AminoMsgEditValidator extends AminoMsg {
}
export function isAminoMsgEditValidator(msg: AminoMsg): msg is AminoMsgEditValidator {
return (msg as AminoMsgEditValidator).type === "cosmos-sdk/MsgEditValidator";
return msg.type === "cosmos-sdk/MsgEditValidator";
}
/**
@ -297,7 +295,7 @@ export interface AminoMsgDelegate extends AminoMsg {
}
export function isAminoMsgDelegate(msg: AminoMsg): msg is AminoMsgDelegate {
return (msg as AminoMsgDelegate).type === "cosmos-sdk/MsgDelegate";
return msg.type === "cosmos-sdk/MsgDelegate";
}
/** Performs a redelegation from a delegate and source validator to a destination validator */
@ -315,7 +313,7 @@ export interface AminoMsgBeginRedelegate extends AminoMsg {
}
export function isAminoMsgBeginRedelegate(msg: AminoMsg): msg is AminoMsgBeginRedelegate {
return (msg as AminoMsgBeginRedelegate).type === "cosmos-sdk/MsgBeginRedelegate";
return msg.type === "cosmos-sdk/MsgBeginRedelegate";
}
/** Performs an undelegation from a delegate and a validator */
@ -331,7 +329,38 @@ export interface AminoMsgUndelegate extends AminoMsg {
}
export function isAminoMsgUndelegate(msg: AminoMsg): msg is AminoMsgUndelegate {
return (msg as AminoMsgUndelegate).type === "cosmos-sdk/MsgUndelegate";
return msg.type === "cosmos-sdk/MsgUndelegate";
}
// upgrade (no messages) - see https://github.com/cosmos/cosmos-sdk/blob/efa73c7/proto/cosmos/upgrade/upgrade.proto
// ibc
// https://github.com/cosmos/ibc-go/blob/07b6a97b67d17fd214a83764cbdb2c2c3daef445/modules/core/02-client/types/client.pb.go#L297-L312
interface AminoHeight {
readonly revision_number: string;
readonly revision_height: string;
}
// https://github.com/cosmos/ibc-go/blob/07b6a97b67d17fd214a83764cbdb2c2c3daef445/modules/apps/transfer/types/tx.pb.go#L33-L53
/** Transfers fungible tokens (i.e Coins) between ICS20 enabled chains */
export interface AminoMsgTransfer extends AminoMsg {
readonly type: "cosmos-sdk/MsgTransfer";
readonly value: {
readonly source_port: string;
readonly source_channel: string;
readonly token?: Coin;
/** Bech32 account address */
readonly sender: string;
/** Bech32 account address */
readonly receiver: string;
readonly timeout_height?: AminoHeight;
// Timeout timestamp (in nanoseconds) relative to the current block timestamp.
// The timeout is disabled when set to 0.
readonly timeout_timestamp: string;
};
}
export function isAminoMsgTransfer(msg: AminoMsg): msg is AminoMsgTransfer {
return msg.type === "cosmos-sdk/MsgTransfer";
}

View File

@ -2,6 +2,7 @@
import { encodeBech32Pubkey } from "@cosmjs/amino";
import { fromBase64 } from "@cosmjs/encoding";
import { coin, coins } from "@cosmjs/proto-signing";
import Long from "long";
import {
AminoMsgBeginRedelegate,
@ -12,6 +13,7 @@ import {
AminoMsgMultiSend,
AminoMsgSend,
AminoMsgSetWithdrawAddress,
AminoMsgTransfer,
AminoMsgUndelegate,
AminoMsgWithdrawDelegatorReward,
AminoMsgWithdrawValidatorCommission,
@ -31,6 +33,7 @@ import {
MsgEditValidator,
MsgUndelegate,
} from "./codec/cosmos/staking/v1beta1/tx";
import { MsgTransfer } from "./codec/ibc/applications/transfer/v1/tx";
describe("AminoTypes", () => {
describe("toAmino", () => {
@ -315,6 +318,41 @@ describe("AminoTypes", () => {
expect(aminoMsg).toEqual(expected);
});
it("works for MsgTransfer", () => {
const msg: MsgTransfer = {
sourcePort: "testport",
sourceChannel: "testchannel",
token: coin(1234, "utest"),
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
timeoutHeight: {
revisionHeight: Long.fromString("123", true),
revisionNumber: Long.fromString("456", true),
},
timeoutTimestamp: Long.fromString("789", true),
};
const aminoMsg = new AminoTypes().toAmino({
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer",
value: msg,
});
const expected: AminoMsgTransfer = {
type: "cosmos-sdk/MsgTransfer",
value: {
source_port: "testport",
source_channel: "testchannel",
token: coin(1234, "utest"),
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
timeout_height: {
revision_height: "123",
revision_number: "456",
},
timeout_timestamp: "789",
},
};
expect(aminoMsg).toEqual(expected);
});
it("works with custom type url", () => {
const msg = {
foo: "bar",
@ -588,6 +626,41 @@ describe("AminoTypes", () => {
});
});
it("works for MsgTransfer", () => {
const aminoMsg: AminoMsgTransfer = {
type: "cosmos-sdk/MsgTransfer",
value: {
source_port: "testport",
source_channel: "testchannel",
token: coin(1234, "utest"),
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
timeout_height: {
revision_height: "123",
revision_number: "456",
},
timeout_timestamp: "789",
},
};
const msg = new AminoTypes().fromAmino(aminoMsg);
const expectedValue: MsgTransfer = {
sourcePort: "testport",
sourceChannel: "testchannel",
token: coin(1234, "utest"),
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
timeoutHeight: {
revisionHeight: Long.fromString("123", true),
revisionNumber: Long.fromString("456", true),
},
timeoutTimestamp: Long.fromString("789", true),
};
expect(msg).toEqual({
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer",
value: expectedValue,
});
});
it("works for custom type url", () => {
const aminoMsg = {
type: "my-sdk/CustomType",

View File

@ -3,6 +3,7 @@ import { AminoMsg, decodeBech32Pubkey, encodeBech32Pubkey } from "@cosmjs/amino"
import { fromBase64, toBase64 } from "@cosmjs/encoding";
import { EncodeObject } from "@cosmjs/proto-signing";
import { assertDefinedAndNotNull } from "@cosmjs/utils";
import Long from "long";
import {
AminoMsgBeginRedelegate,
@ -13,6 +14,7 @@ import {
AminoMsgMultiSend,
AminoMsgSend,
AminoMsgSetWithdrawAddress,
AminoMsgTransfer,
AminoMsgUndelegate,
AminoMsgWithdrawDelegatorReward,
AminoMsgWithdrawValidatorCommission,
@ -31,6 +33,7 @@ import {
MsgEditValidator,
MsgUndelegate,
} from "./codec/cosmos/staking/v1beta1/tx";
import { MsgTransfer } from "./codec/ibc/applications/transfer/v1/tx";
export interface AminoConverter {
readonly aminoType: string;
@ -324,6 +327,53 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
amount: amount,
}),
},
"/ibc.applications.transfer.v1.MsgTransfer": {
aminoType: "cosmos-sdk/MsgTransfer",
toAmino: ({
sourcePort,
sourceChannel,
token,
sender,
receiver,
timeoutHeight,
timeoutTimestamp,
}: MsgTransfer): AminoMsgTransfer["value"] => ({
source_port: sourcePort,
source_channel: sourceChannel,
token: token,
sender: sender,
receiver: receiver,
timeout_height: timeoutHeight
? {
revision_height: timeoutHeight.revisionHeight.toString(),
revision_number: timeoutHeight.revisionNumber.toString(),
}
: undefined,
timeout_timestamp: timeoutTimestamp.toString(),
}),
fromAmino: ({
source_port,
source_channel,
token,
sender,
receiver,
timeout_height,
timeout_timestamp,
}: AminoMsgTransfer["value"]): MsgTransfer => ({
sourcePort: source_port,
sourceChannel: source_channel,
token: token,
sender: sender,
receiver: receiver,
timeoutHeight: timeout_height
? {
revisionHeight: Long.fromString(timeout_height.revision_height, true),
revisionNumber: Long.fromString(timeout_height.revision_number, true),
}
: undefined,
timeoutTimestamp: Long.fromString(timeout_timestamp, true),
}),
},
};
}

View File

@ -0,0 +1,274 @@
/* eslint-disable */
import { Coin } from "../../../../cosmos/base/v1beta1/coin";
import { Height } from "../../../../ibc/core/client/v1/client";
import Long from "long";
import _m0 from "protobufjs/minimal";
export const protobufPackage = "ibc.applications.transfer.v1";
/**
* MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between
* ICS20 enabled chains. See ICS Spec here:
* https://github.com/cosmos/ics/tree/master/spec/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: Long;
}
/** MsgTransferResponse defines the Msg/Transfer response type. */
export interface MsgTransferResponse {}
const baseMsgTransfer: object = {
sourcePort: "",
sourceChannel: "",
sender: "",
receiver: "",
timeoutTimestamp: Long.UZERO,
};
export const MsgTransfer = {
encode(message: MsgTransfer, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
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.isZero()) {
writer.uint32(56).uint64(message.timeoutTimestamp);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): MsgTransfer {
const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgTransfer } as MsgTransfer;
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() as Long;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgTransfer {
const message = { ...baseMsgTransfer } as MsgTransfer;
if (object.sourcePort !== undefined && object.sourcePort !== null) {
message.sourcePort = String(object.sourcePort);
} else {
message.sourcePort = "";
}
if (object.sourceChannel !== undefined && object.sourceChannel !== null) {
message.sourceChannel = String(object.sourceChannel);
} else {
message.sourceChannel = "";
}
if (object.token !== undefined && object.token !== null) {
message.token = Coin.fromJSON(object.token);
} else {
message.token = undefined;
}
if (object.sender !== undefined && object.sender !== null) {
message.sender = String(object.sender);
} else {
message.sender = "";
}
if (object.receiver !== undefined && object.receiver !== null) {
message.receiver = String(object.receiver);
} else {
message.receiver = "";
}
if (object.timeoutHeight !== undefined && object.timeoutHeight !== null) {
message.timeoutHeight = Height.fromJSON(object.timeoutHeight);
} else {
message.timeoutHeight = undefined;
}
if (object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null) {
message.timeoutTimestamp = Long.fromString(object.timeoutTimestamp);
} else {
message.timeoutTimestamp = Long.UZERO;
}
return message;
},
toJSON(message: MsgTransfer): unknown {
const obj: any = {};
message.sourcePort !== undefined && (obj.sourcePort = message.sourcePort);
message.sourceChannel !== undefined && (obj.sourceChannel = message.sourceChannel);
message.token !== undefined && (obj.token = message.token ? Coin.toJSON(message.token) : undefined);
message.sender !== undefined && (obj.sender = message.sender);
message.receiver !== undefined && (obj.receiver = message.receiver);
message.timeoutHeight !== undefined &&
(obj.timeoutHeight = message.timeoutHeight ? Height.toJSON(message.timeoutHeight) : undefined);
message.timeoutTimestamp !== undefined &&
(obj.timeoutTimestamp = (message.timeoutTimestamp || Long.UZERO).toString());
return obj;
},
fromPartial(object: DeepPartial<MsgTransfer>): MsgTransfer {
const message = { ...baseMsgTransfer } as MsgTransfer;
if (object.sourcePort !== undefined && object.sourcePort !== null) {
message.sourcePort = object.sourcePort;
} else {
message.sourcePort = "";
}
if (object.sourceChannel !== undefined && object.sourceChannel !== null) {
message.sourceChannel = object.sourceChannel;
} else {
message.sourceChannel = "";
}
if (object.token !== undefined && object.token !== null) {
message.token = Coin.fromPartial(object.token);
} else {
message.token = undefined;
}
if (object.sender !== undefined && object.sender !== null) {
message.sender = object.sender;
} else {
message.sender = "";
}
if (object.receiver !== undefined && object.receiver !== null) {
message.receiver = object.receiver;
} else {
message.receiver = "";
}
if (object.timeoutHeight !== undefined && object.timeoutHeight !== null) {
message.timeoutHeight = Height.fromPartial(object.timeoutHeight);
} else {
message.timeoutHeight = undefined;
}
if (object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null) {
message.timeoutTimestamp = object.timeoutTimestamp as Long;
} else {
message.timeoutTimestamp = Long.UZERO;
}
return message;
},
};
const baseMsgTransferResponse: object = {};
export const MsgTransferResponse = {
encode(_: MsgTransferResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): MsgTransferResponse {
const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgTransferResponse } as MsgTransferResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgTransferResponse {
const message = { ...baseMsgTransferResponse } as MsgTransferResponse;
return message;
},
toJSON(_: MsgTransferResponse): unknown {
const obj: any = {};
return obj;
},
fromPartial(_: DeepPartial<MsgTransferResponse>): MsgTransferResponse {
const message = { ...baseMsgTransferResponse } as MsgTransferResponse;
return message;
},
};
/** Msg defines the ibc/transfer Msg service. */
export interface Msg {
/** Transfer defines a rpc handler method for MsgTransfer. */
Transfer(request: MsgTransfer): Promise<MsgTransferResponse>;
}
export class MsgClientImpl implements Msg {
private readonly rpc: Rpc;
constructor(rpc: Rpc) {
this.rpc = rpc;
}
Transfer(request: MsgTransfer): Promise<MsgTransferResponse> {
const data = MsgTransfer.encode(request).finish();
const promise = this.rpc.request("ibc.applications.transfer.v1.Msg", "Transfer", data);
return promise.then((data) => MsgTransferResponse.decode(new _m0.Reader(data)));
}
}
interface Rpc {
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}
type Builtin = Date | Function | Uint8Array | string | number | undefined | Long;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;

View File

@ -32,6 +32,7 @@ import {
} from "./codec/cosmos/staking/v1beta1/tx";
import { SignMode } from "./codec/cosmos/tx/signing/v1beta1/signing";
import { TxRaw } from "./codec/cosmos/tx/v1beta1/tx";
import { MsgTransfer } from "./codec/ibc/applications/transfer/v1/tx";
import {
MsgAcknowledgement,
MsgChannelCloseConfirm,
@ -108,6 +109,7 @@ export const defaultRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [
["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry],
["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck],
["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm],
["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer],
];
function createDefaultRegistry(): Registry {