@@ -11,6 +11,7 @@ import { assertDefinedAndNotNull } from '@cosmjs/utils';
1111import { AminoMsg , Coin } from '@cosmjs/amino' ;
1212import Long from 'long' ;
1313
14+ import { MsgVote } from '../codec/cosmos/gov/v1/tx' ;
1415import { MsgDeposit as MsgDepositDfract } from '../codec/lum-network/dfract/tx' ;
1516import {
1617 MsgDeposit as MsgMillionsDeposit ,
@@ -19,6 +20,17 @@ import {
1920 MsgWithdrawDepositRetry as MsgMillionsWithdrawDepositRetry ,
2021 MsgClaimPrize as MsgMillionsClaimPrize ,
2122} from '../codec/lum-network/millions/tx' ;
23+
24+ export interface AminoMsgGovVote extends AminoMsg {
25+ readonly type : 'cosmos-sdk/v1/MsgVote' ;
26+ readonly value : {
27+ readonly proposal_id : string ;
28+ readonly voter : string ;
29+ readonly option : number ;
30+ readonly metadata ?: string ;
31+ } ;
32+ }
33+
2234export interface AminoMsgDepositDfract extends AminoMsg {
2335 readonly type : 'lum-network/MsgDeposit' ;
2436 readonly value : {
@@ -82,11 +94,30 @@ export const createDefaultAminoTypes = (): AminoConverters => {
8294 ...createAuthzAminoConverters ( ) ,
8395 ...createDistributionAminoConverters ( ) ,
8496 ...createGovAminoConverters ( ) ,
97+ ...createGovV1AminoConverters ( ) ,
8598 ...createStakingAminoConverters ( ) ,
8699 ...createIbcAminoConverters ( ) ,
87100 } ;
88101} ;
89102
103+ const createGovV1AminoConverters = ( ) : AminoConverters => ( {
104+ '/cosmos.gov.v1.MsgVote' : {
105+ aminoType : 'cosmos-sdk/v1/MsgVote' ,
106+ toAmino : ( { proposalId, voter, option, metadata } : MsgVote ) : AminoMsgGovVote [ 'value' ] => ( {
107+ proposal_id : proposalId . toString ( ) ,
108+ voter,
109+ option,
110+ metadata : metadata . length > 0 ? metadata : undefined ,
111+ } ) ,
112+ fromAmino : ( { proposal_id, voter, option, metadata } : AminoMsgGovVote [ 'value' ] ) : MsgVote => ( {
113+ proposalId : Long . fromString ( proposal_id ) ,
114+ voter,
115+ option,
116+ metadata : metadata || '' ,
117+ } ) ,
118+ } ,
119+ } ) ;
120+
90121const createDfractAminoConverters = ( ) : AminoConverters => ( {
91122 '/lum.network.dfract.MsgDeposit' : {
92123 aminoType : 'lum-network/MsgDeposit' ,
0 commit comments