notification object
This commit is contained in:
parent
7396bb4146
commit
9de92652a1
|
@ -44,6 +44,6 @@ pub trait LiteRpc {
|
|||
config: Option<RpcRequestAirdropConfig>,
|
||||
) -> Result<String>;
|
||||
|
||||
#[subscription(name = "signatureSubscribe", unsubscribe="signatureUnsubscribe", item=Option<TransactionError>)]
|
||||
#[subscription(name = "signatureSubscribe", unsubscribe="signatureUnsubscribe", item=RpcResponse<Option<TransactionError>>)]
|
||||
fn signature_subscribe(&self, signature: String, commitment_config: CommitmentConfig);
|
||||
}
|
||||
|
|
|
@ -8,13 +8,15 @@ use log::{info, warn};
|
|||
use solana_client::{
|
||||
nonblocking::{pubsub_client::PubsubClient, rpc_client::RpcClient},
|
||||
rpc_config::{RpcBlockSubscribeConfig, RpcBlockSubscribeFilter},
|
||||
rpc_response::{Response as RpcResponse, RpcResponseContext},
|
||||
};
|
||||
use solana_sdk::{
|
||||
commitment_config::{CommitmentConfig, CommitmentLevel},
|
||||
transaction::TransactionError,
|
||||
};
|
||||
use solana_sdk::commitment_config::{CommitmentConfig, CommitmentLevel};
|
||||
|
||||
use solana_sdk::transaction::TransactionError;
|
||||
use solana_transaction_status::{TransactionConfirmationStatus, TransactionStatus};
|
||||
use tokio::sync::RwLock;
|
||||
use tokio::task::JoinHandle;
|
||||
use tokio::{sync::RwLock, task::JoinHandle};
|
||||
|
||||
/// Background worker which listen's to new blocks
|
||||
/// and keeps a track of confirmed txs
|
||||
|
@ -149,7 +151,14 @@ impl BlockListener {
|
|||
if let Some((_, mut sink)) = self.signature_subscribers.remove(&sig) {
|
||||
warn!("notification {}", sig);
|
||||
// none if transaction succeeded
|
||||
sink.send::<Option<TransactionError>>(&None).unwrap();
|
||||
sink.send(&RpcResponse {
|
||||
context: RpcResponseContext {
|
||||
slot,
|
||||
api_version: None,
|
||||
},
|
||||
value: None::<TransactionError>,
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
self.blocks.insert(
|
||||
|
|
Loading…
Reference in New Issue