File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -674,6 +674,37 @@ def get_committee_state(self) -> dict[str, tp.Any]:
674674 out : dict [str , tp .Any ] = json .loads (self .query_cli (["committee-state" ]))
675675 return out
676676
677+ def get_proposals (
678+ self ,
679+ action_txid : str = "" ,
680+ action_ix : int | None = None ,
681+ ) -> list [dict [str , tp .Any ]]:
682+ """Get the governance proposals that are eligible for ratification.
683+
684+ When no arguments are passed, query for all proposals.
685+
686+ Args:
687+ action_txid: TxId of the governance action.
688+ action_ix: Tx's governance action index.
689+
690+ Returns:
691+ list[dict[str, tp.Any]]: A list of governance proposals.
692+ """
693+ if bool (action_txid ) != (action_ix is not None ):
694+ msg = "Both `action_txid` and `action_ix` must be specified together."
695+ raise ValueError (msg )
696+
697+ query_args = ["proposals" ]
698+
699+ if action_txid and action_ix is not None :
700+ query_args .extend (["--governance-action-tx-id" , action_txid ])
701+ query_args .extend (["--governance-action-index" , str (action_ix )])
702+ else :
703+ query_args .append ("--all-proposals" )
704+
705+ proposals : list [dict [str , tp .Any ]] = json .loads (self .query_cli (query_args ))
706+ return proposals
707+
677708 def get_treasury (self ) -> int :
678709 """Get the treasury value."""
679710 return int (self .query_cli (["treasury" ]))
You can’t perform that action at this time.
0 commit comments