Unbond/undelegate mixnode with rust client

This commit is contained in:
Bogdan-Ștefan Neacșu
2021-12-02 15:14:03 +01:00
parent b175480ba5
commit 2f68439916
@@ -661,6 +661,26 @@ impl<C> NymdClient<C> {
.await
}
/// Unbond a mixnode on behalf of the owner, removing it from the network and reclaiming staked coins
pub async fn unbond_mixnode_on_behalf(&self, owner: String) -> Result<ExecuteResult, NymdError>
where
C: SigningCosmWasmClient + Sync,
{
let fee = self.get_fee(Operation::UnbondMixnode);
let req = ExecuteMsg::UnbondMixnodeOnBehalf { owner };
self.client
.execute(
self.address(),
self.mixnet_contract_address()?,
&req,
fee,
"Unbonding mixnode on behalf from rust!",
Vec::new(),
)
.await
}
/// Delegates specified amount of stake to particular mixnode.
pub async fn delegate_to_mixnode(
&self,
@@ -741,6 +761,33 @@ impl<C> NymdClient<C> {
.await
}
/// Removes stake delegation from a particular mixnode on behalf of a particular delegator.
pub async fn remove_mixnode_delegation_on_behalf(
&self,
mix_identity: &str,
delegate: &str,
) -> Result<ExecuteResult, NymdError>
where
C: SigningCosmWasmClient + Sync,
{
let fee = self.get_fee(Operation::UndelegateFromMixnode);
let req = ExecuteMsg::UndelegateFromMixnodeOnBehalf {
mix_identity: mix_identity.to_string(),
delegate: delegate.to_string(),
};
self.client
.execute(
self.address(),
self.mixnet_contract_address()?,
&req,
fee,
"Removing mixnode delegation on behalf from rust!",
Vec::new(),
)
.await
}
/// Announce a gateway, paying a fee.
pub async fn bond_gateway(
&self,