Documentation ¶
Index ¶
- Variables
- func CheckProof(proof *Cell, hash []byte) error
- func ToBOCWithFlags(roots []*Cell, flags ...bool) []byte
- type Builder
- func (b *Builder) BitsLeft() uint
- func (b *Builder) BitsUsed() uint
- func (b *Builder) Copy() *Builder
- func (b *Builder) EndCell() *Cell
- func (b *Builder) MustStoreAddr(addr *address.Address) *Builder
- func (b *Builder) MustStoreBigCoins(value *big.Int) *Builder
- func (b *Builder) MustStoreBigInt(value *big.Int, sz uint) *Builder
- func (b *Builder) MustStoreBigUInt(value *big.Int, sz uint) *Builder
- func (b *Builder) MustStoreBigVarUInt(val *big.Int, sz uint) *Builder
- func (b *Builder) MustStoreBinarySnake(data []byte) *Builder
- func (b *Builder) MustStoreBoolBit(value bool) *Builder
- func (b *Builder) MustStoreBuilder(builder *Builder) *Builder
- func (b *Builder) MustStoreCoins(value uint64) *Builder
- func (b *Builder) MustStoreDict(dict *Dictionary) *Builder
- func (b *Builder) MustStoreInt(value int64, sz uint) *Builder
- func (b *Builder) MustStoreMaybeRef(ref *Cell) *Builder
- func (b *Builder) MustStoreRef(ref *Cell) *Builder
- func (b *Builder) MustStoreSlice(bytes []byte, sz uint) *Builder
- func (b *Builder) MustStoreStringSnake(str string) *Builder
- func (b *Builder) MustStoreUInt(value uint64, sz uint) *Builder
- func (b *Builder) MustStoreVarUInt(val uint64, sz uint) *Builder
- func (b *Builder) RefsLeft() uint
- func (b *Builder) RefsUsed() int
- func (b *Builder) StoreAddr(addr *address.Address) error
- func (b *Builder) StoreBigCoins(value *big.Int) error
- func (b *Builder) StoreBigInt(value *big.Int, sz uint) error
- func (b *Builder) StoreBigUInt(value *big.Int, sz uint) error
- func (b *Builder) StoreBigVarUInt(val *big.Int, sz uint) error
- func (b *Builder) StoreBinarySnake(data []byte) error
- func (b *Builder) StoreBoolBit(value bool) error
- func (b *Builder) StoreBuilder(builder *Builder) error
- func (b *Builder) StoreCoins(value uint64) error
- func (b *Builder) StoreDict(dict *Dictionary) error
- func (b *Builder) StoreInt(value int64, sz uint) error
- func (b *Builder) StoreMaybeRef(ref *Cell) error
- func (b *Builder) StoreRef(ref *Cell) error
- func (b *Builder) StoreSlice(bytes []byte, sz uint) error
- func (b *Builder) StoreStringSnake(str string) error
- func (b *Builder) StoreUInt(value uint64, sz uint) error
- func (b *Builder) StoreVarUInt(val uint64, sz uint) error
- func (b *Builder) ToSlice() *Slice
- type Cell
- func (c *Cell) AsDict(keySz uint) *Dictionary
- func (c *Cell) BeginParse() *Slice
- func (c *Cell) BitsSize() uint
- func (c *Cell) CreateProof(skeleton *ProofSkeleton) (*Cell, error)
- func (c *Cell) Depth(level ...int) uint16
- func (c *Cell) Dump(limitLength ...int) string
- func (c *Cell) DumpBits(limitLength ...int) string
- func (c *Cell) GetType() Type
- func (c *Cell) Hash(level ...int) []byte
- func (c *Cell) MarshalJSON() ([]byte, error)
- func (c *Cell) MustPeekRef(i int) *Cell
- func (c *Cell) PeekRef(i int) (*Cell, error)
- func (c *Cell) RefsNum() uint
- func (c *Cell) Sign(key ed25519.PrivateKey) []byte
- func (c *Cell) ToBOC() []byte
- func (c *Cell) ToBOCWithFlags(flags ...bool) []byte
- func (c *Cell) ToBuilder() *Builder
- func (c *Cell) ToRawUnsafe() RawUnsafeCell
- func (c *Cell) UnmarshalJSON(bytes []byte) error
- func (c *Cell) UnsafeModify(levelMask LevelMask, special bool)
- func (c *Cell) Verify(key ed25519.PublicKey, signature []byte) bool
- type DictKV
- type Dictionary
- func (d *Dictionary) All() []*HashmapKVdeprecated
- func (d *Dictionary) AsCell() *Cell
- func (d *Dictionary) Copy() *Dictionary
- func (d *Dictionary) Delete(key *Cell) error
- func (d *Dictionary) DeleteIntKey(key *big.Int) error
- func (d *Dictionary) Get(key *Cell) *Celldeprecated
- func (d *Dictionary) GetByIntKey(key *big.Int) *Celldeprecated
- func (d *Dictionary) GetKeySize() uint
- func (d *Dictionary) IsEmpty() bool
- func (d *Dictionary) LoadAll() ([]DictKV, error)
- func (d *Dictionary) LoadValue(key *Cell) (*Slice, error)
- func (d *Dictionary) LoadValueByIntKey(key *big.Int) (*Slice, error)
- func (d *Dictionary) LoadValueWithProof(key *Cell, skeleton *ProofSkeleton) (*Slice, *ProofSkeleton, error)
- func (d *Dictionary) MustToCell() *Celldeprecated
- func (d *Dictionary) Set(key, value *Cell) error
- func (d *Dictionary) SetIntKey(key *big.Int, value *Cell) error
- func (d *Dictionary) Size() intdeprecated
- func (d *Dictionary) ToCell() (*Cell, error)deprecated
- type HashmapKV
- type LevelMask
- type ProofSkeleton
- type RawUnsafeCell
- type Slice
- func (c *Slice) BitsLeft() uint
- func (c *Slice) Copy() *Slice
- func (c *Slice) IsSpecial() bool
- func (c *Slice) LoadAddr() (*address.Address, error)
- func (c *Slice) LoadBigCoins() (*big.Int, error)
- func (c *Slice) LoadBigInt(sz uint) (*big.Int, error)
- func (c *Slice) LoadBigUInt(sz uint) (*big.Int, error)
- func (c *Slice) LoadBinarySnake() ([]byte, error)
- func (c *Slice) LoadBoolBit() (bool, error)
- func (c *Slice) LoadCoins() (uint64, error)
- func (c *Slice) LoadDict(keySz uint) (*Dictionary, error)
- func (c *Slice) LoadInt(sz uint) (int64, error)
- func (c *Slice) LoadMaybeRef() (*Slice, error)
- func (c *Slice) LoadRef() (*Slice, error)
- func (c *Slice) LoadRefCell() (*Cell, error)
- func (c *Slice) LoadSlice(sz uint) ([]byte, error)
- func (c *Slice) LoadStringSnake() (string, error)
- func (c *Slice) LoadUInt(sz uint) (uint64, error)
- func (c *Slice) LoadVarUInt(sz uint) (*big.Int, error)
- func (c *Slice) MustLoadAddr() *address.Address
- func (c *Slice) MustLoadBigCoins() *big.Int
- func (c *Slice) MustLoadBigUInt(sz uint) *big.Int
- func (c *Slice) MustLoadBinarySnake() []byte
- func (c *Slice) MustLoadBoolBit() bool
- func (c *Slice) MustLoadCoins() uint64
- func (c *Slice) MustLoadDict(keySz uint) *Dictionary
- func (c *Slice) MustLoadInt(sz uint) int64
- func (c *Slice) MustLoadMaybeRef() *Slice
- func (c *Slice) MustLoadRef() *Slice
- func (c *Slice) MustLoadSlice(sz uint) []byte
- func (c *Slice) MustLoadStringSnake() string
- func (c *Slice) MustLoadUInt(sz uint) uint64
- func (c *Slice) MustLoadVarUInt(sz uint) *big.Int
- func (c *Slice) MustPreloadBigUInt(sz uint) *big.Int
- func (c *Slice) MustPreloadSlice(sz uint) []byte
- func (c *Slice) MustPreloadUInt(sz uint) uint64
- func (c *Slice) MustToCell() *Cell
- func (c *Slice) PreloadBigUInt(sz uint) (*big.Int, error)
- func (c *Slice) PreloadRef() (*Slice, error)
- func (c *Slice) PreloadRefCell() (*Cell, error)
- func (c *Slice) PreloadSlice(sz uint) ([]byte, error)
- func (c *Slice) PreloadUInt(sz uint) (uint64, error)
- func (c *Slice) RefsNum() int
- func (c *Slice) RestBits() (uint, []byte, error)
- func (c *Slice) ToBuilder() *Builder
- func (c *Slice) ToCell() (*Cell, error)
- func (c *Slice) ToDict(keySz uint) (*Dictionary, error)
- type Type
Constants ¶
This section is empty.
Variables ¶
var ErrAddressTypeNotSupported = errors.New("address type is not supported")
var ErrNegative = errors.New("value should be non negative")
var ErrNoMoreRefs = errors.New("no more refs exists")
var ErrNoSuchKeyInDict = errors.New("no such key in dict")
var ErrNotEnoughData = func(has, need int) error { return fmt.Errorf("not enough data in reader, need %d, has %d", need, has) }
var ErrNotFit1023 = errors.New("cell data size should fit into 1023 bits")
var ErrRefCannotBeNil = errors.New("ref cannot be nil")
var ErrSmallSlice = errors.New("too small slice for this size")
var ErrTooBigSize = errors.New("too big size")
var ErrTooBigValue = errors.New("too big value")
var ErrTooMuchRefs = errors.New("too much refs")
Functions ¶
func CheckProof ¶
func ToBOCWithFlags ¶
ToBOCWithFlags - flags are: first - withCRC, second - withIndex, third - withCache
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) MustStoreBigInt ¶
func (*Builder) MustStoreBigUInt ¶
func (*Builder) MustStoreBigVarUInt ¶
func (*Builder) MustStoreBinarySnake ¶
func (*Builder) MustStoreBoolBit ¶
func (*Builder) MustStoreBuilder ¶
func (*Builder) MustStoreCoins ¶
func (*Builder) MustStoreDict ¶
func (b *Builder) MustStoreDict(dict *Dictionary) *Builder
func (*Builder) MustStoreMaybeRef ¶
func (*Builder) MustStoreRef ¶
func (*Builder) MustStoreStringSnake ¶
func (*Builder) StoreBinarySnake ¶
func (*Builder) StoreBoolBit ¶
func (*Builder) StoreBuilder ¶
func (*Builder) StoreCoins ¶
func (*Builder) StoreDict ¶
func (b *Builder) StoreDict(dict *Dictionary) error
func (*Builder) StoreMaybeRef ¶
func (*Builder) StoreStringSnake ¶
type Cell ¶
type Cell struct {
// contains filtered or unexported fields
}
func FromBOCMultiRoot ¶
func FromRawUnsafe ¶
func FromRawUnsafe(u RawUnsafeCell) *Cell
func (*Cell) AsDict ¶
func (c *Cell) AsDict(keySz uint) *Dictionary
func (*Cell) BeginParse ¶
func (*Cell) CreateProof ¶
func (c *Cell) CreateProof(skeleton *ProofSkeleton) (*Cell, error)
func (*Cell) Hash ¶
Hash - calculates a hash of cell recursively Once calculated, it is cached and can be reused cheap.
func (*Cell) MarshalJSON ¶
func (*Cell) MustPeekRef ¶
func (*Cell) ToBOCWithFlags ¶
func (*Cell) ToRawUnsafe ¶
func (c *Cell) ToRawUnsafe() RawUnsafeCell
func (*Cell) UnmarshalJSON ¶
func (*Cell) UnsafeModify ¶
type Dictionary ¶
type Dictionary struct {
// contains filtered or unexported fields
}
func NewDict ¶
func NewDict(keySz uint) *Dictionary
func (*Dictionary) All
deprecated
func (d *Dictionary) All() []*HashmapKV
Deprecated: use LoadAll, dict was reimplemented, so it will be parsed during this call, and it can return error now.
func (*Dictionary) AsCell ¶
func (d *Dictionary) AsCell() *Cell
func (*Dictionary) Copy ¶
func (d *Dictionary) Copy() *Dictionary
func (*Dictionary) Delete ¶
func (d *Dictionary) Delete(key *Cell) error
func (*Dictionary) DeleteIntKey ¶
func (d *Dictionary) DeleteIntKey(key *big.Int) error
func (*Dictionary) Get
deprecated
func (d *Dictionary) Get(key *Cell) *Cell
Deprecated: use LoadValue
func (*Dictionary) GetByIntKey
deprecated
func (d *Dictionary) GetByIntKey(key *big.Int) *Cell
Deprecated: use LoadValueByIntKey
func (*Dictionary) GetKeySize ¶
func (d *Dictionary) GetKeySize() uint
func (*Dictionary) IsEmpty ¶
func (d *Dictionary) IsEmpty() bool
func (*Dictionary) LoadAll ¶
func (d *Dictionary) LoadAll() ([]DictKV, error)
func (*Dictionary) LoadValue ¶
func (d *Dictionary) LoadValue(key *Cell) (*Slice, error)
LoadValue - searches key in the underline dict cell and returns its value
If key is not found ErrNoSuchKeyInDict will be returned
func (*Dictionary) LoadValueByIntKey ¶
func (d *Dictionary) LoadValueByIntKey(key *big.Int) (*Slice, error)
LoadValueByIntKey - same as LoadValue, but constructs cell key from int
func (*Dictionary) LoadValueWithProof ¶
func (d *Dictionary) LoadValueWithProof(key *Cell, skeleton *ProofSkeleton) (*Slice, *ProofSkeleton, error)
LoadValueWithProof - searches key in the underline dict cell, constructs proof path and returns leaf
If key is not found ErrNoSuchKeyInDict will be returned, and path with proof of non-existing key will be attached to skeleton (if passed)
func (*Dictionary) MustToCell
deprecated
func (d *Dictionary) MustToCell() *Cell
Deprecated: use AsCell
func (*Dictionary) Set ¶
func (d *Dictionary) Set(key, value *Cell) error
func (*Dictionary) Size
deprecated
func (d *Dictionary) Size() int
Deprecated: use IsEmpty or LoadAll and then len
func (*Dictionary) ToCell
deprecated
func (d *Dictionary) ToCell() (*Cell, error)
Deprecated: use AsCell
type ProofSkeleton ¶
type ProofSkeleton struct {
// contains filtered or unexported fields
}
func CreateProofSkeleton ¶
func CreateProofSkeleton() *ProofSkeleton
func (*ProofSkeleton) AttachAt ¶
func (s *ProofSkeleton) AttachAt(i int, sk *ProofSkeleton)
AttachAt - attach skeleton chain at specific ref slot
func (*ProofSkeleton) Copy ¶
func (s *ProofSkeleton) Copy() *ProofSkeleton
func (*ProofSkeleton) Merge ¶
func (s *ProofSkeleton) Merge(sk *ProofSkeleton)
Merge - merge 2 proof chains in a single proof tree
func (*ProofSkeleton) ProofRef ¶
func (s *ProofSkeleton) ProofRef(i int) *ProofSkeleton
ProofRef - include ref with index i to proof
func (*ProofSkeleton) SetRecursive ¶
func (s *ProofSkeleton) SetRecursive()
SetRecursive - include all underlying refs recursively in ordinary form to proof
type RawUnsafeCell ¶
type Slice ¶
type Slice struct {
// contains filtered or unexported fields
}
func (*Slice) LoadBinarySnake ¶
func (*Slice) LoadBoolBit ¶
func (*Slice) LoadMaybeRef ¶
func (*Slice) LoadRefCell ¶
func (*Slice) LoadStringSnake ¶
func (*Slice) MustLoadAddr ¶
func (*Slice) MustLoadBigCoins ¶
func (*Slice) MustLoadBinarySnake ¶
func (*Slice) MustLoadBoolBit ¶
func (*Slice) MustLoadCoins ¶
func (*Slice) MustLoadDict ¶
func (c *Slice) MustLoadDict(keySz uint) *Dictionary