pub fn resolve_from(
        block: &Block,
        discrimination: Discrimination,
        prev_transactions: &Transactions,
        prev_blocks: &Blocks,
    ) -> ExplorerBlock {
        let fragments = block.contents.iter();
        let id = block.id();
        let chain_length = block.chain_length();

        let transactions = fragments
            .filter_map(|fragment| {
                let fragment_id = fragment.id();
                match fragment {
                    Fragment::Transaction(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            //certificate
                            None,
                        ),
                    )),
                    Fragment::OwnerStakeDelegation(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            Some(Certificate::OwnerStakeDelegation(
                                auth_tx.transaction.extra.clone(),
                            )),
                        ),
                    )),
                    Fragment::StakeDelegation(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            Some(Certificate::StakeDelegation(
                                auth_tx.transaction.extra.clone(),
                            )),
                        ),
                    )),
                    Fragment::PoolRegistration(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            Some(Certificate::PoolRegistration(
                                auth_tx.transaction.extra.clone(),
                            )),
                        ),
                    )),
                    Fragment::PoolManagement(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            Some(Certificate::PoolManagement(
                                auth_tx.transaction.extra.clone(),
                            )),
                        ),
                    )),
                    _ => None,
                }
            })
            .collect();

        ExplorerBlock {
            id,
            transactions,
            chain_length,
            date: *block.header.block_date(),
            parent_hash: block.parent_id(),
        }
    }
/// Map the given `Block` to the `ExplorerBlock`, transforming all the transactions
/// using the previous state to transform the utxo inputs to the form (Address, Amount)
/// and mapping the account inputs to addresses with the given discrimination
/// This function relies on the given block to be validated previously, and will panic
/// otherwise
Map the given `Block` to the `ExplorerBlock`, transforming all the transactions
using the previous state to transform the utxo inputs to the form (Address, Amount)
and mapping the account inputs to addresses with the given discrimination
This function relies on the given block to be validated previously, and will panic
otherwise
Map the given ` Block ` to the ` ExplorerBlock ` transforming all the transactions using the previous state to transform the utxo inputs to the form ( Address Amount ) and mapping the account inputs to addresses with the given discrimination This function relies on the given block to be validated previously and will panic otherwise
pub fn resolve_from(
        block: &Block,
        discrimination: Discrimination,
        prev_transactions: &Transactions,
        prev_blocks: &Blocks,
    ) -> ExplorerBlock {
        let fragments = block.contents.iter();
        let id = block.id();
        let chain_length = block.chain_length();
        let transactions = fragments
            .filter_map(|fragment| {
                let fragment_id = fragment.id();
                match fragment {
                    Fragment::Transaction(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            //certificate
                            None,
                        ),
                    )),
                    Fragment::OwnerStakeDelegation(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            Some(Certificate::OwnerStakeDelegation(
                                auth_tx.transaction.extra.clone(),
                            )),
                        ),
                    )),
                    Fragment::StakeDelegation(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            Some(Certificate::StakeDelegation(
                                auth_tx.transaction.extra.clone(),
                            )),
                        ),
                    )),
                    Fragment::PoolRegistration(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            Some(Certificate::PoolRegistration(
                                auth_tx.transaction.extra.clone(),
                            )),
                        ),
                    )),
                    Fragment::PoolManagement(auth_tx) => Some((
                        fragment_id,
                        ExplorerTransaction::from(
                            &fragment_id,
                            auth_tx,
                            discrimination,
                            prev_transactions,
                            prev_blocks,
                            Some(Certificate::PoolManagement(
                                auth_tx.transaction.extra.clone(),
                            )),
                        ),
                    )),
                    _ => None,
                }
            })
            .collect();
        ExplorerBlock {
            id,
            transactions,
            chain_length,
            date: *block.header.block_date(),
            parent_hash: block.parent_id(),
        }
    }
pub fn resolve_from ( block : & Block , discrimination : Discrimination , prev_transactions : & Transactions , prev_blocks : & Blocks , ) -> ExplorerBlock { let fragments = block . contents . iter ( ) ; let id = block . id ( ) ; let chain_length = block . chain_length ( ) ; let transactions = fragments . filter_map ( | fragment | { let fragment_id = fragment . id ( ) ; match fragment { Fragment :: Transaction ( auth_tx ) => Some ( ( fragment_id , ExplorerTransaction :: from ( & fragment_id , auth_tx , discrimination , prev_transactions , prev_blocks , //certificate None , ) , ) ) , Fragment :: OwnerStakeDelegation ( auth_tx ) => Some ( ( fragment_id , ExplorerTransaction :: from ( & fragment_id , auth_tx , discrimination , prev_transactions , prev_blocks , Some ( Certificate :: OwnerStakeDelegation ( auth_tx . transaction . extra . clone ( ) , ) ) , ) , ) ) , Fragment :: StakeDelegation ( auth_tx ) => Some ( ( fragment_id , ExplorerTransaction :: from ( & fragment_id , auth_tx , discrimination , prev_transactions , prev_blocks , Some ( Certificate :: StakeDelegation ( auth_tx . transaction . extra . clone ( ) , ) ) , ) , ) ) , Fragment :: PoolRegistration ( auth_tx ) => Some ( ( fragment_id , ExplorerTransaction :: from ( & fragment_id , auth_tx , discrimination , prev_transactions , prev_blocks , Some ( Certificate :: PoolRegistration ( auth_tx . transaction . extra . clone ( ) , ) ) , ) , ) ) , Fragment :: PoolManagement ( auth_tx ) => Some ( ( fragment_id , ExplorerTransaction :: from ( & fragment_id , auth_tx , discrimination , prev_transactions , prev_blocks , Some ( Certificate :: PoolManagement ( auth_tx . transaction . extra . clone ( ) , ) ) , ) , ) ) , _ => None , } } ) . collect ( ) ; ExplorerBlock { id , transactions , chain_length , date : * block . header . block_date ( ) , parent_hash : block . parent_id ( ) , } }
Map the given `Block` to the `ExplorerBlock`, transforming all the transactions
using the previous state to transform the utxo inputs to the form (Address, Amount)
and mapping the account inputs to addresses with the given discrimination
This function relies on the given block to be validated previously, and will panic
otherwise
Map the given ` Block ` to the ` ExplorerBlock ` transforming all the transactions using the previous state to transform the utxo inputs to the form ( Address Amount ) and mapping the account inputs to addresses with the given discrimination This function relies on the given block to be validated previously and will panic otherwise
block
&Block
discrimination
Discrimination
prev_transactions
&Transactions
prev_blocks
&Blocks
block
&Block
discrimination
Discrimination
prev_transactions
&Transactions
prev_blocks
&Blocks