Documentation ¶
Index ¶
- Constants
- type Connection
- func (c *Connection) CheckTime(ctx context.Context, cutoff time.Duration) (bool, error)
- func (c *Connection) Client() ton.LiteClient
- func (c *Connection) CurrentMasterchainInfo(ctx context.Context) (*ton.BlockIDExt, error)
- func (c *Connection) DeployTonWallet(ctx context.Context, wallet *wallet.Wallet) error
- func (c *Connection) GenerateDefaultWallet(seed string, isHighload bool) (w *wallet.Wallet, shard byte, subwalletID uint32, err error)
- func (c *Connection) GenerateDepositJettonWalletForProxy(ctx context.Context, shard byte, proxyOwner, jettonMaster *address.Address, ...) (proxy *core.JettonProxy, addr *address.Address, err error)
- func (c *Connection) GenerateSubWallet(seed string, shard byte, startSubWalletID uint32) (*wallet.Wallet, uint32, error)
- func (c *Connection) GetAccount(ctx context.Context, block *ton.BlockIDExt, addr *address.Address) (*tlb.Account, error)
- func (c *Connection) GetAccountCurrentState(ctx context.Context, address *address.Address) (*big.Int, tlb.AccountStatus, error)
- func (c *Connection) GetJettonBalance(ctx context.Context, address core.Address, blockID *ton.BlockIDExt) (*big.Int, error)
- func (c *Connection) GetJettonWalletAddress(ctx context.Context, owner *address.Address, jettonMaster *address.Address) (*address.Address, error)
- func (c *Connection) GetLastJettonBalance(ctx context.Context, address *address.Address) (*big.Int, error)
- func (c *Connection) GetMasterchainInfo(ctx context.Context) (*ton.BlockIDExt, error)
- func (c *Connection) GetTransactionFromBlock(ctx context.Context, blockID *ton.BlockIDExt, txID ton.TransactionShortInfo) (*tlb.Transaction, error)
- func (c *Connection) GetTransactionIDsFromBlock(ctx context.Context, blockID *ton.BlockIDExt) ([]ton.TransactionShortInfo, error)
- func (c *Connection) ListTransactions(ctx context.Context, addr *address.Address, num uint32, lt uint64, ...) ([]*tlb.Transaction, error)
- func (c *Connection) RunGetMethod(ctx context.Context, block *ton.BlockIDExt, addr *address.Address, ...) (*ton.ExecutionResult, error)
- func (c *Connection) SendExternalMessage(ctx context.Context, msg *tlb.ExternalMessage) error
- func (c *Connection) WaitNextMasterBlock(ctx context.Context, master *ton.BlockIDExt) (*ton.BlockIDExt, error)
- func (c *Connection) WaitStatus(ctx context.Context, addr *address.Address, status tlb.AccountStatus) error
- type ShardTracker
Constants ¶
const ErrBlockNotApplied = "block is not applied"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(addr, key string) (*Connection, error)
NewConnection creates new Blockchain connection
func (*Connection) CheckTime ¶
CheckTime Checks time diff between node and local time. Due to the fact that the request to the node takes time, the local time is defined as the average between the beginning and end of the request. Returns true if time diff < cutoff.
func (*Connection) Client ¶
func (c *Connection) Client() ton.LiteClient
func (*Connection) CurrentMasterchainInfo ¶
func (c *Connection) CurrentMasterchainInfo(ctx context.Context) (*ton.BlockIDExt, error)
func (*Connection) DeployTonWallet ¶
DeployTonWallet Deploys wallet contract and wait its activation
func (*Connection) GenerateDefaultWallet ¶
func (c *Connection) GenerateDefaultWallet(seed string, isHighload bool) ( w *wallet.Wallet, shard byte, subwalletID uint32, err error, )
GenerateDefaultWallet generates HighloadV2R2 or V3R2 TON wallet with default subwallet_id and returns wallet, shard and subwalletID
func (*Connection) GenerateDepositJettonWalletForProxy ¶
func (c *Connection) GenerateDepositJettonWalletForProxy( ctx context.Context, shard byte, proxyOwner, jettonMaster *address.Address, startSubWalletID uint32, ) ( proxy *core.JettonProxy, addr *address.Address, err error, )
GenerateDepositJettonWalletForProxy Generates jetton wallet address for custom shard and proxy contract as owner with subwallet_id >= startSubWalletId
func (*Connection) GenerateSubWallet ¶
func (c *Connection) GenerateSubWallet(seed string, shard byte, startSubWalletID uint32) (*wallet.Wallet, uint32, error)
GenerateSubWallet generates subwallet for custom shard and subwallet_id >= startSubWalletId and returns wallet and new subwallet_id
func (*Connection) GetAccount ¶
func (c *Connection) GetAccount(ctx context.Context, block *ton.BlockIDExt, addr *address.Address) (*tlb.Account, error)
GetAccount The method is being redefined for more stable operation. Gets account from prev block if impossible to get it from current block. Be careful with diff calculation between blocks.
func (*Connection) GetAccountCurrentState ¶
func (c *Connection) GetAccountCurrentState(ctx context.Context, address *address.Address) (*big.Int, tlb.AccountStatus, error)
GetAccountCurrentState Returns TON balance in nanoTONs and account status
func (*Connection) GetJettonBalance ¶
func (c *Connection) GetJettonBalance(ctx context.Context, address core.Address, blockID *ton.BlockIDExt) (*big.Int, error)
GetJettonBalance Get method get_wallet_data() returns (int balance, slice owner, slice jetton, cell jetton_wallet_code) Returns jetton balance for custom block in basic units
func (*Connection) GetJettonWalletAddress ¶
func (c *Connection) GetJettonWalletAddress( ctx context.Context, owner *address.Address, jettonMaster *address.Address, ) (*address.Address, error)
GetJettonWalletAddress generates jetton wallet address from owner and jetton master addresses
func (*Connection) GetLastJettonBalance ¶
func (c *Connection) GetLastJettonBalance(ctx context.Context, address *address.Address) (*big.Int, error)
GetLastJettonBalance Returns jetton balance for last block in basic units
func (*Connection) GetMasterchainInfo ¶
func (c *Connection) GetMasterchainInfo(ctx context.Context) (*ton.BlockIDExt, error)
func (*Connection) GetTransactionFromBlock ¶
func (c *Connection) GetTransactionFromBlock(ctx context.Context, blockID *ton.BlockIDExt, txID ton.TransactionShortInfo) (*tlb.Transaction, error)
GetTransactionFromBlock Gets transaction from block
func (*Connection) GetTransactionIDsFromBlock ¶
func (c *Connection) GetTransactionIDsFromBlock(ctx context.Context, blockID *ton.BlockIDExt) ([]ton.TransactionShortInfo, error)
GetTransactionIDsFromBlock Gets all transactions IDs from custom block
func (*Connection) ListTransactions ¶
func (*Connection) RunGetMethod ¶
func (c *Connection) RunGetMethod(ctx context.Context, block *ton.BlockIDExt, addr *address.Address, method string, params ...any) (*ton.ExecutionResult, error)
RunGetMethod The method is being redefined for more stable operation Wait until BlockIsApplied. Use context with timeout.
func (*Connection) SendExternalMessage ¶
func (c *Connection) SendExternalMessage(ctx context.Context, msg *tlb.ExternalMessage) error
func (*Connection) WaitNextMasterBlock ¶
func (c *Connection) WaitNextMasterBlock(ctx context.Context, master *ton.BlockIDExt) (*ton.BlockIDExt, error)
func (*Connection) WaitStatus ¶
func (c *Connection) WaitStatus(ctx context.Context, addr *address.Address, status tlb.AccountStatus) error
WaitStatus Waits custom status for account. Returns error if context timeout is exceeded. Context must be with timeout to avoid blocking!
type ShardTracker ¶
type ShardTracker struct {
// contains filtered or unexported fields
}
func NewShardTracker ¶
func NewShardTracker(shard byte, startBlock *ton.BlockIDExt, connection *Connection) *ShardTracker
NewShardTracker creates new tracker to get blocks with specific shard attribute
func (*ShardTracker) NextBlock ¶
func (s *ShardTracker) NextBlock() (core.ShardBlockHeader, bool, error)
NextBlock returns next block header and graceful shutdown flag. (ShardBlockHeader, false) for normal operation and (empty block header, true) for graceful shutdown.