From 9dbc180a3ec090b8f13a849d43fa79acd901af04 Mon Sep 17 00:00:00 2001 From: abefernan <44572727+abefernan@users.noreply.github.com> Date: Thu, 27 Apr 2023 16:29:54 +0200 Subject: [PATCH] Add tx / msg types --- types/txMsg.ts | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 types/txMsg.ts diff --git a/types/txMsg.ts b/types/txMsg.ts new file mode 100644 index 0000000..cc94ec3 --- /dev/null +++ b/types/txMsg.ts @@ -0,0 +1,53 @@ +export type TxType = null | "send" | "delegate" | "undelegate" | "redelegate" | "claimRewards"; + +export type TxMsg = + | TxMsgSend + | TxMsgDelegate + | TxMsgUndelegate + | TxMsgRedelegate + | TxMsgClaimRewards; + +export interface TxMsgSend { + readonly typeUrl: "/cosmos.bank.v1beta1.MsgSend"; + readonly value: { + readonly fromAddress: string; + readonly toAddress: string; + readonly amount: [{ readonly amount: string; readonly denom: string }]; + }; +} + +export interface TxMsgDelegate { + readonly typeUrl: "/cosmos.staking.v1beta1.MsgDelegate"; + readonly value: { + readonly delegatorAddress: string; + readonly validatorAddress: string; + readonly amount: [{ readonly amount: string; readonly denom: string }]; + }; +} + +export interface TxMsgUndelegate { + readonly typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate"; + readonly value: { + readonly delegatorAddress: string; + readonly validatorAddress: string; + readonly amount: [{ readonly amount: string; readonly denom: string }]; + }; +} + +export interface TxMsgRedelegate { + readonly typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate"; + readonly value: { + readonly delegatorAddress: string; + readonly validatorSrcAddress: string; + readonly validatorDstAddress: string; + readonly amount: [{ readonly amount: string; readonly denom: string }]; + }; +} + +export interface TxMsgClaimRewards { + readonly typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"; + readonly value: { + readonly delegatorAddress: string; + readonly validatorAddress: string; + }; +}