stargate: Export defaultRegistryTypes

This commit is contained in:
willclarktech 2021-01-27 18:05:52 +00:00
parent af5ea8cbe7
commit 047c8f717a
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
4 changed files with 19 additions and 15 deletions

View File

@ -28,4 +28,4 @@ export {
SequenceResponse,
StargateClient,
} from "./stargateclient";
export { SigningStargateClient } from "./signingstargateclient";
export { defaultRegistryTypes, SigningStargateClient } from "./signingstargateclient";

View File

@ -15,6 +15,7 @@ import { Int53 } from "@cosmjs/math";
import {
EncodeObject,
encodePubkey,
GeneratedType,
isOfflineDirectSigner,
makeAuthInfoBytes,
makeSignDoc,
@ -46,19 +47,21 @@ const { TxRaw } = cosmos.tx.v1beta1;
const defaultGasPrice = GasPrice.fromString("0.025ucosm");
const defaultGasLimits: GasLimits<CosmosFeeTable> = { send: 80000 };
export const defaultRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [
["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend],
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool],
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress],
["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward],
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission],
["/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],
];
function createDefaultRegistry(): Registry {
return new Registry([
["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend],
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool],
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress],
["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward],
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission],
["/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],
]);
return new Registry(defaultRegistryTypes);
}
/** Use for testing only */

View File

@ -28,4 +28,4 @@ export {
SequenceResponse,
StargateClient,
} from "./stargateclient";
export { SigningStargateClient } from "./signingstargateclient";
export { defaultRegistryTypes, SigningStargateClient } from "./signingstargateclient";

View File

@ -1,7 +1,8 @@
import { Coin, CosmosFeeTable, GasLimits, GasPrice, StdFee } from "@cosmjs/launchpad";
import { EncodeObject, OfflineSigner, Registry } from "@cosmjs/proto-signing";
import { EncodeObject, GeneratedType, OfflineSigner, Registry } from "@cosmjs/proto-signing";
import { AminoTypes } from "./aminotypes";
import { BroadcastTxResponse, StargateClient } from "./stargateclient";
export declare const defaultRegistryTypes: ReadonlyArray<[string, GeneratedType]>;
/** Use for testing only */
export interface PrivateSigningStargateClient {
readonly fees: CosmosFeeTable;