pub trait RewardApi {
type RewardClaimInput: Serialize + Send + Sync;
type RewardBalance: Serialize + Send + Sync;
type RewardAccountQueryData: Serialize + Send + Sync;
type RewardAmounts: Serialize + Send + Sync;
type RewardMerkleTreeData: Serialize + Send + Sync;
type RewardAccountQueryDataV1: Serialize + Send + Sync;
type RewardStatePathV1: Serialize + Send + Sync;
type RewardStatePathV2: Serialize + Send + Sync;
// Required methods
fn get_reward_state_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_reward_state_v2_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_reward_account_proof_v1<'life0, 'async_trait>(
&'life0 self,
height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAccountQueryDataV1>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_reward_claim_input<'life0, 'async_trait>(
&'life0 self,
block_height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardClaimInput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_reward_balance<'life0, 'async_trait>(
&'life0 self,
height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardBalance>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_latest_reward_balance<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardBalance>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_reward_account_proof<'life0, 'async_trait>(
&'life0 self,
height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAccountQueryData>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_latest_reward_account_proof<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAccountQueryData>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_reward_amounts<'life0, 'async_trait>(
&'life0 self,
height: u64,
offset: u64,
limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAmounts>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_reward_merkle_tree_v2<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardMerkleTreeData>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_reward_state_path_v1<'life0, 'async_trait>(
&'life0 self,
snapshot: Snapshot,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardStatePathV1>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_reward_state_path_v2<'life0, 'async_trait>(
&'life0 self,
snapshot: Snapshot,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardStatePathV2>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Reward API trait - returns internal types
Uses associated types to avoid importing espresso-types in this crate. Types must be Serialize for JSON responses, but don’t need JsonSchema.
Required Associated Types§
Sourcetype RewardClaimInput: Serialize + Send + Sync
type RewardClaimInput: Serialize + Send + Sync
Type for reward claim input data (must be serializable to JSON)
Sourcetype RewardBalance: Serialize + Send + Sync
type RewardBalance: Serialize + Send + Sync
Type for reward balance queries (must be serializable to JSON)
Sourcetype RewardAccountQueryData: Serialize + Send + Sync
type RewardAccountQueryData: Serialize + Send + Sync
Type for reward account proof queries (must be serializable to JSON)
Sourcetype RewardAmounts: Serialize + Send + Sync
type RewardAmounts: Serialize + Send + Sync
Type for paginated reward amounts (must be serializable to JSON)
Sourcetype RewardMerkleTreeData: Serialize + Send + Sync
type RewardMerkleTreeData: Serialize + Send + Sync
Type for raw merkle tree snapshots (must be serializable to JSON)
Sourcetype RewardAccountQueryDataV1: Serialize + Send + Sync
type RewardAccountQueryDataV1: Serialize + Send + Sync
Type for reward account proof queries against the V1 (RewardMerkleTreeV1) tree
Sourcetype RewardStatePathV1: Serialize + Send + Sync
type RewardStatePathV1: Serialize + Send + Sync
Type for a raw Merkle path into the reward-state (RewardMerkleTreeV1) tree
Sourcetype RewardStatePathV2: Serialize + Send + Sync
type RewardStatePathV2: Serialize + Send + Sync
Type for a raw Merkle path into the reward-state-v2 (RewardMerkleTreeV2) tree
Required Methods§
Sourcefn get_reward_state_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_state_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the height of the last persisted reward-state-v1 merklized state snapshot
Sourcefn get_reward_state_v2_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_state_v2_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the height of the last persisted reward-state-v2 merklized state snapshot
Sourcefn get_reward_account_proof_v1<'life0, 'async_trait>(
&'life0 self,
height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAccountQueryDataV1>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_account_proof_v1<'life0, 'async_trait>(
&'life0 self,
height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAccountQueryDataV1>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get Merkle proof for a reward account against the V1 (RewardMerkleTreeV1) tree
§Arguments
height- Block height to queryaddress- Ethereum address to query proof for
Sourcefn get_reward_claim_input<'life0, 'async_trait>(
&'life0 self,
block_height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardClaimInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_claim_input<'life0, 'async_trait>(
&'life0 self,
block_height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardClaimInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get reward claim input for L1 contract submission
Returns all data needed to call the claimRewards function on the L1 contract, including lifetime rewards and the Merkle proof.
§Arguments
block_height- Must match the height finalized in the Light Client contractaddress- Ethereum address to query rewards for (hex format)
Sourcefn get_reward_balance<'life0, 'async_trait>(
&'life0 self,
height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_balance<'life0, 'async_trait>(
&'life0 self,
height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get reward balance at a specific height
§Arguments
height- Block height to queryaddress- Ethereum address to query rewards for
Sourcefn get_latest_reward_balance<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_latest_reward_balance<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get latest reward balance at the most recent finalized height
§Arguments
address- Ethereum address to query rewards for
Sourcefn get_reward_account_proof<'life0, 'async_trait>(
&'life0 self,
height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAccountQueryData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_account_proof<'life0, 'async_trait>(
&'life0 self,
height: u64,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAccountQueryData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get Merkle proof for a reward account at a specific height
Returns complete query data with balance and expanded merkle proof
§Arguments
height- Block height to queryaddress- Ethereum address to query proof for
Sourcefn get_latest_reward_account_proof<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAccountQueryData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_latest_reward_account_proof<'life0, 'async_trait>(
&'life0 self,
address: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAccountQueryData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get Merkle proof for a reward account at the latest finalized height
Returns complete query data with balance and expanded merkle proof
§Arguments
address- Ethereum address to query proof for
Sourcefn get_reward_amounts<'life0, 'async_trait>(
&'life0 self,
height: u64,
offset: u64,
limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAmounts>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_amounts<'life0, 'async_trait>(
&'life0 self,
height: u64,
offset: u64,
limit: u64,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardAmounts>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get paginated list of reward amounts at a specific height
§Arguments
height- Block height to queryoffset- Starting index for paginationlimit- Maximum number of results (≤ 10000)
Sourcefn get_reward_merkle_tree_v2<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardMerkleTreeData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_merkle_tree_v2<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardMerkleTreeData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get raw RewardMerkleTreeV2 snapshot at a given height
Returns the serialized merkle tree data
§Arguments
height- Block height to query
Sourcefn get_reward_state_path_v1<'life0, 'async_trait>(
&'life0 self,
snapshot: Snapshot,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardStatePathV1>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_state_path_v1<'life0, 'async_trait>(
&'life0 self,
snapshot: Snapshot,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardStatePathV1>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the Merkle path for a key in the reward-state (RewardMerkleTreeV1) tree
Mirrors the legacy merklized_state get_path, inherited by the reward-state mount
from hotshot-query-service’s merklized-state base routes (same as block-state/fee-state).
§Arguments
snapshot- Height or commitment identifying the tree snapshotkey- Reward account address to query
Sourcefn get_reward_state_path_v2<'life0, 'async_trait>(
&'life0 self,
snapshot: Snapshot,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardStatePathV2>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_reward_state_path_v2<'life0, 'async_trait>(
&'life0 self,
snapshot: Snapshot,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Self::RewardStatePathV2>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the Merkle path for a key in the reward-state-v2 (RewardMerkleTreeV2) tree
§Arguments
snapshot- Height or commitment identifying the tree snapshotkey- Reward account address to query