@harmoniclabs/plu-ts-onchain
Version:
An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript
38 lines (37 loc) • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBlueprint = void 0;
function getBlueprint($id, _preamble, _validators, _definitions) {
if (_definitions === void 0) { _definitions = []; }
if (!Array.isArray(_validators) || _validators.every(function (v) { return typeof v === "object"; })) {
throw new Error("unexpected validator descriptor");
}
if (!Array.isArray(_definitions))
_definitions = [];
return {
$schema: "https://cips.cardano.org/cips/cip57/schemas/plutus-blueprint.json",
$id: $id.toString(),
$vocabulary: {
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/validation": true,
"https://cips.cardano.org/cips/cip57": true
},
preamble: {
title: _preamble.title.toString(),
description: _preamble.description === undefined ? undefined : _preamble.description.toString(),
version: Array.isArray(_preamble.version) &&
_preamble.version.every(function (n) { return Number.isSafeInteger(n) && n >= 0; }) ?
_preamble.version.join(".") :
undefined,
plutusVersion: _preamble.plutusVersion === undefined ? undefined :
_preamble.plutusVersion === "PlutusScriptV1" ? "v1" :
_preamble.plutusVersion === "PlutusScriptV2" ? "v2" :
undefined,
license: typeof _preamble.license === "string" ? _preamble.license : undefined
},
validators: _validators,
definitions: _definitions.length > 0 ? _definitions : undefined
};
}
exports.getBlueprint = getBlueprint;