Skip to content
2 changes: 1 addition & 1 deletion napi-pallas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hex = "0.4.3"
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "2.12.2", default-features = false, features = ["napi4"] }
napi-derive = "2.12.2"
pallas = { git = "https://github.com/alegadea/pallas.git", rev = "54ffc77" , features = ["unstable"]}
pallas = { git = "https://github.com/txpipe/pallas.git", rev = "2f97cbe" , features = ["unstable"]}

[build-dependencies]
napi-build = "2.0.1"
Expand Down
59 changes: 30 additions & 29 deletions napi-pallas/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,47 @@
/* auto-generated by NAPI-RS */

export interface ShelleyPart {
isScript: boolean
hash?: string
pointer?: string
isScript: boolean;
hash?: string;
pointer?: string;
}
export interface AddressDiagnostic {
kind: string
network?: string
paymentPart?: ShelleyPart
delegationPart?: ShelleyPart
byronCbor?: string
kind: string;
network?: string;
paymentPart?: ShelleyPart;
delegationPart?: ShelleyPart;
byronCbor?: string;
}
export interface Output {
error?: string
bytes?: string
address?: AddressDiagnostic
error?: string;
bytes?: string;
address?: AddressDiagnostic;
}
export interface Attribute {
topic?: string
value?: string
topic?: string;
value?: string;
}
export interface Section {
topic?: string
identity?: string
error?: string
attributes: Array<Attribute>
bytes?: string
children: Array<Section>
}
export function parseAddress(raw: string): Output
topic?: string;
identity?: string;
error?: string;
attributes: Array<Attribute>;
bytes?: string;
children: Array<Section>;
}
export function parseAddress(raw: string): Output;
export interface SectionValidation {
section: Section
validations: Validations
section: Section;
validations: Validations;
}
export function safeParseTx(raw: string): SectionValidation
export function safeParseBlock(raw: string): Section
export function safeParseTx(raw: string): SectionValidation;
export function safeParseBlock(raw: string): Section;
export interface Validation {
name: string
value: boolean
description: string
name: string;
value: boolean;
description: string;
}
export interface Validations {
validations: Array<Validation>
validations: Array<Validation>;
era: string;
}
8 changes: 8 additions & 0 deletions napi-pallas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ impl Validation {
#[napi(object)]
pub struct Validations {
pub validations: Vec<Validation>,
pub era: String,
}

impl Validations {
Expand All @@ -224,4 +225,11 @@ impl Validations {

self
}

pub fn with_era(self, era: impl ToString) -> Self {
Self {
era: era.to_string(),
..self
}
}
}
2 changes: 1 addition & 1 deletion napi-pallas/src/validations/alonzo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ use pallas::ledger::primitives::alonzo::MintedTx;
use crate::Validations;

pub fn validate_alonzo(mtx_a: &MintedTx) -> Validations {
let out = Validations::new();
let out = Validations::new().with_era("Alonzo".to_string());
out
}
Loading