txvmutil

package
v0.0.0-...-ff6bfbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2019 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package txvmutil defines a "fluent" builder type for constructing TxVM programs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder helps programmatically build txvm programs.

func (*Builder) Build

func (b *Builder) Build() []byte

Build returns the assembled txvm program.

func (*Builder) Concat

func (b *Builder) Concat(prog []byte) *Builder

Concat concatenates an already assemble txvm program fragment onto the end of b.

func (*Builder) Op

func (b *Builder) Op(o byte) *Builder

Op writes the provided opcode to b.

func (*Builder) PushdataByte

func (b *Builder) PushdataByte(byt byte) *Builder

PushdataByte writes instructions to b, pushing byt onto the stack.

func (*Builder) PushdataBytes

func (b *Builder) PushdataBytes(data []byte) *Builder

PushdataBytes writes instructions to b, pushing data onto the stack.

func (*Builder) PushdataInt64

func (b *Builder) PushdataInt64(v int64) *Builder

PushdataInt64 writes instructions to b pushing v onto the stack.

func (*Builder) PushdataUint64

func (b *Builder) PushdataUint64(v uint64) *Builder

PushdataInt64 writes instructions to b pushing v onto the stack. It panics if v does not fit in a int64.

func (*Builder) Tuple

func (b *Builder) Tuple(fn func(*TupleBuilder)) *Builder

Tuple executes fn, passing in a TupleBuilder that exposes pushdata operations. All operations performed on the TupleBuilder during fn are shadowed to b. When fn completes, Tuple writes to b instructions to construct a tuple of the pushed data.

type TupleBuilder

type TupleBuilder struct {
	// contains filtered or unexported fields
}

TupleBuilder wraps a Builder, exposing only pushdata operations.

func (*TupleBuilder) PushdataByte

func (tb *TupleBuilder) PushdataByte(byt byte) *TupleBuilder

PushdataByte writes instructions to b, pushing byt onto the stack.

func (*TupleBuilder) PushdataBytes

func (tb *TupleBuilder) PushdataBytes(data []byte) *TupleBuilder

PushdataBytes writes instructions to b pushing data onto the stack.

func (*TupleBuilder) PushdataInt64

func (tb *TupleBuilder) PushdataInt64(v int64) *TupleBuilder

PushdataInt64 writes instructions to b pushing v onto the stack.

func (*TupleBuilder) Tuple

func (tb *TupleBuilder) Tuple(fn func(*TupleBuilder)) *TupleBuilder

Tuple executes fn, passing in a TupleBuilder that exposes pushdata operations. All operations performed on the TupleBuilder during fn are shadowed to tb's underlying Builder. When fn completes, Tuple writes to tb's underlying Builder instructions to construct a tuple of the pushed data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL