miden-ntx-builder 0.16.1

Miden network transaction builder
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Returns the committed account state for a given network account.

use miden_node_db::DatabaseError;
use miden_node_db::sqlite::ReadTx;
use miden_protocol::account::{Account, AccountId};

const SQL: &str = include_str!("get_account.sql");

/// Returns the committed account state for the given network account.
pub fn get_account(
    tx: &ReadTx<'_>,
    account_id: AccountId,
) -> Result<Option<Account>, DatabaseError> {
    Ok(tx.query(SQL, &[&account_id], |row| row.get::<Account>(0))?.into_iter().next())
}