Skip to content

Commit

Permalink
Fix the listing of transactions on address
Browse files Browse the repository at this point in the history
  • Loading branch information
sondreb committed Feb 13, 2022
1 parent 7cb44e4 commit fb15017
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@
<span class="grid-hash-middle breakable">{{address}}</span>
<span class="grid-hash-right">
<div class="grid-double">
<!-- <div *ngIf="block.blockIndex > 1">
<a [routerLink]="['../', block.blockIndex - 1]">
<i class="fas fa-cube"></i><br>
<span class="grid-hash-block-index">{{block.blockIndex - 1}}</span>
</a>
</div>
<div class="muted">
<i class="fas fa-cube"></i><br>
<span class="grid-hash-block-index">{{block.blockIndex}}</span>
</div>
<div *ngIf="block.blockIndex !== lastBlockHeight">
<a [routerLink]="['../', block.blockIndex + 1]">
<i class="fas fa-cube"></i><br>
<span class="grid-hash-block-index">{{block.blockIndex + 1}}</span>
</a>
</div> -->
</div>
</span>
</div>
Expand All @@ -33,10 +17,6 @@

<div class="box">

<!-- <a class="link block-details-toggle" (click)="toggleDetails()"><span *ngIf="!detailsVisible">View</span><span
*ngIf="detailsVisible">Hide</span>
details</a> -->

<h3><i class="fas fa-wallet"></i>&nbsp;&nbsp;Address</h3>

<app-progress class="centered" *ngIf="!balance"></app-progress>
Expand Down Expand Up @@ -96,24 +76,13 @@ <h3>Transactions ({{total}})</h3>
</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 (onScroll)="onScroll($event)" [bottomOffset]="400" [topOffset]="400">
<div class="grid-list-transactions" *ngFor="let item of transactions">

<i *ngIf="item.entryType == 'stake'" class="fas fa-coins" title="Stake"></i>
<i *ngIf="item.entryType != 'stake'" class="fas fa-handshake" title="Transfer"></i>
<!-- <span>{{item.entryType}}</span> -->

<span class="left"><a class="nonbreakable number" [routerLink]="['../../transaction', item.transactionHash]">{{item.transactionHash}}</a></span>
<span> <a class="number" [routerLink]="['../../block', item.blockIndex]">{{item.blockIndex}}</a></span>
<!-- <span>{{item.confirmations}}</span> -->
<span class="number">{{item.value | amount}} {{setup.Chain.Symbol}}</span>
</div>
<br>
Expand All @@ -122,57 +91,3 @@ <h3>Transactions ({{total}})</h3>
</div>

</div>

<!-- <div class="box" *ngIf="address">
<h3>Transactions ({{address.transactions.length}})</h3>
<div class="grid grid-odd-line" *ngIf="address">
<div class="grid-header">
<span>Transaction ID</span>
<span></span>
<span></span>
<span></span>
</div>
<div *ngFor="let item of address.transactions">
<span><a class="nonbreakable" [routerLink]="['../../transaction', item.transactionId]">{{item.transactionId}}</a></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div> -->

<!-- <div class="grid-double" *ngIf="transaction">
<div class="grid-double-left shadow">
<h3>Inputs ({{transaction.inputs.length}})</h3>
<div class="grid-list-inputs" *ngFor="let item of transaction.inputs">
<div *ngIf="item.inputTransactionId != '0000000000000000000000000000000000000000000000000000000000000000'"><a
[routerLink]="['../../transaction', item.inputTransactionId]" title="Previous output"><i
class="fas fa-arrow-left"></i></a></div>
<div *ngIf="item.inputTransactionId == '0000000000000000000000000000000000000000000000000000000000000000'">
<i title="Coinbase" class="fas fa-hammer"></i>
</div>
<div class="left number"> {{item.inputIndex}}</div>
<div class="left" *ngIf="item.inputAddress != null"><a class="address"
[routerLink]="['address', item.inputAddress]">{{item.inputAddress}}</a></div>
<div class="left" *ngIf="item.inputAddress == null">Can't parse input address</div>
</div>
</div>
<div class="grid-double-right shadow">
<h3>Outputs ({{transaction.outputs.length}})</h3>
<div class="grid-list-outputs" *ngFor="let item of transaction.outputs">
<div class="left number"> {{item.index}}</div>
<div class="left" *ngIf="item.address != null"><a class="address" [routerLink]="['address', item.address]">{{item.address}}</a></div>
<div class="left" *ngIf="item.address == null">Can't parse output address</div>
<div>{{item.balance | amount}} <span class="hide-small">{{setup.Chain.Symbol}}</span></div>
<div *ngIf="item.spentInTransaction != null"><a [routerLink]="['../../transaction', item.spentInTransaction]" title="Spent"><i class="fas fa-arrow-right"></i></a></div>
<div *ngIf="item.spentInTransaction == null"></div>
</div>
</div>
</div> -->
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class AddressComponent implements OnInit, OnDestroy {
}

try {
await this.updateTransactions('/api/query/address/' + id + '/transactions?limit=' + this.limit);
await this.updateTransactions('/api/query/address/' + id + '/transactions?offset=&limit=' + this.limit);
} catch (err) {
if (err.message[0] === '{') {
this.errorTransactions = JSON.parse(err.message);
Expand Down Expand Up @@ -103,7 +103,7 @@ export class AddressComponent implements OnInit, OnDestroy {
const response = await this.api.request(baseUrl + url);

// When the offset is not set (0), we should reverse the order of items.
const list = await response.json();
let list = await response.json();

if (response.status !== 200) {
if (list && list.status) {
Expand All @@ -113,14 +113,15 @@ export class AddressComponent implements OnInit, OnDestroy {
}
}

// Since we are looking at the history from latest to oldest, we must reverse the data in this individual page.
list = list.reverse();

this.total = response.headers.get('Pagination-Total');
const linkHeader = response.headers.get('Link');
const links = this.api.parseLinkHeader(linkHeader);

// This will be set to undefined/null when no more next links is available.
this.link = links['previous'];


this.link = links.previous;

if (!this.transactions) {
this.transactions = [];
Expand Down

0 comments on commit fb15017

Please sign in to comment.