pub struct GetEarningsResponse {
pub total_points: Points,
pub total_bandwidth: Bytes,
pub proof_count: u64,
pub avg_per_proof: Points,
pub by_content: Option<Vec<ContentEarnings>>,
}Expand description
Response with earnings information.
§Examples
use chie_shared::{GetEarningsResponse, ContentEarnings};
// Earnings summary with breakdown
let earnings = GetEarningsResponse {
total_points: 50_000,
total_bandwidth: 100 * 1024 * 1024 * 1024, // 100 GB
proof_count: 500,
avg_per_proof: 100,
by_content: Some(vec![
ContentEarnings {
content_cid: "QmPopular".to_string(),
points_earned: 30_000,
bandwidth_served: 60 * 1024 * 1024 * 1024,
chunks_served: 300,
},
ContentEarnings {
content_cid: "QmRare".to_string(),
points_earned: 20_000,
bandwidth_served: 40 * 1024 * 1024 * 1024,
chunks_served: 200,
},
]),
};
assert_eq!(earnings.total_points, 50_000);
assert_eq!(earnings.proof_count, 500);
assert_eq!(earnings.avg_per_proof, 100);
assert!(earnings.by_content.is_some());
assert_eq!(earnings.by_content.as_ref().unwrap().len(), 2);Fields§
§total_points: PointsTotal points earned.
total_bandwidth: BytesTotal bandwidth served (bytes).
proof_count: u64Number of successful proofs.
avg_per_proof: PointsAverage earnings per proof.
by_content: Option<Vec<ContentEarnings>>Earnings breakdown by content (optional).
Trait Implementations§
Source§impl Clone for GetEarningsResponse
impl Clone for GetEarningsResponse
Source§fn clone(&self) -> GetEarningsResponse
fn clone(&self) -> GetEarningsResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GetEarningsResponse
impl Debug for GetEarningsResponse
Source§impl<'de> Deserialize<'de> for GetEarningsResponse
impl<'de> Deserialize<'de> for GetEarningsResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GetEarningsResponse
impl RefUnwindSafe for GetEarningsResponse
impl Send for GetEarningsResponse
impl Sync for GetEarningsResponse
impl Unpin for GetEarningsResponse
impl UnwindSafe for GetEarningsResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more