Skip to main content

Module emit

Module emit 

Source
Expand description

Pass 6: Emit – converts Stack IR to Bitcoin Script bytes (hex string).

Walks the StackOp list and encodes each operation as one or more Bitcoin Script opcodes, producing both a hex-encoded script and a human-readable ASM representation.

Structs§

ConstructorSlot
Records the byte offset of a constructor parameter placeholder in the emitted script. The SDK uses these offsets to splice in real values at deployment time.
EmitResult
The output of the emission pass.
SourceMapping
Maps an emitted opcode to a source location.

Functions§

emit
Emit a slice of StackMethods as Bitcoin Script hex and ASM.
emit_method
Emit a single method’s ops. Useful for testing.
encode_push_data
Encode raw bytes as a Bitcoin Script push-data operation.
encode_push_int
Encode an integer push, using small-integer opcodes where possible.
encode_script_number
Encode an i128 as a Bitcoin Script number (little-endian, sign-magnitude). Bitcoin Script numbers can be up to 2^252, so i128 is needed.