Add MsgSetWithdrawAddress types and helpers

This commit is contained in:
abefernan
2023-05-19 13:44:19 +02:00
parent b8501be674
commit 59699e3941
2 changed files with 34 additions and 3 deletions
+17 -1
View File
@@ -5,6 +5,7 @@ import {
TxMsgDelegate,
TxMsgRedelegate,
TxMsgSend,
TxMsgSetWithdrawAddress,
TxMsgUndelegate,
} from "../types/txMsg";
@@ -58,4 +59,19 @@ const isTxMsgClaimRewards = (msg: TxMsg | EncodeObject): msg is TxMsgClaimReward
!!msg.value.delegatorAddress &&
!!msg.value.validatorAddress;
export { isTxMsgSend, isTxMsgDelegate, isTxMsgUndelegate, isTxMsgRedelegate, isTxMsgClaimRewards };
const isTxMsgSetWithdrawAddress = (msg: TxMsg | EncodeObject): msg is TxMsgSetWithdrawAddress =>
msg.typeUrl === "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress" &&
"value" in msg &&
"delegatorAddress" in msg.value &&
"withdrawAddress" in msg.value &&
!!msg.value.delegatorAddress &&
!!msg.value.withdrawAddress;
export {
isTxMsgSend,
isTxMsgDelegate,
isTxMsgUndelegate,
isTxMsgRedelegate,
isTxMsgClaimRewards,
isTxMsgSetWithdrawAddress,
};
+17 -2
View File
@@ -1,11 +1,18 @@
export type TxType = "send" | "delegate" | "undelegate" | "redelegate" | "claimRewards";
export type TxType =
| "send"
| "delegate"
| "undelegate"
| "redelegate"
| "claimRewards"
| "setWithdrawAddress";
export type TxMsg =
| TxMsgSend
| TxMsgDelegate
| TxMsgUndelegate
| TxMsgRedelegate
| TxMsgClaimRewards;
| TxMsgClaimRewards
| TxMsgSetWithdrawAddress;
export interface TxMsgSend {
readonly typeUrl: "/cosmos.bank.v1beta1.MsgSend";
@@ -51,3 +58,11 @@ export interface TxMsgClaimRewards {
readonly validatorAddress: string;
};
}
export interface TxMsgSetWithdrawAddress {
readonly typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress";
readonly value: {
readonly delegatorAddress: string;
readonly withdrawAddress: string;
};
}