pub async fn update_signer(
        &self,
        signer: impl Signer,
        chain_id: ChainId,
        request_id: Option<String>,
        new_public_key: PublicKey,
        memo: String,
    ) -> Result<()> {
        let mut transaction = self
            .db_pool
            .begin()
            .await
            .context("unable to begin database transaction")?;

        let mut chain = chain::get_chain(&mut transaction, &chain_id)
            .await?
            .ok_or_else(|| anyhow!("chain details for {} not found", chain_id))?;

        chain_keys::add_chain_key(&mut transaction, &chain_id, &new_public_key.encode()).await?;

        let rpc_client = HttpClient::new(chain.config.rpc_addr.as_str())
            .context("unable to connect to rpc client")?;

        let msg = transaction_builder::msg_update_solo_machine_client(
            &mut transaction,
            &signer,
            &mut chain,
            Some(&new_public_key),
            memo.clone(),
            request_id.as_deref(),
        )
        .await?;

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

        ensure_response_success(&response)?;

        transaction
            .commit()
            .await
            .context("unable to commit transaction for receiving tokens over IBC")?;

        notify_event(
            &self.notifier,
            Event::SignerUpdated {
                chain_id,
                old_public_key: signer.to_public_key()?,
                new_public_key,
            },
        )
    }
/// Updates signer for future IBC transactions
Updates signer for future IBC transactions
Updates signer for future IBC transactions
pub async fn update_signer(
        &self,
        signer: impl Signer,
        chain_id: ChainId,
        request_id: Option<String>,
        new_public_key: PublicKey,
        memo: String,
    ) -> Result<()> {
        let mut transaction = self
            .db_pool
            .begin()
            .await
            .context("unable to begin database transaction")?;
        let mut chain = chain::get_chain(&mut transaction, &chain_id)
            .await?
            .ok_or_else(|| anyhow!("chain details for {} not found", chain_id))?;
        chain_keys::add_chain_key(&mut transaction, &chain_id, &new_public_key.encode()).await?;
        let rpc_client = HttpClient::new(chain.config.rpc_addr.as_str())
            .context("unable to connect to rpc client")?;
        let msg = transaction_builder::msg_update_solo_machine_client(
            &mut transaction,
            &signer,
            &mut chain,
            Some(&new_public_key),
            memo.clone(),
            request_id.as_deref(),
        )
        .await?;
        let response = rpc_client
            .broadcast_tx_commit(proto_encode(&msg)?.into())
            .await?;
        ensure_response_success(&response)?;
        transaction
            .commit()
            .await
            .context("unable to commit transaction for receiving tokens over IBC")?;
        notify_event(
            &self.notifier,
            Event::SignerUpdated {
                chain_id,
                old_public_key: signer.to_public_key()?,
                new_public_key,
            },
        )
    }
pub async fn update_signer ( & self , signer : impl Signer , chain_id : ChainId , request_id : Option < String > , new_public_key : PublicKey , memo : String , ) -> Result < ( ) > { let mut transaction = self . db_pool . begin ( ) . await . context ( " " ) ? ; let mut chain = chain :: get_chain ( & mut transaction , & chain_id ) . await ? . ok_or_else ( | | anyhow ! ( " " chain_id ) ) ? ; chain_keys :: add_chain_key ( & mut transaction , & chain_id , & new_public_key . encode ( ) ) . await ? ; let rpc_client = HttpClient :: new ( chain . config . rpc_addr . as_str ( ) ) . context ( " " ) ? ; let msg = transaction_builder :: msg_update_solo_machine_client ( & mut transaction , & signer , & mut chain , Some ( & new_public_key ) , memo . clone ( ) , request_id . as_deref ( ) , ) . await ? ; let response = rpc_client . broadcast_tx_commit ( proto_encode ( & msg ) ? . into ( ) ) . await ? ; ensure_response_success ( & response ) ? ; transaction . commit ( ) . await . context ( " " ) ? ; notify_event ( & self . notifier , Event :: SignerUpdated { chain_id , old_public_key : signer . to_public_key ( ) ? , new_public_key , } , ) }
Updates signer for future IBC transactions
Updates signer for future IBC transactions
&self
signer
impl Signer
chain_id
ChainId
request_id
Option<String>
new_public_key
PublicKey
memo
String
&self
signer
impl Signer
chain_id
ChainId
request_id
Option<String>
new_public_key
PublicKey
memo
String