@@ -640,149 +640,19 @@ pub async fn handle_account_addresses_blockfrost(
640640
641641/// Handle `/accounts/{stake_address}/addresses/assets` Blockfrost-compatible endpoint
642642pub async fn handle_account_assets_blockfrost (
643- context : Arc < Context < Message > > ,
644- params : Vec < String > ,
645- handlers_config : Arc < HandlersConfig > ,
643+ _context : Arc < Context < Message > > ,
644+ _params : Vec < String > ,
645+ _handlers_config : Arc < HandlersConfig > ,
646646) -> Result < RESTResponse > {
647- let account = match parse_stake_address ( & params) {
648- Ok ( addr) => addr,
649- Err ( resp) => return Ok ( resp) ,
650- } ;
651-
652- // Prepare the message
653- let msg = Arc :: new ( Message :: StateQuery ( StateQuery :: Accounts (
654- AccountsStateQuery :: GetAccountAssociatedAddresses { account } ,
655- ) ) ) ;
656-
657- // Get addresses from historical accounts state
658- let addresses = query_state (
659- & context,
660- & handlers_config. historical_accounts_query_topic ,
661- msg,
662- |message| match message {
663- Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
664- AccountsStateQueryResponse :: AccountAssociatedAddresses ( addresses) ,
665- ) ) => Ok ( Some ( addresses) ) ,
666- Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
667- AccountsStateQueryResponse :: NotFound ,
668- ) ) => Ok ( None ) ,
669- Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
670- AccountsStateQueryResponse :: Error ( e) ,
671- ) ) => Err ( anyhow:: anyhow!(
672- "Internal server error while retrieving account addresses: {e}"
673- ) ) ,
674- _ => Err ( anyhow:: anyhow!(
675- "Unexpected message type while retrieving account addresses"
676- ) ) ,
677- } ,
678- )
679- . await ?;
680-
681- let Some ( addresses) = addresses else {
682- return Ok ( RESTResponse :: with_text ( 404 , "Account not found" ) ) ;
683- } ;
684-
685- let msg = Arc :: new ( Message :: StateQuery ( StateQuery :: Addresses (
686- AddressStateQuery :: GetAddressesAssets { addresses } ,
687- ) ) ) ;
688-
689- // Get assets from address state
690- let _assets = query_state (
691- & context,
692- & handlers_config. historical_accounts_query_topic ,
693- msg,
694- |message| match message {
695- Message :: StateQueryResponse ( StateQueryResponse :: Addresses (
696- AddressStateQueryResponse :: AddressesAssets ( assets) ,
697- ) ) => Ok ( Some ( assets) ) ,
698- Message :: StateQueryResponse ( StateQueryResponse :: Addresses (
699- AddressStateQueryResponse :: NotFound ,
700- ) ) => Ok ( None ) ,
701- Message :: StateQueryResponse ( StateQueryResponse :: Addresses (
702- AddressStateQueryResponse :: Error ( e) ,
703- ) ) => Err ( anyhow:: anyhow!(
704- "Internal server error while retrieving account assets: {e}"
705- ) ) ,
706- _ => Err ( anyhow:: anyhow!(
707- "Unexpected message type while retrieving account assets"
708- ) ) ,
709- } ,
710- )
711- . await ?;
712647 Ok ( RESTResponse :: with_text ( 501 , "Not implemented" ) )
713648}
714649
715650/// Handle `/accounts/{stake_address}/addresses/total` Blockfrost-compatible endpoint
716651pub async fn handle_account_totals_blockfrost (
717- context : Arc < Context < Message > > ,
718- params : Vec < String > ,
719- handlers_config : Arc < HandlersConfig > ,
652+ _context : Arc < Context < Message > > ,
653+ _params : Vec < String > ,
654+ _handlers_config : Arc < HandlersConfig > ,
720655) -> Result < RESTResponse > {
721- let account = match parse_stake_address ( & params) {
722- Ok ( addr) => addr,
723- Err ( resp) => return Ok ( resp) ,
724- } ;
725-
726- // Prepare the message
727- let msg = Arc :: new ( Message :: StateQuery ( StateQuery :: Accounts (
728- AccountsStateQuery :: GetAccountAssociatedAddresses { account } ,
729- ) ) ) ;
730-
731- // Get addresses from historical accounts state
732- let addresses = query_state (
733- & context,
734- & handlers_config. historical_accounts_query_topic ,
735- msg,
736- |message| match message {
737- Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
738- AccountsStateQueryResponse :: AccountAssociatedAddresses ( addresses) ,
739- ) ) => Ok ( Some ( addresses) ) ,
740- Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
741- AccountsStateQueryResponse :: NotFound ,
742- ) ) => Ok ( None ) ,
743- Message :: StateQueryResponse ( StateQueryResponse :: Accounts (
744- AccountsStateQueryResponse :: Error ( e) ,
745- ) ) => Err ( anyhow:: anyhow!(
746- "Internal server error while retrieving account addresses: {e}"
747- ) ) ,
748- _ => Err ( anyhow:: anyhow!(
749- "Unexpected message type while retrieving account addresses"
750- ) ) ,
751- } ,
752- )
753- . await ?;
754-
755- let Some ( addresses) = addresses else {
756- return Ok ( RESTResponse :: with_text ( 404 , "Account not found" ) ) ;
757- } ;
758-
759- let msg = Arc :: new ( Message :: StateQuery ( StateQuery :: Addresses (
760- AddressStateQuery :: GetAddressesTotals { addresses } ,
761- ) ) ) ;
762-
763- // Get totals from address state
764- let _totals = query_state (
765- & context,
766- & handlers_config. historical_accounts_query_topic ,
767- msg,
768- |message| match message {
769- Message :: StateQueryResponse ( StateQueryResponse :: Addresses (
770- AddressStateQueryResponse :: AddressesTotals ( totals) ,
771- ) ) => Ok ( Some ( totals) ) ,
772- Message :: StateQueryResponse ( StateQueryResponse :: Addresses (
773- AddressStateQueryResponse :: NotFound ,
774- ) ) => Ok ( None ) ,
775- Message :: StateQueryResponse ( StateQueryResponse :: Addresses (
776- AddressStateQueryResponse :: Error ( e) ,
777- ) ) => Err ( anyhow:: anyhow!(
778- "Internal server error while retrieving account totals: {e}"
779- ) ) ,
780- _ => Err ( anyhow:: anyhow!(
781- "Unexpected message type while retrieving account totals"
782- ) ) ,
783- } ,
784- )
785- . await ?;
786656 Ok ( RESTResponse :: with_text ( 501 , "Not implemented" ) )
787657}
788658
0 commit comments