Documentation ¶
Index ¶
- Variables
- func TransactionHashFromString(encoded string) (uint64, ton.Bits256, error)
- func TransactionHashToString(lt uint64, hash ton.Bits256) string
- func TransactionToHashString(tx ton.Transaction) string
- type Client
- func (c *Client) GetBlockHeader(ctx context.Context, blockID ton.BlockIDExt, mode uint32) (tlb.BlockInfo, error)
- func (c *Client) GetFirstTransaction(ctx context.Context, acc ton.AccountID) (*ton.Transaction, int, error)
- func (c *Client) GetTransaction(ctx context.Context, acc ton.AccountID, lt uint64, hash ton.Bits256) (ton.Transaction, error)
- func (c *Client) GetTransactionsSince(ctx context.Context, acc ton.AccountID, oldestLT uint64, ...) ([]ton.Transaction, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
func TransactionHashFromString ¶
TransactionHashFromString parses encoded string into logicalTime and hash
func TransactionHashToString ¶
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 ¶
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 NewFromSource ¶
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.