Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserFills subscription does not work #75

Open
yassinekachrad opened this issue Dec 30, 2024 · 0 comments
Open

UserFills subscription does not work #75

yassinekachrad opened this issue Dec 30, 2024 · 0 comments

Comments

@yassinekachrad
Copy link

yassinekachrad commented Dec 30, 2024

use std::str::FromStr;

use ethers::types::H160;
use hyperliquid_rust_sdk::{InfoClient, Message, Subscription};
use tokio::sync::mpsc::unbounded_channel;


#[tokio::main]
pub async fn main() {
    let (sender, mut receiver) = unbounded_channel::<Message>();
    let address = H160::from_str("0x023a3d058020fb76cca98f01b3c48c8938a22355").unwrap();
    let mut info = InfoClient::new(None, None).await.unwrap();
    let i = info.subscribe(Subscription::UserFills { user: address }, sender).await.unwrap();

    println!("subscription idx: {}", i);

    loop {
        match receiver.recv().await {
            Some(msg) => {
                println!("{:?}", msg)
            },
            None => break,
        }
    }
}

Above sample code simply blocks in the loop, and does not receive any userFill event.

Please let me know if am I doing something wrong, or if it works on your machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant