feat: move input from json to helper method
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
ast::{DeBruijn, FakeNamedDeBruijn, NamedDeBruijn, Program},
|
||||
ast::{FakeNamedDeBruijn, NamedDeBruijn, Program},
|
||||
machine::cost_model::ExBudget,
|
||||
PlutusData,
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::{fs::File, io::BufReader, path::PathBuf};
|
||||
|
||||
use pallas_codec::utils::KeyValuePairs;
|
||||
use pallas_crypto::hash::Hash;
|
||||
use pallas_primitives::babbage::{
|
||||
@@ -14,6 +16,26 @@ pub struct ResolvedInput {
|
||||
pub output: TransactionOutput,
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("{0}")]
|
||||
File(#[from] std::io::Error),
|
||||
#[error("{0}")]
|
||||
Serde(#[from] serde_json::error::Error),
|
||||
}
|
||||
|
||||
impl ResolvedInput {
|
||||
pub fn from_json(file: &PathBuf) -> Result<Vec<Self>, Error> {
|
||||
let file = File::open(file)?;
|
||||
|
||||
let reader = BufReader::new(file);
|
||||
|
||||
let resolved_inputs: Vec<ResolvedInput> = serde_json::from_reader(reader)?;
|
||||
|
||||
Ok(resolved_inputs)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct TxInInfo {
|
||||
pub out_ref: TransactionInput,
|
||||
|
||||
@@ -43,7 +43,7 @@ pub trait ToPlutusData {
|
||||
fn to_plutus_data(&self) -> PlutusData;
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub struct MintValue {
|
||||
pub mint_value: Mint,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user