UNPKG

@helios-lang/compiler

Version:

Helios is a Domain Specific Language that compiles to Plutus-Core (i.e. Cardano on-chain validator scripts). Helios is a non-Haskell alternative to Plutus. With this library you can compile Helios scripts and build Cardano transactions, all you need to bu

24 lines (20 loc) 540 B
import { oneOf, word } from "@helios-lang/compiler-utils" /** * @typedef {(typeof SCRIPT_PURPOSES) extends ReadonlyArray<infer T> ? T : never} ScriptPurpose */ export const SCRIPT_PURPOSES = /** @type {const} */ ([ "spending", "minting", "staking", "module", "testing", "mixed" ]) export const anyScriptPurpose = oneOf(SCRIPT_PURPOSES.map((p) => word(p))) /** * @param {string} s * @returns {s is ScriptPurpose} */ export function isValidScriptPurpose(s) { return !!SCRIPT_PURPOSES.find((p) => p == s) }