-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a36e10
commit 2cfe850
Showing
131 changed files
with
14,188 additions
and
108,959 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
import packageJson from "./package.json" with { type: "json" }; | ||
import { parse } from "https://deno.land/[email protected]/flags/mod.ts"; | ||
|
||
const flags = parse(Deno.args, { | ||
boolean: ["npm"], | ||
}); | ||
import { version } from "./package.json" with { type: "json" }; | ||
|
||
type Blueprint = { | ||
preamble: { | ||
|
@@ -54,11 +49,7 @@ const plutusVersion = "Plutus" + | |
const definitions = plutusJson.definitions; | ||
|
||
const imports = `// deno-lint-ignore-file | ||
import { applyParamsToScript, Data, Validator } from "${ | ||
flags.npm | ||
? "lucid-cardano" | ||
: `https://deno.land/x/lucid@${packageJson.version}/mod.ts` | ||
}"`; | ||
import { applyParamsToScript, Data, Script } from "https://deno.land/x/lucid@${version}/mod.ts"`; | ||
|
||
const validators = plutusJson.validators.map((validator) => { | ||
const title = validator.title; | ||
|
@@ -87,7 +78,7 @@ const validators = plutusJson.validators.map((validator) => { | |
const script = validator.compiledCode; | ||
|
||
return `export interface ${name} { | ||
new (${paramsArgs.map((param) => param.join(":")).join(",")}): Validator;${ | ||
new (${paramsArgs.map((param) => param.join(":")).join(",")}): Script;${ | ||
datum ? `\n${datumTitle}: ${schemaToType(datumSchema)};` : "" | ||
} | ||
${redeemerTitle}: ${schemaToType(redeemerSchema)}; | ||
|
@@ -96,9 +87,9 @@ const validators = plutusJson.validators.map((validator) => { | |
export const ${name} = Object.assign( | ||
function (${paramsArgs.map((param) => param.join(":")).join(",")}) {${ | ||
paramsArgs.length > 0 | ||
? `return { type: "${plutusVersion}", script: applyParamsToScript("${script}", [${ | ||
? `return { type: "${plutusVersion}", script: applyParamsToScript([${ | ||
paramsArgs.map((param) => param[0]).join(",") | ||
}], ${JSON.stringify(paramsSchema)} as any) };` | ||
}], "${script}", ${JSON.stringify(paramsSchema)} as any) };` | ||
: `return {type: "${plutusVersion}", script: "${script}"};` | ||
}}, | ||
${datum ? `{${datumTitle}: ${JSON.stringify(datumSchema)}},` : ""} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,36 @@ | ||
import * as C from "./libs/cardano_multiplatform_lib/cardano_multiplatform_lib.generated.js"; | ||
import * as M from "./libs/cardano_message_signing/cardano_message_signing.generated.js"; | ||
import packageJson from "../../package.json" with { type: "json" }; | ||
|
||
async function unsafeInstantiate(module: any, url: string) { | ||
try { | ||
await module.instantiate({ | ||
// Exception for Deno fresh framework | ||
url: new URL( | ||
url, | ||
`https://deno.land/x/lucid@${packageJson.version}/src/core/libs/`, | ||
), | ||
}); | ||
} catch (_e) { | ||
// This only ever happens during SSR rendering | ||
} | ||
} | ||
|
||
await Promise.all([ | ||
unsafeInstantiate( | ||
C, | ||
`cardano_multiplatform_lib/cardano_multiplatform_lib_bg.wasm`, | ||
), | ||
unsafeInstantiate( | ||
M, | ||
`cardano_message_signing/cardano_message_signing_bg.wasm`, | ||
), | ||
]); | ||
|
||
export { C, M }; | ||
import * as Core from "./libs/lucid_core/pkg/lucid_core.js"; | ||
import type * as CoreTypes from "./libs/lucid_core/pkg/lucid_core.d.ts"; | ||
import * as MessageSigningInstance from "./libs/message_signing/pkg/message_signing.js"; | ||
import type * as MessageSigningTypes from "./libs/message_signing/pkg/message_signing.d.ts"; | ||
|
||
export type Addresses = CoreTypes.Addresses; | ||
export const Addresses: typeof CoreTypes.Addresses = Core.Addresses; | ||
|
||
export type Codec = CoreTypes.Codec; | ||
export const Codec: typeof CoreTypes.Codec = Core.Codec; | ||
|
||
export type Crypto = CoreTypes.Crypto; | ||
export const Crypto: typeof CoreTypes.Crypto = Core.Crypto; | ||
|
||
export type EmulatorState = CoreTypes.EmulatorState; | ||
export const EmulatorState: typeof CoreTypes.EmulatorState = Core.EmulatorState; | ||
|
||
export type Hasher = CoreTypes.Hasher; | ||
export const Hasher: typeof CoreTypes.Hasher = Core.Hasher; | ||
|
||
export type InstructionBuilder = CoreTypes.InstructionBuilder; | ||
export const InstructionBuilder: typeof CoreTypes.InstructionBuilder = | ||
Core.InstructionBuilder; | ||
|
||
export type InstructionSigner = CoreTypes.InstructionSigner; | ||
export const InstructionSigner: typeof CoreTypes.InstructionSigner = | ||
Core.InstructionSigner; | ||
|
||
export type Utils = CoreTypes.Utils; | ||
export const Utils: typeof CoreTypes.Utils = Core.Utils; | ||
|
||
export type MessageSigning = typeof MessageSigningTypes; | ||
export const MessageSigning: typeof MessageSigningTypes = | ||
MessageSigningInstance; | ||
|
||
export type * from "./libs/lucid_core/pkg/lucid_core.d.ts"; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.