This commit is contained in:
aniketfuryrocks 2022-12-06 17:12:46 +05:30
parent cf4beed0f1
commit aea182b3b9
No known key found for this signature in database
GPG Key ID: 9CDC12D03F4F5BB7
2 changed files with 34 additions and 0 deletions

33
src/client.rs Normal file
View File

@ -0,0 +1,33 @@
use std::ops::{Deref, DerefMut};
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_client::rpc_request::RpcRequest;
pub struct LiteClient(pub RpcClient);
impl Deref for LiteClient {
type Target = RpcClient;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for LiteClient {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl LiteClient {
pub async fn confirm_transaction(&self, signature: String) -> bool {
self.send(
RpcRequest::Custom {
method: "confirmTransaction",
},
serde_json::json!([signature]),
)
.await
.unwrap()
}
}

View File

@ -13,6 +13,7 @@ use crate::rpc::{
LightRpcRequestProcessor,
};
mod cli;
mod client;
mod context;
mod pubsub;
mod rpc;