1
- 'use strict'
1
+ 'use strict' ;
2
2
3
3
module . exports = web3 => {
4
- const account = '0xe1Dd30fecAb8a63105F2C035B084BfC6Ca5B1493 ' . toLowerCase ( )
4
+ const account = 'YOUR_ETH_ADDRESS ' . toLowerCase ( ) ;
5
5
6
6
return {
7
7
checkLastBlock : async ( ) => {
8
- let block = await web3 . eth . getBlock ( 'latest' )
9
- console . log ( `[*] Searching block ${ block . number } ...` )
8
+ let block = await web3 . eth . getBlock ( 'latest' ) ;
9
+ console . log ( `[*] Searching block ${ block . number } ...` ) ;
10
10
if ( block && block . transactions ) {
11
11
for ( let tx of block . transactions ) {
12
- let transaction = await web3 . eth . getTransaction ( tx )
12
+ let transaction = await web3 . eth . getTransaction ( tx ) ;
13
13
if ( account === transaction . to . toLowerCase ( ) ) {
14
- console . log ( `[+] Transaction found on block ${ lastBlockNumber } ` )
15
- console . log ( { address : transaction . from , value : web3 . utils . fromWei ( transaction . value , 'ether' ) , timestamp : new Date ( ) } )
14
+ console . log ( `[+] Transaction found on block ${ lastBlockNumber } ` ) ;
15
+ console . log ( { address : transaction . from , value : web3 . utils . fromWei ( transaction . value , 'ether' ) , timestamp : new Date ( ) } ) ;
16
16
}
17
17
}
18
18
}
@@ -21,14 +21,13 @@ module.exports = web3 => {
21
21
checkBlocks : async ( start , end ) => {
22
22
for ( let i = start ; i < end ; i ++ ) {
23
23
let block = await web3 . eth . getBlock ( i )
24
- console . log ( `[*] Searching block ${ i } ` )
24
+ console . log ( `[*] Searching block ${ i } ` ) ;
25
25
if ( block && block . transactions ) {
26
26
for ( let tx of block . transactions ) {
27
- let transaction = await web3 . eth . getTransaction ( tx )
28
- console . log ( transaction )
27
+ let transaction = await web3 . eth . getTransaction ( tx ) ;
29
28
if ( account === transaction . to . toLowerCase ( ) ) {
30
- console . log ( `[+] Transaction found on block ${ lastBlockNumber } ` )
31
- console . log ( { address : transaction . from , value : web3 . utils . fromWei ( transaction . value , 'ether' ) , timestamp : new Date ( ) } )
29
+ console . log ( `[+] Transaction found on block ${ lastBlockNumber } ` ) ;
30
+ console . log ( { address : transaction . from , value : web3 . utils . fromWei ( transaction . value , 'ether' ) , timestamp : new Date ( ) } ) ;
32
31
}
33
32
}
34
33
}
0 commit comments