feat(network): implement GetFilteredDelegationsAndRewardAccounts query (#552)
Signed-off-by: Santiago Carmuega <santiago@carmuega.me> Co-authored-by: Santiago Carmuega <santiago@carmuega.me>
This commit is contained in:
parent
57157b66fa
commit
cfc840f1b2
5 changed files with 249 additions and 99 deletions
|
|
@ -7,9 +7,7 @@ use pallas::{
|
|||
facades::NodeClient,
|
||||
miniprotocols::{
|
||||
chainsync,
|
||||
localstate::queries_v16::{
|
||||
self, Addr, Addrs, TransactionInput,
|
||||
},
|
||||
localstate::queries_v16::{self, Addr, Addrs, StakeAddr, TransactionInput},
|
||||
Point, PRE_PRODUCTION_MAGIC,
|
||||
},
|
||||
},
|
||||
|
|
@ -18,6 +16,8 @@ use pallas::{
|
|||
use tracing::info;
|
||||
use hex::FromHex;
|
||||
|
||||
use hex::FromHex;
|
||||
|
||||
async fn do_localstate_query(client: &mut NodeClient) {
|
||||
let client = client.statequery();
|
||||
|
||||
|
|
@ -46,6 +46,24 @@ async fn do_localstate_query(client: &mut NodeClient) {
|
|||
let era = queries_v16::get_current_era(client).await.unwrap();
|
||||
info!("result: {:?}", era);
|
||||
|
||||
// Getting delegation and rewards for preprod stake addresses:
|
||||
let mut addrs = BTreeSet::new();
|
||||
// 1. `stake_test1uqfp3atrunssjk8a4w7lk3ct97wnscs4wc7v3ynnmx7ll7s2ea9p2`
|
||||
let addr: Addr = <[u8; 28]>::from_hex(
|
||||
"1218F563E4E10958FDABBDFB470B2F9D386215763CC89273D9BDFFFA"
|
||||
).unwrap().to_vec().into();
|
||||
addrs.insert(StakeAddr::from((0x00, addr)));
|
||||
// 2. `stake_test1uq2pnumhfrnnse0t3uwj4n0lhz58ehfhkdhr64ylptjhq9cyney6d`
|
||||
let addr: Addr = <[u8; 28]>::from_hex(
|
||||
"1419F37748E73865EB8F1D2ACDFFB8A87CDD37B36E3D549F0AE57017"
|
||||
).unwrap().to_vec().into();
|
||||
addrs.insert(StakeAddr::from((0x00, addr)));
|
||||
|
||||
let result = queries_v16::get_filtered_delegations_rewards(client, era, addrs)
|
||||
.await
|
||||
.unwrap();
|
||||
info!("result: {:?}", result);
|
||||
|
||||
let result = queries_v16::get_block_epoch_number(client, era)
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue