11'use strict'
2- import { AbiCoder } from 'ethers'
2+ import { AbiCoder , Block } from 'ethers'
33import { toBytes , addHexPrefix } from '@ethereumjs/util'
44import { EventManager } from '../eventManager'
55import { compareByteCode , getinputParameters } from '../util'
@@ -159,9 +159,8 @@ export class TxListener {
159159 }
160160
161161 async _startListenOnNetwork ( ) {
162- let lastSeenBlock = this . executionContext . lastBlock ?. number - BigInt ( 1 )
162+ let lastSeenBlock = BigInt ( this . executionContext . lastBlock ?. number ) - BigInt ( 1 )
163163 let processingBlock = false
164-
165164 const processBlocks = async ( ) => {
166165 if ( ! this . _isListening ) return
167166 if ( processingBlock ) return
@@ -203,9 +202,9 @@ export class TxListener {
203202
204203 async _manageBlock ( blockNumber ) {
205204 try {
206- const result = await this . executionContext . web3 ( ) . getBlock ( blockNumber , true )
207- return await this . _newBlock ( Object . assign ( { type : 'web3' } , result ) )
208- } catch ( e ) { }
205+ const result : Block = await this . executionContext . web3 ( ) . getBlock ( blockNumber , true )
206+ return await this . _newBlock ( Object . assign ( result , { type : 'web3' } ) )
207+ } catch ( e ) { }
209208 }
210209
211210 /**
@@ -231,7 +230,7 @@ export class TxListener {
231230
232231 async _newBlock ( block ) {
233232 this . blocks . push ( block )
234- await this . _resolve ( block . transactions )
233+ await this . _resolve ( block . prefetchedTransactions || block . transactions )
235234 this . event . trigger ( 'newBlock' , [ block ] )
236235 }
237236
@@ -256,7 +255,7 @@ export class TxListener {
256255 try {
257256 if ( ! this . _isListening ) break
258257 await this . _resolveAsync ( tx )
259- } catch ( e ) { }
258+ } catch ( e ) { console . error ( e ) }
260259 }
261260 }
262261
0 commit comments