forge

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 19 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ByteInt            = 0x00
	ByteString         = 0x01
	ByteArray          = 0x02
	BytePrim           = 0x03
	BytePrimAnnots     = 0x04
	BytePrimArg        = 0x05
	BytePrimArgAnnots  = 0x06
	BytePrimArgs       = 0x07
	BytePrimArgsAnnots = 0x08
	ByteGeneralPrim    = 0x09
	ByteBytes          = 0x0a
)

first bytes

View Source
const (
	PackPrefix     = "05"
	PackPrefixByte = 0x05
)

pack prefix

View Source
const (
	PrimArray = "_array"
)

custom prim

Variables

View Source
var (
	ErrTooFewBytes     = errors.New("too few bytes")
	ErrInvalidKeyword  = errors.New("invalid prim keyword")
	ErrUnknownTypeCode = errors.New("unknown type code")
)

errors

Functions

func Address

func Address(val string, tzOnly bool) ([]byte, error)

Address -

func CollectStrings

func CollectStrings(node *base.Node, tryUnpack bool) ([]string, error)

CollectStrings - returns strings contained in tree. If `tryUnpack` is true, it tries to unpack bytes value.

func Contract

func Contract(val string) (string, error)

Contract -

func DecodeString

func DecodeString(str string) string

DecodeString -

func Endorsement added in v0.1.42

func Endorsement(endorsement node.Endorsement, branch string) ([]byte, error)

Endorsement -

func Forge

func Forge(node *base.Node) ([]byte, error)

Forge -

func ForgeArray added in v0.1.33

func ForgeArray(value []byte, l uint64) []byte

ForgeArray -

func ForgeBool added in v0.1.33

func ForgeBool(value bool) []byte

ForgeBool -

func ForgeInt added in v0.1.33

func ForgeInt(value *types.BigInt) ([]byte, error)

ForgeInt -

func ForgeNat added in v0.1.33

func ForgeNat(value *types.BigInt) ([]byte, error)

ForgeNat -

func ForgeString added in v0.1.33

func ForgeString(value string) ([]byte, error)

ForgeString -

func OPG added in v0.1.33

func OPG(branch string, operations ...node.Operation) ([]byte, error)

OPG -

func PublicKey

func PublicKey(val string) ([]byte, error)

PublicKey -

func ToString

func ToString(node *base.Node) (string, error)

ToString -

func Transaction added in v0.1.33

func Transaction(transaction node.Transaction) ([]byte, error)

Transaction -

func TrimPackByte

func TrimPackByte(data []byte) ([]byte, error)

TrimPackByte -

func TryUnpackString

func TryUnpackString(str string) []*base.Node

TryUnpackString - try unpack `str` to tree. If try failed returns `nil`

func UnforgeAddress

func UnforgeAddress(str string) (string, error)

UnforgeAddress -

func UnforgeBakerHash

func UnforgeBakerHash(str string) (string, error)

UnforgeBakerHash -

func UnforgeChainID

func UnforgeChainID(str string) (string, error)

UnforgeChainID -

func UnforgeContract

func UnforgeContract(str string) (string, error)

UnforgeContract -

func UnforgeOpgHash

func UnforgeOpgHash(input string) (string, error)

UnforgeOpgHash -

func UnforgePublicKey

func UnforgePublicKey(str string) (string, error)

UnforgePublicKey -

func UnforgeSignature

func UnforgeSignature(str string) (string, error)

UnforgeSignature -

func Unpack

func Unpack(data []byte) ([]*base.Node, error)

Unpack -

func UnpackString

func UnpackString(str string) ([]*base.Node, error)

UnpackString -

Types

type Array

type Array base.Node

Array -

func NewArray

func NewArray() *Array

NewArray -

func (*Array) Forge

func (a *Array) Forge() ([]byte, error)

Forge -

func (*Array) Unforge

func (a *Array) Unforge(data []byte) (int, error)

Unforge -

type Bytes

type Bytes base.Node

Bytes -

func (*Bytes) Forge

func (b *Bytes) Forge() ([]byte, error)

Forge -

func (*Bytes) Unforge

func (b *Bytes) Unforge(data []byte) (int, error)

Unforge -

type Forger

type Forger interface {
	Forge() ([]byte, error)
}

Forger -

type Int

type Int base.Node

Int -

func NewInt

func NewInt() *Int

NewInt -

func (*Int) Forge

func (val *Int) Forge() ([]byte, error)

Forge -

func (*Int) Unforge

func (val *Int) Unforge(data []byte) (int, error)

Unforge -

type Michelson

type Michelson struct {
	Nodes []*base.Node
}

Michelson -

func NewMichelson

func NewMichelson() *Michelson

NewMichelson -

func (*Michelson) Forge

func (m *Michelson) Forge() ([]byte, error)

Forge -

func (*Michelson) Unforge

func (m *Michelson) Unforge(b []byte) (n int, err error)

Unforge -

func (*Michelson) UnforgeString

func (m *Michelson) UnforgeString(s string) (int, error)

UnforgeString -

type Object

type Object struct {
	base.Node
	// contains filtered or unexported fields
}

Object -

func NewObject

func NewObject(argsCount int, hasAnnots bool) *Object

NewObject -

func (*Object) Forge

func (obj *Object) Forge() ([]byte, error)

Forge -

func (*Object) Unforge

func (obj *Object) Unforge(data []byte) (int, error)

Unforge -

type String

type String base.Node

String -

func (*String) Forge

func (s *String) Forge() ([]byte, error)

Forge -

func (*String) Unforge

func (s *String) Unforge(data []byte) (int, error)

Unforge -

type Unforger

type Unforger interface {
	Unforge(data []byte) (int, error)
}

Unforger -

Jump to

Keyboard shortcuts

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