pub async fn channel_close_init<C>(
    transaction: &mut Transaction<'_, Db>,
    rpc_client: &C,
    signer: impl Signer,
    chain_id: ChainId,
    request_id: Option<&str>,
    memo: String,
) -> Result<String>
where
    C: Client + Send + Sync,
{
    let chain = chain::get_chain(transaction, &chain_id)
        .await?
        .ok_or_else(|| anyhow!("chain details for {} not found", chain_id))?;
    ensure!(
        chain.connection_details.is_some(),
        "connection is not established with given chain"
    );

    let msg = msg_channel_close_init(signer, &chain, memo, request_id).await?;

    let response = rpc_client
        .broadcast_tx_commit(proto_encode(&msg)?.into())
        .await?;

    ensure_response_success(&response)?;

    let channel_id: String = extract_attribute(
        &response.deliver_tx.events,
        "channel_close_init",
        "channel_id",
    )?
    .parse()?;
    Ok(channel_id)
}
/// Close solomachine channel, return the solo-machine channel id
Close solomachine channel, return the solo-machine channel id
Close solomachine channel return the solo - machine channel id
pub async fn channel_close_init<C>(
    transaction: &mut Transaction<'_, Db>,
    rpc_client: &C,
    signer: impl Signer,
    chain_id: ChainId,
    request_id: Option<&str>,
    memo: String,
) -> Result<String>
where
    C: Client + Send + Sync,
{
    let chain = chain::get_chain(transaction, &chain_id)
        .await?
        .ok_or_else(|| anyhow!("chain details for {} not found", chain_id))?;
    ensure!(
        chain.connection_details.is_some(),
        "connection is not established with given chain"
    );
    let msg = msg_channel_close_init(signer, &chain, memo, request_id).await?;
    let response = rpc_client
        .broadcast_tx_commit(proto_encode(&msg)?.into())
        .await?;
    ensure_response_success(&response)?;
    let channel_id: String = extract_attribute(
        &response.deliver_tx.events,
        "channel_close_init",
        "channel_id",
    )?
    .parse()?;
    Ok(channel_id)
}
pub async fn channel_close_init < C > ( transaction : & mut Transaction < ' _ , Db > , rpc_client : & C , signer : impl Signer , chain_id : ChainId , request_id : Option < & str > , memo : String , ) -> Result < String > where C : Client + Send + Sync , { let chain = chain :: get_chain ( transaction , & chain_id ) . await ? . ok_or_else ( | | anyhow ! ( " " chain_id ) ) ? ; ensure ! ( chain connection_details is_some ( ) " " ) ; let msg = msg_channel_close_init ( signer , & chain , memo , request_id ) . await ? ; let response = rpc_client . broadcast_tx_commit ( proto_encode ( & msg ) ? . into ( ) ) . await ? ; ensure_response_success ( & response ) ? ; let channel_id : String = extract_attribute ( & response . deliver_tx . events , " " , " " , ) ? . parse ( ) ? ; Ok ( channel_id ) }
Close solomachine channel, return the solo-machine channel id
Close solomachine channel return the solo - machine channel id
transaction
&mut Transaction<'_, Db>
rpc_client
&C
signer
impl Signer
chain_id
ChainId
request_id
Option<&str>
memo
String
transaction
&mut Transaction<'_, Db>
rpc_client
&C
signer
impl Signer
chain_id
ChainId
request_id
Option<&str>
memo
String