@@ -37,13 +37,13 @@ pub async fn handle_single_account_blockfrost(
3737 params : Vec < String > ,
3838 handlers_config : Arc < HandlersConfig > ,
3939) -> Result < RESTResponse > {
40- let stake_address = match parse_stake_address ( & params) {
40+ let account = match parse_stake_address ( & params) {
4141 Ok ( addr) => addr,
4242 Err ( resp) => return Ok ( resp) ,
4343 } ;
4444 // Prepare the message
4545 let msg = Arc :: new ( Message :: StateQuery ( StateQuery :: Accounts (
46- AccountsStateQuery :: GetAccountInfo { stake_address } ,
46+ AccountsStateQuery :: GetAccountInfo { account } ,
4747 ) ) ) ;
4848 let account = query_state (
4949 & context,
@@ -120,16 +120,14 @@ pub async fn handle_account_registrations_blockfrost(
120120 params : Vec < String > ,
121121 handlers_config : Arc < HandlersConfig > ,
122122) -> Result < RESTResponse > {
123- let stake_address = match parse_stake_address ( & params) {
123+ let account = match parse_stake_address ( & params) {
124124 Ok ( addr) => addr,
125125 Err ( resp) => return Ok ( resp) ,
126126 } ;
127127
128128 // Prepare the message
129129 let msg = Arc :: new ( Message :: StateQuery ( StateQuery :: Accounts (
130- AccountsStateQuery :: GetAccountRegistrationHistory {
131- account : stake_address,
132- } ,
130+ AccountsStateQuery :: GetAccountRegistrationHistory { account } ,
133131 ) ) ) ;
134132
135133 // Get registrations from historical accounts state
@@ -147,10 +145,10 @@ pub async fn handle_account_registrations_blockfrost(
147145 Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
148146 AccountsStateQueryResponse :: Error ( e) ,
149147 ) ) => Err ( anyhow:: anyhow!(
150- "Internal server error while retrieving account info : {e}"
148+ "Internal server error while retrieving account registrations : {e}"
151149 ) ) ,
152150 _ => Err ( anyhow:: anyhow!(
153- "Unexpected message type while retrieving account info "
151+ "Unexpected message type while retrieving account registrations "
154152 ) ) ,
155153 } ,
156154 )
@@ -216,16 +214,14 @@ pub async fn handle_account_delegations_blockfrost(
216214 params : Vec < String > ,
217215 handlers_config : Arc < HandlersConfig > ,
218216) -> Result < RESTResponse > {
219- let stake_address = match parse_stake_address ( & params) {
217+ let account = match parse_stake_address ( & params) {
220218 Ok ( addr) => addr,
221219 Err ( resp) => return Ok ( resp) ,
222220 } ;
223221
224222 // Prepare the message
225223 let msg = Arc :: new ( Message :: StateQuery ( StateQuery :: Accounts (
226- AccountsStateQuery :: GetAccountDelegationHistory {
227- account : stake_address,
228- } ,
224+ AccountsStateQuery :: GetAccountDelegationHistory { account } ,
229225 ) ) ) ;
230226
231227 // Get delegations from historical accounts state
@@ -243,10 +239,10 @@ pub async fn handle_account_delegations_blockfrost(
243239 Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
244240 AccountsStateQueryResponse :: Error ( e) ,
245241 ) ) => Err ( anyhow:: anyhow!(
246- "Internal server error while retrieving account info : {e}"
242+ "Internal server error while retrieving account delegations : {e}"
247243 ) ) ,
248244 _ => Err ( anyhow:: anyhow!(
249- "Unexpected message type while retrieving account info "
245+ "Unexpected message type while retrieving account delegations "
250246 ) ) ,
251247 } ,
252248 )
@@ -349,10 +345,10 @@ pub async fn handle_account_mirs_blockfrost(
349345 Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
350346 AccountsStateQueryResponse :: Error ( e) ,
351347 ) ) => Err ( anyhow:: anyhow!(
352- "Internal server error while retrieving account info : {e}"
348+ "Internal server error while retrieving account mirs : {e}"
353349 ) ) ,
354350 _ => Err ( anyhow:: anyhow!(
355- "Unexpected message type while retrieving account info "
351+ "Unexpected message type while retrieving account mirs "
356352 ) ) ,
357353 } ,
358354 )
@@ -417,16 +413,14 @@ pub async fn handle_account_withdrawals_blockfrost(
417413 params : Vec < String > ,
418414 handlers_config : Arc < HandlersConfig > ,
419415) -> Result < RESTResponse > {
420- let stake_address = match parse_stake_address ( & params) {
416+ let account = match parse_stake_address ( & params) {
421417 Ok ( addr) => addr,
422418 Err ( resp) => return Ok ( resp) ,
423419 } ;
424420
425421 // Prepare the message
426422 let msg = Arc :: new ( Message :: StateQuery ( StateQuery :: Accounts (
427- AccountsStateQuery :: GetAccountRegistrationHistory {
428- account : stake_address,
429- } ,
423+ AccountsStateQuery :: GetAccountRegistrationHistory { account } ,
430424 ) ) ) ;
431425
432426 // Get withdrawals from historical accounts state
@@ -444,10 +438,10 @@ pub async fn handle_account_withdrawals_blockfrost(
444438 Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
445439 AccountsStateQueryResponse :: Error ( e) ,
446440 ) ) => Err ( anyhow:: anyhow!(
447- "Internal server error while retrieving account info : {e}"
441+ "Internal server error while retrieving account withdrawals : {e}"
448442 ) ) ,
449443 _ => Err ( anyhow:: anyhow!(
450- "Unexpected message type while retrieving account info "
444+ "Unexpected message type while retrieving account withdrawals "
451445 ) ) ,
452446 } ,
453447 )
@@ -512,16 +506,14 @@ pub async fn handle_account_rewards_blockfrost(
512506 params : Vec < String > ,
513507 handlers_config : Arc < HandlersConfig > ,
514508) -> Result < RESTResponse > {
515- let stake_address = match parse_stake_address ( & params) {
509+ let account = match parse_stake_address ( & params) {
516510 Ok ( addr) => addr,
517511 Err ( resp) => return Ok ( resp) ,
518512 } ;
519513
520514 // Prepare the message
521515 let msg = Arc :: new ( Message :: StateQuery ( StateQuery :: Accounts (
522- AccountsStateQuery :: GetAccountRegistrationHistory {
523- account : stake_address,
524- } ,
516+ AccountsStateQuery :: GetAccountRewardHistory { account } ,
525517 ) ) ) ;
526518
527519 // Get rewards from historical accounts state
@@ -539,10 +531,10 @@ pub async fn handle_account_rewards_blockfrost(
539531 Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
540532 AccountsStateQueryResponse :: Error ( e) ,
541533 ) ) => Err ( anyhow:: anyhow!(
542- "Internal server error while retrieving account info : {e}"
534+ "Internal server error while retrieving account rewards : {e}"
543535 ) ) ,
544536 _ => Err ( anyhow:: anyhow!(
545- "Unexpected message type while retrieving account info "
537+ "Unexpected message type while retrieving account rewards "
546538 ) ) ,
547539 } ,
548540 )
@@ -567,7 +559,7 @@ pub async fn handle_account_rewards_blockfrost(
567559 Ok ( json) => Ok ( RESTResponse :: with_json ( 200 , & json) ) ,
568560 Err ( e) => Ok ( RESTResponse :: with_text (
569561 500 ,
570- & format ! ( "Internal server error while serializing withdrawal history: {e}" ) ,
562+ & format ! ( "Internal server error while serializing reward history: {e}" ) ,
571563 ) ) ,
572564 }
573565}
0 commit comments