-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* change dao folder * Add support for standard token
- Loading branch information
1 parent
5ec5473
commit c5a75b0
Showing
9 changed files
with
236 additions
and
14 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
99 changes: 99 additions & 0 deletions
99
...lockcore.Explorer/ClientApp/src/app/explorer/contract-token/contract-token.component.html
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<app-search></app-search> | ||
|
||
<div class="box"> | ||
<div *ngIf="transaction"> | ||
<div class="grid-hash"> | ||
<div> | ||
<span class="grid-hash-left"><i class="fas fa-hashtag"></i></span> | ||
<span class="grid-hash-middle breakable">{{transaction.contractAddress}}</span> | ||
<span class="grid-hash-right"> | ||
<div class="grid-double"> | ||
</div> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="box"> | ||
|
||
<h3><i class="fas fa-receipt"></i> Standard Token Details</h3> | ||
|
||
<app-progress class="centered" *ngIf="!transaction"></app-progress> | ||
<app-error class="centered" [error]="error"></app-error> | ||
|
||
<div class="grid-label-value" *ngIf="transaction"> | ||
|
||
|
||
|
||
<div> | ||
<span>Token name</span> | ||
<span>{{transaction.name }}</span> | ||
</div> | ||
<div> | ||
<span>Token symbol</span> | ||
<span>{{transaction.symbol}}</span> | ||
</div> | ||
<div> | ||
<span>Token total supply</span> | ||
<span>{{transaction.totalSupply | amount}}</span> | ||
</div> | ||
<div> | ||
<span>Decimals</span> | ||
<span>{{transaction.decimals}}</span> | ||
</div> | ||
<div> | ||
<span>Contract Address</span> | ||
<span><a [routerLink]="['../../contract-address', transaction.contractAddress]">{{transaction.contractAddress}}</a></span> | ||
</div> | ||
<div> | ||
<span>Created on Transaction</span> | ||
<span><a [routerLink]="['../../','contract-transaction', transaction.contractCreateTransactionId]">{{transaction.contractCreateTransactionId | slice:0:20}}</a></span> | ||
</div> | ||
|
||
<div *ngIf="transaction.error"> | ||
<span>Error</span> | ||
<span>{{transaction.error}}</span> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="box"> | ||
|
||
<div *ngIf="this.filterAddress"> | ||
<h4>Filter by address: {{this.filterAddress}}</h4> | ||
</div> | ||
|
||
<h3>Token Holders</h3> | ||
|
||
<app-progress class="centered" *ngIf="!transactions">Loading transactions...</app-progress> | ||
|
||
<div *ngIf="errorTransactions"> | ||
<span class="muted">Error: </span> <span class="negative">{{errorTransactions.title}}</span><br><br> | ||
{{errorTransactions.errors | json}} | ||
</div> | ||
|
||
<div *ngIf="transactions"> | ||
<!-- <div class="grid-list-transactions"> | ||
<span></span> | ||
<span>Transaction ID</span> | ||
<span>Height</span> | ||
<span></span> | ||
<span>Amount</span> | ||
</div> --> | ||
|
||
<div class="scrollable address-transactions-scrollable" appDetectScroll [bottomOffset]="400" [topOffset]="400"> | ||
<div class="grid-list-contract-token" *ngFor="let item of transactions"> | ||
|
||
<span class="address left">{{item.address}}</span> | ||
<span class="number">{{item.amount | amount}} {{transaction.symbol}}</span> | ||
</div> | ||
<br> | ||
<app-progress class="centered" *ngIf="loading">Loading more transactions...</app-progress> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
|
98 changes: 98 additions & 0 deletions
98
src/Blockcore.Explorer/ClientApp/src/app/explorer/contract-token/contract-token.component.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 |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { Component, HostBinding, OnInit, OnDestroy, HostListener } from '@angular/core'; | ||
import { ActivatedRoute, Route, Router } from '@angular/router'; | ||
import { ApiComponent } from 'src/app/api/api.component'; | ||
import { ApiService, HttpError } from 'src/app/services/api.service'; | ||
import { SetupService } from 'src/app/services/setup.service'; | ||
import { ScrollEvent } from 'src/app/shared/scroll.directive'; | ||
|
||
@Component({ | ||
selector: 'app-contract-token-component', | ||
templateUrl: './contract-token.component.html' | ||
}) | ||
export class ContractTokenComponent implements OnInit, OnDestroy { | ||
@HostBinding('class.content-centered-top') hostClass = true; | ||
|
||
info: any; | ||
node: any; | ||
blockchain: any; | ||
network: any; | ||
configuration: any; | ||
consensus: any; | ||
peers: any; | ||
blocks: any; | ||
transactions: any; | ||
transaction: any; | ||
|
||
contractCodeTypeLink = false; | ||
contractCodeTypeLinkPath: any; | ||
contractCodeTypeLinkParam: any; | ||
|
||
timerInfo: any; | ||
timerBlocks: any; | ||
timerTransactions: any; | ||
address: any; | ||
filterAddress: any; | ||
balance: any; | ||
detailsVisible = false; | ||
lastBlockHeight: number; | ||
subscription: any; | ||
limit = 10; | ||
loading = false; | ||
count = 0; | ||
total: any; | ||
link: string; | ||
error: any; | ||
errorTransactions: any; | ||
navPath: any; | ||
|
||
constructor( | ||
private api: ApiService, | ||
private router: Router, | ||
public setup: SetupService, | ||
private activatedRoute: ActivatedRoute) { | ||
|
||
this.activatedRoute.paramMap.subscribe(async params => { | ||
const id: any = params.get('address'); | ||
console.log('Address:', id); | ||
|
||
const idFilter: any = params.get('filterAddress'); | ||
console.log('filterAddress:', idFilter); | ||
|
||
this.transactions = null; | ||
this.address = id; | ||
this.filterAddress = idFilter; | ||
|
||
try { | ||
this.transaction = await this.api.getContractTokenTransaction(id); | ||
this.transactions = this.transaction.tokenHolders; | ||
|
||
} catch (err) { | ||
if (err.message[0] === '{') { | ||
this.error = JSON.parse(err.message); | ||
} else { | ||
this.error = err; | ||
} | ||
} | ||
}); | ||
} | ||
|
||
amount(outputs: any[]) { | ||
const filteredOutputs = outputs.filter(o => o.address === this.address); | ||
const amount = filteredOutputs.reduce((acc, item) => acc + item.balance, 0); | ||
|
||
return amount; | ||
} | ||
|
||
async ngOnInit() { | ||
|
||
} | ||
|
||
toggleDetails() { | ||
this.detailsVisible = !this.detailsVisible; | ||
} | ||
|
||
ngOnDestroy(): void { | ||
|
||
} | ||
} | ||
|
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