Proof of stake using the SDK
All proof of stake functionality will be find within the namada_sdk::proof_of_stake
module.
The namada_impl
object is assumed to have been constructed as described in the setting up a client section.
// We assume we have a namada_impl object that is already initialized
let bond_tx_builder = namada_impl
.new_bond(validator_address.clone(), amount)
.source(source_address.clone())
.signing_keys(vec![source_public_key]);
let (mut bond_tx, signing_data) = bond_tx_builder
.build(&namada_iml)
.await
.expect("unable to build bond");
namada_impl
.sign(
&mut bond_tx,
&bond_tx_builder.tx,
signing_data,
default_sign,
(),
)
.await
.expect("unable to sign reveal bond");
let tx = namada_iml.submit(bond_tx, &bond_tx_builder.tx).await;
That will submit the bond transaction to the network.
Similar proof of stake transactions such as new_unbond
, new_redelegation
, new_claim_rewards
and new_withdraw
are also available in the SDK.