abstractBaseTransaction <TransactionObject>
Hierarchy
Index
Constructors
Properties
Accessors
Methods
Constructors
publicconstructor
Type parameters
- TransactionObject
Parameters
txData: FeeMarketEIP1559TxData | AccessListEIP2930TxData | TxData
opts: TxOptions
Returns BaseTransaction<TransactionObject>
Properties
publicreadonlycommon
publicreadonlydata
publicreadonlygasLimit
publicreadonlynonce
publicoptionalreadonlyr
publicoptionalreadonlys
publicoptionalreadonlyto
publicoptionalreadonlyv
publicreadonlyvalue
Accessors
publictype
Returns the transaction type.
Note: legacy txs will return tx type
0
.Returns number
Methods
publicabstracterrorStr
Return a compact error string representation of the object
Returns string
publicgetBaseFee
The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)
Returns bigint
publicgetDataFee
The amount of gas paid for the data in this tx
Returns bigint
publicabstractgetMessageToSign
Parameters
hashMessage: false
Returns Uint8Array | Uint8Array[]
publicabstractgetMessageToVerifySignature
Returns Uint8Array
publicgetSenderAddress
Returns the sender's address
Returns Address
publicabstractgetSenderPublicKey
Returns the public key of the sender
Returns Uint8Array
publicabstractgetUpfrontCost
The up front amount that an account must have for this transaction to be valid
Returns bigint
publicabstracthash
Returns Uint8Array
publicisSigned
Returns boolean
publicabstractraw
Returns a Uint8Array Array of the raw Uint8Arrays of this transaction, in order.
Use BaseTransaction.serialize to add a transaction to a block with Block.fromValuesArray.
For an unsigned tx this method uses the empty Uint8Array values for the signature parameters
v
,r
ands
for encoding. For an EIP-155 compliant representation for external signing use BaseTransaction.getMessageToSign.Returns FeeMarketEIP1559ValuesArray | AccessListEIP2930ValuesArray | TxValuesArray
publicabstractserialize
Returns the encoding of the transaction.
Returns Uint8Array
publicsign
Signs a transaction.
Note that the signed tx is returned as a new object, use as follows:
const signedTx = tx.sign(privateKey)
Parameters
privateKey: Uint8Array
Returns TransactionObject
publicsupports
Checks if a tx type defining capability is active on a tx, for example the EIP-1559 fee market mechanism or the EIP-2930 access list feature.
Note that this is different from the tx type itself, so EIP-2930 access lists can very well be active on an EIP-1559 tx for example.
This method can be useful for feature checks if the tx type is unknown (e.g. when instantiated with the tx factory).
See
Capabilites
in thetypes
module for a reference on all supported capabilities.Parameters
capability: Capability
Returns boolean
publictoCreationAddress
If the tx's
to
is to the creation addressReturns boolean
publicabstracttoJSON
Returns an object with the JSON representation of the transaction
Returns JsonTx
publicvalidate
Checks if the transaction has the minimum amount of gas required (DataFee + TxFee + Creation Fee).
Returns boolean
publicverifySignature
Determines if the signature is valid
Returns boolean
publicstaticfromSerializedTx
Parameters
serialized: Uint8Array
opts: TxOptions = {}
Returns any
publicstaticfromTxData
Parameters
txData: any
opts: TxOptions = {}
Returns any
This base class will likely be subject to further refactoring along the introduction of additional tx types on the Ethereum network.
It is therefore not recommended to use directly.