pub trait UpstreamClient: Send + Sync {
// Required methods
fn rpc_call<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, UpstreamError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_account<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AccountData>, UpstreamError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided method
fn fetch_uri<'life0, 'life1, 'async_trait>(
&'life0 self,
_uri: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
}Expand description
An abstract Solana RPC client. rpc_call is the catch-all; typed
conveniences sit on top of it where we care about ergonomics.
Required Methods§
Sourcefn rpc_call<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, UpstreamError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn rpc_call<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, UpstreamError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Invoke an arbitrary JSON-RPC method and return the result
field as raw JSON bytes. Higher layers deserialize per-method.
Sourcefn get_account<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AccountData>, UpstreamError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_account<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AccountData>, UpstreamError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Convenience: read an account by base58 pubkey. Network impl
goes through getAccountInfo; fixture impl reads from its map.
Returns Ok(None) when the account doesn’t exist; Err for
transport failure.
Provided Methods§
Sourcefn fetch_uri<'life0, 'life1, 'async_trait>(
&'life0 self,
_uri: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn fetch_uri<'life0, 'life1, 'async_trait>(
&'life0 self,
_uri: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Fetch arbitrary off-chain content by URI for DAS metadata
enrichment (the JSON an NFT’s on-chain uri points at).
Implementations should support http(s):// and file://,
apply a timeout + size cap, and fail soft — returning
None on any error rather than propagating, so a blocked or
slow fetch degrades a getAsset response to its on-chain
fields instead of failing the whole call.
The default returns None (no enrichment). The HTTP-backed
impl overrides it; fixture impls override it to serve canned
bytes for tests.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".