rename light_bridge-^>lite_bridge
This commit is contained in:
parent
636947b439
commit
0ff895a862
|
@ -22,14 +22,14 @@ use solana_sdk::{signature::Signature, transaction::VersionedTransaction};
|
|||
use tokio::task::JoinHandle;
|
||||
|
||||
/// A bridge between clients and tpu
|
||||
pub struct LightBridge {
|
||||
pub struct LiteBridge {
|
||||
pub tpu_client: Arc<TpuClient>,
|
||||
pub rpc_url: Url,
|
||||
pub tx_sender: TxSender,
|
||||
pub block_listner: BlockListener,
|
||||
}
|
||||
|
||||
impl LightBridge {
|
||||
impl LiteBridge {
|
||||
pub async fn new(rpc_url: reqwest::Url, ws_addr: &str) -> anyhow::Result<Self> {
|
||||
let rpc_client = Arc::new(RpcClient::new(rpc_url.to_string()));
|
||||
|
||||
|
@ -142,7 +142,7 @@ impl LightBridge {
|
|||
vec![server, block_listenser, tx_sender]
|
||||
}
|
||||
|
||||
async fn rpc_route(body: bytes::Bytes, state: web::Data<Arc<LightBridge>>) -> JsonRpcRes {
|
||||
async fn rpc_route(body: bytes::Bytes, state: web::Data<Arc<LiteBridge>>) -> JsonRpcRes {
|
||||
let json_rpc_req = match serde_json::from_slice::<JsonRpcReq>(&body) {
|
||||
Ok(json_rpc_req) => json_rpc_req,
|
||||
Err(err) => return JsonRpcError::SerdeError(err).into(),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use clap::Parser;
|
||||
use lite_rpc::bridge::LightBridge;
|
||||
use lite_rpc::bridge::LiteBridge;
|
||||
use lite_rpc::cli::Args;
|
||||
use reqwest::Url;
|
||||
use simplelog::*;
|
||||
|
@ -21,7 +21,7 @@ pub async fn main() -> anyhow::Result<()> {
|
|||
lite_rpc_addr,
|
||||
} = Args::parse();
|
||||
|
||||
let light_bridge = LightBridge::new(Url::from_str(&rpc_addr).unwrap(), &ws_addr).await?;
|
||||
let light_bridge = LiteBridge::new(Url::from_str(&rpc_addr).unwrap(), &ws_addr).await?;
|
||||
|
||||
let services = light_bridge.start_services(lite_rpc_addr);
|
||||
let services = futures::future::join_all(services);
|
||||
|
|
|
@ -8,14 +8,14 @@ use solana_sdk::{
|
|||
signer::Signer, system_instruction, transaction::Transaction,
|
||||
};
|
||||
|
||||
use lite_rpc::{bridge::LightBridge, encoding::BinaryEncoding, rpc::SendTransactionParams};
|
||||
use lite_rpc::{bridge::LiteBridge, encoding::BinaryEncoding, rpc::SendTransactionParams};
|
||||
|
||||
const RPC_ADDR: &str = "http://127.0.0.1:8899";
|
||||
const WS_ADDR: &str = "ws://127.0.0.1:8900";
|
||||
|
||||
#[tokio::test]
|
||||
async fn get_version() {
|
||||
let light_bridge = LightBridge::new(Url::from_str(RPC_ADDR).unwrap(), WS_ADDR)
|
||||
let light_bridge = LiteBridge::new(Url::from_str(RPC_ADDR).unwrap(), WS_ADDR)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -31,7 +31,7 @@ async fn get_version() {
|
|||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_send_transaction() {
|
||||
let light_bridge = LightBridge::new(Url::from_str(RPC_ADDR).unwrap(), WS_ADDR)
|
||||
let light_bridge = LiteBridge::new(Url::from_str(RPC_ADDR).unwrap(), WS_ADDR)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
|
Loading…
Reference in New Issue