pub async fn download_block_with_deploys(
    client: &mut Client,
    url: &str,
    block_hash: BlockHash,
) -> Result<BlockWithDeploys, anyhow::Error> {
    let block_identifier = BlockIdentifier::Hash(block_hash);
    let block = get_block(client, url, Some(GetBlockParams { block_identifier }))
        .await?
        .block
        .unwrap();

    let mut transfers = Vec::new();
    for transfer_hash in block.transfer_hashes() {
        let transfer: Deploy = get_deploy(
            client,
            url,
            GetDeployParams {
                deploy_hash: *transfer_hash,
            },
        )
        .await?
        .deploy;
        transfers.push(transfer);
    }

    let mut deploys = Vec::new();
    for deploy_hash in block.deploy_hashes() {
        let deploy: Deploy = get_deploy(
            client,
            url,
            GetDeployParams {
                deploy_hash: *deploy_hash,
            },
        )
        .await?
        .deploy;
        deploys.push(deploy);
    }

    Ok(BlockWithDeploys {
        block,
        transfers,
        deploys,
    })
}
/// Download a block, along with all it's deploys.
Download a block, along with all it's deploys.
Download a block along with all it ' s deploys .
pub async fn download_block_with_deploys(
    client: &mut Client,
    url: &str,
    block_hash: BlockHash,
) -> Result<BlockWithDeploys, anyhow::Error> {
    let block_identifier = BlockIdentifier::Hash(block_hash);
    let block = get_block(client, url, Some(GetBlockParams { block_identifier }))
        .await?
        .block
        .unwrap();
    let mut transfers = Vec::new();
    for transfer_hash in block.transfer_hashes() {
        let transfer: Deploy = get_deploy(
            client,
            url,
            GetDeployParams {
                deploy_hash: *transfer_hash,
            },
        )
        .await?
        .deploy;
        transfers.push(transfer);
    }
    let mut deploys = Vec::new();
    for deploy_hash in block.deploy_hashes() {
        let deploy: Deploy = get_deploy(
            client,
            url,
            GetDeployParams {
                deploy_hash: *deploy_hash,
            },
        )
        .await?
        .deploy;
        deploys.push(deploy);
    }
    Ok(BlockWithDeploys {
        block,
        transfers,
        deploys,
    })
}
pub async fn download_block_with_deploys ( client : & mut Client , url : & str , block_hash : BlockHash , ) -> Result < BlockWithDeploys , anyhow :: Error > { let block_identifier = BlockIdentifier :: Hash ( block_hash ) ; let block = get_block ( client , url , Some ( GetBlockParams { block_identifier } ) ) . await ? . block . unwrap ( ) ; let mut transfers = Vec :: new ( ) ; for transfer_hash in block . transfer_hashes ( ) { let transfer : Deploy = get_deploy ( client , url , GetDeployParams { deploy_hash : * transfer_hash , } , ) . await ? . deploy ; transfers . push ( transfer ) ; } let mut deploys = Vec :: new ( ) ; for deploy_hash in block . deploy_hashes ( ) { let deploy : Deploy = get_deploy ( client , url , GetDeployParams { deploy_hash : * deploy_hash , } , ) . await ? . deploy ; deploys . push ( deploy ) ; } Ok ( BlockWithDeploys { block , transfers , deploys , } ) }
Download a block, along with all it's deploys.
Download a block along with all it ' s deploys .
client
&mut Client
url
&str
block_hash
BlockHash
client
&mut Client
url
&str
block_hash
BlockHash