basewallet

Documentation for eth_defi.basewallet Python module.

Classes

BaseWallet

Abstract base class for Ethereum wallets.

class BaseWallet

Bases: abc.ABC

Abstract base class for Ethereum wallets.

This interface defines the common contract that both HotWallet and HSM-based wallets must implement.

abstract property address: eth_typing.evm.HexAddress

Get the wallet’s Ethereum address.

abstract get_main_address()

Get the main Ethereum address for this wallet.

Return type

eth_typing.evm.HexAddress

abstract sync_nonce(web3)

Synchronize the nonce with the blockchain.

Parameters

web3 (web3.main.Web3) –

Return type

None

abstract allocate_nonce()

Get the next available nonce.

Return type

int

abstract sign_transaction_with_new_nonce(tx)

Sign a transaction with a new nonce.

Parameters

tx (dict) –

Return type

eth_defi.hotwallet.SignedTransactionWithNonce

abstract sign_bound_call_with_new_nonce(func, tx_params=None)

Sign a contract function call with a new nonce.

Parameters
  • func (web3.contract.contract.ContractFunction) –

  • tx_params (Optional[dict]) –

Return type

eth_defi.hotwallet.SignedTransactionWithNonce

abstract get_native_currency_balance(web3)

Get the wallet’s native currency balance.

Parameters

web3 (web3.main.Web3) –

Return type

decimal.Decimal

abstract static fill_in_gas_price(web3, tx)

Fill in gas price details for a transaction.

Parameters
  • web3 (web3.main.Web3) –

  • tx (dict) –

Return type

dict