@@ -39,12 +39,13 @@ export class Arc extends GraphNodeObserver {
39
39
* a mapping of contrct names to contract addresses
40
40
*/
41
41
public contractInfos : IContractInfo [ ]
42
- public contracts : { [ key : string ] : any } = { } // a cache for the contracts
43
- public contractsR : { [ key : string ] : any } = { } // a cache for teh "read-only" contracts
42
+ public contracts : { [ key : string ] : any } = { } // a cache for the contracts
43
+ public contractsR : { [ key : string ] : any } = { } // a cache for teh "read-only" contracts
44
44
45
45
// accounts observed by ethBalance
46
- public blockHeaderSubscription : Subscription | undefined = undefined
47
- public observedAccounts : { [ address : string ] : {
46
+ public blockHeaderSubscription : Subscription | undefined = undefined
47
+ public observedAccounts : {
48
+ [ address : string ] : {
48
49
observable ?: Observable < BN >
49
50
observer ?: Observer < BN >
50
51
lastBalance ?: string
@@ -125,6 +126,7 @@ export class Arc extends GraphNodeObserver {
125
126
name
126
127
version
127
128
address
129
+ alias
128
130
}
129
131
}`
130
132
// const result = await this.getObservableList(query, itemMap, apolloQueryOptions).pipe(first()).toPromise()
@@ -204,11 +206,11 @@ export class Arc extends GraphNodeObserver {
204
206
if ( ! this . observedAccounts [ owner ] ) {
205
207
this . observedAccounts [ owner ] = {
206
208
subscriptionsCount : 1
207
- }
209
+ }
208
210
}
209
211
if ( this . observedAccounts [ owner ] . observable ) {
210
- this . observedAccounts [ owner ] . subscriptionsCount += 1
211
- return this . observedAccounts [ owner ] . observable as Observable < BN >
212
+ this . observedAccounts [ owner ] . subscriptionsCount += 1
213
+ return this . observedAccounts [ owner ] . observable as Observable < BN >
212
214
}
213
215
214
216
const observable = Observable . create ( ( observer : Observer < BN > ) => {
@@ -225,7 +227,7 @@ export class Arc extends GraphNodeObserver {
225
227
226
228
// set up the blockheadersubscription if it does not exist yet
227
229
if ( ! this . blockHeaderSubscription ) {
228
- const subscribeToBlockHeaders = ( ) => {
230
+ const subscribeToBlockHeaders = ( ) => {
229
231
this . blockHeaderSubscription = this . web3Read . eth . subscribe ( 'newBlockHeaders' , async ( err : Error ) => {
230
232
Object . keys ( this . observedAccounts ) . forEach ( async ( addr ) => {
231
233
const accInfo = this . observedAccounts [ addr ]
@@ -294,10 +296,10 @@ export class Arc extends GraphNodeObserver {
294
296
295
297
public getContractInfoByName ( name : string , version : string ) {
296
298
for ( const contractInfo of this . contractInfos ) {
297
- if ( contractInfo . name === name && contractInfo . version === version ) {
298
- return contractInfo
299
- }
299
+ if ( contractInfo . name === name && contractInfo . version === version ) {
300
+ return contractInfo
300
301
}
302
+ }
301
303
if ( ! this . contractInfos ) {
302
304
throw Error ( `no contract info was found - did you call "arc.setContractInfos(...)"?` )
303
305
}
@@ -389,7 +391,7 @@ export class Arc extends GraphNodeObserver {
389
391
if ( web3 . eth . accounts [ 0 ] ) {
390
392
observer . next ( web3 . eth . accounts [ 0 ] . address )
391
393
prevAccount = web3 . eth . accounts [ 0 ] . address
392
- } else if ( web3 . eth . defaultAccount ) {
394
+ } else if ( web3 . eth . defaultAccount ) {
393
395
observer . next ( web3 . eth . defaultAccount )
394
396
prevAccount = web3 . eth . defaultAccount
395
397
}
@@ -407,7 +409,7 @@ export class Arc extends GraphNodeObserver {
407
409
}
408
410
} )
409
411
} , interval )
410
- return ( ) => clearTimeout ( timeout )
412
+ return ( ) => clearTimeout ( timeout )
411
413
} )
412
414
}
413
415
@@ -449,7 +451,7 @@ export class Arc extends GraphNodeObserver {
449
451
* @param options an Object to save. This object must have title, url and desction defined
450
452
* @return a Promise that resolves in the IPFS Hash where the file is saved
451
453
*/
452
- public async saveIPFSData ( options : { title ?: string , url ?: string , description ?: string , tags ?: string [ ] } ) :
454
+ public async saveIPFSData ( options : { title ?: string , url ?: string , description ?: string , tags ?: string [ ] } ) :
453
455
Promise < string > {
454
456
let ipfsDataToSave : object = { }
455
457
if ( options . title || options . url || options . description || options . tags !== undefined ) {
@@ -486,4 +488,5 @@ export interface IContractInfo {
486
488
version : string
487
489
address : Address
488
490
name : string
491
+ alias : string
489
492
}
0 commit comments