What I am trying to do is listen to some onchain program accounts being changed. I could do this pretty easily in typescript with onProgramAccountChange() method provided in the Connection class in @solana/web3.js package. Is there a way to do this in rust, as I cannot find any impl in rust's solana_client crate.

1 Answer 1



You have to use the PubsubClient


This is the method you want:

  pub async fn account_subscribe(
        pubkey: &Pubkey,
        config: Option<RpcAccountInfoConfig>,
    ) -> SubscribeResult<'_, RpcResponse<UiAccount>> {
        let params = json!([pubkey.to_string(), config]);
        self.subscribe("account", params).await

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.