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(ctx context.Context) (tracetracking.SignedAPIClient, error)
- 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, ConfirmPollInterval: config.MustNewDuration(5 * time.Second), SendRetryDelay: config.MustNewDuration(3 * time.Second), MaxSendRetryAttempts: 5, TxExpiration: config.MustNewDuration(5 * time.Minute), CleanupInterval: config.MustNewDuration(60 * time.Minute), SendTimeout: config.MustNewDuration(30 * time.Second), TraceTimeout: config.MustNewDuration(60 * time.Second), EnableTraceLogging: ptr(true), }
Functions ¶
This section is empty.
Types ¶
type AccountStore ¶
type AccountStore struct {
// contains filtered or unexported fields
}
func NewAccountStore ¶
func NewAccountStore() *AccountStore
func (*AccountStore) CleanupAll ¶
func (c *AccountStore) CleanupAll(currentTimeMs uint64) (finalizedLTs []uint64, expiredLTs []uint64)
CleanupAll removes finalized and expired transactions from all TxStores. Returns the LTs of finalized and expired transactions that were removed.
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
ConfirmPollInterval *config.Duration // Interval to poll for transaction confirmations
SendRetryDelay *config.Duration // Delay between send retry attempts
MaxSendRetryAttempts uint // Max retries before giving up broadcasting
TxExpiration *config.Duration // Time after which an unconfirmed transaction is considered expired
CleanupInterval *config.Duration // Interval to clean up finalized and expired transactions
SendTimeout *config.Duration // Timeout for each SendWaitTransaction call to prevent hanging
TraceTimeout *config.Duration // Timeout for each WaitForTrace call to prevent hanging
EnableTraceLogging *bool // Whether to gather and log full transaction traces for debugging
}
Config holds configuration parameters for the Transaction Manager. NOTE: when adding new fields, please update ApplyDefaults, DefaultConfigSet, and ValidateConfig accordingly. Also check toml_test.go TestNewDecodedTOMLConfig() to ensure new fields are tested there.
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
func (*Config) ValidateConfig ¶
type FinalizedTx ¶
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
ID *string // Optional: unique ID for transaction tracking
}
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
BroadcastAt time.Time // when the tx was successfully broadcasted
FinalizedAt time.Time // when the message status is finalized
Expiration time.Time // expiration timestamp based on TTL
ReceivedMessage tracetracking.ReceivedMessage // received message
ID *string // optional: unique ID for transaction tracking
}
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 {
// contains filtered or unexported fields
}
func (*Txm) GetClient ¶
func (t *Txm) GetClient(ctx context.Context) (tracetracking.SignedAPIClient, error)
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.