pub trait HopApiClient<BlockHash>: ClientT{
// Provided methods
fn submit<'life0, 'async_trait>(
&'life0 self,
data: Bytes,
recipients: Vec<Bytes>,
signature: Bytes,
signer: Bytes,
submit_timestamp: u64,
) -> Pin<Box<dyn Future<Output = Result<SubmitResult, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn claim<'life0, 'async_trait>(
&'life0 self,
raw_hash: Bytes,
signature: Bytes,
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn ack<'life0, 'async_trait>(
&'life0 self,
raw_hash: Bytes,
signature: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn pool_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PoolStatus, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Client implementation for the HopApi RPC API.
Provided Methods§
Sourcefn submit<'life0, 'async_trait>(
&'life0 self,
data: Bytes,
recipients: Vec<Bytes>,
signature: Bytes,
signer: Bytes,
submit_timestamp: u64,
) -> Pin<Box<dyn Future<Output = Result<SubmitResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn submit<'life0, 'async_trait>(
&'life0 self,
data: Bytes,
recipients: Vec<Bytes>,
signature: Bytes,
signer: Bytes,
submit_timestamp: u64,
) -> Pin<Box<dyn Future<Output = Result<SubmitResult, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Submit data to the data pool.
§Arguments
data: The data to store, in bytesrecipients: List of SCALE-encodedMultiSigner(ed25519, sr25519, or ecdsa)signature: SCALE-encodedMultiSignatureover the submit signing payload (blake2_256(HOP_SUBMIT_CONTEXT || blake2_256(data) || submit_timestamp.to_le_bytes())).signer: SCALE-encodedMultiSignerof the account signing the submissionsubmit_timestamp: Wall-clock timestamp (ms since unix epoch) bound into the signed payload. The runtime rejects promotions whose timestamp is too far from on-chain time.
data.len() must not exceed HopRuntimeApi::max_promotion_size(), and
the signer must be authorized by the runtime (checked via
HopRuntimeApi::can_account_promote).
§Returns
The current pool status
Sourcefn claim<'life0, 'async_trait>(
&'life0 self,
raw_hash: Bytes,
signature: Bytes,
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn claim<'life0, 'async_trait>(
&'life0 self,
raw_hash: Bytes,
signature: Bytes,
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Claim data from the data pool by hash (read-only download).
This does NOT mark the recipient as claimed. After receiving the data,
call hop_ack with the same arguments to confirm receipt.
The blob may be deleted concurrently by another recipient’s ack once all
recipients have acknowledged; callers must be prepared for NotFound
and should not assume availability between successive calls.
Requires a SCALE-encoded MultiSignature over the hash using the ephemeral
private key corresponding to one of the recipient public keys.
§Arguments
hash: The hash of the data, in bytes (32 bytes)signature: SCALE-encodedMultiSignatureover the hash
§Returns
The data if the signature matches a recipient that hasn’t yet acked
Sourcefn ack<'life0, 'async_trait>(
&'life0 self,
raw_hash: Bytes,
signature: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn ack<'life0, 'async_trait>(
&'life0 self,
raw_hash: Bytes,
signature: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Acknowledge receipt of claimed data.
Marks the recipient as claimed and triggers cleanup when all recipients
have acknowledged. Idempotent: acking twice succeeds silently, but if the
entry has already been deleted (either because all recipients have
acknowledged or because it expired) the call returns NotFound — callers
should treat NotFound as a benign terminal state rather than an error.
§Arguments
raw_hash: The hash of the data, in bytes (32 bytes)signature: SCALE-encodedMultiSignatureover the hash
Sourcefn pool_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PoolStatus, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn pool_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PoolStatus, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.