Skip to main content

fromString

scrypt-ts-opcat v1.0.1


scrypt-ts-opcat / Script / fromString

Function: fromString()

fromString(str): Script

Defined in: node_modules/@opcat-labs/opcat/types/script/script.d.cts:334

Converts a string representation of a script into a Script object. Handles hex strings, empty strings, and space-separated opcode tokens. For pushdata operations (OP_PUSHDATA1/2/4), validates format and length. Throws errors for invalid script formats or data lengths.

Parameters

str

string

The script string to parse (hex or opcode tokens)

Returns

Script

The constructed Script object

Throws

When script format is invalid or data lengths don't match