SignedTransactionWithNonce

Documentation for eth_defi.hotwallet.SignedTransactionWithNonce Python class.

class SignedTransactionWithNonce

Bases: NamedTuple

A better signed transaction structure.

Helper class to pass around the used nonce when signing txs from the wallet.

  • Compatible with eth_accounts.datastructures.SignedTransaction. Emulates its behavior and should be backwards compatible.

  • Retains more information about the transaction source, to allow us to diagnose broadcasting failures better

  • Add some debugging helpers

Create new instance of SignedTransactionWithNonce(rawTransaction, hash, r, s, v, nonce, address, source)

Attributes summary

address

Whas was the source address for this trasaction

hash

See SignedTransaction

nonce

What was the source nonce for this transaction

r

See SignedTransaction

rawTransaction

See SignedTransaction

raw_transaction

Get the bytes to be broadcasted to the P2P network.

s

See SignedTransaction

source

Unencoded transaction data as a dict.

v

See SignedTransaction

Methods summary

__init__()

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

rawTransaction: hexbytes.main.HexBytes

See SignedTransaction

hash: hexbytes.main.HexBytes

See SignedTransaction

r: int

See SignedTransaction

s: int

See SignedTransaction

v: int

See SignedTransaction

nonce: int

What was the source nonce for this transaction

address: str

Whas was the source address for this trasaction

source: Optional[dict]

Unencoded transaction data as a dict.

If broadcast fails, retain the source so we can debug the cause, like the original gas parameters.

property raw_transaction: hexbytes.main.HexBytes

Get the bytes to be broadcasted to the P2P network.

Legacy web3.py compatibility.

static __new__(_cls, rawTransaction, hash, r, s, v, nonce, address, source=None)

Create new instance of SignedTransactionWithNonce(rawTransaction, hash, r, s, v, nonce, address, source)

Parameters
  • rawTransaction (hexbytes.main.HexBytes) –

  • hash (hexbytes.main.HexBytes) –

  • r (int) –

  • s (int) –

  • v (int) –

  • nonce (int) –

  • address (str) –

  • source (Optional[dict]) –

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.