pub fn liquid_unstake(
        &mut self,
        pool_account_id: AccountId,
        amount: Option<Balance>,
    ) {
        assert!(self.stake_pools.get(&pool_account_id).is_some(), "Pool doesnt exist");

        // First check if there are any staked balances
        let p1 = env::promise_create(
            pool_account_id.clone(),
            b"get_account_info",
            json!({
                "account_id": env::current_account_id(),
            }).to_string().as_bytes(),
            NO_DEPOSIT,
            GAS_STAKE_LIQUID_UNSTAKE_VIEW
        );

        let p2 = env::promise_then(
            p1,
            env::current_account_id(),
            b"callback_liquid_unstake",
            json!({
                "pool_account_id": pool_account_id,
                "amount": amount,
            }).to_string().as_bytes(),
            NO_DEPOSIT,
            GAS_STAKE_LIQUID_UNSTAKE_CALLBACK
        );

        env::promise_return(p2);
    }
/// Unstake any liquid staked near tokens for NEAR. Useful for situations that require immediate access to NEAR.
/// 
/// ```bash
/// near call treasury.testnet liquid_unstake '{"pool_account_id": "steak.factory.testnet", "amount": "100000000000000000000000000"}' --accountId treasury.testnet
/// ```
Unstake any liquid staked near tokens for NEAR. Useful for situations that require immediate access to NEAR.
Unstake any liquid staked near tokens for NEAR . Useful for situations that require immediate access to NEAR .
pub fn liquid_unstake(
        &mut self,
        pool_account_id: AccountId,
        amount: Option<Balance>,
    ) {
        assert!(self.stake_pools.get(&pool_account_id).is_some(), "Pool doesnt exist");
        // First check if there are any staked balances
        let p1 = env::promise_create(
            pool_account_id.clone(),
            b"get_account_info",
            json!({
                "account_id": env::current_account_id(),
            }).to_string().as_bytes(),
            NO_DEPOSIT,
            GAS_STAKE_LIQUID_UNSTAKE_VIEW
        );
        let p2 = env::promise_then(
            p1,
            env::current_account_id(),
            b"callback_liquid_unstake",
            json!({
                "pool_account_id": pool_account_id,
                "amount": amount,
            }).to_string().as_bytes(),
            NO_DEPOSIT,
            GAS_STAKE_LIQUID_UNSTAKE_CALLBACK
        );
        env::promise_return(p2);
    }
pub fn liquid_unstake ( & mut self , pool_account_id : AccountId , amount : Option < Balance > , ) { assert ! ( self stake_pools get ( pool_account_id ) is_some ( ) " " ) ; // First check if there are any staked balances let p1 = env :: promise_create ( pool_account_id . clone ( ) , b" " , json ! ( { " " env current_account_id ( ) } ) . to_string ( ) . as_bytes ( ) , NO_DEPOSIT , GAS_STAKE_LIQUID_UNSTAKE_VIEW ) ; let p2 = env :: promise_then ( p1 , env :: current_account_id ( ) , b" " , json ! ( { " " pool_account_id " " amount } ) . to_string ( ) . as_bytes ( ) , NO_DEPOSIT , GAS_STAKE_LIQUID_UNSTAKE_CALLBACK ) ; env :: promise_return ( p2 ) ; }
Unstake any liquid staked near tokens for NEAR.
Unstake any liquid staked near tokens for NEAR .
&mut self
pool_account_id
AccountId
amount
Option<Balance>
&mut self
pool_account_id
AccountId
amount
Option<Balance>