forked from bitpay/bitcore
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(insight): clean up, document
- Loading branch information
Showing
14 changed files
with
99 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,10 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { combineLatest, from, Subject } from 'rxjs'; | ||
import { map, switchMap, take, tap } from 'rxjs/operators'; | ||
import { ApiService } from '../../services/api/api.service'; | ||
import { ConfigService } from '../../services/config/config.service'; | ||
import { | ||
Direction, | ||
StreamingFindOptions, | ||
TransactionJSON | ||
} from '../../types/bitcore-node'; | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-input-page', | ||
templateUrl: 'input.page.html', | ||
styleUrls: ['input.page.scss'] | ||
}) | ||
export class InputPage implements OnInit { | ||
private _query$: Subject< | ||
StreamingFindOptions<TransactionJSON> & { | ||
blockHeight?: number; | ||
blockHash?: string; | ||
} | ||
> = new Subject(); | ||
query$ = this._query$.asObservable(); | ||
|
||
hash = this.route.params | ||
.pipe( | ||
take(1), | ||
map(param => param['hash']) | ||
) | ||
.toPromise() as Promise<string>; | ||
|
||
block$ = combineLatest(from(this.hash), this.config.currentChain$).pipe( | ||
switchMap(([hash, chain]) => this.apiService.streamBlock(chain, hash)) | ||
); | ||
|
||
constructor( | ||
public config: ConfigService, | ||
private route: ActivatedRoute, | ||
private apiService: ApiService | ||
) {} | ||
ngOnInit() { | ||
this.hash.then(hash => { | ||
this._query$.next({ | ||
blockHash: hash, | ||
limit: 20, | ||
direction: Direction.ascending, | ||
paging: 'txid' | ||
}); | ||
}); | ||
} | ||
export class InputPage { | ||
// TODO: see OutputPage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 3 additions & 46 deletions
49
packages/insight/src/app/transaction/inputs/inputs.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,10 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { combineLatest, from, Subject } from 'rxjs'; | ||
import { map, switchMap, take, tap } from 'rxjs/operators'; | ||
import { ApiService } from '../../services/api/api.service'; | ||
import { ConfigService } from '../../services/config/config.service'; | ||
import { | ||
Direction, | ||
StreamingFindOptions, | ||
TransactionJSON | ||
} from '../../types/bitcore-node'; | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-inputs-page', | ||
templateUrl: 'inputs.page.html', | ||
styleUrls: ['inputs.page.scss'] | ||
}) | ||
export class InputsPage implements OnInit { | ||
private _query$: Subject< | ||
StreamingFindOptions<TransactionJSON> & { | ||
blockHeight?: number; | ||
blockHash?: string; | ||
} | ||
> = new Subject(); | ||
query$ = this._query$.asObservable(); | ||
|
||
hash = this.route.params | ||
.pipe( | ||
take(1), | ||
map(param => param['hash']) | ||
) | ||
.toPromise() as Promise<string>; | ||
|
||
block$ = combineLatest(from(this.hash), this.config.currentChain$).pipe( | ||
switchMap(([hash, chain]) => this.apiService.streamBlock(chain, hash)) | ||
); | ||
|
||
constructor( | ||
public config: ConfigService, | ||
private route: ActivatedRoute, | ||
private apiService: ApiService | ||
) {} | ||
ngOnInit() { | ||
this.hash.then(hash => { | ||
this._query$.next({ | ||
blockHash: hash, | ||
limit: 20, | ||
direction: Direction.ascending, | ||
paging: 'txid' | ||
}); | ||
}); | ||
} | ||
export class InputsPage { | ||
// TODO: see OutputsPage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 20 additions & 33 deletions
53
packages/insight/src/app/transaction/output/output.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,40 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { combineLatest, from, Subject } from 'rxjs'; | ||
import { map, switchMap, take, tap } from 'rxjs/operators'; | ||
import { combineLatest, from, Observable, of } from 'rxjs'; | ||
import { filter, map, switchMap } from 'rxjs/operators'; | ||
import { ApiService } from '../../services/api/api.service'; | ||
import { ConfigService } from '../../services/config/config.service'; | ||
import { | ||
Direction, | ||
StreamingFindOptions, | ||
TransactionJSON | ||
} from '../../types/bitcore-node'; | ||
import { CoinJSON } from '../../types/bitcore-node'; | ||
|
||
@Component({ | ||
selector: 'app-output-page', | ||
templateUrl: 'output.page.html', | ||
styleUrls: ['output.page.scss'] | ||
}) | ||
export class OutputPage implements OnInit { | ||
private _query$: Subject< | ||
StreamingFindOptions<TransactionJSON> & { | ||
blockHeight?: number; | ||
blockHash?: string; | ||
} | ||
> = new Subject(); | ||
query$ = this._query$.asObservable(); | ||
|
||
hash = this.route.params | ||
.pipe( | ||
take(1), | ||
map(param => param['hash']) | ||
) | ||
.toPromise() as Promise<string>; | ||
|
||
block$ = combineLatest(from(this.hash), this.config.currentChain$).pipe( | ||
switchMap(([hash, chain]) => this.apiService.streamBlock(chain, hash)) | ||
); | ||
coin$: Observable<CoinJSON>; | ||
|
||
constructor( | ||
public config: ConfigService, | ||
private route: ActivatedRoute, | ||
private apiService: ApiService | ||
) {} | ||
|
||
ngOnInit() { | ||
this.hash.then(hash => { | ||
this._query$.next({ | ||
blockHash: hash, | ||
limit: 20, | ||
direction: Direction.ascending, | ||
paging: 'txid' | ||
}); | ||
}); | ||
this.coin$ = combineLatest( | ||
this.config.currentChain$, | ||
this.route.paramMap.pipe( | ||
switchMap(params => of([params.get('hash'), params.get('output')])), | ||
filter<[string, string]>( | ||
([hash, output]) => hash !== null && output !== null | ||
) | ||
) | ||
).pipe( | ||
switchMap(([chain, [hash, index]]) => | ||
this.apiService | ||
.streamTransactionCoins(chain, hash) | ||
.pipe(map(listing => listing.outputs[index])) | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters