Type Alias: TransactionManagerConfig
type TransactionManagerConfig = {
abis?: Record<string, Abi>;
blockTime?: bigint;
chainId: number;
finalizedTransactionPurgeTime?: number;
gas?: {
baseFeePercentageMargin?: bigint;
eip1559?: EIP1559Parameters;
maxPriorityFeePerGas?: bigint;
minPriorityFeePerGas?: bigint;
priorityFeeAnalysisBlocks?: number;
priorityFeeTargetPercentile?: number;
};
gasEstimator?: GasEstimator;
metrics?: {
active?: boolean;
metricReader?: MetricReader;
port?: number;
};
privateKey: Hex;
retryPolicyManager?: RetryPolicyManager;
rpc: {
allowDebug?: boolean;
blockInactivityTimeout?: number;
livenessCheckInterval?: number;
livenessDownDelay?: number;
livenessSuccessCount?: number;
livenessThreshold?: number;
livenessWindow?: number;
pollingInterval?: number;
retries?: number;
retryDelay?: number;
timeout?: number;
url: string;
};
traces?: {
active?: boolean;
spanExporter?: SpanExporter;
};
};
Defined in: packages/txm/lib/TransactionManager.ts:36
Properties
abis?
optional abis: Record<string, Abi>;
Defined in: packages/txm/lib/TransactionManager.ts:181
The ABIs used by the TransactionManager. This is a record of aliases to ABIs. The aliases are used to reference the ABIs in the transactions.
blockTime?
optional blockTime: bigint;
Defined in: packages/txm/lib/TransactionManager.ts:187
The expected interval (in seconds) for the creation of a new block on the blockchain. Defaults to 2 seconds.
chainId
chainId: number;
Defined in: packages/txm/lib/TransactionManager.ts:192
The chain ID of the blockchain.
finalizedTransactionPurgeTime?
optional finalizedTransactionPurgeTime: number;
Defined in: packages/txm/lib/TransactionManager.ts:199
The time (in milliseconds) after which finalized transactions are purged from the database. If finalizedTransactionPurgeTime is 0, finalized transactions are not purged from the database. Defaults to 2 minutes.
gas?
optional gas: {
baseFeePercentageMargin?: bigint;
eip1559?: EIP1559Parameters;
maxPriorityFeePerGas?: bigint;
minPriorityFeePerGas?: bigint;
priorityFeeAnalysisBlocks?: number;
priorityFeeTargetPercentile?: number;
};
Defined in: packages/txm/lib/TransactionManager.ts:124
baseFeePercentageMargin?
optional baseFeePercentageMargin: bigint;
Safety margin for transaction base fees, expressed as a percentage. For example, a 20% increase should be represented as 20n.
This is used to calculate the maximum fee per gas and safeguard from unanticipated or unpredictable gas price increases, in particular when the transaction cannot be included in the very next block.
Default
20n (20% increase)
eip1559?
optional eip1559: EIP1559Parameters;
Optional EIP-1559 parameters. If not provided, defaults to the OP stack's stock parameters.
maxPriorityFeePerGas?
optional maxPriorityFeePerGas: bigint;
Maximum allowed priority fee per gas unit (in wei). Acts as a safety cap to prevent overpaying for transaction priority. Even if the calculated priority fee based on percentile is higher, it will be capped at this value.
Default
undefined (no maximum cap)
Example
2_000_000_000n // 2 Gwei max priority fee
minPriorityFeePerGas?
optional minPriorityFeePerGas: bigint;
Minimum required priority fee per gas unit (in wei). Ensures transactions don't get stuck in the mempool due to too low priority fees. If the calculated priority fee based on percentile is lower, it will be raised to this minimum value.
Default
undefined (no minimum)
Example
500_000_000n // 0.5 Gwei minimum priority fee
priorityFeeAnalysisBlocks?
optional priorityFeeAnalysisBlocks: number;
Number of blocks to analyze when calculating the priority fee percentile. The system will look at transactions from this many blocks back to determine the appropriate priority fee level. Higher values provide more stable fee estimates but may be less responsive to recent changes.
Default
2 (analyze the last 2 blocks)
priorityFeeTargetPercentile?
optional priorityFeeTargetPercentile: number;
Target percentile for priority fee calculation (0-100). The system analyzes priority fees from transactions in the analyzed blocks and sets the fee at this percentile level. Higher percentiles mean higher priority but more expensive transactions.
Default
50 (50th percentile - median priority fee)
gasEstimator?
optional gasEstimator: GasEstimator;
Defined in: packages/txm/lib/TransactionManager.ts:206
The gas estimator to use for estimating the gas limit of a transaction. You can provide your own implementation to override the default one. Default: DefaultGasLimitEstimator
metrics?
optional metrics: {
active?: boolean;
metricReader?: MetricReader;
port?: number;
};
Defined in: packages/txm/lib/TransactionManager.ts:219
Transaction Manager metrics configuration.
active?
optional active: boolean;
Whether to enable metrics collection. Defaults to true.
metricReader?
optional metricReader: MetricReader;
Custom metric reader to use instead of the default Prometheus reader. If provided, this reader will be used and the port setting will be ignored. If not provided, a default Prometheus reader will be configured using the specified port.
port?
optional port: number;
Port number for the default Prometheus metrics endpoint. The default metric reader is a Prometheus reader that exposes metrics via this endpoint. This setting is only used when custom metricReaders are not provided. Defaults to 9090.
privateKey
privateKey: Hex;
Defined in: packages/txm/lib/TransactionManager.ts:122
The private key of the account used for signing transactions.
retryPolicyManager?
optional retryPolicyManager: RetryPolicyManager;
Defined in: packages/txm/lib/TransactionManager.ts:214
The retry policy manager to use for retrying failed transactions. You can provide your own implementation to override the default one. This is used to determine if a transaction should be retried based on the receipt of the transaction when it reverts. Default: DefaultRetryPolicyManager
rpc
rpc: {
allowDebug?: boolean;
blockInactivityTimeout?: number;
livenessCheckInterval?: number;
livenessDownDelay?: number;
livenessSuccessCount?: number;
livenessThreshold?: number;
livenessWindow?: number;
pollingInterval?: number;
retries?: number;
retryDelay?: number;
timeout?: number;
url: string;
};
Defined in: packages/txm/lib/TransactionManager.ts:40
The RPC node configuration
allowDebug?
optional allowDebug: boolean;
Enables debug methods on the RPC node. This is necessary for retrieving revert reasons for failed transactions and for increasing precision in managing transactions that fail due to out-of-gas errors Defaults to false.
blockInactivityTimeout?
optional blockInactivityTimeout: number;
The time without blocks before closing the connection to the RPC node and reconnecting. Defaults to 4000 milliseconds.
livenessCheckInterval?
optional livenessCheckInterval: number;
The interval between health check attempts for the RPC. When unhealthy, the system will send chainId requests at this interval until either the RPC recovers or the connection is terminated.
Default
2000 (2 seconds)
Unit
milliseconds
livenessDownDelay?
optional livenessDownDelay: number;
Margin of time after the RPC is marked as unhealthy before the txm starts checking if it is healthy again.
Default
5000 (5 seconds)
Unit
milliseconds
livenessSuccessCount?
optional livenessSuccessCount: number;
Number of successful consecutive chainId requests required to mark the RPC healthy again. When marked unhealthy, the system will periodically send chainId requests to check if the RPC has recovered.
Default
3
livenessThreshold?
optional livenessThreshold: number;
The minimum success rate of RPC calls required to consider the RPC healthy. Expressed as a decimal between 0 and 1. Example: 0.85 means 85% of calls must be successful.
Default
0.85
livenessWindow?
optional livenessWindow: number;
The monitoring window duration for evaluating RPC health. The success rate is calculated based on RPC calls within this time frame.
Default
10000 (10 seconds)
Unit
milliseconds
pollingInterval?
optional pollingInterval: number;
Specifies the polling interval in milliseconds. Defaults to 1/2 of the block time.
retries?
optional retries: number;
The number of retries for the RPC node. Defaults to 2.
retryDelay?
optional retryDelay: number;
The delay between retries. Defaults to 50 milliseconds.
timeout?
optional timeout: number;
The timeout for the RPC node. Defaults to 2000 milliseconds.
url
url: string;
The url of the RPC node. It can be a http or websocket url.
traces?
optional traces: {
active?: boolean;
spanExporter?: SpanExporter;
};
Defined in: packages/txm/lib/TransactionManager.ts:243
The traces configuration.
active?
optional active: boolean;
Whether to enable traces collection. Defaults to false.
spanExporter?
optional spanExporter: SpanExporter;
The span exporter to use. Defaults to a console span exporter.