|
1 | 1 | use std::collections::HashMap; |
2 | 2 |
|
| 3 | +use crate::queries::errors::QueryError; |
3 | 4 | use crate::{ |
4 | 5 | Anchor, DRepCredential, GovActionId, Lovelace, ProposalProcedure, StakeAddress, TxHash, |
5 | 6 | TxIdentifier, Vote, Voter, VotingProcedure, |
@@ -41,8 +42,7 @@ pub enum GovernanceStateQueryResponse { |
41 | 42 | ProposalWithdrawals(ProposalWithdrawals), |
42 | 43 | ProposalVotes(ProposalVotes), |
43 | 44 | ProposalMetadata(ProposalMetadata), |
44 | | - NotFound, |
45 | | - Error(String), |
| 45 | + Error(QueryError), |
46 | 46 | } |
47 | 47 |
|
48 | 48 | #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] |
@@ -124,14 +124,3 @@ pub struct ProposalVotes { |
124 | 124 |
|
125 | 125 | #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] |
126 | 126 | pub struct ProposalMetadata {} |
127 | | - |
128 | | -pub fn handle_governance_query_result<T>( |
129 | | - result: anyhow::Result<Option<T>>, |
130 | | - mapper: impl FnOnce(T) -> GovernanceStateQueryResponse, |
131 | | -) -> GovernanceStateQueryResponse { |
132 | | - match result { |
133 | | - Ok(Some(val)) => mapper(val), |
134 | | - Ok(None) => GovernanceStateQueryResponse::NotFound, |
135 | | - Err(e) => GovernanceStateQueryResponse::Error(e.to_string()), |
136 | | - } |
137 | | -} |
0 commit comments