Skip to content

Commit 154af49

Browse files
committed
feat: update example
1 parent 1ee0e0e commit 154af49

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

examples/pool_manager_initialization_only.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ use alloy::{
55
primitives::address,
66
providers::{Provider, ProviderBuilder, WsConnect}
77
};
8+
use angstrom_v4::slot0::Slot0Client;
89
use eyre::Result;
910
use futures::StreamExt;
11+
use jsonrpsee::ws_client::WsClientBuilder;
1012
use tokio::sync::mpsc;
1113
use uni_v4_common::{PoolUpdate, StreamMode};
1214
use uni_v4_upkeeper::{
@@ -47,6 +49,11 @@ async fn main() -> Result<()> {
4749
.await
4850
.with_stream_mode(StreamMode::InitializationOnly); // Set InitializationOnly mode
4951

52+
let ws_url = std::env::var("ANGSTROM_WS_URL").expect("no angstrom ws set");
53+
54+
let ws_client = Arc::new(WsClientBuilder::default().build(&ws_url).await?);
55+
let slot0_client = Slot0Client::new(ws_client);
56+
5057
// Create block stream
5158
let latest_block = provider
5259
.get_block(BlockNumberOrTag::Latest.into())
@@ -82,6 +89,7 @@ async fn main() -> Result<()> {
8289
)
8390
.with_initial_tick_range_size(300)
8491
.with_tick_edge_threshold(100)
92+
.with_slot0_stream(slot0_client)
8593
.with_update_channel(tx) // Enable channel mode
8694
.build()
8795
.await?;
@@ -104,7 +112,7 @@ async fn main() -> Result<()> {
104112

105113
// Spawn a task to receive and process updates
106114
let _update_processor = tokio::spawn(async move {
107-
let mut local_pools = initial_pools;
115+
let local_pools = initial_pools;
108116
let mut message_count = 0;
109117
let mut filtered_count = 0;
110118

0 commit comments

Comments
 (0)