Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,31 @@ const maybeDecodeSequencerBatchTransaction = (
let decoded = null
let type = null

try {
// Try to decode as RLP first. This function will throw if the transaction can't be properly
// decoded as RLP and we'll get bumped down to the next set of possible decodings.
const decodedTx = ethers.utils.parseTransaction(transaction)

return {
type: 'EIP155',
decoded: {
nonce: BigNumber.from(decodedTx.nonce).toNumber(),
gasPrice: BigNumber.from(decodedTx.gasPrice).toNumber(),
gasLimit: BigNumber.from(decodedTx.gasLimit).toNumber(),
target: toHexString(decodedTx.to), // Maybe null this out for creations?
data: toHexString(decodedTx.data),
sig: {
v: BigNumber.from(decodedTx.v).toNumber(),
r: toHexString(decodedTx.r),
s: toHexString(decodedTx.s),
},
type: 0, // EIP155 legacy holdover.
},
}
} catch (err) {
// Do nothing, fall back to legacy decode.
}

try {
const txType = transaction.slice(0, 1).readUInt8()
if (txType === TxType.EIP155) {
Expand Down