@steerprotocol/transaction-manager
v1.1.2
Published
This repository contains code for the Transaction Manager class. The Transaction Manager is a class that is responsible for handling the queueing, sending, and retrying of Ethereum transactions.
Downloads
66
Readme
transaction-manager
This repository contains code for the Transaction Manager class. The Transaction Manager is a class that is responsible for handling the queueing, sending, and retrying of Ethereum transactions.
Constants
The following constants are used to configure the behavior of the Transaction Manager:
- maxLiveTransactions: The maximum number of transactions that can be sent at the same time.
- maxRetries: The maximum number of times to retry a transaction if it fails.
- minGasPrice: The minimum gas price (in wei) to use for transactions.
- maxGasPrice: The maximum gas price (in wei) to use for transactions.
- wallet: The wallet object that should be used to send transactions.
- timeOutInSeconds: The amount of time, in seconds, to wait before timing out a transaction.
Usage To use the Transaction Manager, you first need to create an instance of it by passing in the necessary configuration values:
const transactionManager = new TransactionManager(
wallet,
maxLiveTransactions,
maxRetries,
minGasPrice,
maxGasPrice,
timeOutInSeconds,
);
Once you have an instance of the Transaction Manager, you can queue transactions for processing using the queueTransaction method:
const transaction: WrappedTransaction = getDummyTransaction(wallet);
const transactionManagerResponse: TransactionManagerResponse = await transactionManager.queueTransaction(
transaction,
1,
);
await transactionManagerResponse.wait();
The queueTransaction method returns an instance of the TransactionManagerResponse class, which provides methods for waiting for the transaction to be processed and checking its status.