HotWalletTransactionBuilder#
tradeexecutor.ethereum.tx.HotWalletTransactionBuilder Python class in Trading Strategy framework.
- class HotWalletTransactionBuilder[source]#
Bases:
TransactionBuilder
Create transactions from the hot wallet and store them in the state.
Creates trackable transactions. TransactionHelper is initialised at the start of the each cycle.
Transaction builder can prepare multiple transactions in one batch. For all tranactions, we use the previously prepared gas price information.
Methods
__init__
(web3, hot_wallet)broadcast
(tx)Broadcast the transaction.
broadcast_and_wait_transactions_to_complete
(...)Watch multiple transactions executed at parallel.
decode_signed_bytes
(tx)Get raw transaction data out from the signed tx bytes.
fetch_gas_price_suggestion
()Calculate the suggested gas price based on a policy.
Get the address that holds ERC-20 supply
Get the address that holds native token for gas fees
Get the balance of the native currency (ETH, BNB, MATIC) of the wallet.
Get the target address for ERC-20 approve()
init
()Initialise the transaction builder.
serialise_to_broadcast_format
(tx)Prepare a transaction as a format ready to broadcast.
sign_transaction
(contract, args_bound_func)Sign a transaction with the hot wallet private key.
- get_gas_wallet_balance()[source]#
Get the balance of the native currency (ETH, BNB, MATIC) of the wallet.
Useful to check if you have enough cryptocurrency for the gas fees.
- Return type:
- sign_transaction(contract, args_bound_func, gas_limit=None, gas_price_suggestion=None, asset_deltas=None)[source]#
Sign a transaction with the hot wallet private key.
- Parameters:
contract (Contract) –
args_bound_func (ContractFunction) –
gas_price_suggestion (Optional[GasPriceSuggestion]) –
asset_deltas (Optional[List[AssetDelta]]) –
- Return type: