ton

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 17 Imported by: 46

Documentation

Index

Constants

View Source
const OneTON tlb.Grams = 1_000_000_000

Variables

This section is empty.

Functions

func CreateExternalMessage

func CreateExternalMessage(address AccountID, body *boc.Cell, init *tlb.StateInit, importFee tlb.Grams) (tlb.Message, error)

func DecodeConfigParams added in v1.4.0

func DecodeConfigParams(b []byte) (tlb.ConfigParams, error)

Types

type AccountID

type AccountID struct {
	Workchain int32
	Address   [32]byte
}

func AccountIDFromBase64Url

func AccountIDFromBase64Url(s string) (AccountID, error)

func AccountIDFromRaw

func AccountIDFromRaw(s string) (AccountID, error)

func AccountIDFromTlb

func AccountIDFromTlb(a tlb.MsgAddress) (*AccountID, error)

TODO: replace pointer with nullable type

func MustParseAccountID

func MustParseAccountID(s string) AccountID

func NewAccountID added in v1.3.0

func NewAccountID(id int32, addr [32]byte) *AccountID

func ParseAccountID

func ParseAccountID(s string) (AccountID, error)

func (AccountID) IsZero

func (id AccountID) IsZero() bool

func (AccountID) MarshalJSON

func (id AccountID) MarshalJSON() ([]byte, error)

func (AccountID) MarshalTL

func (id AccountID) MarshalTL() ([]byte, error)

func (AccountID) String

func (id AccountID) String() string

func (AccountID) ToHuman

func (id AccountID) ToHuman(bounce, testnet bool) string

func (*AccountID) ToMsgAddress

func (id *AccountID) ToMsgAddress() tlb.MsgAddress

func (AccountID) ToRaw

func (id AccountID) ToRaw() string

func (*AccountID) UnmarshalJSON

func (id *AccountID) UnmarshalJSON(data []byte) error

func (*AccountID) UnmarshalTL

func (id *AccountID) UnmarshalTL(r io.Reader) error

type Address

type Address struct {
	ID        AccountID
	Bounce    bool
	StateInit *tlb.StateInit
}

Address identifies an account in the TON network. Comparing to AccountID which is a low-level identifier of a smart contract, Address is a high-level abstraction containing additional information besides AccountID, which is useful for building more advanced workflows.

type Bits256

type Bits256 tlb.Bits256

func MustParseHash

func MustParseHash(s string) Bits256

func ParseHash

func ParseHash(s string) (Bits256, error)

func (Bits256) Base64

func (h Bits256) Base64() string

func (*Bits256) FromBase64

func (h *Bits256) FromBase64(s string) error

func (*Bits256) FromBase64URL

func (h *Bits256) FromBase64URL(s string) error

func (*Bits256) FromBytes

func (h *Bits256) FromBytes(b []byte) error

func (*Bits256) FromHex

func (h *Bits256) FromHex(s string) error

func (*Bits256) FromUnknownString

func (h *Bits256) FromUnknownString(s string) error

func (Bits256) Hex

func (h Bits256) Hex() string

func (Bits256) MarshalJSON

func (b Bits256) MarshalJSON() ([]byte, error)

func (*Bits256) Scan

func (h *Bits256) Scan(src interface{}) error

Scan implements Scanner for database/sql.

func (*Bits256) UnmarshalJSON

func (b *Bits256) UnmarshalJSON(buf []byte) error

func (Bits256) Value

func (h Bits256) Value() (driver.Value, error)

Value implements valuer for database/sql.

type BlockID

type BlockID struct {
	Workchain int32
	Shard     uint64
	Seqno     uint32
}

func MustParseBlockID

func MustParseBlockID(s string) BlockID

func ParseBlockID

func ParseBlockID(s string) (BlockID, error)

ParseBlockID tries to construct BlockID from the given string.

func (BlockID) String

func (id BlockID) String() string

type BlockIDExt

type BlockIDExt struct {
	BlockID
	RootHash Bits256
	FileHash Bits256
}

func GetParents

func GetParents(i tlb.BlockInfo) ([]BlockIDExt, error)

func NewTonBlockId

func NewTonBlockId(fileHash, rootHash Bits256, seqno uint32, shard uint64, workchain int32) *BlockIDExt

func ShardIDs

func ShardIDs(blk *tlb.Block) []BlockIDExt

ShardIDs returns a list of IDs of shard blocks this block refers to.

func ToBlockId

func ToBlockId(s tlb.ShardDesc, workchain int32) BlockIDExt

func (BlockIDExt) MarshalTL

func (id BlockIDExt) MarshalTL() ([]byte, error)

func (BlockIDExt) String

func (id BlockIDExt) String() string

func (*BlockIDExt) UnmarshalTL

func (id *BlockIDExt) UnmarshalTL(data []byte) error

type BlockchainConfig added in v1.4.0

