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

feat: Implement legacy v1 mapper #554

Merged
merged 2 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 7 additions & 3 deletions src/framework/legacy_v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use std::fmt::Display;

use merge::Merge;
Expand Down Expand Up @@ -120,12 +119,13 @@ impl From<OutputAssetRecord> for EventData {
}
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct TxOutputRecord {
pub address: String,
pub amount: u64,
pub assets: Option<Vec<OutputAssetRecord>>,
pub datum_hash: Option<String>,
pub inline_datum: Option<PlutusDatumRecord>,
}

impl From<TxOutputRecord> for EventData {
Expand Down Expand Up @@ -161,6 +161,8 @@ pub struct TransactionRecord {
pub validity_interval_start: Option<u64>,
pub network_id: Option<u32>,
pub input_count: usize,
pub collateral_input_count: usize,
pub has_collateral_output: bool,
pub output_count: usize,
pub mint_count: usize,
pub total_output: u64,
Expand All @@ -169,6 +171,8 @@ pub struct TransactionRecord {
pub metadata: Option<Vec<MetadataRecord>>,
pub inputs: Option<Vec<TxInputRecord>>,
pub outputs: Option<Vec<TxOutputRecord>>,
pub collateral_inputs: Option<Vec<TxInputRecord>>,
pub collateral_output: Option<TxOutputRecord>,
pub mint: Option<Vec<MintRecord>>,
pub vkey_witnesses: Option<Vec<VKeyWitnessRecord>>,
pub native_witnesses: Option<Vec<NativeWitnessRecord>>,
Expand Down Expand Up @@ -261,14 +265,14 @@ impl From<PlutusDatumRecord> for EventData {
EventData::PlutusDatum(x)
}
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct BlockRecord {
pub era: Era,
pub epoch: Option<u64>,
pub epoch_slot: Option<u64>,
pub body_size: usize,
pub issuer_vkey: String,
pub vrf_vkey: String,
pub tx_count: usize,
pub slot: u64,
pub hash: String,
Expand Down
14 changes: 13 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
use thiserror::Error;

pub mod filters;
pub mod framework;
pub mod mapper;
pub mod sinks;
pub mod sources;
pub mod utils;

pub type Error = Box<dyn std::error::Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error("parse error {0}")]
Parse(String),
}

impl Error {
pub fn parse(error: impl ToString) -> Self {
Error::Parse(error)
}
}
Loading