Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release v1.0.0-beta.5 #149

Merged
merged 52 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2604a83
feat: copy from create validator
YasunoriMATSUOKA Apr 18, 2022
67c9d71
Merge branch 'develop' of github.com:UnUniFi/web-apps into feature/cr…
YasunoriMATSUOKA Apr 19, 2022
46a9029
Merge branch 'develop' of github.com:UnUniFi/web-apps into feature/cr…
YasunoriMATSUOKA Apr 19, 2022
51d5dbf
feat: copy from create validator, disable form, add file input and fi…
YasunoriMATSUOKA Apr 19, 2022
c66c9ae
Merge branch 'develop' of github.com:UnUniFi/web-apps into feature/cr…
YasunoriMATSUOKA Apr 19, 2022
77dea51
fix: create validator simple page implementation
YasunoriMATSUOKA Apr 27, 2022
69291f0
Merge branch 'develop' of github.com:UnUniFi/web-apps into feature/cr…
YasunoriMATSUOKA Apr 27, 2022
ce28603
Merge branch 'develop' of github.com:UnUniFi/web-apps into feature/cr…
YasunoriMATSUOKA Apr 27, 2022
a824fdb
Merge branch 'develop' of github.com:UnUniFi/web-apps into feature/cr…
YasunoriMATSUOKA Apr 27, 2022
b207996
fix: gas ratio
YasunoriMATSUOKA Apr 27, 2022
f973d30
chore: uncomment debug code before delete
YasunoriMATSUOKA Apr 28, 2022
1a039fd
chore: delete debug code
YasunoriMATSUOKA Apr 28, 2022
490574c
Merge pull request #87 from UnUniFi/feature/create-validator-simple
YasunoriMATSUOKA Apr 28, 2022
339d7ed
fix: app title from telescope to ununifi explorer
YasunoriMATSUOKA May 4, 2022
02ef2de
fix: portal home validator link
YasunoriMATSUOKA May 4, 2022
dbf8b0b
fix: explorer dashboard inflation margin bottom
YasunoriMATSUOKA May 4, 2022
82eab04
fix: title from telescope to ununifi explorer
YasunoriMATSUOKA May 4, 2022
3a1209f
feat: landing-page
May 6, 2022
5e87e9d
feat: fix redirect-url
May 6, 2022
1c99709
fix: portal create validator simple page title
YasunoriMATSUOKA May 6, 2022
eca7042
feat: add pagination to txs card in account page
May 6, 2022
cf10856
Merge pull request #134 from UnUniFi/feature/hotfix-wrong-chain-id
YasunoriMATSUOKA May 6, 2022
13aa4dc
Merge pull request #130 from UnUniFi/feature/Landing-page
YasunoriMATSUOKA May 6, 2022
d0c311a
Merge pull request #131 from UnUniFi/feature/searchbar-redirect-url
YasunoriMATSUOKA May 6, 2022
7d0840f
fix: disable bank send navigation
YasunoriMATSUOKA May 6, 2022
9f18c8c
feat: import wallet with private key
YasunoriMATSUOKA May 7, 2022
e6de288
Merge pull request #140 from UnUniFi/feature/import-wallet-with-priva…
YasunoriMATSUOKA May 8, 2022
24ef5c3
Merge pull request #135 from UnUniFi/feature/fix-portal-create-valida…
YasunoriMATSUOKA May 9, 2022
9b736ea
Merge pull request #136 from UnUniFi/feature/fix-portal-home-validato…
YasunoriMATSUOKA May 9, 2022
42ad5f6
Merge pull request #137 from UnUniFi/feature/fix-explorer-dashboard-i…
YasunoriMATSUOKA May 9, 2022
5206070
Merge pull request #138 from UnUniFi/feature/fix-explorer-title-from-…
YasunoriMATSUOKA May 9, 2022
797d419
Merge pull request #139 from UnUniFi/feature/fix-disable-bank-send
YasunoriMATSUOKA May 9, 2022
3eed919
Merge pull request #143 from UnUniFi/delete/google-analytics
YasunoriMATSUOKA May 9, 2022
323e2c2
fix: convert base account
Senna46 May 9, 2022
8a2a713
feat: add onepage download link
May 9, 2022
0de60a6
feat: links are opend in other tab
May 9, 2022
33bc0f4
feat: add active effect when cursor on
May 9, 2022
6e640ee
Merge branch 'develop' into feature/account-txs-pagination
May 9, 2022
33ef9c3
fix: fix tx type
May 9, 2022
303b5bc
Merge pull request #145 from UnUniFi/feature/other-tab
YasunoriMATSUOKA May 10, 2022
3763d0a
Merge pull request #146 from UnUniFi/feature/active-hover
YasunoriMATSUOKA May 10, 2022
8b3942c
Merge pull request #147 from UnUniFi/feature/onepage-download
YasunoriMATSUOKA May 10, 2022
2aa4213
feat: change redirect url at search bar
May 10, 2022
d695228
Merge branch 'main' of https://github.com/UnUniFi/web-apps into develop
Senna46 May 11, 2022
febb7d8
Merge pull request #148 from UnUniFi/feature/redirect-explorer
YasunoriMATSUOKA May 11, 2022
90469b0
Merge pull request #144 from UnUniFi/fix/convert-baseaccount
YasunoriMATSUOKA May 11, 2022
39543f1
Merge pull request #133 from UnUniFi/feature/account-txs-pagination
YasunoriMATSUOKA May 11, 2022
4af00f2
fix: delete environment gtag
Senna46 May 11, 2022
7710c89
Merge pull request #153 from UnUniFi/fix/delete-gtag
Senna46 May 11, 2022
a63a8d0
feat: test code
Senna46 May 11, 2022
09cde11
Revert "Merge pull request #140 from UnUniFi/feature/import-wallet-wi…
Senna46 May 11, 2022
7a2dad1
Merge pull request #154 from UnUniFi/hotfix/develop-fix
YasunoriMATSUOKA May 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"start:portal": "ng serve --project portal",
"start:landing-page": "ng serve --project landing-page",
"start:all": "npm run build:all && firebase emulators:start --only hosting:ununifi-alpha-test",
"start:all:prod": "npm run build:all:prod && firebase emulators:start --only hosting:ununifi-alpha-test",
"build": "ng build",
"build:explorer": "ng build --project explorer",
"build:explorer:prod": "ng build --project explorer --configuration=production",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
<view-txs [txsWithPagination]="txsWithPagination$ | async"></view-txs>
<view-txs
[pageSizeOptions]="pageSizeOptions"
[txsWithPagination]="txsWithPagination$ | async"
[txTypes]="txTypes$ | async"
[pageInfo]="paginationInfo$ | async"
[pageLength]="pageLength$ | async"
(paginationChange)="appPaginationChanged($event)"
></view-txs>
148 changes: 142 additions & 6 deletions projects/explorer/src/app/pages/accounts/account/txs/txs.component.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
import { CosmosSDKService } from '../../../../models/cosmos-sdk.service';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { cosmosclient, rest, proto } from '@cosmos-client/core';
import { PageEvent } from '@angular/material/paginator';
import { Router, ActivatedRoute } from '@angular/router';
import { rest } from '@cosmos-client/core';
import { CosmosTxV1beta1GetTxsEventResponse } from '@cosmos-client/core/esm/openapi';
import { combineLatest, Observable } from 'rxjs';
import { map, mergeMap } from 'rxjs/operators';
import { of, combineLatest, Observable } from 'rxjs';
import { map, mergeMap, switchMap, distinctUntilChanged, withLatestFrom } from 'rxjs/operators';

