Skip to content

compile (Func)

Compile SilverScript source into a CompiledContract.

Experimental: SilverScript and these bindings are under active development; the API and the compiler's output may change in breaking ways between releases. See the kaspa.experimental.silverscript module docs.

PARAMETER DESCRIPTION
source

The SilverScript contract source.

TYPE: str

constructor_args

Native Python values matching the contract's constructor parameters. Omit or pass None for a contract with no constructor parameters.

TYPE: Optional[Any] DEFAULT: None

allow_entrypoint_return

Permit entrypoints that return a value (default: False).

TYPE: bool DEFAULT: False

record_debug_infos

Record debug information during compilation (default: False).

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
CompiledContract

The compiled contract.

TYPE: CompiledContract

RAISES DESCRIPTION
SilverScriptError

If compilation fails (syntax error, type error, or incompatible pragma).