@@ -27,6 +27,7 @@ export default class Subspace {
27
27
this . options . dbFilename = options . dbFilename || 'subspace.db' ;
28
28
this . latestBlockNumber = undefined ;
29
29
this . disableDatabase = options . disableDatabase ;
30
+ this . networkId = undefined ;
30
31
31
32
this . newBlocksSubscription = null ;
32
33
this . intervalTracker = null ;
@@ -43,6 +44,10 @@ export default class Subspace {
43
44
this . eventSyncer = new EventSyncer ( this . web3 , this . events , this . _db ) ;
44
45
this . logSyncer = new LogSyncer ( this . web3 , this . events , this . _db ) ;
45
46
47
+ this . web3 . net . getId ( ) . then ( netId => {
48
+ this . networkId = netId ;
49
+ } ) ;
50
+
46
51
this . web3 . getBlock ( 'latest' ) . then ( block => {
47
52
this . latestBlockNumber = block . number ;
48
53
@@ -109,7 +114,7 @@ export default class Subspace {
109
114
110
115
// TODO: get contract abi/address instead
111
116
trackEvent ( contractInstance , eventName , filterConditionsOrCb ) {
112
- let returnSub = this . eventSyncer . track ( contractInstance , eventName , filterConditionsOrCb , this . latestBlockNumber - this . options . refreshLastNBlocks ) ;
117
+ let returnSub = this . eventSyncer . track ( contractInstance , eventName , filterConditionsOrCb , this . latestBlockNumber - this . options . refreshLastNBlocks , this . networkId ) ;
113
118
114
119
returnSub . map = ( prop ) => {
115
120
return returnSub . pipe ( map ( ( x ) => {
@@ -138,7 +143,7 @@ export default class Subspace {
138
143
}
139
144
140
145
trackLogs ( options , inputsABI ) {
141
- return this . logSyncer . track ( options , inputsABI , this . latestBlockNumber - this . options . refreshLastNBlocks ) ;
146
+ return this . logSyncer . track ( options , inputsABI , this . latestBlockNumber - this . options . refreshLastNBlocks , this . networkId ) ;
142
147
}
143
148
144
149
_initNewBlocksSubscription ( ) {
0 commit comments