boc

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 13 Imported by: 0

README

TON bag-of-cells (BOC) and Cell implementation.

This library implements structures and methods to interact with TON bag-of-cells (BOC) and Cells.

BOC and Cell description:

Usage

Example

Documentation

Index

Constants

View Source
const BOCSizeLimit = 65536
View Source
const CellBits = 1023

Variables

View Source
var ErrBitStingOverflow = errors.New("BitString overflow")
View Source
var ErrCellRefsOverflow = errors.New("too many refs")
View Source
var ErrNotEnoughBits = errors.New("not enough bits")
View Source
var ErrNotEnoughRefs = errors.New("not enough refs")

Functions

func SerializeBoc

func SerializeBoc(cell *Cell, idx bool, hasCrc32 bool, cacheBits bool, flags uint) ([]byte, error)

Types

type BitString

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

func NewBitString

func NewBitString(bitLen int) BitString

func (*BitString) Append

func (s *BitString) Append(b BitString)

func (*BitString) BinaryString

func (s *BitString) BinaryString() string

func (*BitString) BitsAvailableForRead

func (s *BitString) BitsAvailableForRead() int

func (*BitString) BitsAvailableForWrite

func (s *BitString) BitsAvailableForWrite() int

func (*BitString) Buffer

func (s *BitString) Buffer() []byte

func (*BitString) Copy

func (s *BitString) Copy() BitString

func (*BitString) GetTopUppedArray

func (s *BitString) GetTopUppedArray() ([]byte, error)

func (*BitString) GetWriteCursor

func (s *BitString) GetWriteCursor() int

func (*BitString) Grow

func (s *BitString) Grow(bitLen int)

func (BitString) MarshalTLB

func (s BitString) MarshalTLB(cell *Cell, tag string) error

func (*BitString) Off

func (s *BitString) Off(n int) error

func (*BitString) On

func (s *BitString) On(n int) error

func (*BitString) PickUint

func (s *BitString) PickUint(bitLen int) (uint64, error)

func (*BitString) Print

func (s *BitString) Print()

func (*BitString) ReadBigInt

func (s *BitString) ReadBigInt(bitLen int) (*big.Int, error)

func (*BitString) ReadBigUint

func (s *BitString) ReadBigUint(bitLen int) (*big.Int, error)

func (*BitString) ReadBit

func (s *BitString) ReadBit() (bool, error)

func (*BitString) ReadBits

func (s *BitString) ReadBits(n int) (BitString, error)

func (*BitString) ReadByte

func (s *BitString) ReadByte() (byte, error)

func (*BitString) ReadBytes

func (s *BitString) ReadBytes(size int) ([]byte, error)

func (*BitString) ReadInt

func (s *BitString) ReadInt(bitLen int) (int64, error)

func (*BitString) ReadLimUint

func (s *BitString) ReadLimUint(n int) (uint, error)

ReadLimUint #<= n

func (*BitString) ReadRemainingBits

func (s *BitString) ReadRemainingBits() BitString

func (*BitString) ReadUint

func (s *BitString) ReadUint(bitLen int) (uint64, error)

func (*BitString) ReadUnary

func (s *BitString) ReadUnary() (uint, error)

func (*BitString) ResetCounter

func (s *BitString) ResetCounter()

func (*BitString) SetTopUppedArray

func (s *BitString) SetTopUppedArray(arr []byte, fulfilledBytes bool) error

func (*BitString) Skip

func (s *BitString) Skip(n int) error

func (*BitString) ToFiftHex

func (s *BitString) ToFiftHex() string

func (*BitString) UnmarshalTLB

func (s *BitString) UnmarshalTLB(cell *Cell, tag string) error

func (*BitString) WriteBigInt

func (s *BitString) WriteBigInt(val *big.Int, bitLen int) error

func (*BitString) WriteBigUint

func (s *BitString) WriteBigUint(val *big.Int, bitLen int) error

func (*BitString) WriteBit

func (s *BitString) WriteBit(val bool) error

func (*BitString) WriteBitArray

func (s *BitString) WriteBitArray(val []bool) error

func (*BitString) WriteBitString

func (s *BitString) WriteBitString(bs BitString) error

func (*BitString) WriteByte

func (s *BitString) WriteByte(val byte) error

func (*BitString) WriteBytes

func (s *BitString) WriteBytes(data []byte) error

func (*BitString) WriteInt

func (s *BitString) WriteInt(val int64, bitLen int) error

func (*BitString) WriteLimUint

func (s *BitString) WriteLimUint(val, n int) error

WriteLimUint #<= n

func (*BitString) WriteUint

func (s *BitString) WriteUint(val uint64, bitLen int) error

func (*BitString) WriteUnary

func (s *BitString) WriteUnary(n uint) error

type Cell

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

func DeserializeBoc

func DeserializeBoc(boc []byte) ([]*Cell, error)

func DeserializeBocBase64

func DeserializeBocBase64(boc string) ([]*Cell, error)

func DeserializeBocHex

func DeserializeBocHex(boc string) ([]*Cell, error)

func NewCell

func NewCell() *Cell

func NewCellExotic

