Skip to main content

Crate acuity_index_api_rs

Crate acuity_index_api_rs 

Source
Expand description

High-level async client for the acuity-index WebSocket API.

use acuity_index_api_rs::{CustomKey, CustomScalarValue, IndexerClient, Key};

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = IndexerClient::connect("ws://127.0.0.1:8172").await?;

    let spans = client.status().await?;
    println!("indexed spans: {spans:?}");

    let events = client
        .get_events(
            Key::Custom(CustomKey::composite(
                "item_revision",
                [
                    CustomScalarValue::Bytes32([0x11; 32].into()),
                    CustomScalarValue::U32(7),
                ],
            )),
            Some(100),
            None,
        )
        .await?;
    println!("events: {}", events.events.len());
    Ok(())
}

Structs§

Bytes32
CustomKey
DecodedEvent
EventMatch
EventMeta
EventNotification
EventRef
EventSubscription
EventsResponse
IndexerClient
PalletMeta
ServerError
Span
StatusSubscription
StatusUpdate
StoredEvent
U64Text
U128Text

Enums§

CustomScalarValue
CustomValue
IndexerApiError
Key
SubscriptionTarget