Skip to content

Commit

Permalink
🐛 Fix: add rest of arb tx types
Browse files Browse the repository at this point in the history
  • Loading branch information
roninjin10 committed Oct 17, 2024
1 parent d591949 commit 5884a34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 9 additions & 0 deletions packages/blockchain/src/utils/CUSTOM_Tx_TYPES.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const customTxTypes = [
'0x7e', // Optimism deposit tx
'0x6a', // ArbitrumDepositTxType
'0x6b', // ArbitrumUnsignedTxType
'0x6c', // ArbitrumContractTxType
'0x6d', // ArbitrumRetryTxType
'0x6e', // ArbitrumSubmitRetryableTxType
'0x6f', // ArbitrumInternalTxType
]
8 changes: 3 additions & 5 deletions packages/blockchain/src/utils/getBlockFromRpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { InvalidBlockError, UnknownBlockError } from '@tevm/errors'
import { createJsonRpcFetcher } from '@tevm/jsonrpc'
import { numberToHex } from '@tevm/utils'
import { withRetry } from 'viem'
import { customTxTypes } from './CUSTOM_Tx_TYPES.js'
import { isTevmBlockTag } from './isTevmBlockTag.js'
import { warnOnce } from './warnOnce.js'

Expand All @@ -27,11 +28,8 @@ export const getBlockFromRpc = async (baseChain, { transport, blockTag = 'latest
.../** @type {any}*/ (rpcBlock),
// filter out transactions we don't support as a hack
transactions: rpcBlock.transactions?.filter((tx) => {
// we currently don't support optimism deposit tx which uses this custom code
// Optimism type is currently not in viem types
// @ts-expect-error
if (tx.type === '0x7e' || tx.type === '0x6a') {
doWarning(tx)
if (customTxTypes.includes(tx.type)) {
doWarning(/** @type {any}*/ (tx))
return false
}
return true
Expand Down

0 comments on commit 5884a34

Please sign in to comment.