tlb

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountStatusActive = "ACTIVE"
	AccountStatusUninit = "UNINIT"
	AccountStatusFrozen = "FROZEN"
)

Variables

This section is empty.

Functions

func LoadFromCell added in v0.8.0

func LoadFromCell(v any, loader *cell.LoadCell) error

LoadFromCell automatically parses cell based on struct tags ## N - means integer with N bits, if size <= 64 it loads to uint of any size, if > 64 it loads to *big.Int ^ - loads ref and calls recursively, if field type is *cell.Cell, it loads without parsing . - calls recursively to continue load from current loader (inner struct) [^]dict N - loads dictionary with key size N bits N - loads bit slice N len to []byte bool - loads 1 bit boolean maybe - reads 1 bit, and loads rest if its 1, can be used in combination with others only Some tags can be combined, for example "maybe ^dict 256", "maybe ^" Magic can be used to load first bits and check struct type, in tag can be specified magic number itself, in [#]HEX or [$]BIN format Example: _ Magic `tlb:"#deadbeef" _ Magic `tlb:"$1101"

Types

type AccountState added in v0.3.0

type AccountState struct {
	IsValid     bool
	Address     *address.Address
	StorageInfo StorageInfo

	AccountStorage
}

func (*AccountState) LoadFromCell added in v0.3.0

func (a *AccountState) LoadFromCell(loader *cell.LoadCell) error

type AccountStatus added in v0.5.0

type AccountStatus string

type AccountStorage added in v0.3.0

type AccountStorage struct {
	Status            AccountStatus
	LastTransactionLT uint64
	Balance           *Grams
}

func (*AccountStorage) LoadFromCell added in v0.3.0

func (s *AccountStorage) LoadFromCell(loader *cell.LoadCell) error

type AnyMessage added in v0.6.0

type AnyMessage interface {
	Payload() *cell.Cell
	SenderAddr() *address.Address
	DestAddr() *address.Address
}

type BinTree added in v0.8.0

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

func (*BinTree) All added in v0.8.0

func (b *BinTree) All() []*cell.HashmapKV

func (*BinTree) Get added in v0.8.0

func (b *BinTree) Get(key *cell.Cell) *cell.Cell

func (*BinTree) LoadFromCell added in v0.8.0

func (b *BinTree) LoadFromCell(loader *cell.LoadCell) error

type Block added in v0.8.0

type Block struct {
	GlobalID    int32       `tlb:"## 32"`
	BlockInfo   *cell.Cell  `tlb:"^"`
	ValueFlow   *cell.Cell  `tlb:"^"`
	StateUpdate StateUpdate `tlb:"^"`
	Extra       *BlockExtra `tlb:"^"`
	// contains filtered or unexported fields
}

type BlockExtra added in v0.8.0

type BlockExtra struct {
	InMsgDesc          *cell.Cell    `tlb:"^"`
	OutMsgDesc         *cell.Cell    `tlb:"^"`
	ShardAccountBlocks *cell.Cell    `tlb:"^"`
	RandSeed           []byte        `tlb:"bits 256"`
	CreatedBy          []byte        `tlb:"bits 256"`
	Custom             *McBlockExtra `tlb:"maybe ^"`
}

type BlockInfo

type BlockInfo struct {
	Workchain int32
	Shard     uint64
	SeqNo     uint32
	RootHash  []byte
	FileHash  []byte
}

func (*BlockInfo) Load

func (b *BlockInfo) Load(data []byte) ([]byte, error)

func (*BlockInfo) Serialize

func (b *BlockInfo) Serialize() []byte

type DepthBalanceInfo added in v0.5.0

type DepthBalanceInfo struct {
	Depth uint32
	Coins *Grams
}

func (*DepthBalanceInfo) LoadFromCell added in v0.5.0

func (d *DepthBalanceInfo) LoadFromCell(loader *cell.LoadCell) error

type ExternalMessageIn added in v0.5.0

type ExternalMessageIn struct {
	SrcAddr   *address.Address
	DstAddr   *address.Address
	ImportFee *Grams

	StateInit *StateInit
	Body      *cell.Cell
}

func (*ExternalMessageIn) DestAddr added in v0.5.0

func (m *ExternalMessageIn) DestAddr() *address.Address

func (*ExternalMessageIn) LoadFromCell added in v0.5.0

