Skip to main content

RewardApi

Trait RewardApi 

Source
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;

    // Required methods
    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;
}
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§

Source

type RewardClaimInput: Serialize + Send + Sync

Type for reward claim input data (must be serializable to JSON)

Source

type RewardBalance: Serialize + Send + Sync

Type for reward balance queries (must be serializable to JSON)

Source

type RewardAccountQueryData: Serialize + Send + Sync

Type for reward account proof queries (must be serializable to JSON)

Source

type RewardAmounts: Serialize + Send + Sync

Type for paginated reward amounts (must be serializable to JSON)

Source

type RewardMerkleTreeData: Serialize + Send + Sync

Type for raw merkle tree snapshots (must be serializable to JSON)

Required Methods§

Source

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 contract
  • address - Ethereum address to query rewards for (hex format)
Source

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 query
  • address - Ethereum address to query rewards for
Source

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
Source

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 query
  • address - Ethereum address to query proof for
Source

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
Source

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 query
  • offset - Starting index for pagination
  • limit - Maximum number of results (≤ 10000)
Source

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

Implementors§