Documentation ¶
Overview ¶
Package txvmutil defines a "fluent" builder type for constructing TxVM programs.
Index ¶
- type Builder
- func (b *Builder) Build() []byte
- func (b *Builder) Concat(prog []byte) *Builder
- func (b *Builder) Op(o byte) *Builder
- func (b *Builder) PushdataByte(byt byte) *Builder
- func (b *Builder) PushdataBytes(data []byte) *Builder
- func (b *Builder) PushdataInt64(v int64) *Builder
- func (b *Builder) PushdataUint64(v uint64) *Builder
- func (b *Builder) Tuple(fn func(*TupleBuilder)) *Builder
- type TupleBuilder
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) Concat ¶
Concat concatenates an already assemble txvm program fragment onto the end of b.
func (*Builder) PushdataByte ¶
PushdataByte writes instructions to b, pushing byt onto the stack.
func (*Builder) PushdataBytes ¶
PushdataBytes writes instructions to b, pushing data onto the stack.
func (*Builder) PushdataInt64 ¶
PushdataInt64 writes instructions to b pushing v onto the stack.
func (*Builder) PushdataUint64 ¶
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.