neo3/neo_protocol/responses/
neo_get_unclaimed_gas.rs

1use serde::{Deserialize, Serialize};
2use std::ops::{Add, AddAssign};
3
4#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Hash, Debug, Default)]
5pub struct UnclaimedGas {
6	pub unclaimed: String,
7	pub address: String,
8}
9
10impl Add for UnclaimedGas {
11	type Output = Self;
12
13	fn add(self, other: Self) -> Self {
14		// Parse the unclaimed values as f64 for addition
15		let self_unclaimed = self.unclaimed.parse::<f64>().unwrap_or(0.0);
16		let other_unclaimed = other.unclaimed.parse::<f64>().unwrap_or(0.0);
17
18		UnclaimedGas {
19			unclaimed: (self_unclaimed + other_unclaimed).to_string(),
20			address: self.address, // Keep the original address
21		}
22	}
23}
24
25impl AddAssign for UnclaimedGas {
26	fn add_assign(&mut self, other: Self) {
27		*self = self.clone() + other;
28	}
29}