Skip to content

Commit

Permalink
chore: update Pallas to v0.19.0-alpha.1 (txpipe#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Jun 13, 2023
1 parent 90aa975 commit 2fe4f7b
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 149 deletions.
147 changes: 87 additions & 60 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ authors = ["Santiago Carmuega <[email protected]>"]


[dependencies]
# pallas = "0.19.0-alpha.0"
pallas = "0.19.0-alpha.1"
# pallas = { path = "../pallas/pallas" }
pallas = { git = "https://github.com/txpipe/pallas" }
# pallas = { git = "https://github.com/txpipe/pallas" }

gasket = { version = "^0.4", features = ["derive"] }
# gasket = { path = "../../construkts/gasket-rs/gasket", features = ["derive"] }
# gasket = { git = "https://github.com/construkts/gasket-rs.git", features = ["derive"] }

utxorpc-spec-ledger = "1.0.0-alpha.0"
# utxorpc-spec-ledger = { path = "../../utxorpc/spec/ledger/gen/rust" }
# utxorpc-spec-ledger = { git = "https://github.com/utxorpc/spec.git" }
utxorpc = { version = "1.0.0-alpha.1" }

hex = "0.4.3"
net2 = "0.2.37"
Expand Down
2 changes: 1 addition & 1 deletion src/bin/oura/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ pub fn initialize(mode: &Option<Mode>) {
if !matches!(mode, Some(Mode::Tui)) {
tracing::subscriber::set_global_default(
tracing_subscriber::FmtSubscriber::builder()
.with_max_level(tracing::Level::TRACE)
.with_max_level(tracing::Level::DEBUG)
.finish(),
)
.unwrap();
Expand Down
12 changes: 8 additions & 4 deletions src/filters/legacy_v1/crawl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ impl EventWriter<'_> {
..EventContext::default()
});

for asset in output.assets() {
child.append_from(OutputAssetRecord::from(&asset))?;
for policy in output.non_ada_assets() {
for asset in policy.assets() {
child.append_from(OutputAssetRecord::from(&asset))?;
}
}

if let Some(MintedDatumOption::Data(datum)) = &output.datum() {
Expand Down Expand Up @@ -135,8 +137,10 @@ impl EventWriter<'_> {
}

// crawl mints
for asset in tx.mints() {
self.append_from(self.to_mint_record(&asset))?;
for policy in tx.mints() {
for asset in policy.assets() {
self.append_from(self.to_mint_record(&asset))?;
}
}

self.crawl_metadata(tx)?;
Expand Down
22 changes: 14 additions & 8 deletions src/filters/legacy_v1/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ impl From<&MultiEraInput<'_>> for TxInputRecord {
impl From<&MultiEraAsset<'_>> for OutputAssetRecord {
fn from(value: &MultiEraAsset<'_>) -> Self {
Self {
policy: value.policy().map(ToString::to_string).unwrap_or_default(),
asset: value.name().map(|x| x.to_hex()).unwrap_or_default(),
policy: value.policy().to_string(),
asset: value.name().to_hex(),
asset_ascii: value.to_ascii_name(),
amount: value.coin() as u64,
amount: value.output_coin().unwrap_or_default(),
}
}
}
Expand Down Expand Up @@ -146,7 +146,8 @@ impl EventWriter<'_> {
assets: output
.non_ada_assets()
.iter()
.map(|x| OutputAssetRecord::from(x))
.flat_map(|x| x.assets())
.map(|x| OutputAssetRecord::from(&x))
.collect::<Vec<_>>()
.into(),
datum_hash: match &output.datum() {
Expand Down Expand Up @@ -197,7 +198,12 @@ impl EventWriter<'_> {

record.input_count = inputs.len();

let mints: Vec<_> = tx.mints().iter().map(|x| self.to_mint_record(x)).collect();
let mints: Vec<_> = tx
.mints()
.iter()
.flat_map(|x| x.assets())
.map(|x| self.to_mint_record(&x))
.collect();

record.mint_count = mints.len();

Expand Down Expand Up @@ -331,9 +337,9 @@ impl EventWriter<'_> {

pub fn to_mint_record(&self, asset: &MultiEraAsset) -> MintRecord {
MintRecord {
policy: asset.policy().map(|x| x.to_string()).unwrap_or_default(),
asset: asset.name().map(hex::encode).unwrap_or_default(),
quantity: asset.coin(),
policy: asset.policy().to_string(),
asset: hex::encode(asset.name()),
quantity: asset.mint_coin().unwrap_or_default(),
}
}

Expand Down
Loading

0 comments on commit 2fe4f7b

Please sign in to comment.