stargate: Use cosmjs-types

This commit is contained in:
willclarktech 2021-06-03 13:24:08 +02:00
parent 554d23dadd
commit 86b3438911
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
25 changed files with 105 additions and 109 deletions

View File

@ -1,5 +1,6 @@
import { Any } from "cosmjs-types/google/protobuf/any";
import { accountFromAny } from "./accounts";
import { Any } from "./codec/google/protobuf/any";
describe("accounts", () => {
describe("accountFromAny", () => {

View File

@ -2,16 +2,15 @@ import { Pubkey } from "@cosmjs/amino";
import { Uint64 } from "@cosmjs/math";
import { decodePubkey } from "@cosmjs/proto-signing";
import { assert } from "@cosmjs/utils";
import Long from "long";
import { BaseAccount, ModuleAccount } from "./codec/cosmos/auth/v1beta1/auth";
import { BaseAccount, ModuleAccount } from "cosmjs-types/cosmos/auth/v1beta1/auth";
import {
BaseVestingAccount,
ContinuousVestingAccount,
DelayedVestingAccount,
PeriodicVestingAccount,
} from "./codec/cosmos/vesting/v1beta1/vesting";
import { Any } from "./codec/google/protobuf/any";
} from "cosmjs-types/cosmos/vesting/v1beta1/vesting";
import { Any } from "cosmjs-types/google/protobuf/any";
import Long from "long";
export interface Account {
/** Bech32 account address */

View File

@ -2,6 +2,21 @@
import { encodeBech32Pubkey } from "@cosmjs/amino";
import { fromBase64 } from "@cosmjs/encoding";
import { coin, coins } from "@cosmjs/proto-signing";
import { MsgMultiSend, MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import {
MsgFundCommunityPool,
MsgSetWithdrawAddress,
MsgWithdrawDelegatorReward,
MsgWithdrawValidatorCommission,
} from "cosmjs-types/cosmos/distribution/v1beta1/tx";
import {
MsgBeginRedelegate,
MsgCreateValidator,
MsgDelegate,
MsgEditValidator,
MsgUndelegate,
} from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx";
import Long from "long";
import {
@ -19,21 +34,6 @@ import {
AminoMsgWithdrawValidatorCommission,
} from "./aminomsgs";
import { AminoTypes } from "./aminotypes";
import { MsgMultiSend, MsgSend } from "./codec/cosmos/bank/v1beta1/tx";
import {
MsgFundCommunityPool,
MsgSetWithdrawAddress,
MsgWithdrawDelegatorReward,
MsgWithdrawValidatorCommission,
} from "./codec/cosmos/distribution/v1beta1/tx";
import {
MsgBeginRedelegate,
MsgCreateValidator,
MsgDelegate,
MsgEditValidator,
MsgUndelegate,
} from "./codec/cosmos/staking/v1beta1/tx";
import { MsgTransfer } from "./codec/ibc/applications/transfer/v1/tx";
describe("AminoTypes", () => {
describe("toAmino", () => {

View File

@ -3,6 +3,21 @@ 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 { MsgMultiSend, MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import {
MsgFundCommunityPool,
MsgSetWithdrawAddress,
MsgWithdrawDelegatorReward,
MsgWithdrawValidatorCommission,
} from "cosmjs-types/cosmos/distribution/v1beta1/tx";
import {
MsgBeginRedelegate,
MsgCreateValidator,
MsgDelegate,
MsgEditValidator,
MsgUndelegate,
} from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx";
import Long from "long";
import {
@ -19,21 +34,6 @@ import {
AminoMsgWithdrawDelegatorReward,
AminoMsgWithdrawValidatorCommission,
} from "./aminomsgs";
import { MsgMultiSend, MsgSend } from "./codec/cosmos/bank/v1beta1/tx";
import {
MsgFundCommunityPool,
MsgSetWithdrawAddress,
MsgWithdrawDelegatorReward,
MsgWithdrawValidatorCommission,
} from "./codec/cosmos/distribution/v1beta1/tx";
import {
MsgBeginRedelegate,
MsgCreateValidator,
MsgDelegate,
MsgEditValidator,
MsgUndelegate,
} from "./codec/cosmos/staking/v1beta1/tx";
import { MsgTransfer } from "./codec/ibc/applications/transfer/v1/tx";
export interface AminoConverter {
readonly aminoType: string;

View File

@ -1,9 +1,8 @@
import { EncodeObject } from "@cosmjs/proto-signing";
import { MsgSend } from "./codec/cosmos/bank/v1beta1/tx";
import { MsgWithdrawDelegatorReward } from "./codec/cosmos/distribution/v1beta1/tx";
import { MsgDelegate, MsgUndelegate } from "./codec/cosmos/staking/v1beta1/tx";
import { MsgTransfer } from "./codec/ibc/applications/transfer/v1/tx";
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import { MsgWithdrawDelegatorReward } from "cosmjs-types/cosmos/distribution/v1beta1/tx";
import { MsgDelegate, MsgUndelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx";
export interface MsgSendEncodeObject extends EncodeObject {
readonly typeUrl: "/cosmos.bank.v1beta1.MsgSend";

View File

@ -7,9 +7,9 @@ import {
} from "@cosmjs/amino";
import { coins } from "@cosmjs/proto-signing";
import { assert } from "@cosmjs/utils";
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { MsgSend } from "./codec/cosmos/bank/v1beta1/tx";
import { TxRaw } from "./codec/cosmos/tx/v1beta1/tx";
import { MsgSendEncodeObject } from "./encodeobjects";
import { makeCompactBitArray, makeMultisignedTx } from "./multisignature";
import { SignerData, SigningStargateClient } from "./signingstargateclient";

View File

@ -1,13 +1,12 @@
import { MultisigThresholdPubkey, pubkeyToAddress, StdFee } from "@cosmjs/amino";
import { Bech32 } from "@cosmjs/encoding";
import { encodePubkey } from "@cosmjs/proto-signing";
import { CompactBitArray, MultiSignature } from "cosmjs-types/cosmos/crypto/multisig/v1beta1/multisig";
import { SignMode } from "cosmjs-types/cosmos/tx/signing/v1beta1/signing";
import { AuthInfo, SignerInfo } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import Long from "long";
import { CompactBitArray, MultiSignature } from "./codec/cosmos/crypto/multisig/v1beta1/multisig";
import { SignMode } from "./codec/cosmos/tx/signing/v1beta1/signing";
import { AuthInfo, SignerInfo } from "./codec/cosmos/tx/v1beta1/tx";
import { TxRaw } from "./codec/cosmos/tx/v1beta1/tx";
export function makeCompactBitArray(bits: readonly boolean[]): CompactBitArray {
const byteCount = Math.ceil(bits.length / 8);
const extraBits = bits.length - Math.floor(bits.length / 8) * 8;

View File

@ -2,10 +2,10 @@
import { encodePubkey } from "@cosmjs/proto-signing";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { assert } from "@cosmjs/utils";
import { BaseAccount } from "cosmjs-types/cosmos/auth/v1beta1/auth";
import { Any } from "cosmjs-types/google/protobuf/any";
import Long from "long";
import { BaseAccount } from "../codec/cosmos/auth/v1beta1/auth";
import { Any } from "../codec/google/protobuf/any";
import { nonExistentAddress, pendingWithoutSimapp, simapp, unused, validator } from "../testutils.spec";
import { AuthExtension, setupAuthExtension } from "./auth";
import { QueryClient } from "./queryclient";

View File

@ -1,5 +1,6 @@
import { QueryClientImpl } from "../codec/cosmos/auth/v1beta1/query";
import { Any } from "../codec/google/protobuf/any";
import { QueryClientImpl } from "cosmjs-types/cosmos/auth/v1beta1/query";
import { Any } from "cosmjs-types/google/protobuf/any";
import { QueryClient } from "./queryclient";
import { createProtobufRpcClient, toAccAddress } from "./utils";

View File

@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { toAscii } from "@cosmjs/encoding";
import { assert } from "@cosmjs/utils";
import { QueryClientImpl } from "cosmjs-types/cosmos/bank/v1beta1/query";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
import { QueryClientImpl } from "../codec/cosmos/bank/v1beta1/query";
import { Coin } from "../codec/cosmos/base/v1beta1/coin";
import { QueryClient } from "./queryclient";
import { createProtobufRpcClient, toAccAddress } from "./utils";

View File

@ -2,8 +2,8 @@
import { coin, coins, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { sleep } from "@cosmjs/utils";
import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { MsgDelegate } from "../codec/cosmos/staking/v1beta1/tx";
import { MsgDelegateEncodeObject } from "../encodeobjects";
import { SigningStargateClient } from "../signingstargateclient";
import { assertIsBroadcastTxSuccess } from "../stargateclient";

View File

@ -1,6 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import Long from "long";
import {
QueryClientImpl,
QueryCommunityPoolResponse,
@ -12,7 +10,9 @@ import {
QueryValidatorCommissionResponse,
QueryValidatorOutstandingRewardsResponse,
QueryValidatorSlashesResponse,
} from "../codec/cosmos/distribution/v1beta1/query";
} from "cosmjs-types/cosmos/distribution/v1beta1/query";
import Long from "long";
import { QueryClient } from "./queryclient";
import { createPagination, createProtobufRpcClient } from "./utils";

View File

@ -1,16 +1,14 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { toAscii } from "@cosmjs/encoding";
import { Uint64 } from "@cosmjs/math";
import Long from "long";
import { Any } from "../codec/google/protobuf/any";
import { Any } from "cosmjs-types/google/protobuf/any";
import {
QueryClientImpl as TransferQuery,
QueryDenomTraceResponse,
QueryDenomTracesResponse,
QueryParamsResponse as QueryTransferParamsResponse,
} from "../codec/ibc/applications/transfer/v1/query";
import { Channel } from "../codec/ibc/core/channel/v1/channel";
} from "cosmjs-types/ibc/applications/transfer/v1/query";
import { Channel } from "cosmjs-types/ibc/core/channel/v1/channel";
import {
QueryChannelClientStateResponse,
QueryChannelConsensusStateResponse,
@ -26,8 +24,8 @@ import {
QueryPacketReceiptResponse,
QueryUnreceivedAcksResponse,
QueryUnreceivedPacketsResponse,
} from "../codec/ibc/core/channel/v1/query";
import { Height } from "../codec/ibc/core/client/v1/client";
} from "cosmjs-types/ibc/core/channel/v1/query";
import { Height } from "cosmjs-types/ibc/core/client/v1/client";
import {
QueryClientImpl as ClientQuery,
QueryClientParamsResponse,
@ -36,7 +34,7 @@ import {
QueryConsensusStateRequest,
QueryConsensusStateResponse,
QueryConsensusStatesResponse,
} from "../codec/ibc/core/client/v1/query";
} from "cosmjs-types/ibc/core/client/v1/query";
import {
QueryClientConnectionsResponse,
QueryClientImpl as ConnectionQuery,
@ -45,11 +43,13 @@ import {
QueryConnectionConsensusStateResponse,
QueryConnectionResponse,
QueryConnectionsResponse,
} from "../codec/ibc/core/connection/v1/query";
} from "cosmjs-types/ibc/core/connection/v1/query";
import {
ClientState as TendermintClientState,
ConsensusState as TendermintConsensusState,
} from "../codec/ibc/lightclients/tendermint/v1/tendermint";
} from "cosmjs-types/ibc/lightclients/tendermint/v1/tendermint";
import Long from "long";
import { QueryClient } from "./queryclient";
import { createPagination, createProtobufRpcClient } from "./utils";

View File

@ -1,6 +1,4 @@
import { fromBase64 } from "@cosmjs/encoding";
import Long from "long";
import {
Channel,
Counterparty as ChannelCounterparty,
@ -8,15 +6,16 @@ import {
Order,
PacketState,
State as ChannelState,
} from "../codec/ibc/core/channel/v1/channel";
import { MerklePrefix } from "../codec/ibc/core/commitment/v1/commitment";
} from "cosmjs-types/ibc/core/channel/v1/channel";
import { MerklePrefix } from "cosmjs-types/ibc/core/commitment/v1/commitment";
import {
ConnectionEnd,
Counterparty as ConnectionCounterparty,
IdentifiedConnection,
State as ConnectionState,
Version,
} from "../codec/ibc/core/connection/v1/connection";
} from "cosmjs-types/ibc/core/connection/v1/connection";
import Long from "long";
// From scripts/simapp/genesis-ibc.json

View File

@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { toAscii } from "@cosmjs/encoding";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { QueryAllBalancesRequest, QueryAllBalancesResponse } from "cosmjs-types/cosmos/bank/v1beta1/query";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
import { QueryAllBalancesRequest, QueryAllBalancesResponse } from "../codec/cosmos/bank/v1beta1/query";
import { Coin } from "../codec/cosmos/base/v1beta1/coin";
import { nonNegativeIntegerMatcher, pendingWithoutSimapp, simapp, unused } from "../testutils.spec";
import { QueryClient } from "./queryclient";
import { toAccAddress } from "./utils";

View File

@ -4,10 +4,9 @@ import { toAscii, toHex } from "@cosmjs/encoding";
import { firstEvent } from "@cosmjs/stream";
import { tendermint34, Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { arrayContentEquals, assert, assertDefined, isNonNullObject, sleep } from "@cosmjs/utils";
import { ProofOps } from "cosmjs-types/tendermint/crypto/proof";
import { Stream } from "xstream";
import { ProofOps } from "../codec/tendermint/crypto/proof";
type QueryExtensionSetup<P> = (base: QueryClient) => P;
function checkAndParseOp(op: tendermint34.ProofOp, kind: string, key: Uint8Array): ics23.CommitmentProof {

View File

@ -2,8 +2,8 @@
import { coin, coins, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { sleep } from "@cosmjs/utils";
import { MsgDelegate, MsgUndelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { MsgDelegate, MsgUndelegate } from "../codec/cosmos/staking/v1beta1/tx";
import { MsgDelegateEncodeObject, MsgUndelegateEncodeObject } from "../encodeobjects";
import { SigningStargateClient } from "../signingstargateclient";
import { assertIsBroadcastTxSuccess } from "../stargateclient";

View File

@ -1,6 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import Long from "long";
import {
QueryClientImpl,
QueryDelegationResponse,
@ -17,8 +15,10 @@ import {
QueryValidatorResponse,
QueryValidatorsResponse,
QueryValidatorUnbondingDelegationsResponse,
} from "../codec/cosmos/staking/v1beta1/query";
import { BondStatus } from "../codec/cosmos/staking/v1beta1/staking";
} from "cosmjs-types/cosmos/staking/v1beta1/query";
import { BondStatus } from "cosmjs-types/cosmos/staking/v1beta1/staking";
import Long from "long";
import { QueryClient } from "./queryclient";
import { createPagination, createProtobufRpcClient } from "./utils";

View File

@ -1,7 +1,7 @@
import { Bech32 } from "@cosmjs/encoding";
import { PageRequest } from "cosmjs-types/cosmos/base/query/v1beta1/pagination";
import Long from "long";
import { PageRequest } from "../codec/cosmos/base/query/v1beta1/pagination";
import { QueryClient } from "./queryclient";
/**

View File

@ -2,15 +2,15 @@
import { Secp256k1HdWallet } from "@cosmjs/amino";
import { coin, coins, DirectSecp256k1HdWallet, Registry } from "@cosmjs/proto-signing";
import { assert, sleep } from "@cosmjs/utils";
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
import { DeepPartial, MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import { AuthInfo, TxBody, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import protobuf from "protobufjs/minimal";
import { decodeTxRaw } from "../../proto-signing/build";
import { AminoMsgDelegate } from "./aminomsgs";
import { AminoTypes } from "./aminotypes";
import { MsgSend } from "./codec/cosmos/bank/v1beta1/tx";
import { Coin } from "./codec/cosmos/base/v1beta1/coin";
import { DeepPartial, MsgDelegate } from "./codec/cosmos/staking/v1beta1/tx";
import { AuthInfo, TxBody, TxRaw } from "./codec/cosmos/tx/v1beta1/tx";
import { MsgDelegateEncodeObject, MsgSendEncodeObject } from "./encodeobjects";
import { GasPrice } from "./fee";
import { PrivateSigningStargateClient, SigningStargateClient } from "./signingstargateclient";

View File

@ -14,27 +14,24 @@ import {
} from "@cosmjs/proto-signing";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { assert } from "@cosmjs/utils";
import Long from "long";
import { AminoTypes } from "./aminotypes";
import { MsgMultiSend } from "./codec/cosmos/bank/v1beta1/tx";
import { Coin } from "./codec/cosmos/base/v1beta1/coin";
import { MsgMultiSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
import {
MsgFundCommunityPool,
MsgSetWithdrawAddress,
MsgWithdrawDelegatorReward,
MsgWithdrawValidatorCommission,
} from "./codec/cosmos/distribution/v1beta1/tx";
} from "cosmjs-types/cosmos/distribution/v1beta1/tx";
import {
MsgBeginRedelegate,
MsgCreateValidator,
MsgDelegate,
MsgEditValidator,
MsgUndelegate,
} 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";
} 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,
@ -46,20 +43,23 @@ import {
MsgRecvPacket,
MsgTimeout,
MsgTimeoutOnClose,
} from "./codec/ibc/core/channel/v1/tx";
import { Height } from "./codec/ibc/core/client/v1/client";
} from "cosmjs-types/ibc/core/channel/v1/tx";
import { Height } from "cosmjs-types/ibc/core/client/v1/client";
import {
MsgCreateClient,
MsgSubmitMisbehaviour,
MsgUpdateClient,
MsgUpgradeClient,
} from "./codec/ibc/core/client/v1/tx";
} from "cosmjs-types/ibc/core/client/v1/tx";
import {
MsgConnectionOpenAck,
MsgConnectionOpenConfirm,
MsgConnectionOpenInit,
MsgConnectionOpenTry,
} from "./codec/ibc/core/connection/v1/tx";
} from "cosmjs-types/ibc/core/connection/v1/tx";
import Long from "long";
import { AminoTypes } from "./aminotypes";
import {
MsgDelegateEncodeObject,
MsgSendEncodeObject,

View File

@ -9,10 +9,10 @@ import {
TxBodyEncodeObject,
} from "@cosmjs/proto-signing";
import { assert, sleep } from "@cosmjs/utils";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { decodeTxRaw } from "../../proto-signing/build";
import { Coin } from "./codec/cosmos/base/v1beta1/coin";
import { TxRaw } from "./codec/cosmos/tx/v1beta1/tx";
import { isMsgSendEncodeObject } from "./encodeobjects";
import {
BroadcastTxResponse,

View File

@ -10,9 +10,9 @@ import {
TxBodyEncodeObject,
} from "@cosmjs/proto-signing";
import { assert, sleep } from "@cosmjs/utils";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { ReadonlyDate } from "readonly-date";
import { TxRaw } from "./codec/cosmos/tx/v1beta1/tx";
import {
assertIsBroadcastTxSuccess,
PrivateStargateClient,

View File

@ -3,10 +3,10 @@ import { toHex } from "@cosmjs/encoding";
import { Uint53 } from "@cosmjs/math";
import { Tendermint34Client, toRfc3339WithNanoseconds } from "@cosmjs/tendermint-rpc";
import { sleep } from "@cosmjs/utils";
import { MsgData } from "cosmjs-types/cosmos/base/abci/v1beta1/abci";
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
import { Account, accountFromAny } from "./accounts";
import { MsgData } from "./codec/cosmos/base/abci/v1beta1/abci";
import { Coin } from "./codec/cosmos/base/v1beta1/coin";
import { AuthExtension, BankExtension, QueryClient, setupAuthExtension, setupBankExtension } from "./queries";
import {
isSearchByHeightQuery,

View File

@ -9,9 +9,8 @@ import {
DirectSignResponse,
makeAuthInfoBytes,
} from "@cosmjs/proto-signing";
import { SignMode } from "./codec/cosmos/tx/signing/v1beta1/signing";
import { AuthInfo, SignDoc, TxBody } from "./codec/cosmos/tx/v1beta1/tx";
import { SignMode } from "cosmjs-types/cosmos/tx/signing/v1beta1/signing";
import { AuthInfo, SignDoc, TxBody } from "cosmjs-types/cosmos/tx/v1beta1/tx";
export function simappEnabled(): boolean {
return !!process.env.SIMAPP_ENABLED;