Compare commits
4 Commits
20f29c1e21
...
1245d8be37
Author | SHA1 | Date |
---|---|---|
GroovieGermanikus | 1245d8be37 | |
GroovieGermanikus | 0a5aaf4846 | |
GroovieGermanikus | 458f82725a | |
GroovieGermanikus | 793de099d3 |
|
@ -1249,7 +1249,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "geyser-grpc-connector"
|
name = "geyser-grpc-connector"
|
||||||
version = "0.10.5+yellowstone.1.13"
|
version = "0.10.6+yellowstone.1.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-stream",
|
"async-stream",
|
||||||
|
|
|
@ -15,6 +15,15 @@ The implementation is based on _Rust Futures_.
|
||||||
|
|
||||||
Please open an issue if you have any questions or suggestions -> [New Issue](https://github.com/blockworks-foundation/geyser-grpc-connector/issues/new).
|
Please open an issue if you have any questions or suggestions -> [New Issue](https://github.com/blockworks-foundation/geyser-grpc-connector/issues/new).
|
||||||
|
|
||||||
|
## Versions
|
||||||
|
These are the currently maintained versions of the library
|
||||||
|
|
||||||
|
| Tag (geyser-grpc-connector) | Yellowstone | Solana | Branch |
|
||||||
|
|----------------------------------------|-------------|--------|----------------------------------|
|
||||||
|
| 0.10.x+yellowstone.1.13+solana.1.17.28 | 1.13 | 1.17.28| release/v0.10.x+yellowstone.1.13 |
|
||||||
|
| 0.10.x+yellowstone.1.12+solana.1.17.15 | 1.12 | 1.17.15| main |
|
||||||
|
|
||||||
|
|
||||||
## Installation and Usage
|
## Installation and Usage
|
||||||
|
|
||||||
```cargo add geyser-grpc-connector ```
|
```cargo add geyser-grpc-connector ```
|
||||||
|
|
|
@ -73,6 +73,7 @@ pub async fn main() {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
// console_subscriber::init();
|
// console_subscriber::init();
|
||||||
|
|
||||||
|
let COMMITMENT_LEVEL = CommitmentConfig::processed();
|
||||||
let grpc_addr_green = env::var("GRPC_ADDR").expect("need grpc url for green");
|
let grpc_addr_green = env::var("GRPC_ADDR").expect("need grpc url for green");
|
||||||
let grpc_x_token_green = env::var("GRPC_X_TOKEN").ok();
|
let grpc_x_token_green = env::var("GRPC_X_TOKEN").ok();
|
||||||
|
|
||||||
|
@ -95,30 +96,27 @@ pub async fn main() {
|
||||||
|
|
||||||
let green_stream = create_geyser_reconnecting_stream(
|
let green_stream = create_geyser_reconnecting_stream(
|
||||||
config.clone(),
|
config.clone(),
|
||||||
GeyserFilter(CommitmentConfig::processed()).accounts(),
|
GeyserFilter(COMMITMENT_LEVEL).accounts(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let blue_stream = create_geyser_reconnecting_stream(
|
let blue_stream = create_geyser_reconnecting_stream(
|
||||||
config.clone(),
|
config.clone(),
|
||||||
GeyserFilter(CommitmentConfig::processed()).blocks_and_txs(),
|
GeyserFilter(COMMITMENT_LEVEL).blocks_and_txs(),
|
||||||
);
|
);
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut wtr = csv::Writer::from_path("accounts-mainnet.csv").unwrap();
|
|
||||||
|
|
||||||
let mut green_stream = pin!(green_stream);
|
let mut green_stream = pin!(green_stream);
|
||||||
while let Some(message) = green_stream.next().await {
|
while let Some(message) = green_stream.next().await {
|
||||||
match message {
|
match message {
|
||||||
Message::GeyserSubscribeUpdate(subscriber_update) => {
|
Message::GeyserSubscribeUpdate(subscriber_update) => {
|
||||||
match subscriber_update.update_oneof {
|
match subscriber_update.update_oneof {
|
||||||
Some(UpdateOneof::Account(update)) => {
|
Some(UpdateOneof::Account(update)) => {
|
||||||
info!("got update (green)!!! slot: {}", update.slot);
|
let account_info = update.account.unwrap();
|
||||||
let key = update.account.unwrap().pubkey;
|
let account_pk = Pubkey::try_from(account_info.pubkey).unwrap();
|
||||||
|
info!("got account update (green)!!! {} - {:?} - {} bytes",
|
||||||
|
update.slot, account_pk, account_info.data.len());
|
||||||
let bytes: [u8; 32] =
|
let bytes: [u8; 32] =
|
||||||
key.try_into().unwrap_or(Pubkey::default().to_bytes());
|
account_pk.to_bytes();
|
||||||
let pubkey = Pubkey::new_from_array(bytes);
|
|
||||||
wtr.write_record(&[pubkey.to_string()]).unwrap();
|
|
||||||
wtr.flush().unwrap();
|
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -133,13 +131,13 @@ pub async fn main() {
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut blue_stream = pin!(blue_stream);
|
let mut blue_stream = pin!(blue_stream);
|
||||||
|
let extractor = BlockMiniExtractor(COMMITMENT_LEVEL);
|
||||||
while let Some(message) = blue_stream.next().await {
|
while let Some(message) = blue_stream.next().await {
|
||||||
match message {
|
match message {
|
||||||
Message::GeyserSubscribeUpdate(subscriber_update) => {
|
Message::GeyserSubscribeUpdate(subscriber_update) => {
|
||||||
let bytes = subscriber_update.encoded_len();
|
let mapped = extractor.map_yellowstone_update(*subscriber_update);
|
||||||
let mapped = map_block_update(*subscriber_update);
|
if let Some((slot, block_mini)) = mapped {
|
||||||
if let Some(slot) = mapped {
|
info!("got update (blue)!!! block: {} - {} bytes", slot, block_mini.blocksize);
|
||||||
info!("got update (blue)!!! slot: {}, {} bytes", slot, bytes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::Connecting(attempt) => {
|
Message::Connecting(attempt) => {
|
||||||
|
|
Loading…
Reference in New Issue