Documentation
¶
Index ¶
- Variables
- type AccountStore
- type Config
- type FinalizedTx
- type Request
- type Tx
- type TxManager
- type TxStore
- func (s *TxStore) AddUnconfirmed(lt uint64, expirationMs uint64, tx *Tx) error
- func (s *TxStore) GetTxState(lt uint64) (tracetracking.MsgStatus, bool, tvm.ExitCode, tlb.Coins, bool)
- func (s *TxStore) GetUnconfirmed() []*UnconfirmedTx
- func (s *TxStore) InflightCount() int
- func (s *TxStore) MarkFinalized(lt uint64, success bool, exitCode tvm.ExitCode) error
- type Txm
- func (t *Txm) Close() error
- func (t *Txm) Enqueue(request Request) error
- func (t *Txm) GetClient() tracetracking.SignedAPIClient
- func (t *Txm) GetTransactionStatus(ctx context.Context, lt uint64) (commontypes.TransactionStatus, tvm.ExitCode, tlb.Coins, error)
- func (t *Txm) HealthReport() map[string]error
- func (t *Txm) InflightCount() (int, int)
- func (t *Txm) Name() string
- func (t *Txm) Ready() error
- func (t *Txm) Start(ctx context.Context) error
- type UnconfirmedTx
Constants ¶
This section is empty.
Variables ¶
var DefaultConfigSet = Config{ BroadcastChanSize: 100, ConfirmPollSecs: 5, SendRetryDelay: 3 * time.Second, MaxSendRetryAttempts: 5, TxExpirationMins: 5, StickyNodeContextEnabled: true, }
Functions ¶
This section is empty.
Types ¶
type AccountStore ¶
type AccountStore struct {
// contains filtered or unexported fields
}
func NewAccountStore ¶
func NewAccountStore() *AccountStore
func (*AccountStore) GetAllUnconfirmed ¶
func (c *AccountStore) GetAllUnconfirmed() map[string][]*UnconfirmedTx
GetAllUnconfirmed returns a map from account address to their list of unconfirmed transactions.
func (*AccountStore) GetTotalInflightCount ¶
func (c *AccountStore) GetTotalInflightCount() int
GetTotalInflightCount returns the total count of unconfirmed txs across all accounts.
func (*AccountStore) GetTxStore ¶
func (c *AccountStore) GetTxStore(accountAddress string) *TxStore
GetTxStore returns the TxStore for an account, creating it if missing.
type Config ¶
type Config struct {
BroadcastChanSize uint // Size of the broadcast queue
ConfirmPollSecs uint // Interval to poll for transaction confirmations
SendRetryDelay time.Duration // Delay between send retry attempts
MaxSendRetryAttempts uint // Max retries before giving up broadcasting
TxExpirationMins uint // Time (in minutes) after which an unconfirmed transaction is considered expired
StickyNodeContextEnabled bool // Whether to use sticky context (single node per lifecycle)
}
type FinalizedTx ¶
type FinalizedTx struct {
ReceivedMessage tracetracking.ReceivedMessage
ExitCode tvm.ExitCode
TraceSucceeded bool
}
type Request ¶
type Request struct {
Mode uint8 // Send mode for TON message
FromWallet wallet.Wallet // Source wallet address
ContractAddress address.Address // Destination contract or wallet address
Body *cell.Cell // Encoded message body (method + params)
Amount tlb.Coins // Amount in nanotons
Bounce bool // Bounce on error (TON message flag)
StateInit *cell.Cell // Optional: contract deploy init
}
type Tx ¶
type Tx struct {
Mode uint8 // send mode bitmask, controls how the TON message is processed
From address.Address // wallet used to send the message
To address.Address // destination address
Amount tlb.Coins // amount to send
Body *cell.Cell // optional body to attach
StateInit *cell.Cell // optional, for deploying new contracts
Bounceable bool // whether the destination is bounceable
CreatedAt time.Time // when the tx was first enqueued
Expiration time.Time // expiration timestamp based on TTL
ReceivedMessage tracetracking.ReceivedMessage // received message
}
type TxManager ¶
type TxManager interface {
services.Service
Enqueue(request Request) error
GetTransactionStatus(ctx context.Context, lt uint64) (commontypes.TransactionStatus, tvm.ExitCode, tlb.Coins, error)
GetClient() tracetracking.SignedAPIClient
InflightCount() (int, int)
}
type TxStore ¶
type TxStore struct {
// contains filtered or unexported fields
}
TxStore tracks broadcast & unconfirmed txs per account address per chain id
func NewTxStore ¶
func NewTxStore() *TxStore
func (*TxStore) AddUnconfirmed ¶
AddUnconfirmed adds a new unconfirmed transaction by lamport time.
func (*TxStore) GetTxState ¶
func (s *TxStore) GetTxState(lt uint64) (tracetracking.MsgStatus, bool, tvm.ExitCode, tlb.Coins, bool)
GetTxState returns the message status, whether the transaction trace succeeded, the exit code, and whether the transaction was found at all. - MsgStatus indicates the lifecycle state of the message. - isSucceeded indicates whether the transaction trace execution succeeded. - ExitCode contains the VM result code. - Coins represents the Total Action Fees associated with the transaction. - found tells whether the transaction was present in memory.
func (*TxStore) GetUnconfirmed ¶
func (s *TxStore) GetUnconfirmed() []*UnconfirmedTx
GetUnconfirmed returns all unconfirmed transactions sorted by expiration time ascending.
func (*TxStore) InflightCount ¶
type Txm ¶
type Txm struct {
Logger logger.Logger
Keystore loop.Keystore
Config Config
Client tracetracking.SignedAPIClient
BroadcastChan chan *Tx
AccountStore *AccountStore
Starter commonutils.StartStopOnce
Done sync.WaitGroup
Stop chan struct{}
}
func New ¶
func New(lgr logger.Logger, keystore loop.Keystore, client tracetracking.SignedAPIClient, config Config) *Txm
func (*Txm) GetClient ¶
func (t *Txm) GetClient() tracetracking.SignedAPIClient
func (*Txm) GetTransactionStatus ¶
func (t *Txm) GetTransactionStatus(ctx context.Context, lt uint64) (commontypes.TransactionStatus, tvm.ExitCode, tlb.Coins, error)
GetTransactionStatus translates internal TON transaction state to chainlink common statuses.