Skip to content

Commit

Permalink
fix: fix display of tx_output_asset_policy_assets and reference_inputs (
Browse files Browse the repository at this point in the history
#6)

* Fixing tx_output_asset_policy_asset_name information and a minor typo in tx_mint_policy_asset_count. Bumping pallas dependency for fixing reference inputs

* Minor fix related to the validation section.
  • Loading branch information
alegadea authored Dec 5, 2024
1 parent ccfcfca commit b4ea439
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 62 deletions.
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 = "ba342ab", features = ["unstable"] }

[build-dependencies]
napi-build = "2.0.1"
Expand Down
6 changes: 3 additions & 3 deletions napi-pallas/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export interface Section {
bytes?: string
children: Array<Section>
}
export function parseAddress(raw: string): Output
export declare function parseAddress(raw: string): Output
export interface SectionValidation {
section: Section
validations: Validations
}
export function safeParseTx(raw: string): SectionValidation
export function safeParseBlock(raw: string): Section
export declare function safeParseTx(raw: string): SectionValidation
export declare function safeParseBlock(raw: string): Section
export interface Validation {
name: string
value: boolean
Expand Down
49 changes: 39 additions & 10 deletions napi-pallas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,32 @@ switch (platform) {
}
break
case 'arm':
localFileExisted = existsSync(
join(__dirname, 'napi-pallas.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./napi-pallas.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('napi-pallas-linux-arm-gnueabihf')
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'napi-pallas.linux-arm-musleabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./napi-pallas.linux-arm-musleabihf.node')
} else {
nativeBinding = require('napi-pallas-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'napi-pallas.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./napi-pallas.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('napi-pallas-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
} catch (e) {
loadError = e
}
break
case 'riscv64':
Expand Down Expand Up @@ -266,6 +281,20 @@ switch (platform) {
}
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'napi-pallas.linux-s390x-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./napi-pallas.linux-s390x-gnu.node')
} else {
nativeBinding = require('napi-pallas-linux-s390x-gnu')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
}
Expand Down
8 changes: 4 additions & 4 deletions napi-pallas/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ fn tx_output_section(o: &MultiEraOutput) -> Section {
.collect_children(x.assets().iter().map(|asset| {
Section::new()
.with_topic("tx_output_asset_policy_asset")
.with_attr("tx_mint_policy_asset_name", hex::encode(asset.name()))
.with_maybe_attr("tx_mint_policy_asset_name_ascii", asset.to_ascii_name())
.with_maybe_attr("tx_mint_policy_asset_coint", asset.mint_coin())
.with_attr("tx_output_asset_policy_asset_name", hex::encode(asset.name()))
.with_maybe_attr("tx_output_asset_policy_asset_name_ascii", asset.to_ascii_name())
.with_maybe_attr("tx_output_asset_policy_asset_count", asset.output_coin())
}))
})
}))
Expand Down Expand Up @@ -121,7 +121,7 @@ fn tx_mints_section(tx: &MultiEraTx<'_>) -> Section {
.with_topic("tx_mint_policy_asset")
.with_attr("tx_mint_policy_asset_name", hex::encode(asset.name()))
.with_maybe_attr("tx_mint_policy_asset_name_ascii", asset.to_ascii_name())
.with_maybe_attr("tx_mint_policy_asset_coint", asset.mint_coin())
.with_maybe_attr("tx_mint_policy_asset_count", asset.mint_coin())
}))
})
}))
Expand Down
44 changes: 0 additions & 44 deletions web/app/routes/tx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,50 +66,6 @@ export default function Index() {

const validations: IValidation[] = data?.validations || [];

const validations: IValidation[] = [
{ name: "Non empty inputs", value: true, description: "Sucessful" },
{
name: "All inputs in utxos",
value: false,
description:
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro id maiores exercitationem asperiores molestias assumenda doloremque magnam fugit. Iure dolorum fugit facilis autem incidunt vero necessitatibus consectetur ducimus recusandae blanditiis!",
},
{ name: "Validity interval", value: true, description: "Sucessful" },
{ name: "Fee", value: true, description: "Sucessful" },
{
name: "Preservation of value",
value: false,
description:
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro id maiores exercitationem asperiores molestias assumenda doloremque magnam fugit. Iure dolorum fugit facilis autem incidunt vero necessitatibus consectetur ducimus recusandae blanditiis!",
},
{
name: "Min lovelace per UTxO",
value: false,
description:
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro id maiores exercitationem asperiores molestias assumenda doloremque magnam fugit. Iure dolorum fugit facilis autem incidunt vero necessitatibus consectetur ducimus recusandae blanditiis!",
},
{ name: "Output value size", value: true, description: "Successful" },
{ name: "Network Id", value: true, description: "Successful" },
{ name: "Tx size", value: true, description: "Successful" },
{ name: "Tx execution units", value: true, description: "Successful" },
{ name: "Minting", value: true, description: "Successful" },
{
name: "Well formed",
value: false,
description:
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro id maiores exercitationem asperiores molestias assumenda doloremque magnam fugit. Iure dolorum fugit facilis autem incidunt vero necessitatibus consectetur ducimus recusandae blanditiis!",
},
{ name: "Script witness", value: true, description: "Successful" },
{ name: "Languages", value: true, description: "Successful" },
{
name: "Auxiliary data hash",
value: false,
description:
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro id maiores exercitationem asperiores molestias assumenda doloremque magnam fugit. Iure dolorum fugit facilis autem incidunt vero necessitatibus consectetur ducimus recusandae blanditiis!",
},
{ name: "Script data hash", value: true, description: "Successful" },
];

return (
<main className="mt-10 px-4">
<h1 className="text-5xl lg:text-7xl text-black">Cardano Tx</h1>
Expand Down

0 comments on commit b4ea439

Please sign in to comment.