Documentation
¶
Index ¶
- type BroadcasterChainConfig
- type BroadcasterFeeConfig
- type BroadcasterListenerConfig
- type BroadcasterTransactionsConfig
- type ChainClient
- type ChainReceipt
- type ConfirmerDatabaseConfig
- type ConfirmerFeeConfig
- type ConfirmerTransactionsConfig
- type ErrorClassifier
- type Finalizer
- type ForwarderManager
- type KeyStore
- type ReaperTransactionsConfig
- type ReceiptPlus
- type ResenderChainConfig
- type ResenderTransactionsConfig
- type SequenceTracker
- type StuckTxDetector
- type TransactionClient
- type TransactionManagerChainConfig
- type TransactionManagerFeeConfig
- type TransactionManagerTransactionsConfig
- type TransactionStore
- type TransmitCheckerSpec
- type TransmitCheckerType
- type Tx
- func (e *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetChecker() (TransmitCheckerSpec[ADDR], error)
- func (e *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetError() error
- func (e *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetID() string
- func (e *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetLogger(lgr logger.Logger) logger.SugaredLogger
- func (e *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetMeta() (*TxMeta[ADDR, TX_HASH], error)
- func (e *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) HasPurgeAttempt() bool
- type TxAttempt
- type TxAttemptBuilder
- type TxAttemptState
- type TxHistoryReaper
- type TxMeta
- type TxRequest
- type TxState
- type TxStore
- type TxStrategy
- type TxmClient
- type UnstartedTxQueuePruner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcasterChainConfig ¶
type BroadcasterChainConfig interface {
IsL2() bool
}
type BroadcasterFeeConfig ¶
type BroadcasterTransactionsConfig ¶
type BroadcasterTransactionsConfig interface {
MaxInFlight() uint32
}
type ChainClient ¶
type ChainClient[ CHAIN_ID chains.ID, ADDR chains.Hashable, SEQ chains.Sequence, ] interface { ConfiguredChainID() CHAIN_ID PendingSequenceAt(ctx context.Context, addr ADDR) (SEQ, error) SequenceAt(ctx context.Context, addr ADDR, blockNum *big.Int) (SEQ, error) }
ChainClient contains the interfaces for reading chain parameters (chain id, sequences, etc)
type ChainReceipt ¶
type ChainReceipt[THASH, BHASH chains.Hashable] interface { GetStatus() uint64 GetTxHash() THASH GetBlockNumber() *big.Int IsZero() bool IsUnmined() bool GetFeeUsed() uint64 GetTransactionIndex() uint GetBlockHash() BHASH GetRevertReason() *string GetEffectiveGasPrice() *big.Int GetL1Fee() *big.Int }
type ConfirmerDatabaseConfig ¶
type ConfirmerFeeConfig ¶
type ErrorClassifier ¶
Provides error classification to external components in a chain agnostic way Only exposes the error types that could be set in the transaction error field
type ForwarderManager ¶
type ForwarderManager[ADDR chains.Hashable] interface { services.Service ForwarderFor(ctx context.Context, addr ADDR) (forwarder ADDR, err error) ForwarderForOCR2Feeds(ctx context.Context, eoa, ocr2Aggregator ADDR) (forwarder ADDR, err error) // Converts payload to be forwarder-friendly ConvertPayload(dest ADDR, origPayload []byte) ([]byte, error) }
type KeyStore ¶
type KeyStore[ ADDR chains.Hashable, ] interface { CheckEnabled(ctx context.Context, address ADDR) error EnabledAddresses(ctx context.Context) ([]ADDR, error) }
KeyStore encompasses the subset of keystore used by txmgr
type ReceiptPlus ¶
type ReceiptPlus[R any] struct { ID uuid.UUID `db:"pipeline_run_id"` Receipt R `db:"receipt"` FailOnRevert bool `db:"fail_on_revert"` }
R is the raw unparsed transaction receipt
type ResenderChainConfig ¶
type ResenderChainConfig interface {
RPCDefaultBatchSize() uint32
}
type SequenceTracker ¶
type SequenceTracker[ ADDR chains.Hashable, SEQ chains.Sequence, ] interface { // Load the next sequence needed for transactions for all enabled addresses LoadNextSequences(context.Context, []ADDR) // Get the next sequence to assign to a transaction GetNextSequence(context.Context, ADDR) (SEQ, error) // Signals the existing sequence has been used so generates and stores the next sequence // Can be a no-op depending on the chain GenerateNextSequence(ADDR, SEQ) // Syncs the local sequence with the one on-chain in case the address as been used externally // Can be a no-op depending on the chain SyncSequence(context.Context, ADDR, services.StopChan) }
type StuckTxDetector ¶
type StuckTxDetector[CID chains.ID, ADDR chains.Hashable, THASH, BHASH chains.Hashable, SEQ chains.Sequence, FEE fees.Fee] interface { // Uses either a chain specific API or heuristic to determine if any unconfirmed transactions are terminally stuck. Returns only one transaction per enabled address. DetectStuckTransactions(ctx context.Context, enabledAddresses []ADDR, blockNum int64) ([]Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], error) // Loads the internal map that tracks the last block num a transaction was purged at using the DB state LoadPurgeBlockNumMap(ctx context.Context, addresses []ADDR) error // Sets the last purged block num after a transaction has been successfully purged with receipt SetPurgeBlockNum(fromAddress ADDR, blockNum int64) // Returns the error message to set in the transaction error field to mark it as terminally stuck StuckTxFatalError() string }
StuckTxDetector is used by the Confirmer to determine if any unconfirmed transactions are terminally stuck
type TransactionClient ¶
type TransactionClient[ CHAIN_ID chains.ID, ADDR chains.Hashable, TX_HASH chains.Hashable, BLOCK_HASH chains.Hashable, SEQ chains.Sequence, FEE fees.Fee, ] interface { ChainClient[CHAIN_ID, ADDR, SEQ] BatchSendTransactions( ctx context.Context, attempts []TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], bathSize int, lggr logger.SugaredLogger, ) ( txCodes []multinode.SendTxReturnCode, txErrs []error, broadcastTime time.Time, successfulTxIDs []int64, err error) SendTransactionReturnCode( ctx context.Context, tx Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], attempt TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], lggr logger.SugaredLogger, ) (multinode.SendTxReturnCode, error) SendEmptyTransaction( ctx context.Context, newTxAttempt func(ctx context.Context, seq SEQ, feeLimit uint64, fee FEE, fromAddress ADDR) (attempt TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error), seq SEQ, gasLimit uint64, fee FEE, fromAddress ADDR, ) (txhash string, err error) CallContract( ctx context.Context, attempt TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], blockNumber *big.Int, ) (rpcErr fmt.Stringer, extractErr error) }
TransactionClient contains the methods for building, simulating, broadcasting transactions
type TransactionManagerChainConfig ¶
type TransactionManagerChainConfig interface {
BroadcasterChainConfig
}
type TransactionManagerFeeConfig ¶
type TransactionManagerFeeConfig interface {
BroadcasterFeeConfig
ConfirmerFeeConfig
}
type TransactionManagerTransactionsConfig ¶
type TransactionManagerTransactionsConfig interface {
BroadcasterTransactionsConfig
ConfirmerTransactionsConfig
ResenderTransactionsConfig
ReaperTransactionsConfig
ForwardersEnabled() bool
MaxQueued() uint64
}
type TransactionStore ¶
type TransactionStore[ADDR chains.Hashable, CID chains.ID, THASH chains.Hashable, BHASH chains.Hashable, SEQ chains.Sequence, FEE fees.Fee] interface { CountUnconfirmedTransactions(ctx context.Context, fromAddress ADDR, chainID CID) (count uint32, err error) CountTransactionsByState(ctx context.Context, state TxState, chainID CID) (count uint32, err error) CountUnstartedTransactions(ctx context.Context, fromAddress ADDR, chainID CID) (count uint32, err error) CreateTransaction(ctx context.Context, txRequest TxRequest[ADDR, THASH], chainID CID) (tx Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) DeleteInProgressAttempt(ctx context.Context, attempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE]) error FindLatestSequence(ctx context.Context, fromAddress ADDR, chainID CID) (SEQ, error) // FindReorgOrIncludedTxs returns either a list of re-org'd transactions or included transactions based on the provided sequence FindReorgOrIncludedTxs(ctx context.Context, fromAddress ADDR, nonce SEQ, chainID CID) (reorgTx []*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], includedTxs []*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) FindTxsRequiringGasBump(ctx context.Context, address ADDR, blockNum, gasBumpThreshold, depth int64, chainID CID) (etxs []*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) FindTxsRequiringResubmissionDueToInsufficientFunds(ctx context.Context, address ADDR, chainID CID) (etxs []*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) FindTxAttemptsConfirmedMissingReceipt(ctx context.Context, chainID CID) (attempts []TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) FindTxAttemptsRequiringResend(ctx context.Context, olderThan time.Time, maxInFlightTransactions uint32, chainID CID, address ADDR) (attempts []TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) // Search for Tx using the idempotencyKey and chainID FindTxWithIdempotencyKey(ctx context.Context, idempotencyKey string, chainID CID) (tx *Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) // Search for Tx using the fromAddress and sequence FindTxWithSequence(ctx context.Context, fromAddress ADDR, seq SEQ) (etx *Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) FindNextUnstartedTransactionFromAddress(ctx context.Context, fromAddress ADDR, chainID CID) (*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], error) FindEarliestUnconfirmedBroadcastTime(ctx context.Context, chainID CID) (null.Time, error) FindEarliestUnconfirmedTxAttemptBlock(ctx context.Context, chainID CID) (null.Int, error) GetTxInProgress(ctx context.Context, fromAddress ADDR) (etx *Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) GetInProgressTxAttempts(ctx context.Context, address ADDR, chainID CID) (attempts []TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) GetAbandonedTransactionsByBatch(ctx context.Context, chainID CID, enabledAddrs []ADDR, offset, limit uint) (txs []*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) GetTxByID(ctx context.Context, id int64) (tx *Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) HasInProgressTransaction(ctx context.Context, account ADDR, chainID CID) (exists bool, err error) LoadTxAttempts(ctx context.Context, etx *Tx[CID, ADDR, THASH, BHASH, SEQ, FEE]) error PreloadTxes(ctx context.Context, attempts []TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE]) error SaveConfirmedAttempt(ctx context.Context, timeout time.Duration, attempt *TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], broadcastAt time.Time) error SaveInProgressAttempt(ctx context.Context, attempt *TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE]) error SaveInsufficientFundsAttempt(ctx context.Context, timeout time.Duration, attempt *TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], broadcastAt time.Time) error SaveReplacementInProgressAttempt(ctx context.Context, oldAttempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], replacementAttempt *TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE]) error SaveSentAttempt(ctx context.Context, timeout time.Duration, attempt *TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], broadcastAt time.Time) error SetBroadcastBeforeBlockNum(ctx context.Context, blockNum int64, chainID CID) error UpdateBroadcastAts(ctx context.Context, now time.Time, etxIDs []int64) error UpdateTxAttemptInProgressToBroadcast(ctx context.Context, etx *Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], attempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], NewAttemptState TxAttemptState) error // UpdateTxCallbackCompleted updates tx to mark that its callback has been signaled UpdateTxCallbackCompleted(ctx context.Context, pipelineTaskRunRid uuid.UUID, chainID CID) error // UpdateTxConfirmed updates transaction states to confirmed UpdateTxConfirmed(ctx context.Context, etxIDs []int64) error // UpdateTxFatalErrorAndDeleteAttempts updates transaction states to fatal error, deletes attempts, and clears broadcast info and sequence UpdateTxFatalErrorAndDeleteAttempts(ctx context.Context, etx *Tx[CID, ADDR, THASH, BHASH, SEQ, FEE]) error // UpdateTxFatalError updates transaction states to fatal error with error message UpdateTxFatalError(ctx context.Context, etxIDs []int64, errMsg string) error UpdateTxsForRebroadcast(ctx context.Context, etxIDs []int64, attemptIDs []int64) error UpdateTxsUnconfirmed(ctx context.Context, etxIDs []int64) error UpdateTxUnstartedToInProgress(ctx context.Context, etx *Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], attempt *TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE]) error }
TransactionStore contains the persistence layer methods needed to manage Txs and TxAttempts
type TransmitCheckerSpec ¶
type TransmitCheckerSpec[ADDR chains.Hashable] struct { // CheckerType is the type of check that should be performed. Empty indicates no check. CheckerType TransmitCheckerType `json:",omitempty"` // VRFCoordinatorAddress is the address of the VRF coordinator that should be used to perform // VRF transmit checks. This should be set iff CheckerType is TransmitCheckerTypeVRFV2. VRFCoordinatorAddress *ADDR `json:",omitempty"` // VRFRequestBlockNumber is the block number in which the provided VRF request has been made. // This should be set iff CheckerType is TransmitCheckerTypeVRFV2. VRFRequestBlockNumber *big.Int `json:",omitempty"` }
TransmitCheckerSpec defines the check that should be performed before a transaction is submitted on chain.
type TransmitCheckerType ¶
type TransmitCheckerType string
TransmitCheckerType describes the type of check that should be performed before a transaction is executed on-chain.
type Tx ¶
type Tx[ CHAIN_ID chains.ID, ADDR chains.Hashable, TX_HASH, BLOCK_HASH chains.Hashable, SEQ chains.Sequence, FEE fees.Fee, ] struct { ID int64 IdempotencyKey *string Sequence *SEQ FromAddress ADDR ToAddress ADDR EncodedPayload []byte Value big.Int // FeeLimit on the Tx is always the conceptual gas limit, which is not // necessarily the same as the on-chain encoded value (i.e. Optimism) FeeLimit uint64 Error null.String // BroadcastAt is updated every time an attempt for this tx is re-sent // In almost all cases it will be within a second or so of the actual send time. BroadcastAt *time.Time // InitialBroadcastAt is recorded once, the first ever time this tx is sent InitialBroadcastAt *time.Time CreatedAt time.Time State TxState TxAttempts []TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE] `json:"-"` // Marshalled TxMeta // Used for additional context around transactions which you want to log // at send time. Meta *sqlutil.JSON Subject uuid.NullUUID ChainID CHAIN_ID PipelineTaskRunID uuid.NullUUID MinConfirmations clnull.Uint32 // TransmitChecker defines the check that should be performed before a transaction is submitted on // chain. TransmitChecker *sqlutil.JSON // Marks tx requiring callback SignalCallback bool // Marks tx callback as signaled CallbackCompleted bool }
func (*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetChecker ¶
func (e *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetChecker() (TransmitCheckerSpec[ADDR], error)
GetChecker returns an Tx's transmit checker spec in struct form, unmarshalling it from JSON first.
func (*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetID ¶
GetID allows Tx to be used as jsonapi.MarshalIdentifier
func (*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetLogger ¶
func (e *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetLogger(lgr logger.Logger) logger.SugaredLogger
GetLogger returns a new logger with metadata fields.
func (*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetMeta ¶
func (e *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) GetMeta() (*TxMeta[ADDR, TX_HASH], error)
GetMeta returns an Tx's meta in struct form, unmarshalling it from JSON first.
func (*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) HasPurgeAttempt ¶
type TxAttempt ¶
type TxAttempt[ CHAIN_ID chains.ID, ADDR chains.Hashable, TX_HASH, BLOCK_HASH chains.Hashable, SEQ chains.Sequence, FEE fees.Fee, ] struct { ID int64 TxID int64 Tx Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE] TxFee FEE // ChainSpecificFeeLimit on the TxAttempt is always the same as the on-chain encoded value for fee limit ChainSpecificFeeLimit uint64 SignedRawTx []byte Hash TX_HASH CreatedAt time.Time BroadcastBeforeBlockNum *int64 State TxAttemptState Receipts []ChainReceipt[TX_HASH, BLOCK_HASH] `json:"-"` TxType int IsPurgeAttempt bool }
type TxAttemptBuilder ¶
type TxAttemptBuilder[CID chains.ID, HEAD chains.Head[BHASH], ADDR chains.Hashable, THASH, BHASH chains.Hashable, SEQ chains.Sequence, FEE fees.Fee] interface { // interfaces for running the underlying estimator services.Service heads.Trackable[HEAD, BHASH] // NewTxAttempt builds a transaction using the configured transaction type and fee estimator (new estimation) NewTxAttempt(ctx context.Context, tx Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], lggr logger.Logger, opts ...fees.Opt) (attempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], fee FEE, feeLimit uint64, retryable bool, err error) // NewTxAttemptWithType builds a transaction using the configured fee estimator (new estimation) + passed in tx type NewTxAttemptWithType(ctx context.Context, tx Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], lggr logger.Logger, txType int, opts ...fees.Opt) (attempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], fee FEE, feeLimit uint64, retryable bool, err error) // NewBumpTxAttempt builds a transaction using the configured fee estimator (bumping) + tx type from previous attempt // this should only be used after an initial attempt has been broadcast and the underlying gas estimator only needs to bump the fee NewBumpTxAttempt(ctx context.Context, tx Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], previousAttempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], priorAttempts []TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], lggr logger.Logger) (attempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], bumpedFee FEE, bumpedFeeLimit uint64, retryable bool, err error) // NewCustomTxAttempt builds a transaction using the passed in fee + tx type NewCustomTxAttempt(ctx context.Context, tx Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], fee FEE, gasLimit uint64, txType int, lggr logger.Logger) (attempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], retryable bool, err error) // NewEmptyTxAttempt is used in ForceRebroadcast to create a signed tx with zero value sent to the zero address NewEmptyTxAttempt(ctx context.Context, seq SEQ, feeLimit uint64, fee FEE, fromAddress ADDR) (attempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) // NewPurgeTxAttempt is used to create empty transaction attempts with higher gas than the previous attempt to purge stuck transactions NewPurgeTxAttempt(ctx context.Context, etx Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], lggr logger.Logger) (attempt TxAttempt[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) }
TxAttemptBuilder takes the base unsigned transaction + optional parameters (tx type, gas parameters) and returns a signed TxAttempt it is able to estimate fees and sign transactions
type TxAttemptState ¶
type TxAttemptState int8
const ( TxAttemptInProgress TxAttemptState = iota + 1 TxAttemptInsufficientFunds TxAttemptBroadcast )
func NewTxAttemptState ¶
func NewTxAttemptState(state string) (s TxAttemptState)
func (TxAttemptState) String ¶
func (s TxAttemptState) String() (str string)
String returns string formatted states for logging
type TxHistoryReaper ¶
type TxMeta ¶
type TxMeta[ADDR chains.Hashable, TX_HASH chains.Hashable] struct { JobID *int32 `json:"JobID,omitempty"` // Pipeline fields FailOnRevert null.Bool `json:"FailOnRevert,omitempty"` // VRF-only fields RequestID *TX_HASH `json:"RequestID,omitempty"` RequestTxHash *TX_HASH `json:"RequestTxHash,omitempty"` // Batch variants of the above RequestIDs []TX_HASH `json:"RequestIDs,omitempty"` RequestTxHashes []TX_HASH `json:"RequestTxHashes,omitempty"` // Used for the VRFv2 - max link this tx will bill // should it get bumped MaxLink *string `json:"MaxLink,omitempty"` // Used for the VRFv2 - the subscription ID of the // requester of the VRF. SubID *uint64 `json:"SubId,omitempty"` // Used for the VRFv2Plus - the uint256 subscription ID of the // requester of the VRF. GlobalSubID *string `json:"GlobalSubId,omitempty"` // Used for VRFv2Plus - max native token this tx will bill // should it get bumped MaxEth *string `json:"MaxEth,omitempty"` // Used for keepers UpkeepID *string `json:"UpkeepID,omitempty"` // Used for VRF to know if the txn is a ForceFulfilment txn ForceFulfilled *bool `json:"ForceFulfilled,omitempty"` ForceFulfillmentAttempt *uint64 `json:"ForceFulfillmentAttempt,omitempty"` // Used for Keystone Workflows WorkflowExecutionID *string `json:"WorkflowExecutionID,omitempty"` // Used only for forwarded txs, tracks the original destination address. // When this is set, it indicates tx is forwarded through To address. FwdrDestAddress *ADDR `json:"ForwarderDestAddress,omitempty"` // MessageIDs is used by CCIP for tx to executed messages correlation in logs MessageIDs []string `json:"MessageIDs,omitempty"` // SeqNumbers is used by CCIP for tx to committed sequence numbers correlation in logs SeqNumbers []uint64 `json:"SeqNumbers,omitempty"` // Dual Broadcast DualBroadcast *bool `json:"DualBroadcast,omitempty"` DualBroadcastParams *string `json:"DualBroadcastParams,omitempty"` }
TxMeta contains fields of the transaction metadata Not all fields are guaranteed to be present
type TxRequest ¶
type TxRequest[ADDR chains.Hashable, TX_HASH chains.Hashable] struct { // IdempotencyKey is a globally unique ID set by the caller, to prevent accidental creation of duplicated Txs during retries or crash recovery. // If this field is set, the TXM will first search existing Txs with this field. // If found, it will return the existing Tx, without creating a new one. TXM will not validate or ensure that existing Tx is same as the incoming TxRequest. // If not found, TXM will create a new Tx. // If IdempotencyKey is set to null, TXM will always create a new Tx. // Since IdempotencyKey has to be globally unique, consider prepending the service or component's name it is being used by // Such as {service}-{ID}. E.g vrf-12345 IdempotencyKey *string FromAddress ADDR ToAddress ADDR EncodedPayload []byte Value big.Int FeeLimit uint64 Meta *TxMeta[ADDR, TX_HASH] ForwarderAddress ADDR // Pipeline variables - if you aren't calling this from chain tx task within // the pipeline, you don't need these variables MinConfirmations clnull.Uint32 PipelineTaskRunID *uuid.UUID Strategy TxStrategy // Checker defines the check that should be run before a transaction is submitted on chain. Checker TransmitCheckerSpec[ADDR] // Mark tx requiring callback SignalCallback bool }
type TxStore ¶
type TxStore[ADDR chains.Hashable, CID chains.ID, THASH chains.Hashable, BHASH chains.Hashable, R ChainReceipt[THASH, BHASH], SEQ chains.Sequence, FEE fees.Fee] interface { UnstartedTxQueuePruner TxHistoryReaper[CID] TransactionStore[ADDR, CID, THASH, BHASH, SEQ, FEE] // Find confirmed txes beyond the minConfirmations param that require callback but have not yet been signaled FindTxesPendingCallback(ctx context.Context, latest, finalized int64, chainID CID) (receiptsPlus []ReceiptPlus[R], err error) // Update tx to mark that its callback has been signaled UpdateTxCallbackCompleted(ctx context.Context, pipelineTaskRunRid uuid.UUID, chainID CID) error SaveFetchedReceipts(ctx context.Context, r []R) error // additional methods for tx store management CheckTxQueueCapacity(ctx context.Context, fromAddress ADDR, maxQueuedTransactions uint64, chainID CID) (err error) Close() Abandon(ctx context.Context, id CID, addr ADDR) error // Find transactions by a field in the TxMeta blob and transaction states FindTxesByMetaFieldAndStates(ctx context.Context, metaField string, metaValue string, states []TxState, chainID *big.Int) (tx []*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) // Find transactions with a non-null TxMeta field that was provided by transaction states FindTxesWithMetaFieldByStates(ctx context.Context, metaField string, states []TxState, chainID *big.Int) (tx []*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) // Find transactions with a non-null TxMeta field that was provided and a receipt block number greater than or equal to the one provided FindTxesWithMetaFieldByReceiptBlockNum(ctx context.Context, metaField string, blockNum int64, chainID *big.Int) (tx []*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) // Find transactions loaded with transaction attempts and receipts by transaction IDs and states FindTxesWithAttemptsAndReceiptsByIdsAndState(ctx context.Context, ids []int64, states []TxState, chainID *big.Int) (tx []*Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) FindTxWithIdempotencyKey(ctx context.Context, idempotencyKey string, chainID CID) (tx *Tx[CID, ADDR, THASH, BHASH, SEQ, FEE], err error) FindReceiptWithIdempotencyKey(ctx context.Context, idempotencyKey string, chainID CID) (ChainReceipt[THASH, BHASH], error) }
TxStore is a superset of all the needed persistence layer methods
type TxStrategy ¶
type TxStrategy interface {
// Subject will be saved txes.subject if not null
Subject() uuid.NullUUID
// PruneQueue is called after tx insertion
// It accepts the service responsible for deleting
// unstarted txs and deletion options
PruneQueue(ctx context.Context, pruneService UnstartedTxQueuePruner) (ids []int64, err error)
}
TxStrategy controls how txes are queued and sent
type TxmClient ¶
type TxmClient[ CHAIN_ID chains.ID, ADDR chains.Hashable, TX_HASH chains.Hashable, BLOCK_HASH chains.Hashable, R ChainReceipt[TX_HASH, BLOCK_HASH], SEQ chains.Sequence, FEE fees.Fee, ] interface { ChainClient[CHAIN_ID, ADDR, SEQ] TransactionClient[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE] // receipt fetching used by confirmer BatchGetReceipts( ctx context.Context, attempts []TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], ) (txReceipt []R, txErr []error, err error) }
TxmClient is a superset of all the methods needed for the txm