@ethereumjs/tx / TransactionFactory
▸ Static
fromBlockBodyData(data
, txOptions?
): FeeMarketEIP1559Transaction
| LegacyTransaction
| AccessListEIP2930Transaction
| BlobEIP4844Transaction
When decoding a BlockBody, in the transactions field, a field is either: A Uint8Array (a TypedTransaction - encoded as TransactionType || rlp(TransactionPayload)) A Uint8Array[] (Legacy Transaction) This method returns the right transaction.
Name | Type | Description |
---|---|---|
data |
Uint8Array | Uint8Array [] |
A Uint8Array or Uint8Array[] |
txOptions |
TxOptions |
The transaction options |
FeeMarketEIP1559Transaction
| LegacyTransaction
| AccessListEIP2930Transaction
| BlobEIP4844Transaction
tx/src/transactionFactory.ts:87
▸ Static
fromJsonRpcProvider(provider
, txHash
, txOptions?
): Promise
<FeeMarketEIP1559Transaction
| LegacyTransaction
| AccessListEIP2930Transaction
| BlobEIP4844Transaction
>
Method to retrieve a transaction from the provider
Name | Type | Description |
---|---|---|
provider |
string | EthersProvider |
a url string for a JSON-RPC provider or an Ethers JsonRPCProvider object |
txHash |
string |
Transaction hash |
txOptions? |
TxOptions |
The transaction options |
Promise
<FeeMarketEIP1559Transaction
| LegacyTransaction
| AccessListEIP2930Transaction
| BlobEIP4844Transaction
>
the transaction specified by txHash
tx/src/transactionFactory.ts:105
▸ Static
fromRPC<T
>(txData
, txOptions?
): Promise
<Transaction
[T
]>
Method to decode data retrieved from RPC, such as eth_getTransactionByHash
Note that this normalizes some of the parameters
Name | Type |
---|---|
T |
extends TransactionType |
Name | Type | Description |
---|---|---|
txData |
TxData [T ] |
The RPC-encoded data |
txOptions |
TxOptions |
The transaction options |
Promise
<Transaction
[T
]>
tx/src/transactionFactory.ts:128
▸ Static
fromSerializedData<T
>(data
, txOptions?
): Transaction
[T
]
This method tries to decode serialized data.
Name | Type |
---|---|
T |
extends TransactionType |
Name | Type | Description |
---|---|---|
data |
Uint8Array |
The data Uint8Array |
txOptions |
TxOptions |
The transaction options |
Transaction
[T
]
tx/src/transactionFactory.ts:57
▸ Static
fromTxData<T
>(txData
, txOptions?
): Transaction
[T
]
Create a transaction from a txData
object
Name | Type |
---|---|
T |
extends TransactionType |
Name | Type | Description |
---|---|---|
txData |
TypedTxData |
The transaction data. The type field will determine which transaction type is returned (if undefined, creates a legacy transaction) |
txOptions |
TxOptions |
Options to pass on to the constructor of the transaction |
Transaction
[T
]