liteapi

package
v0.0.0-...-1329066 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func TransactionHashFromString

func TransactionHashFromString(encoded string) (uint64, ton.Bits256, error)

TransactionHashFromString parses encoded string into logicalTime and hash

func TransactionHashToString

func TransactionHashToString(lt uint64, hash ton.Bits256) string

TransactionHashToString converts logicalTime and hash to string

func TransactionToHashString

func TransactionToHashString(tx ton.Transaction) string

TransactionToHashString converts transaction's logicalTime and hash to string This string is used to store the last scanned hash (e.g. "123:0x123...")

Types

type Client

type Client struct {
	*liteapi.Client
	// contains filtered or unexported fields
}

Client extends liteapi.Client with some high-level tools Reference: https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/tonlib_api.tl

func New

func New(client *liteapi.Client) *Client

New Client constructor.

func NewFromSource

func NewFromSource(ctx context.Context, urlOrPath string) (*Client, error)

NewFromSource creates a new client from a URL or a file path.

func (*Client) GetBlockHeader

func (c *Client) GetBlockHeader(ctx context.Context, blockID ton.BlockIDExt, mode uint32) (tlb.BlockInfo, error)

GetBlockHeader returns block header by block ID. Uses LRU cache for network efficiency. I haven't found what mode means but `0` works fine.

func (*Client) GetFirstTransaction

func (c *Client) GetFirstTransaction(ctx context.Context, acc ton.AccountID) (*ton.Transaction, int, error)

GetFirstTransaction scrolls through the transactions of the given account to find the first one. Note that it might fail w/o using an archival node. Also returns the number of scrolled transactions for this account i.e. total transactions

func (*Client) GetTransaction

func (c *Client) GetTransaction(
	ctx context.Context,
	acc ton.AccountID,
	lt uint64,
	hash ton.Bits256,
) (ton.Transaction, error)

GetTransaction returns account's tx by logicalTime and hash or ErrNotFound.

func (*Client) GetTransactionsSince

func (c *Client) GetTransactionsSince(
	ctx context.Context,
	acc ton.AccountID,
	oldestLT uint64,
	oldestHash ton.Bits256,
) ([]ton.Transaction, error)

GetTransactionsSince returns all account transactions since the given logicalTime and hash (exclusive). The result is ordered from oldest to newest. Used to detect new txs to observe.

Jump to

Keyboard shortcuts

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