From 087625de3fe2a639e3aa9470faea6ca08456aed3 Mon Sep 17 00:00:00 2001 From: GroovieGermanikus Date: Tue, 7 May 2024 17:34:58 +0200 Subject: [PATCH] track phoenix orderbook --- examples/stream_token_accounts.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/stream_token_accounts.rs b/examples/stream_token_accounts.rs index 531e753..b5ca82f 100644 --- a/examples/stream_token_accounts.rs +++ b/examples/stream_token_accounts.rs @@ -71,7 +71,8 @@ pub async fn main() { Some(UpdateOneof::Account(update)) => { let account = update.account.unwrap(); let account_pk = Pubkey::try_from(account.pubkey).unwrap(); - trace!("got account update (green)!!! {} - {:?} - {} bytes", + let size = account.data.len(); + info!("got account update (green)!!! {} - {:?} - {} bytes", update.slot, account_pk, account.data.len()); if ENABLE_TIMESTAMP_TAGGING { @@ -79,6 +80,7 @@ pub async fn main() { info!("got account update: write_version={};timestamp_us={};slot={}", account.write_version, since_the_epoch.as_micros(), update.slot); } + match parse_token(&account.data, Some(6)) { Ok(TokenAccountType::Account(account_ui)) => { // UiTokenAccount { @@ -110,6 +112,10 @@ pub async fn main() { if account_ui.owner.starts_with("66fEFnKy") { info!("update balance for mint {} of owner {}: {}", mint, owner, amount); } + // if pubkey.starts_with(b"JUP") { + // info!("update balance for mint {} of owner {}: {}", mint, owner, amount); + // } + token_account_by_ownermint.entry(owner) .or_insert_with(DashMap::new) .insert(mint, account_ui); @@ -167,9 +173,9 @@ pub fn token_accounts() -> SubscribeRequest { accounts_subs.insert( "client".to_string(), SubscribeRequestFilterAccounts { - account: vec![], - owner: - spl_token_ids().iter().map(|pubkey| pubkey.to_string()).collect(), + account: vec!["4DoNfFBfF7UokCC2FQzriy7yHK6DY6NVdYpuekQ5pRgg".to_string()], + owner: vec![], + // spl_token_ids().iter().map(|pubkey| pubkey.to_string()).collect(), filters: vec![], }, );