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

fix bug due to default validator lacking datum/redeemer #153

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions packages/blaze-blueprint/src/blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,9 @@ export async function generateBlueprint({
if (useSdk) {
generator.useSDK();
}
const validators = plutusJson.validators.map((validator) => {
const validators = plutusJson.validators.flatMap((validator) => {
const title = validator.title;
if (title.endsWith(`.else`)) return [];
const name = (() => {
// Validators can reside under sub-directories and without replacing `/`
// in the path the resulting `plutus.ts` will have validators with `/`
Expand Down Expand Up @@ -303,7 +304,7 @@ export async function generateBlueprint({

const script = validator.compiledCode;

return `export interface ${name} {
return [`export interface ${name} {
new (${paramsArgs.map((param) => param.join(":")).join(",")}): Script;${
datum ? `\n${datumTitle}: ${generator.schemaToType(datumSchema)};` : ""
}
Expand All @@ -322,7 +323,7 @@ export async function generateBlueprint({
}},
${datum ? `{${datumTitle}: ${JSON.stringify(datumSchema)}},` : ""}
{${redeemerTitle}: ${JSON.stringify(redeemerSchema)}},
) as unknown as ${name};`;
) as unknown as ${name};`];
});

const plutus = generator.imports + "\n\n" + validators.join("\n\n");
Expand Down
Loading