Move messages to module folders

This commit is contained in:
Simon Warta 2022-03-03 15:44:07 +01:00
parent 902f21b98a
commit 937dfd9867
9 changed files with 133 additions and 79 deletions

View File

@ -0,0 +1,8 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import { MsgExec, MsgGrant, MsgRevoke } from "cosmjs-types/cosmos/authz/v1beta1/tx";
export const authzTypes: ReadonlyArray<[string, GeneratedType]> = [
["/cosmos.authz.v1beta1.MsgExec", MsgExec],
["/cosmos.authz.v1beta1.MsgGrant", MsgGrant],
["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke],
];

View File

@ -0,0 +1,7 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import { MsgMultiSend, MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
export const bankTypes: ReadonlyArray<[string, GeneratedType]> = [
["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend],
["/cosmos.bank.v1beta1.MsgSend", MsgSend],
];

View File

@ -0,0 +1,14 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import {
MsgFundCommunityPool,
MsgSetWithdrawAddress,
MsgWithdrawDelegatorReward,
MsgWithdrawValidatorCommission,
} from "cosmjs-types/cosmos/distribution/v1beta1/tx";
export const distributionTypes: ReadonlyArray<[string, GeneratedType]> = [
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool],
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress],
["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward],
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission],
];

View File

@ -0,0 +1,7 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import { MsgGrantAllowance, MsgRevokeAllowance } from "cosmjs-types/cosmos/feegrant/v1beta1/tx";
export const feegrantTypes: ReadonlyArray<[string, GeneratedType]> = [
["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance],
["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance],
];

View File

@ -0,0 +1,8 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import { MsgDeposit, MsgSubmitProposal, MsgVote } from "cosmjs-types/cosmos/gov/v1beta1/tx";
export const govTypes: ReadonlyArray<[string, GeneratedType]> = [
["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit],
["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal],
["/cosmos.gov.v1beta1.MsgVote", MsgVote],
];

View File

@ -0,0 +1,48 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx";
import {
MsgAcknowledgement,
MsgChannelCloseConfirm,
MsgChannelCloseInit,
MsgChannelOpenAck,
MsgChannelOpenConfirm,
MsgChannelOpenInit,
MsgChannelOpenTry,
MsgRecvPacket,
MsgTimeout,
MsgTimeoutOnClose,
} from "cosmjs-types/ibc/core/channel/v1/tx";
import {
MsgCreateClient,
MsgSubmitMisbehaviour,
MsgUpdateClient,
MsgUpgradeClient,
} from "cosmjs-types/ibc/core/client/v1/tx";
import {
MsgConnectionOpenAck,
MsgConnectionOpenConfirm,
MsgConnectionOpenInit,
MsgConnectionOpenTry,
} from "cosmjs-types/ibc/core/connection/v1/tx";
export const ibcTypes: ReadonlyArray<[string, GeneratedType]> = [
["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer],
["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement],
["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm],
["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit],
["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck],
["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm],
["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit],
["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry],
["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket],
["/ibc.core.channel.v1.MsgTimeout", MsgTimeout],
["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose],
["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient],
["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour],
["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient],
["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient],
["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck],
["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm],
["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit],
["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry],
];

View File

@ -1,9 +1,16 @@
export { AuthExtension, setupAuthExtension } from "./auth/queries";
export { authzTypes } from "./authz/messages";
export { bankTypes } from "./bank/messages";
export { BankExtension, setupBankExtension } from "./bank/queries";
export { distributionTypes } from "./distribution/messages";
export { DistributionExtension, setupDistributionExtension } from "./distribution/queries";
export { feegrantTypes } from "./feegrant/messages";
export { govTypes } from "./gov/messages";
export { GovExtension, GovParamsType, GovProposalId, setupGovExtension } from "./gov/queries";
export { ibcTypes } from "./ibc/messages";
export { IbcExtension, setupIbcExtension } from "./ibc/queries";
export { MintExtension, MintParams, setupMintExtension } from "./mint/queries";
export { setupSlashingExtension, SlashingExtension } from "./slashing/queries";
export { stakingTypes } from "./staking/messages";
export { setupStakingExtension, StakingExtension } from "./staking/queries";
export { setupTxExtension, TxExtension } from "./tx/queries";

View File

@ -0,0 +1,16 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import {
MsgBeginRedelegate,
MsgCreateValidator,
MsgDelegate,
MsgEditValidator,
MsgUndelegate,
} from "cosmjs-types/cosmos/staking/v1beta1/tx";
export const stakingTypes: ReadonlyArray<[string, GeneratedType]> = [
["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate],
["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator],
["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate],
["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator],
["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate],
];

View File

@ -14,52 +14,13 @@ import {
} from "@cosmjs/proto-signing";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { assert, assertDefined } from "@cosmjs/utils";
import { MsgExec, MsgGrant, MsgRevoke } from "cosmjs-types/cosmos/authz/v1beta1/tx";
import { MsgMultiSend, MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
import {
MsgFundCommunityPool,
MsgSetWithdrawAddress,
MsgWithdrawDelegatorReward,
MsgWithdrawValidatorCommission,
} from "cosmjs-types/cosmos/distribution/v1beta1/tx";
import { MsgGrantAllowance, MsgRevokeAllowance } from "cosmjs-types/cosmos/feegrant/v1beta1/tx";
import { MsgDeposit, MsgSubmitProposal, MsgVote } from "cosmjs-types/cosmos/gov/v1beta1/tx";
import {
MsgBeginRedelegate,
MsgCreateValidator,
MsgDelegate,
MsgEditValidator,
MsgUndelegate,
} from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { MsgWithdrawDelegatorReward } from "cosmjs-types/cosmos/distribution/v1beta1/tx";
import { MsgDelegate, MsgUndelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { SignMode } from "cosmjs-types/cosmos/tx/signing/v1beta1/signing";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx";
import {
MsgAcknowledgement,
MsgChannelCloseConfirm,
MsgChannelCloseInit,
MsgChannelOpenAck,
MsgChannelOpenConfirm,
MsgChannelOpenInit,
MsgChannelOpenTry,
MsgRecvPacket,
MsgTimeout,
MsgTimeoutOnClose,
} from "cosmjs-types/ibc/core/channel/v1/tx";
import { Height } from "cosmjs-types/ibc/core/client/v1/client";
import {
MsgCreateClient,
MsgSubmitMisbehaviour,
MsgUpdateClient,
MsgUpgradeClient,
} from "cosmjs-types/ibc/core/client/v1/tx";
import {
MsgConnectionOpenAck,
MsgConnectionOpenConfirm,
MsgConnectionOpenInit,
MsgConnectionOpenTry,
} from "cosmjs-types/ibc/core/connection/v1/tx";
import Long from "long";
import { AminoTypes } from "./aminotypes";
@ -71,48 +32,26 @@ import {
MsgWithdrawDelegatorRewardEncodeObject,
} from "./encodeobjects";
import { calculateFee, GasPrice } from "./fee";
import {
authzTypes,
bankTypes,
distributionTypes,
feegrantTypes,
govTypes,
ibcTypes,
stakingTypes,
} from "./modules";
import { DeliverTxResponse, StargateClient } from "./stargateclient";
export const defaultRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [
["/cosmos.authz.v1beta1.MsgExec", MsgExec],
["/cosmos.authz.v1beta1.MsgGrant", MsgGrant],
["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke],
["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend],
["/cosmos.bank.v1beta1.MsgSend", MsgSend],
["/cosmos.base.v1beta1.Coin", Coin],
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool],
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress],
["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward],
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission],
["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance],
["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance],
["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit],
["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal],
["/cosmos.gov.v1beta1.MsgVote", MsgVote],
["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate],
["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator],
["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate],
["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator],
["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate],
["/ibc.applications.transfer.v1.MsgTransfer", MsgTransfer],
["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement],
["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm],
["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit],
["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck],
["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm],
["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit],
["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry],
["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket],
["/ibc.core.channel.v1.MsgTimeout", MsgTimeout],
["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose],
["/ibc.core.client.v1.MsgCreateClient", MsgCreateClient],
["/ibc.core.client.v1.MsgSubmitMisbehaviour", MsgSubmitMisbehaviour],
["/ibc.core.client.v1.MsgUpdateClient", MsgUpdateClient],
["/ibc.core.client.v1.MsgUpgradeClient", MsgUpgradeClient],
["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck],
["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm],
["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit],
["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry],
...authzTypes,
...bankTypes,
...distributionTypes,
...feegrantTypes,
...govTypes,
...stakingTypes,
...ibcTypes,
];
function createDefaultRegistry(): Registry {