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§
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)
Required Methods§
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