func (m *ExternalMessageIn) LoadFromCell(loader *cell.LoadCell) error

func (*ExternalMessageIn) Payload added in v0.6.0

func (m *ExternalMessageIn) Payload() *cell.Cell

func (*ExternalMessageIn) SenderAddr added in v0.6.0

func (m *ExternalMessageIn) SenderAddr() *address.Address

type ExternalMessageOut added in v0.5.0

type ExternalMessageOut struct {
	SrcAddr   *address.Address
	DstAddr   *address.Address
	CreatedLT uint64
	CreatedAt uint32

	StateInit *StateInit
	Body      *cell.Cell
}

func (*ExternalMessageOut) DestAddr added in v0.5.0

func (m *ExternalMessageOut) DestAddr() *address.Address

func (*ExternalMessageOut) LoadFromCell added in v0.5.0

func (m *ExternalMessageOut) LoadFromCell(loader *cell.LoadCell) error

func (*ExternalMessageOut) Payload added in v0.6.0

func (m *ExternalMessageOut) Payload() *cell.Cell

func (*ExternalMessageOut) SenderAddr added in v0.6.0

func (m *ExternalMessageOut) SenderAddr() *address.Address

type Grams added in v0.3.0

type Grams big.Int

func FromNanoTON added in v0.7.0

func FromNanoTON(val *big.Int) *Grams

func FromNanoTONU added in v0.7.0

func FromNanoTONU(val uint64) *Grams

func FromTON added in v0.7.0

func FromTON(val string) (*Grams, error)

func MustFromTON added in v0.7.0

func MustFromTON(val string) *Grams

func (*Grams) FromNanoTON added in v0.6.0

func (g *Grams) FromNanoTON(val *big.Int) *Grams

func (*Grams) FromTON added in v0.6.0

func (g *Grams) FromTON(val string) (*Grams, error)

func (*Grams) MarshalJSON added in v0.6.0

func (g *Grams) MarshalJSON() ([]byte, error)

func (*Grams) MustFromTON added in v0.6.0

func (g *Grams) MustFromTON(val string) *Grams

func (Grams) NanoTON added in v0.3.0

func (g Grams) NanoTON() *big.Int

func (*Grams) String added in v0.7.0

func (g *Grams) String() string

func (Grams) TON added in v0.3.0

func (g Grams) TON() string

type InternalMessage added in v0.5.0

type InternalMessage struct {
	IHRDisabled     bool
	Bounce          bool
	Bounced         bool
	SrcAddr         *address.Address
	DstAddr         *address.Address
	Amount          *Grams
	ExtraCurrencies *cell.Dictionary
	IHRFee          *Grams
	FwdFee          *Grams
	CreatedLT       uint64
	CreatedAt       uint32

	StateInit *StateInit
	Body      *cell.Cell
}

func (*InternalMessage) Comment added in v0.6.0

func (m *InternalMessage) Comment() string

func (*InternalMessage) DestAddr added in v0.6.0

func (m *InternalMessage) DestAddr() *address.Address

func (*InternalMessage) Dump added in v0.5.0

func (m *InternalMessage) Dump() string

func (*InternalMessage) LoadFromCell added in v0.5.0

func (m *InternalMessage) LoadFromCell(loader *cell.LoadCell) error

func (*InternalMessage) Payload added in v0.6.0

func (m *InternalMessage) Payload() *cell.Cell

func (*InternalMessage) SenderAddr added in v0.6.0

func (m *InternalMessage) SenderAddr() *address.Address

func (*InternalMessage) ToCell added in v0.6.0

func (m *InternalMessage) ToCell() (*cell.Cell, error)

type Magic added in v0.8.0

type Magic struct{}

type McBlockExtra added in v0.8.0

type McBlockExtra struct {
	KeyBlock    uint8            `tlb:"## 1"`
	ShardHashes *cell.Dictionary `tlb:"maybe ^dict 32"`
	ShardFees   *cell.Dictionary `tlb:"maybe ^dict 96"`
	// contains filtered or unexported fields
}

type Message added in v0.5.0

type Message struct {
	MsgType MsgType
	Msg     AnyMessage
}

func (*Message) AsExternalIn added in v0.5.0

func (m *Message) AsExternalIn() *ExternalMessageIn

func (*Message) AsExternalOut added in v0.5.0

func (m *Message) AsExternalOut() *ExternalMessageOut

func (*Message) AsInternal added in v0.5.0