export type PaginationInfo = {
pageSize: number;
pageNumber: number;
};

@Component({
selector: 'app-txs',
templateUrl: './txs.component.html',
styleUrls: ['./txs.component.css'],
})
export class TxsComponent implements OnInit {
pageSizeOptions = [5, 10, 20, 50, 100];
defaultPageSize = this.pageSizeOptions[1];
defaultPageNumber = 1;

address$: Observable<string | undefined>;
txs$: Observable<CosmosTxV1beta1GetTxsEventResponse | undefined>;
txsTotalCount$: Observable<bigint>;
paginationInfoChanged$: Observable<PaginationInfo>;

paginationInfo$: Observable<PaginationInfo>;
pageLength$: Observable<number | undefined>;
txsWithPagination$: Observable<CosmosTxV1beta1GetTxsEventResponse | undefined>;
txTypes$: Observable<string[] | undefined>;

constructor(private route: ActivatedRoute, private cosmosSDK: CosmosSDKService) {
constructor(
private router: Router,
private route: ActivatedRoute,
private cosmosSDK: CosmosSDKService,
) {
this.address$ = this.route.params.pipe(map((params) => params.address));
const sdk$ = this.cosmosSDK.sdk$;
this.txsWithPagination$ = combineLatest([sdk$, this.address$]).pipe(

this.txs$ = combineLatest([sdk$, this.address$]).pipe(
mergeMap(([sdk, address]) => {
return rest.tx
.getTxsEvent(
Expand All @@ -36,7 +58,121 @@ export class TxsComponent implements OnInit {
});
}),
);

this.txsTotalCount$ = combineLatest([sdk$, this.address$]).pipe(
mergeMap(([sdk, address]) => {
return rest.tx
.getTxsEvent(
sdk.rest,
[`message.sender='${address}'`],
undefined,
undefined,
undefined,
true,
)
.then((res) =>
res.data.pagination?.total ? BigInt(res.data.pagination?.total) : BigInt(0),
)
.catch((error) => {
console.error(error);
return BigInt(0);
});
}),
);

this.pageLength$ = this.txsTotalCount$.pipe(
map((txsTotalCount) => (txsTotalCount ? parseInt(txsTotalCount.toString()) : undefined)),
);

this.paginationInfo$ = combineLatest([this.txsTotalCount$, this.route.queryParams]).pipe(
switchMap(([txTotalCount, params]) => {
//get page size from query param
const pageSize = this.pageSizeOptions.includes(Number(params.perPage))
? Number(params.perPage)
: this.defaultPageSize;

//get page number from query param
const pages = Number(params.pages);
const pageNumber =
txTotalCount === undefined || !pages || pages > Number(txTotalCount) / pageSize + 1
? this.defaultPageNumber
: pages;

return of({ pageNumber, pageSize });
}),
);

this.paginationInfoChanged$ = this.paginationInfo$.pipe(
distinctUntilChanged(),
map((paginationInfo) => paginationInfo),
);

this.txsWithPagination$ = this.paginationInfoChanged$.pipe(
withLatestFrom(sdk$, this.address$, this.txsTotalCount$),
mergeMap(([paginationInfo, sdk, address, txsTotalCount]) => {
const pageOffset = BigInt(paginationInfo.pageSize) * BigInt(paginationInfo.pageNumber - 1);

const modifiedPageSize =
txsTotalCount <= pageOffset
? txsTotalCount % BigInt(paginationInfo.pageSize)
: BigInt(paginationInfo.pageSize);

if (pageOffset < 0 || modifiedPageSize <= 0) {
return [];
}

return rest.tx
.getTxsEvent(
sdk.rest,
[`message.sender='${address}'`],
undefined,
pageOffset,
modifiedPageSize,
true,
)
.then((res) => res.data)
.catch((error) => {
console.error(error);
return undefined;
});
}),
);

this.txTypes$ = this.txsWithPagination$.pipe(
map((txs) => {
if (!txs?.txs) {
return undefined;
}
const txTypeList = txs?.txs?.map((tx) => {
if (!tx.body?.messages) {
return '';
}
const txTypes = tx.body?.messages.map((message) => {
if (!message) {
return [];
}
const txTypeRaw = (message as any)['@type'] as string;
const startLength = txTypeRaw.lastIndexOf('.');
const txType = txTypeRaw.substring(startLength + 1, txTypeRaw.length);
return txType;
});
return txTypes.join();
});
return txTypeList;
}),
);
}

ngOnInit(): void {}

appPaginationChanged(pageEvent: PageEvent): void {
this.router.navigate([], {
relativeTo: this.route,
queryParams: {
perPage: pageEvent.pageSize,
pages: pageEvent.pageIndex + 1,
},
queryParamsHandling: 'merge',
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ <h3 class="mb-0 ml-2">Transactions</h3>
</mat-list-item>
</mat-list>
<mat-nav-list>
<ng-container *ngFor="let tx of txsWithPagination?.tx_responses; last as last">
<ng-container *ngFor="let tx of txsWithPagination?.tx_responses; let i = index; last as last">
<mat-list-item routerLink="/txs/{{ tx.txhash }}">
<span class="pr-4">{{ tx.logs?.[0]?.events?.[3]?.type }}</span>
<span class="pr-4">{{ txTypes?.[i] }}</span>
<span class="flex-auto"></span>
<span
class="w-1/5 break-all truncate"
Expand All @@ -45,4 +45,12 @@ <h3 class="mb-0 ml-2">Transactions</h3>
</ng-container>
</mat-nav-list>
</ng-template>
<mat-paginator
[length]="pageLength"
[pageSize]="pageInfo ? pageInfo.pageSize : 5"
[pageIndex]="pageInfo ? pageInfo.pageNumber - 1 : 0"
[pageSizeOptions]="pageSizeOptions ? pageSizeOptions : []"
(page)="onPaginationChange($event)"
>
</mat-paginator>
</mat-card>
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Component, Input, OnInit } from '@angular/core';
import { PaginationInfo } from '../../../../pages/accounts/account/txs/txs.component';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { PageEvent } from '@angular/material/paginator';
import { CosmosTxV1beta1GetTxsEventResponse } from '@cosmos-client/core/esm/openapi';

@Component({
Expand All @@ -9,7 +11,23 @@ import { CosmosTxV1beta1GetTxsEventResponse } from '@cosmos-client/core/esm/open
export class TxsComponent implements OnInit {
@Input() txsWithPagination?: CosmosTxV1beta1GetTxsEventResponse | null;

constructor() {}
@Input() txTypes?: string[] | null;

@Input() pageSizeOptions?: number[] | null;

@Input() pageInfo?: PaginationInfo | null;

@Input() pageLength?: number | null;

@Output() paginationChange: EventEmitter<PageEvent>;

constructor() {
this.paginationChange = new EventEmitter();
}

ngOnInit(): void {}

onPaginationChange(pageEvent: PageEvent): void {
this.paginationChange.emit(pageEvent);
}
}
2 changes: 1 addition & 1 deletion projects/explorer/src/app/views/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<button class="align-middle" mat-icon-button routerLink="/">
<img class="p-1 w-10 h-10" src="assets/favicon.png" />
</button>
<h1 class="align-middle">Telescope</h1>
<h1 class="align-middle">UnUniFi Explorer</h1>
</mat-toolbar>

<mat-form-field appearance="fill" class="w-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h2>Dashboard</h2>
</mat-card>

<span class="flex-auto"></span>
<mat-card class="lg:w-1/3">
<mat-card class="mb-4 lg:w-1/3">
<mat-card-header>
<mat-icon mat-card-avatar color="accent">generating_tokens</mat-icon>
<mat-card-title>Inflation</mat-card-title>
Expand Down
2 changes: 1 addition & 1 deletion projects/explorer/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Telescope</title>
<title>UnUniFi Explorer</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="assets/favicon.png" />
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading