pub struct Staking { /* private fields */ }Expand description
A handle for interacting with a staking delegation pool.
Implementations§
Source§impl Staking
impl Staking
Sourcepub fn new(
provider: Arc<JsonRpcClient<HttpTransport>>,
pool_address: Address,
token: Token,
) -> Self
pub fn new( provider: Arc<JsonRpcClient<HttpTransport>>, pool_address: Address, token: Token, ) -> Self
Create a staking handle from a known pool address and token.
Sourcepub fn populate_enter(
&self,
amount: &Amount,
reward_address: &Address,
) -> Vec<Call>
pub fn populate_enter( &self, amount: &Amount, reward_address: &Address, ) -> Vec<Call>
Build calls to enter a delegation pool: approve + enter_delegation_pool.
Sourcepub fn populate_add(&self, amount: &Amount) -> Vec<Call>
pub fn populate_add(&self, amount: &Amount) -> Vec<Call>
Build calls to add more stake: approve + add_to_delegation_pool.
Sourcepub fn populate_claim_rewards(&self, reward_address: &Address) -> Call
pub fn populate_claim_rewards(&self, reward_address: &Address) -> Call
Build a claim_rewards call.
Sourcepub fn populate_exit_intent(&self, amount: &Amount) -> Call
pub fn populate_exit_intent(&self, amount: &Amount) -> Call
Build an exit_delegation_pool_intent call.
Sourcepub fn populate_exit(&self) -> Call
pub fn populate_exit(&self) -> Call
Build an exit_delegation_pool_action call.
Sourcepub async fn is_member(&self, address: &Address) -> Result<bool>
pub async fn is_member(&self, address: &Address) -> Result<bool>
Check if an address is a pool member.
Sourcepub async fn get_position(&self, address: &Address) -> Result<PoolPosition>
pub async fn get_position(&self, address: &Address) -> Result<PoolPosition>
Get a member’s staking position.
Sourcepub async fn get_commission(&self) -> Result<u16>
pub async fn get_commission(&self) -> Result<u16>
Get the pool commission rate (basis points).
Sourcepub async fn stake(
&self,
wallet: &dyn WalletExecutor,
amount: &Amount,
reward_address: &Address,
) -> Result<Tx>
pub async fn stake( &self, wallet: &dyn WalletExecutor, amount: &Amount, reward_address: &Address, ) -> Result<Tx>
Stake: if already a member, adds to pool; otherwise enters as new member.
Sourcepub fn pool_address(&self) -> &Address
pub fn pool_address(&self) -> &Address
The pool address.
Auto Trait Implementations§
impl Freeze for Staking
impl !RefUnwindSafe for Staking
impl Send for Staking
impl Sync for Staking
impl Unpin for Staking
impl UnsafeUnpin for Staking
impl !UnwindSafe for Staking
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more