func (m *Message) AsInternal() *InternalMessage

func (*Message) LoadFromCell added in v0.5.0

func (m *Message) LoadFromCell(loader *cell.LoadCell) error

type MsgType added in v0.5.0

type MsgType string
const (
	MsgTypeInternal    MsgType = "INTERNAL"
	MsgTypeExternalIn  MsgType = "EXTERNAL_IN"
	MsgTypeExternalOut MsgType = "EXTERNAL_OUT"
)

type ShardDesc added in v0.8.0

type ShardDesc struct {
	SeqNo              uint32 `tlb:"## 32"`
	RegMcSeqno         uint32 `tlb:"## 32"`
	StartLT            uint64 `tlb:"## 64"`
	EndLT              uint64 `tlb:"## 64"`
	RootHash           []byte `tlb:"bits 256"`
	FileHash           []byte `tlb:"bits 256"`
	BeforeSplit        bool   `tlb:"bool"`
	BeforeMerge        bool   `tlb:"bool"`
	WantSplit          bool   `tlb:"bool"`
	WantMerge          bool   `tlb:"bool"`
	NXCCUpdated        bool   `tlb:"bool"`
	Flags              uint8  `tlb:"## 3"`
	NextCatchainSeqNo  uint32 `tlb:"## 32"`
	NextValidatorShard uint64 `tlb:"## 64"`
	MinRefMcSeqNo      uint32 `tlb:"## 32"`
	GenUTime           uint32 `tlb:"## 32"`
	// contains filtered or unexported fields
}

type ShardIdent added in v0.8.0

type ShardIdent struct {
	PrefixBits  int8   `tlb:"## 6"`
	WorkchainID int32  `tlb:"## 32"`
	ShardPrefix uint64 `tlb:"## 64"`
}

type ShardState added in v0.8.0

type ShardState struct {
	GlobalID        int32      `tlb:"## 32"`
	ShardIdent      ShardIdent `tlb:"."`
	Seqno           uint32     `tlb:"## 32"`
	OutMsgQueueInfo *cell.Cell `tlb:"^"`
	Accounts        struct {
		ShardAccounts *cell.Dictionary `tlb:"maybe ^dict 256"`
	} `tlb:"^"`
	// contains filtered or unexported fields
}

type StateInit added in v0.5.0

type StateInit struct {
	Depth    *uint64
	TickTock *TickTock
	Data     *cell.Cell
	Code     *cell.Cell
	Lib      *cell.Dictionary
}

func (*StateInit) LoadFromCell added in v0.5.0

func (m *StateInit) LoadFromCell(loader *cell.LoadCell) error

func (*StateInit) ToCell added in v0.6.0

func (m *StateInit) ToCell() (*cell.Cell, error)

type StateUpdate added in v0.8.0

type StateUpdate struct {
	Old ShardState `tlb:"^"`
	New ShardState `tlb:"^"`
}

type StorageInfo added in v0.3.0

type StorageInfo struct {
	StorageUsed StorageUsed
	LastPaid    uint32
	DuePayment  *big.Int
}

func (*StorageInfo) LoadFromCell added in v0.3.0

func (s *StorageInfo) LoadFromCell(loader *cell.LoadCell) error

type StorageUsed added in v0.3.0

type StorageUsed struct {
	BitsUsed        uint64
	CellsUsed       uint64
	PublicCellsUsed uint64
}

func (*StorageUsed) LoadFromCell added in v0.3.0

func (s *StorageUsed) LoadFromCell(loader *cell.LoadCell) error

type TickTock added in v0.5.0

type TickTock struct {
	Tick bool
	Tock bool
}

type Transaction added in v0.5.0

type Transaction struct {
	LT         uint64
	PrevTxLT   uint64
	PrevTxHash TxHash
	In         *Message
	Out        []*Message
}

func (*Transaction) Dump added in v0.5.0

func (t *Transaction) Dump() string

func (*Transaction) LoadFromCell added in v0.5.0

func (t *Transaction) LoadFromCell(loader *cell.LoadCell) error

func (*Transaction) String added in v0.5.0

func (t *Transaction) String() string

type TransactionID added in v0.8.0

type TransactionID struct {
	LT        uint64
	Hash      []byte
	AccountID []byte
}

type TxHash added in v0.5.0

type TxHash []byte

Jump to

Keyboard shortcuts

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