Skip to main content
Version: Next

sdk.cbortoscript

Home > @blaze-cardano/sdk > cborToScript

cborToScript() function

Converts the compiled code of a UPLC program into a Script based on the specified script type, handling possible double-CBOR encoding.

Signature:

declare function cborToScript(cbor: string, type: ScriptType): Script;

Parameters

Parameter

Type

Description

cbor

string

The script, possibly double-CBOR-encoded.

type

ScriptType

The type of the script (Native, PlutusV1, or PlutusV2).

Returns:

Script

{Script} - The Script created from the hex blob.

Exceptions

{Error} - Throws an error if the script type is unsupported.