stargate: Refactor registry initialisation in SigningStargateClient

This commit is contained in:
willclarktech 2021-01-13 12:41:22 +00:00
parent 4270e325b5
commit 027f76ce74
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7

View File

@ -40,6 +40,17 @@ const { TxRaw } = cosmos.tx.v1beta1;
const defaultGasPrice = GasPrice.fromString("0.025ucosm");
const defaultGasLimits: GasLimits<CosmosFeeTable> = { send: 80000 };
function createDefaultRegistry(): Registry {
return new Registry([
["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend],
["/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],
]);
}
/** Use for testing only */
export interface PrivateSigningStargateClient {
readonly fees: CosmosFeeTable;
@ -76,14 +87,7 @@ export class SigningStargateClient extends StargateClient {
) {
super(tmClient);
const {
registry = new Registry([
["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend],
["/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],
]),
registry = createDefaultRegistry(),
aminoTypes = new AminoTypes({ prefix: options.prefix }),
gasPrice = defaultGasPrice,
gasLimits = defaultGasLimits,