diff --git a/packages/stargate/src/modules/index.ts b/packages/stargate/src/modules/index.ts index d8ff595acd..3358b6a6e8 100644 --- a/packages/stargate/src/modules/index.ts +++ b/packages/stargate/src/modules/index.ts @@ -86,9 +86,5 @@ export { } from "./staking/messages"; export { setupStakingExtension, StakingExtension } from "./staking/queries"; export { setupTxExtension, TxExtension } from "./tx/queries"; -export { - AminoMsgCreateVestingAccount, - createVestingAminoConverters, - isAminoMsgCreateVestingAccount, -} from "./vesting/aminomessages"; +export { createVestingAminoConverters } from "./vesting/aminomessages"; export { vestingTypes } from "./vesting/messages"; diff --git a/packages/stargate/src/modules/vesting/aminomessages.ts b/packages/stargate/src/modules/vesting/aminomessages.ts index 46fa54f184..b50ba8b242 100644 --- a/packages/stargate/src/modules/vesting/aminomessages.ts +++ b/packages/stargate/src/modules/vesting/aminomessages.ts @@ -1,57 +1,7 @@ -/* eslint-disable @typescript-eslint/naming-convention */ -import { AminoMsg, Coin } from "@cosmjs/amino"; -import { MsgCreateVestingAccount } from "cosmjs-types/cosmos/vesting/v1beta1/tx"; -import Long from "long"; - import { AminoConverters } from "../../aminotypes"; -export interface AminoMsgCreateVestingAccount extends AminoMsg { - readonly type: "cosmos-sdk/MsgCreateVestingAccount"; - readonly value: { - /** Bech32 account address */ - readonly from_address: string; - /** Bech32 account address */ - readonly to_address: string; - readonly amount: readonly Coin[]; - readonly end_time: Long; - readonly delayed: boolean; - }; -} - -export function isAminoMsgCreateVestingAccount(msg: AminoMsg): msg is AminoMsgCreateVestingAccount { - return msg.type === "cosmos-sdk/MsgCreateVestingAccount"; -} - export function createVestingAminoConverters(): AminoConverters { return { - "/cosmos.vesting.v1beta1.MsgCreateVestingAccount": { - aminoType: "cosmos-sdk/MsgCreateVestingAccount", - toAmino: ({ - fromAddress, - toAddress, - amount, - endTime, - delayed, - }: MsgCreateVestingAccount): AminoMsgCreateVestingAccount["value"] => ({ - from_address: fromAddress, - to_address: toAddress, - amount: [...amount], - end_time: endTime, - delayed: delayed, - }), - fromAmino: ({ - from_address, - to_address, - amount, - end_time, - delayed, - }: AminoMsgCreateVestingAccount["value"]): MsgCreateVestingAccount => ({ - fromAddress: from_address, - toAddress: to_address, - amount: [...amount], - endTime: end_time, - delayed: delayed, - }), - }, + "/cosmos.vesting.v1beta1.MsgCreateVestingAccount": "not_supported_by_chain", }; } diff --git a/packages/stargate/src/modules/vesting/messages.spec.ts b/packages/stargate/src/modules/vesting/messages.spec.ts new file mode 100644 index 0000000000..54ae139708 --- /dev/null +++ b/packages/stargate/src/modules/vesting/messages.spec.ts @@ -0,0 +1,45 @@ +import { coins } from "@cosmjs/amino"; +import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; +import { MsgCreateVestingAccount } from "cosmjs-types/cosmos/vesting/v1beta1/tx"; +import Long from "long"; + +import { SigningStargateClient } from "../../signingstargateclient"; +import { isDeliverTxSuccess } from "../../stargateclient"; +import { + defaultSigningClientOptions, + faucet, + makeRandomAddress, + pendingWithoutSimapp, + simapp, +} from "../../testutils.spec"; + +describe("VestingExtension direct", () => { + it("works with direct signing", async () => { + pendingWithoutSimapp(); + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic); + const client = await SigningStargateClient.connectWithSigner( + simapp.tendermintUrl, + wallet, + defaultSigningClientOptions, + ); + const memo = "Vesting is cool!"; + const fee = { + amount: coins(2000, "ucosm"), + gas: "180000", // 180k + }; + + const vestingMsg = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + value: MsgCreateVestingAccount.fromPartial({ + fromAddress: faucet.address0, + toAddress: makeRandomAddress(), + amount: coins(1234, "ucosm"), + endTime: Long.fromString("1838718434"), + delayed: true, + }), + }; + + const result = await client.signAndBroadcast(faucet.address0, [vestingMsg], fee, memo); + expect(isDeliverTxSuccess(result)).toEqual(true); + }); +});