Loading rust-libs/modules/gva/bca/src/exec_req_type.rs +3 −0 Original line number Diff line number Diff line Loading @@ -92,5 +92,8 @@ pub(super) async fn execute_req_type( )) } BcaReqTypeV0::CurrentUd => current_ud::exec_req_current_ud(bca_executor).await, BcaReqTypeV0::BalancesOfScripts(scripts) => { balances::exec_req_balances_of_scripts(bca_executor, scripts).await } } } rust-libs/modules/gva/bca/src/exec_req_type/balances.rs +22 −0 Original line number Diff line number Diff line Loading @@ -37,3 +37,25 @@ pub(super) async fn exec_req_balances_of_pubkeys( .await??, )) } pub(super) async fn exec_req_balances_of_scripts( bca_executor: &BcaExecutor, scripts: ArrayVec<[WalletScriptV10; 16]>, ) -> Result<BcaRespTypeV0, ExecReqTypeError> { let dbs_reader = bca_executor.dbs_reader(); Ok(BcaRespTypeV0::Balances( bca_executor .dbs_pool .execute(move |_| { scripts .into_iter() .map(|script| { dbs_reader .get_account_balance(&script) .map(|balance_opt| balance_opt.map(|balance| balance.0)) }) .collect::<Result<ArrayVec<_>, _>>() }) .await??, )) } rust-libs/modules/gva/bca/types/src/lib.rs +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ pub enum BcaReqTypeV0 { SendTxs(Txs), Identities(ArrayVec<[PublicKey; 16]>), CurrentUd, BalancesOfScripts(ArrayVec<[WalletScriptV10; 16]>), } // Request types helpers Loading Loading
rust-libs/modules/gva/bca/src/exec_req_type.rs +3 −0 Original line number Diff line number Diff line Loading @@ -92,5 +92,8 @@ pub(super) async fn execute_req_type( )) } BcaReqTypeV0::CurrentUd => current_ud::exec_req_current_ud(bca_executor).await, BcaReqTypeV0::BalancesOfScripts(scripts) => { balances::exec_req_balances_of_scripts(bca_executor, scripts).await } } }
rust-libs/modules/gva/bca/src/exec_req_type/balances.rs +22 −0 Original line number Diff line number Diff line Loading @@ -37,3 +37,25 @@ pub(super) async fn exec_req_balances_of_pubkeys( .await??, )) } pub(super) async fn exec_req_balances_of_scripts( bca_executor: &BcaExecutor, scripts: ArrayVec<[WalletScriptV10; 16]>, ) -> Result<BcaRespTypeV0, ExecReqTypeError> { let dbs_reader = bca_executor.dbs_reader(); Ok(BcaRespTypeV0::Balances( bca_executor .dbs_pool .execute(move |_| { scripts .into_iter() .map(|script| { dbs_reader .get_account_balance(&script) .map(|balance_opt| balance_opt.map(|balance| balance.0)) }) .collect::<Result<ArrayVec<_>, _>>() }) .await??, )) }
rust-libs/modules/gva/bca/types/src/lib.rs +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ pub enum BcaReqTypeV0 { SendTxs(Txs), Identities(ArrayVec<[PublicKey; 16]>), CurrentUd, BalancesOfScripts(ArrayVec<[WalletScriptV10; 16]>), } // Request types helpers Loading