feat: implement GetCBOR local state query (#413)
This commit is contained in:
parent
f5263378b8
commit
212da166df
3 changed files with 22 additions and 2 deletions
|
|
@ -138,7 +138,7 @@ impl<'b> Decode<'b, ()> for BlockQuery {
|
|||
6 => Ok(Self::GetUTxOByAddress(d.decode()?)),
|
||||
// 7 => Ok(Self::GetUTxOWhole),
|
||||
// 8 => Ok(Self::DebugEpochState),
|
||||
// 9 => Ok(Self::GetCBOR(())),
|
||||
9 => Ok(Self::GetCBOR(d.decode()?)),
|
||||
// 10 => Ok(Self::GetFilteredDelegationsAndRewardAccounts(())),
|
||||
11 => Ok(Self::GetGenesisConfig),
|
||||
// 12 => Ok(Self::DebugNewEpochState),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ pub enum BlockQuery {
|
|||
GetUTxOByAddress(Addrs),
|
||||
GetUTxOWhole,
|
||||
DebugEpochState,
|
||||
GetCBOR(AnyCbor),
|
||||
GetCBOR(Box<BlockQuery>),
|
||||
GetFilteredDelegationsAndRewardAccounts(AnyCbor),
|
||||
GetGenesisConfig,
|
||||
DebugNewEpochState,
|
||||
|
|
@ -435,6 +435,19 @@ pub async fn get_stake_snapshots(
|
|||
Ok(result)
|
||||
}
|
||||
|
||||
pub async fn get_cbor(
|
||||
client: &mut Client,
|
||||
era: u16,
|
||||
query: BlockQuery,
|
||||
) -> Result<Vec<TagWrap<Bytes, 24>>, ClientError> {
|
||||
let query = BlockQuery::GetCBOR(Box::new(query));
|
||||
let query = LedgerQuery::BlockQuery(era, query);
|
||||
let query = Request::LedgerQuery(query);
|
||||
let result = client.query(query).await?;
|
||||
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Get the genesis configuration for the given era.
|
||||
pub async fn get_genesis_config(
|
||||
client: &mut Client,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue