tongo

package module
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 16 Imported by: 63

README

tongo


Go implementation of libraries for TON blockchain.

Library structure

  1. ADNL - low level adnl protocol implementation
  2. Lite client - interaction with TON node as lite client
  3. BOC - cells and bag-of-cells methods and primitives
  4. TL - interaction with binary data described by TL (Type Language) schemas
  5. TLB - interaction with binary data (in Cells) described by TL-B (Typed Language - Binary) schemas
  6. TVM - interaction with TVM (TON Virtual Machine)
  7. Wallet - tools to simplify the deployment and interaction with the wallet smart contract
  8. Contract - tools to simplify the interaction with the smart contracts like Jettons and NFT
  9. Examples

Dependencies

Libraries

For TVM executor you need a libraries from lib/darwin (MAC) or lib/linux

Connection to TON node

For connect to TON node you need to know public key and ip:port. In most cases you can use public config files. Download global-config.json (mainnet) or testnet-global.config.json (testnet) file from ton.org Lite client supports auto-download mainnet config from ton.org.

Package installation

go get github.com/tonkeeper/tongo

Basic types

Tongo operates with TON blockchain structures described in block.tlb and some types described in lite_api.tl. Go definitions of these types you can find in files: ton/account.go, ton/transactions.go, ton/models.go ...

Chat

You can join to our chat in telegram - https://t.me/tongo_lib

Don't be afraid if you see only russians - we welcome any english speakers too.

Documentation

Index

Constants

View Source
const (
	// DefaultRoot is the default DNS root address used by the addressParser.
	DefaultRoot = "-1:e56754f83426f69b09267bd876ac97c44821345b7e266bd956a7bfbfb98df35c"
)

Variables

View Source
var AccountIDFromTlb = ton.AccountIDFromTlb
View Source
var BlockchainInterfaceIsNil = errors.New("blockchain interface is nil")
View Source
var MustParseAccountID = ton.MustParseAccountID

Deprecated: use MustParseAddress instead.

View Source
var NewAccountId = ton.NewAccountID

Deprecated use ton.NewAccountID instead

View Source
var ParseAccountID = ton.ParseAccountID

Deprecated: use ParseAddress instead.

Functions

func CreateExternalMessage

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

func DefaultAddressParser added in v1.2.1

func DefaultAddressParser() *addressParser

DefaultAddressParser returns a default address parser that works in the mainnet. For other networks, use SetDefaultExecutor(testnetLiteapiClient). Take a look at NewAccountAddressParser to create a parser for a different network or with a different root address.

func MustParseAddress added in v1.3.0

func MustParseAddress(a string) ton.Address

func NewAccountAddressParser added in v1.2.1

func NewAccountAddressParser(resolver dnsResolver) *addressParser

func ParseAddress added in v1.2.1

func ParseAddress(a string) (ton.Address, error)

ParseAddress parses a string of different formats to a ton.Address.

func SetDefaultExecutor added in v1.3.0

func SetDefaultExecutor(executor abi.Executor)

SetDefaultExecutor sets the default executor for the default address parser. The executor is used to resolve DNS records.

Types

type AccountID

type AccountID = ton.AccountID

type Bits256 added in v1.0.1

type Bits256 = ton.Bits256

func MustParseHash

func MustParseHash(s string) Bits256

func ParseHash

func ParseHash(s string) (Bits256, error)

type BlockID added in v1.0.1

type BlockID = ton.BlockID

func MustParseBlockID added in v1.1.2

func MustParseBlockID(s string) BlockID

func ParseBlockID added in v1.1.2

func ParseBlockID(s string) (BlockID, error)

ParseBlockID tries to construct BlockID from the given string.

type BlockIDExt added in v1.0.1

type BlockIDExt = ton.BlockIDExt

func GetParents added in v1.0.1

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

func NewTonBlockId

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

func ShardIDs added in v1.0.1

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

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

func ToBlockId added in v1.0.1

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

type JettonMetadata

type JettonMetadata = tep64.Metadata // deprecated

type ShardID

type ShardID = ton.ShardID

func MustParseShardID

func MustParseShardID(m int64) ShardID

func ParseShardID

func ParseShardID(m int64) (ShardID, error)

type Transaction

type Transaction = ton.Transaction

Jump to

Keyboard shortcuts

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