Use mining pool slug in block component
This commit is contained in:
		
							parent
							
								
									9de8f78b30
								
							
						
					
					
						commit
						8fba450033
					
				@ -4,7 +4,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<ng-template #done>
 | 
					<ng-template #done>
 | 
				
			||||||
  <ng-template [ngIf]="miner" [ngIfElse]="unknownMiner">
 | 
					  <ng-template [ngIf]="miner" [ngIfElse]="unknownMiner">
 | 
				
			||||||
    <a placement="bottom" [ngbTooltip]="title" [href]="url" target="_blank" class="badge badge-primary">{{ miner }}</a>
 | 
					    <a placement="bottom" [ngbTooltip]="title" [href]="url" [target]="target" class="badge badge-primary">{{ miner }}</a>
 | 
				
			||||||
  </ng-template>
 | 
					  </ng-template>
 | 
				
			||||||
  <ng-template #unknownMiner>
 | 
					  <ng-template #unknownMiner>
 | 
				
			||||||
    <span class="badge badge-secondary" i18n="miner.tag.unknown-miner">Unknown</span>
 | 
					    <span class="badge badge-secondary" i18n="miner.tag.unknown-miner">Unknown</span>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,8 @@
 | 
				
			|||||||
import { Component, Input, OnChanges, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
 | 
					import { Component, Input, OnChanges, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
 | 
				
			||||||
import { AssetsService } from 'src/app/services/assets.service';
 | 
					import { AssetsService } from 'src/app/services/assets.service';
 | 
				
			||||||
import { Transaction } from 'src/app/interfaces/electrs.interface';
 | 
					import { Transaction } from 'src/app/interfaces/electrs.interface';
 | 
				
			||||||
 | 
					import { StateService } from 'src/app/services/state.service';
 | 
				
			||||||
 | 
					import { RelativeUrlPipe } from 'src/app/shared/pipes/relative-url/relative-url.pipe';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
  selector: 'app-miner',
 | 
					  selector: 'app-miner',
 | 
				
			||||||
@ -13,11 +15,14 @@ export class MinerComponent implements OnChanges {
 | 
				
			|||||||
  miner = '';
 | 
					  miner = '';
 | 
				
			||||||
  title = '';
 | 
					  title = '';
 | 
				
			||||||
  url = '';
 | 
					  url = '';
 | 
				
			||||||
 | 
					  target = '_blank';
 | 
				
			||||||
  loading = true;
 | 
					  loading = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    private assetsService: AssetsService,
 | 
					    private assetsService: AssetsService,
 | 
				
			||||||
    private cd: ChangeDetectorRef,
 | 
					    private cd: ChangeDetectorRef,
 | 
				
			||||||
 | 
					    public stateService: StateService,
 | 
				
			||||||
 | 
					    private relativeUrlPipe: RelativeUrlPipe,
 | 
				
			||||||
  ) { }
 | 
					  ) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnChanges() {
 | 
					  ngOnChanges() {
 | 
				
			||||||
@ -40,7 +45,13 @@ export class MinerComponent implements OnChanges {
 | 
				
			|||||||
        if (pools.payout_addresses[vout.scriptpubkey_address]) {
 | 
					        if (pools.payout_addresses[vout.scriptpubkey_address]) {
 | 
				
			||||||
            this.miner = pools.payout_addresses[vout.scriptpubkey_address].name;
 | 
					            this.miner = pools.payout_addresses[vout.scriptpubkey_address].name;
 | 
				
			||||||
            this.title = $localize`:@@miner-identified-by-payout:Identified by payout address: '${vout.scriptpubkey_address}:PAYOUT_ADDRESS:'`;
 | 
					            this.title = $localize`:@@miner-identified-by-payout:Identified by payout address: '${vout.scriptpubkey_address}:PAYOUT_ADDRESS:'`;
 | 
				
			||||||
            this.url = pools.payout_addresses[vout.scriptpubkey_address].link;
 | 
					            const pool = pools.payout_addresses[vout.scriptpubkey_address];
 | 
				
			||||||
 | 
					            if (this.stateService.env.MINING_DASHBOARD && pools.slugs[pool.name] !== undefined) {
 | 
				
			||||||
 | 
					              this.url = this.relativeUrlPipe.transform(`/mining/pool/${pools.slugs[pool.name]}`);
 | 
				
			||||||
 | 
					              this.target = '';
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					              this.url = pool.link;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -48,9 +59,15 @@ export class MinerComponent implements OnChanges {
 | 
				
			|||||||
          if (pools.coinbase_tags.hasOwnProperty(tag)) {
 | 
					          if (pools.coinbase_tags.hasOwnProperty(tag)) {
 | 
				
			||||||
            const coinbaseAscii = this.hex2ascii(this.coinbaseTransaction.vin[0].scriptsig);
 | 
					            const coinbaseAscii = this.hex2ascii(this.coinbaseTransaction.vin[0].scriptsig);
 | 
				
			||||||
            if (coinbaseAscii.indexOf(tag) > -1) {
 | 
					            if (coinbaseAscii.indexOf(tag) > -1) {
 | 
				
			||||||
              this.miner = pools.coinbase_tags[tag].name;
 | 
					              const pool = pools.coinbase_tags[tag];
 | 
				
			||||||
 | 
					              this.miner = pool.name;
 | 
				
			||||||
              this.title = $localize`:@@miner-identified-by-coinbase:Identified by coinbase tag: '${tag}:TAG:'`;
 | 
					              this.title = $localize`:@@miner-identified-by-coinbase:Identified by coinbase tag: '${tag}:TAG:'`;
 | 
				
			||||||
              this.url = pools.coinbase_tags[tag].link;
 | 
					              if (this.stateService.env.MINING_DASHBOARD && pools.slugs[pool.name] !== undefined) {
 | 
				
			||||||
 | 
					                this.url = this.relativeUrlPipe.transform(`/mining/pool/${pools.slugs[pool.name]}`);
 | 
				
			||||||
 | 
					                this.target = '';
 | 
				
			||||||
 | 
					              } else {
 | 
				
			||||||
 | 
					                this.url = pool.link;
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
              break;
 | 
					              break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user