Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix examples after latest refactors #560

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions examples/n2c-miniprotocols/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::collections::BTreeSet;
use std::{collections::BTreeSet, str::FromStr};

use pallas::{
codec::utils::Bytes,
crypto::hash::Hash,
ledger::{addresses::Address, traverse::MultiEraBlock},
network::{
facades::NodeClient,
Expand All @@ -11,7 +12,6 @@ use pallas::{
Point, PRE_PRODUCTION_MAGIC,
},
},
crypto::hash::Hash,
};
use tracing::info;

Expand All @@ -21,14 +21,19 @@ async fn do_localstate_query(client: &mut NodeClient) {
client.acquire(None).await.unwrap();

// Get UTxO from a (singleton) set of tx inputs.
let transaction_id = Hash::<32>::from(<[u8; 32]>::from_hex(
"15244950ed56a3af61a00f62584779fb53a9f3910468013a2b00b94b8bbc10e0"
).unwrap());
let tx_in = TransactionInput { transaction_id, index: 0 };
let transaction_id =
Hash::<32>::from_str("15244950ed56a3af61a00f62584779fb53a9f3910468013a2b00b94b8bbc10e0")
.unwrap();
let tx_in = TransactionInput {
transaction_id,
index: 0,
};
let mut txins = BTreeSet::new();
txins.insert(tx_in);

let result = queries_v16::get_utxo_by_txin(client, 6, txins).await.unwrap();

let result = queries_v16::get_utxo_by_txin(client, 6, txins)
.await
.unwrap();
info!("result: {:?}", result);

let result = queries_v16::get_chain_point(client).await.unwrap();
Expand All @@ -46,14 +51,14 @@ async fn do_localstate_query(client: &mut NodeClient) {
// 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();
let addr: Addr = hex::decode("1218F563E4E10958FDABBDFB470B2F9D386215763CC89273D9BDFFFA")
.unwrap()
.into();
addrs.insert(StakeAddr::from((0x00, addr)));
// 2. `stake_test1uq2pnumhfrnnse0t3uwj4n0lhz58ehfhkdhr64ylptjhq9cyney6d`
let addr: Addr = <[u8; 28]>::from_hex(
"1419F37748E73865EB8F1D2ACDFFB8A87CDD37B36E3D549F0AE57017"
).unwrap().to_vec().into();
let addr: Addr = hex::decode("1419F37748E73865EB8F1D2ACDFFB8A87CDD37B36E3D549F0AE57017")
.unwrap()
.into();
addrs.insert(StakeAddr::from((0x00, addr)));

let result = queries_v16::get_filtered_delegations_rewards(client, era, addrs)
Expand Down
Loading