type BlockchainConfig struct {
	ConfigParam0  *tlb.ConfigParam0  `json:",omitempty"`
	ConfigParam1  *tlb.ConfigParam1  `json:",omitempty"`
	ConfigParam2  *tlb.ConfigParam2  `json:",omitempty"`
	ConfigParam3  *tlb.ConfigParam3  `json:",omitempty"`
	ConfigParam4  *tlb.ConfigParam4  `json:",omitempty"`
	ConfigParam5  *tlb.ConfigParam5  `json:",omitempty"`
	ConfigParam6  *tlb.ConfigParam6  `json:",omitempty"`
	ConfigParam7  *tlb.ConfigParam7  `json:",omitempty"`
	ConfigParam8  *tlb.ConfigParam8  `json:",omitempty"`
	ConfigParam9  *tlb.ConfigParam9  `json:",omitempty"`
	ConfigParam10 *tlb.ConfigParam10 `json:",omitempty"`
	ConfigParam11 *tlb.ConfigParam11 `json:",omitempty"`
	ConfigParam12 *tlb.ConfigParam12 `json:",omitempty"`
	ConfigParam13 *tlb.ConfigParam13 `json:",omitempty"`
	ConfigParam14 *tlb.ConfigParam14 `json:",omitempty"`
	ConfigParam15 *tlb.ConfigParam15 `json:",omitempty"`
	ConfigParam16 *tlb.ConfigParam16 `json:",omitempty"`
	ConfigParam17 *tlb.ConfigParam17 `json:",omitempty"`
	ConfigParam18 *tlb.ConfigParam18 `json:",omitempty"`
	ConfigParam20 *tlb.ConfigParam20 `json:",omitempty"`
	ConfigParam21 *tlb.ConfigParam21 `json:",omitempty"`
	ConfigParam22 *tlb.ConfigParam22 `json:",omitempty"`
	ConfigParam23 *tlb.ConfigParam23 `json:",omitempty"`
	ConfigParam24 *tlb.ConfigParam24 `json:",omitempty"`
	ConfigParam25 *tlb.ConfigParam25 `json:",omitempty"`

	ConfigParam28 *tlb.ConfigParam28 `json:",omitempty"`
	ConfigParam29 *tlb.ConfigParam29 `json:",omitempty"`
	ConfigParam31 *tlb.ConfigParam31 `json:",omitempty"`
	ConfigParam32 *tlb.ConfigParam32 `json:",omitempty"`
	ConfigParam33 *tlb.ConfigParam33 `json:",omitempty"`
	ConfigParam34 *tlb.ConfigParam34 `json:",omitempty"`
	ConfigParam35 *tlb.ConfigParam35 `json:",omitempty"`
	ConfigParam36 *tlb.ConfigParam36 `json:",omitempty"`
	ConfigParam37 *tlb.ConfigParam37 `json:",omitempty"`
	ConfigParam39 *tlb.ConfigParam39 `json:",omitempty"`
	ConfigParam40 *tlb.ConfigParam40 `json:",omitempty"`
	ConfigParam43 *tlb.ConfigParam43 `json:",omitempty"`
	ConfigParam44 *tlb.ConfigParam44 `json:",omitempty"`

	ConfigParam71 *tlb.ConfigParam71 `json:",omitempty"`
	ConfigParam72 *tlb.ConfigParam72 `json:",omitempty"`
	ConfigParam73 *tlb.ConfigParam73 `json:",omitempty"`

	ConfigParam79 *tlb.ConfigParam79 `json:",omitempty"`
	ConfigParam81 *tlb.ConfigParam81 `json:",omitempty"`
	ConfigParam82 *tlb.ConfigParam82 `json:",omitempty"`

	ConfigParamNegative71  *boc.Cell `json:",omitempty"`
	ConfigParamNegative999 *boc.Cell `json:",omitempty"`
}

BlockchainConfig represents the TON blockchain configuration stored inside key blocks. This struct is a compromise between a low-level cell-based representation of the config which is tlb.ConfigParams and something more convenient, BlockchainConfig uses lots of tlb types but 1. these tlb types are easy to navigate and 2. BlockchainConfig can be easily serialized to JSON.

func ConvertBlockchainConfig added in v1.4.0

func ConvertBlockchainConfig(params tlb.ConfigParams) (*BlockchainConfig, error)

func (*BlockchainConfig) ConfigAddr added in v1.4.0

func (conf *BlockchainConfig) ConfigAddr() (AccountID, bool)

func (*BlockchainConfig) CriticalParams added in v1.4.0

func (conf *BlockchainConfig) CriticalParams() []int

func (*BlockchainConfig) DnsRootAddr added in v1.4.0

func (conf *BlockchainConfig) DnsRootAddr() (AccountID, bool)

func (*BlockchainConfig) ElectorAddr added in v1.4.0

func (conf *BlockchainConfig) ElectorAddr() (AccountID, bool)

func (*BlockchainConfig) FeeCollectorAddr added in v1.4.0

func (conf *BlockchainConfig) FeeCollectorAddr() (AccountID, bool)

func (*BlockchainConfig) MandatoryParams added in v1.4.0

func (conf *BlockchainConfig) MandatoryParams() []int

func (*BlockchainConfig) MinterAddr added in v1.4.0

func (conf *BlockchainConfig) MinterAddr() (AccountID, bool)

type ShardID

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

func MustParseShardID

func MustParseShardID(m int64) ShardID

func ParseShardID

func ParseShardID(m int64) (ShardID, error)

func (ShardID) Encode

func (s ShardID) Encode() int64

func (ShardID) MatchAccountID

func (s ShardID) MatchAccountID(a AccountID) bool

func (ShardID) MatchBlockID

func (s ShardID) MatchBlockID(block BlockID) bool

type Transaction

type Transaction struct {
	tlb.Transaction
	BlockID BlockIDExt
}

Jump to

Keyboard shortcuts

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