func NewCellExotic(cellType CellType) *Cell

func (*Cell) AddRef

func (c *Cell) AddRef(c2 *Cell) error

func (*Cell) BitSize

func (c *Cell) BitSize() int

func (*Cell) BitsAvailableForRead

func (c *Cell) BitsAvailableForRead() int

func (*Cell) BitsAvailableForWrite

func (c *Cell) BitsAvailableForWrite() int

func (*Cell) CellType

func (c *Cell) CellType() CellType

func (*Cell) Hash

func (c *Cell) Hash() ([]byte, error)

func (*Cell) HashString

func (c *Cell) HashString() (string, error)

func (*Cell) IsExotic

func (c *Cell) IsExotic() bool

func (*Cell) Level

func (c *Cell) Level() int

func (Cell) MarshalTLB

func (c Cell) MarshalTLB(cell *Cell, tag string) error

func (*Cell) NewRef

func (c *Cell) NewRef() (*Cell, error)

func (*Cell) NextRef

func (c *Cell) NextRef() (*Cell, error)

func (*Cell) PickUint

func (c *Cell) PickUint(bitLen int) (uint64, error)

func (*Cell) RawBitString

func (c *Cell) RawBitString() BitString

func (*Cell) ReadBigUint

func (c *Cell) ReadBigUint(n int) (*big.Int, error)

func (*Cell) ReadBit

func (c *Cell) ReadBit() (bool, error)

func (*Cell) ReadBits

func (c *Cell) ReadBits(n int) (BitString, error)

func (*Cell) ReadBytes

func (c *Cell) ReadBytes(n int) ([]byte, error)

func (*Cell) ReadInt

func (c *Cell) ReadInt(n int) (int64, error)

func (*Cell) ReadLimUint

func (c *Cell) ReadLimUint(n int) (uint, error)

func (*Cell) ReadRemainingBits

func (c *Cell) ReadRemainingBits() BitString

func (*Cell) ReadUint

func (c *Cell) ReadUint(bitLen int) (uint64, error)

func (*Cell) ReadUnary

func (c *Cell) ReadUnary() (uint, error)

func (*Cell) Refs

func (c *Cell) Refs() []*Cell

func (*Cell) RefsAvailableForRead

func (c *Cell) RefsAvailableForRead() int

func (*Cell) RefsSize

func (c *Cell) RefsSize() int

func (*Cell) ResetCounters

func (c *Cell) ResetCounters()

func (*Cell) Sign

func (c *Cell) Sign(key ed25519.PrivateKey) (BitString, error)

func (*Cell) Skip

func (c *Cell) Skip(n int) error

func (*Cell) ToBoc

func (c *Cell) ToBoc() ([]byte, error)

func (*Cell) ToBocBase64

func (c *Cell) ToBocBase64() (string, error)

func (*Cell) ToBocBase64Custom

func (c *Cell) ToBocBase64Custom(idx bool, hasCrc32 bool, cacheBits bool, flags uint) (string, error)

func (*Cell) ToBocCustom

func (c *Cell) ToBocCustom(idx bool, hasCrc32 bool, cacheBits bool, flags uint) ([]byte, error)

func (*Cell) ToBocString

func (c *Cell) ToBocString() (string, error)

func (*Cell) ToBocStringCustom

func (c *Cell) ToBocStringCustom(idx bool, hasCrc32 bool, cacheBits bool, flags uint) (string, error)

func (*Cell) ToString

func (c *Cell) ToString() string

func (*Cell) UnmarshalTLB

func (c *Cell) UnmarshalTLB(cell *Cell, tag string) error

func (*Cell) WriteBit

func (c *Cell) WriteBit(val bool) error

func (*Cell) WriteBitString

func (c *Cell) WriteBitString(s BitString) error

func (*Cell) WriteBytes

func (c *Cell) WriteBytes(b []byte) error

func (*Cell) WriteInt

func (c *Cell) WriteInt(val int64, bitLen int) error

func (*Cell) WriteLimUint

func (c *Cell) WriteLimUint(val, n int) error

func (*Cell) WriteUint

func (c *Cell) WriteUint(val uint64, bitLen int) error

func (*Cell) WriteUnary

func (c *Cell) WriteUnary(n uint) error

type CellType

type CellType uint8
const (
	OrdinaryCell CellType = iota
	PrunedBranchCell
	LibraryCell
	MerkleProofCell
	MerkleUpdateCell
)

type LevelMask

type LevelMask uint32

func (LevelMask) Apply

func (m LevelMask) Apply(level uint32) LevelMask

func (LevelMask) ApplyOr

func (m LevelMask) ApplyOr(other LevelMask) LevelMask

func (LevelMask) HashIndex

func (m LevelMask) HashIndex() int

func (LevelMask) HashesCount

func (m LevelMask) HashesCount() int

func (LevelMask) IsSignificant

func (m LevelMask) IsSignificant(level uint32) bool

func (LevelMask) Level

func (m LevelMask) Level() int

func (LevelMask) ShiftRight

func (m LevelMask) ShiftRight() LevelMask

Jump to

Keyboard shortcuts

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