Allow transaction encoding for inferred type transactions.
This commit is contained in:
parent
d8a7cbe83a
commit
f02211d055
@ -206,11 +206,9 @@ function _parseLegacy(data: Uint8Array): TransactionLike {
|
||||
}
|
||||
|
||||
function _serializeLegacy(tx: Transaction, sig?: Signature): string {
|
||||
assertArgument(tx.isLegacy(), "internal check failed; !legacy", "tx", tx);
|
||||
|
||||
const fields: Array<any> = [
|
||||
formatNumber(tx.nonce, "nonce"),
|
||||
formatNumber(tx.gasPrice, "gasPrice"),
|
||||
formatNumber(tx.gasPrice || 0, "gasPrice"),
|
||||
formatNumber(tx.gasLimit, "gasLimit"),
|
||||
(tx.to || "0x"),
|
||||
formatNumber(tx.value, "value"),
|
||||
@ -312,18 +310,16 @@ function _parseEip1559(data: Uint8Array): TransactionLike {
|
||||
}
|
||||
|
||||
function _serializeEip1559(tx: Transaction, sig?: Signature): string {
|
||||
assertArgument(tx.isLondon(), "internal check failed; !london", "tx", tx);
|
||||
|
||||
const fields: Array<any> = [
|
||||
formatNumber(tx.chainId, "chainId"),
|
||||
formatNumber(tx.nonce, "nonce"),
|
||||
formatNumber(tx.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
||||
formatNumber(tx.maxFeePerGas, "maxFeePerGas"),
|
||||
formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
|
||||
formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"),
|
||||
formatNumber(tx.gasLimit, "gasLimit"),
|
||||
(tx.to || "0x"),
|
||||
formatNumber(tx.value, "value"),
|
||||
tx.data,
|
||||
formatAccessList(tx.accessList)
|
||||
formatAccessList(tx.accessList || [ ])
|
||||
];
|
||||
|
||||
if (sig) {
|
||||
@ -364,17 +360,15 @@ function _parseEip2930(data: Uint8Array): TransactionLike {
|
||||
}
|
||||
|
||||
function _serializeEip2930(tx: Transaction, sig?: Signature): string {
|
||||
assertArgument(tx.isBerlin(), "internal check failed; !berlin", "tx", tx);
|
||||
|
||||
const fields: any = [
|
||||
formatNumber(tx.chainId, "chainId"),
|
||||
formatNumber(tx.nonce, "nonce"),
|
||||
formatNumber(tx.gasPrice, "gasPrice"),
|
||||
formatNumber(tx.gasPrice || 0, "gasPrice"),
|
||||
formatNumber(tx.gasLimit, "gasLimit"),
|
||||
(tx.to || "0x"),
|
||||
formatNumber(tx.value, "value"),
|
||||
tx.data,
|
||||
formatAccessList(tx.accessList)
|
||||
formatAccessList(tx.accessList || [ ])
|
||||
];
|
||||
|
||||
if (sig) {
|
||||
@ -426,20 +420,18 @@ function _parseEip4844(data: Uint8Array): TransactionLike {
|
||||
}
|
||||
|
||||
function _serializeEip4844(tx: Transaction, sig?: Signature): string {
|
||||
assertArgument(tx.isCancun(), "internal check failed; !cancun", "tx", tx);
|
||||
|
||||
const fields: Array<any> = [
|
||||
formatNumber(tx.chainId, "chainId"),
|
||||
formatNumber(tx.nonce, "nonce"),
|
||||
formatNumber(tx.maxPriorityFeePerGas, "maxPriorityFeePerGas"),
|
||||
formatNumber(tx.maxFeePerGas, "maxFeePerGas"),
|
||||
formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
|
||||
formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"),
|
||||
formatNumber(tx.gasLimit, "gasLimit"),
|
||||
tx.to,
|
||||
(tx.to || ZeroAddress),
|
||||
formatNumber(tx.value, "value"),
|
||||
tx.data,
|
||||
(formatAccessList(tx.accessList)),
|
||||
formatNumber(tx.maxFeePerBlobGas, "maxFeePerBlobGas"),
|
||||
formatHashes(tx.blobVersionedHashes, "blobVersionedHashes")
|
||||
formatAccessList(tx.accessList || [ ]),
|
||||
formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"),
|
||||
formatHashes(tx.blobVersionedHashes || [ ], "blobVersionedHashes")
|
||||
];
|
||||
|
||||
if (sig) {
|
||||
|
Loading…
Reference in New Issue
Block a user