fix: support multiple pools in stake snapshot query (#396)

This commit is contained in:
Alexsander Falcucci 2024-02-11 16:51:35 +01:00 committed by GitHub
parent d4a8acfaa0
commit 83728a085d
4 changed files with 12 additions and 7 deletions

View file

@ -99,7 +99,7 @@ impl Encode<()> for BlockQuery {
e.u16(20)?;
if !pools.is_empty() {
e.array(Vec::len(pools) as u64)?;
e.array(1)?;
e.tag(Tag::Unassigned(258))?;
}

View file

@ -1,6 +1,7 @@
// TODO: this should move to pallas::ledger crate at some point
use pallas_crypto::hash::Hash;
use std::collections::BTreeSet;
use std::hash::Hash as StdHash;
// required for derive attrs to work
use pallas_codec::minicbor::{self};
@ -210,7 +211,7 @@ pub type Addr = Bytes;
pub type Addrs = Vec<Addr>;
pub type Pools = Vec<Option<Bytes>>;
pub type Pools = BTreeSet<Bytes>;
pub type Coin = AnyUInt;
@ -388,7 +389,7 @@ pub async fn get_utxo_by_address(
pub async fn get_stake_snapshots(
client: &mut Client,
era: u16,
pools: Vec<Option<Bytes>>,
pools: BTreeSet<Bytes>,
) -> Result<StakeSnapshot, ClientError> {
let query = BlockQuery::GetStakeSnapshots(pools);
let query = LedgerQuery::BlockQuery(era, query);