Skip to content

CompiledContract (Class)

A compiled SilverScript contract: the locking script plus the metadata needed to build unlocking (signature) scripts for its entrypoints.

abi property

abi: list[FunctionAbiEntry]

The contract ABI: one entry per callable entrypoint.

compiler_version property

compiler_version: str

The compiler version that produced this contract.

contract_name property

contract_name: str

The contract name from the SilverScript source.

script property

script: bytes

The compiled locking script (redeem script) bytes.

state_layout property

state_layout: tuple[int, int]

(start, len): byte offset and length of the contract state within the script.

without_selector property

without_selector: bool

Whether the contract has a single entrypoint (no function selector).

__repr__

__repr__() -> str

build_sig_script

build_sig_script(function_name: str, args: Optional[Any] = None) -> bytes

Build the signature (unlocking) script for an entrypoint.

PARAMETER DESCRIPTION
function_name

The entrypoint to call.

TYPE: str

args

Native Python values (int, bool, str, bytes, list/tuple, or dict) matching the entrypoint's ABI input types. Omit or pass None for an entrypoint that takes no arguments.

TYPE: Optional[Any] DEFAULT: None

RETURNS DESCRIPTION
bytes

The signature (unlocking) script.

TYPE: bytes

RAISES DESCRIPTION
SilverScriptError

If the entrypoint is unknown or an argument is invalid (wrong type, out of range, or too deeply nested).

build_sig_script_for_covenant_decl

build_sig_script_for_covenant_decl(function_name: str, args: Optional[Any] = None, *, is_leader: bool = False) -> bytes

Build the signature (unlocking) script for a covenant declaration entrypoint.

PARAMETER DESCRIPTION
function_name

The covenant entrypoint to call.

TYPE: str

args

Native Python values matching the entrypoint's ABI input types. Omit or pass None for an entrypoint that takes no arguments.

TYPE: Optional[Any] DEFAULT: None

is_leader

Select the leader path for covenants that distinguish a leader from delegates (default: False).

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
bytes

The signature (unlocking) script.

TYPE: bytes

RAISES DESCRIPTION
SilverScriptError

If the entrypoint is unknown or an argument is invalid (wrong type, out of range, or too deeply nested).