Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

fix: examples #2207

Merged
merged 2 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/contracts/examples/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abigen!(
]"#,
);

const WSS_URL: &str = "wss://eth.llamarpc.com";
const WSS_URL: &str = "wss://mainnet.infura.io/ws/v3/c60b0bb42f8a4c6481ecd229eddaca27";
const WETH_ADDRESS: &str = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";

#[tokio::main]
Expand Down
4 changes: 3 additions & 1 deletion examples/contracts/examples/events_with_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ abigen!(

#[tokio::main]
async fn main() -> Result<()> {
let client = Provider::<Ws>::connect("wss://eth.llamarpc.com").await?;
let client =
Provider::<Ws>::connect("wss://mainnet.infura.io/ws/v3/c60b0bb42f8a4c6481ecd229eddaca27")
.await?;

let client = Arc::new(client);

Expand Down
2 changes: 1 addition & 1 deletion examples/events/examples/filtering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ethers::{
use eyre::Result;
use std::sync::Arc;

const HTTP_URL: &str = "https://eth.llamarpc.com";
const HTTP_URL: &str = "https://rpc.flashbots.net";
const V3FACTORY_ADDRESS: &str = "0x1F98431c8aD98523631AE4a59f267346ea31F984";
const DAI_ADDRESS: &str = "0x6B175474E89094C44Da98b954EedeAC495271d0F";
const USDC_ADDRESS: &str = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
Expand Down
2 changes: 1 addition & 1 deletion examples/providers/examples/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use ethers::prelude::*;

const WSS_URL: &str = "wss://eth.llamarpc.com";
const WSS_URL: &str = "wss://mainnet.infura.io/ws/v3/c60b0bb42f8a4c6481ecd229eddaca27";

#[tokio::main]
async fn main() -> eyre::Result<()> {
Expand Down
4 changes: 3 additions & 1 deletion examples/queries/examples/paginated_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ use std::sync::Arc;

#[tokio::main]
async fn main() -> Result<()> {
let client: Provider<Ws> = Provider::<Ws>::connect("wss://eth.llamarpc.com").await?;
let client: Provider<Ws> =
Provider::<Ws>::connect("wss://mainnet.infura.io/ws/v3/c60b0bb42f8a4c6481ecd229eddaca27")
.await?;
let client = Arc::new(client);

let last_block = client.get_block(BlockNumber::Latest).await?.unwrap().number.unwrap();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
use ethers::providers::{Middleware, Provider, StreamExt, Ws};
use eyre::Result;
use std::time::Duration;

#[tokio::main]
async fn main() -> Result<()> {
let ws_endpoint = "wss://eth.llamarpc.com";
let ws = Ws::connect(ws_endpoint).await?;
let provider = Provider::new(ws).interval(Duration::from_millis(2000));
let mut stream = provider.watch_blocks().await?.take(1);
let provider =
Provider::<Ws>::connect("wss://mainnet.infura.io/ws/v3/c60b0bb42f8a4c6481ecd229eddaca27")
.await?;
let mut stream = provider.subscribe_blocks().await?.take(1);
while let Some(block) = stream.next().await {
let block = provider.get_block(block).await?.unwrap();
println!(
"Ts: {:?}, block number: {} -> {:?}",
block.timestamp,
Expand Down
4 changes: 3 additions & 1 deletion examples/subscriptions/examples/subscribe_events_by_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
}

async fn get_client() -> Provider<Ws> {
Provider::<Ws>::connect("wss://eth.llamarpc.com").await.unwrap()
Provider::<Ws>::connect("wss://mainnet.infura.io/ws/v3/c60b0bb42f8a4c6481ecd229eddaca27")
.await
.unwrap()
}
4 changes: 3 additions & 1 deletion examples/subscriptions/examples/subscribe_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ use std::sync::Arc;

#[tokio::main]
async fn main() -> Result<()> {
let client = Provider::<Ws>::connect("wss://eth.llamarpc.com").await?;
let client =
Provider::<Ws>::connect("wss://mainnet.infura.io/ws/v3/c60b0bb42f8a4c6481ecd229eddaca27")
.await?;
let client = Arc::new(client);

let last_block = client.get_block(BlockNumber::Latest).await?.unwrap().number.unwrap();
Expand Down