signature subscribe fix
This commit is contained in:
parent
9de92652a1
commit
66d7baa807
|
@ -44,6 +44,6 @@ pub trait LiteRpc {
|
|||
config: Option<RpcRequestAirdropConfig>,
|
||||
) -> Result<String>;
|
||||
|
||||
#[subscription(name = "signatureSubscribe", unsubscribe="signatureUnsubscribe", item=RpcResponse<Option<TransactionError>>)]
|
||||
#[subscription(name = "signatureSubscribe" => "signatureNotification", unsubscribe="signatureUnsubscribe", item=RpcResponse<serde_json::Value>)]
|
||||
fn signature_subscribe(&self, signature: String, commitment_config: CommitmentConfig);
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ impl BlockListener {
|
|||
info!("{comfirmation_status:?} {sig}");
|
||||
|
||||
// subscribers
|
||||
if let Some((_, mut sink)) = self.signature_subscribers.remove(&sig) {
|
||||
if let Some((sig, mut sink)) = self.signature_subscribers.remove(&sig) {
|
||||
warn!("notification {}", sig);
|
||||
// none if transaction succeeded
|
||||
sink.send(&RpcResponse {
|
||||
|
@ -156,7 +156,7 @@ impl BlockListener {
|
|||
slot,
|
||||
api_version: None,
|
||||
},
|
||||
value: None::<TransactionError>,
|
||||
value: serde_json::json!({ "err": None::<TransactionError> }),
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@ test('send and confirm transaction', async () => {
|
|||
const toAccount = Keypair.generate().publicKey;
|
||||
|
||||
const airdropSignature = await connection.requestAirdrop(payer.publicKey, LAMPORTS_PER_SOL * 2);
|
||||
console.log('airdrop signature ' + airdropSignature);
|
||||
console.log('airdrop signature ' + airdropSignature);
|
||||
await connection.confirmTransaction(airdropSignature, 'finalized');
|
||||
console.log('confirmed');
|
||||
|
||||
const transaction = new Transaction();
|
||||
|
||||
|
|
Loading…
Reference in New Issue