Skip to main content

arete_server/
token_discovery.rs

1//! Provider boundary for indexed owner token-account discovery. Credentials stay in the provider.
2pub use arete_solana_contracts::{OwnerTokenAccountsPage, OwnerTokenAccountsRequest};
3
4#[derive(Debug, thiserror::Error)]
5pub enum TokenDiscoveryError {
6    #[error("{0}")]
7    InvalidCursor(String),
8    #[error("{0}")]
9    Unsupported(String),
10    #[error("{0}")]
11    Unavailable(String),
12}
13
14#[async_trait::async_trait]
15pub trait OwnerTokenAccountsProvider: Send + Sync {
16    /// Cursors must be opaque and bound to owner, mint and token program. Reject a cursor reused
17    /// with different filters. Return actual observation time and an optional real index watermark.
18    async fn owner_token_accounts(
19        &self,
20        request: &OwnerTokenAccountsRequest,
21    ) -> Result<OwnerTokenAccountsPage, TokenDiscoveryError>;
22}