Skip to content

Commit

Permalink
Merge branch 'main' into 20240407-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeantonio21 committed Apr 8, 2024
2 parents 9b6486d + a58d50b commit ccf1ad0
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
17 changes: 10 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[workspace]
resolver = "2"
edition = "2021"

members = [
"atoma-event-subscribe",
Expand All @@ -12,26 +11,30 @@ members = [

[workspace.package]
version = "0.1.0"
edition = "2021"

[workspace.dependencies]
reqwest = "0.12.1"
async-trait = "0.1.78"
candle = { git = "https://github.com/huggingface/candle", package = "candle-core", branch = "main" }
candle-flash-attn = { git = "https://github.com/huggingface/candle", package = "candle-flash-attn", branch = "main" }
candle-nn = { git = "https://github.com/huggingface/candle", package = "candle-nn", branch = "main" }
candle-transformers = { git = "https://github.com/huggingface/candle", package = "candle-transformers", branch = "main" }
candle = { git = "https://github.com/huggingface/candle", package = "candle-core", version = "0.5.0" }
candle-flash-attn = { git = "https://github.com/huggingface/candle", package = "candle-flash-attn", version = "0.5.0" }
candle-nn = { git = "https://github.com/huggingface/candle", package = "candle-nn", version = "0.5.0" }
candle-transformers = { git = "https://github.com/huggingface/candle", package = "candle-transformers", version = "0.5.0" }
config = "0.14.0"
dotenv = "0.15.0"
ed25519-consensus = "2.1.0"
futures = "0.3.30"
futures-util = "0.3.30"
hf-hub = "0.3.2"
image = { version = "0.25.0", default-features = false, features = [
"jpeg",
"png",
] }
rand = "0.8.5"
reqwest = "0.12.1"
serde = "1.0.197"
serde_json = "1.0.114"
rand = "0.8.5"
solana-client = "1.18.9"
solana-sdk = "1.18.8"
thiserror = "1.0.58"
tokenizers = "0.15.2"
tokio = "1.36.0"
Expand Down
6 changes: 5 additions & 1 deletion atoma-event-subscribe/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
[package]
name = "event-subscribe"
version = "0.1.0"
edition = "2021"
edition.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
futures-util.workspace = true
solana-client.workspace = true
solana-sdk.workspace = true
tokio.workspace = true
9 changes: 7 additions & 2 deletions atoma-event-subscribe/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
fn main() {
println!("Hello, world!");
use solana::solana;

mod solana;

#[tokio::main]
async fn main() {
solana().await.ok();
}
31 changes: 31 additions & 0 deletions atoma-event-subscribe/src/solana.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use futures_util::StreamExt;
use solana_client::{
nonblocking::pubsub_client::PubsubClient,
rpc_config::{RpcTransactionLogsConfig, RpcTransactionLogsFilter},
rpc_response::RpcLogsResponse,
};
use solana_sdk::commitment_config::CommitmentConfig;

pub async fn solana() -> Result<(), Box<dyn std::error::Error>> {
let ws_url = "wss://api.mainnet-beta.solana.com";
let ps_client = PubsubClient::new(ws_url).await?;
// TODO: We should `Mentions` instead of `All` to filter what we need.
let filter = RpcTransactionLogsFilter::All;
let config = RpcTransactionLogsConfig {
commitment: Some(CommitmentConfig::finalized()),
};

let (mut accounts, unsubscriber) = ps_client.logs_subscribe(filter, config).await?;

while let Some(response) = accounts.next().await {
let response: RpcLogsResponse = response.value;
if response.err.is_none() {
println!("{:?}", response.logs);
println!();
}
}

unsubscriber().await;

Ok(())
}

0 comments on commit ccf1ad0

Please sign in to comment.