diff --git a/web-ui/src/app/app.module.ts b/web-ui/src/app/app.module.ts index 076287c..62cfbbc 100644 --- a/web-ui/src/app/app.module.ts +++ b/web-ui/src/app/app.module.ts @@ -18,6 +18,7 @@ import { ErrorService } from './services/error.service'; import { LanguageService } from './services/language.service'; import { NavigatorService } from './services/navigator.service'; import { NotificationService } from './services/notification.service'; +import { TickerService } from './services/ticker.service'; import { TransactionsService } from './services/transactions.service'; import { AppComponent } from './app.component'; @@ -66,6 +67,7 @@ import { LatestBlocksComponent } from './components/latest-blocks/latest-blocks. LanguageService, NavigatorService, NotificationService, + TickerService, TransactionsService ], bootstrap: [AppComponent] diff --git a/web-ui/src/app/models/ticker.ts b/web-ui/src/app/models/ticker.ts new file mode 100644 index 0000000..a44159a --- /dev/null +++ b/web-ui/src/app/models/ticker.ts @@ -0,0 +1,6 @@ + +export class ServerStats { + totalSupply: number; + transactions: number; + height: number; +} diff --git a/web-ui/src/app/services/ticker.service.ts b/web-ui/src/app/services/ticker.service.ts new file mode 100644 index 0000000..1d5b89b --- /dev/null +++ b/web-ui/src/app/services/ticker.service.ts @@ -0,0 +1,24 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Observable } from 'rxjs/Observable'; + +import { environment } from '../../environments/environment'; + +import { ServerStats } from '../models/ticker'; + +const httpOptions = { + headers: new HttpHeaders({ 'Content-Type': 'application/json' }) +}; + +@Injectable() +export class TickerService { + + private baseUrl = environment.api.url + '/stats'; + + constructor(private http: HttpClient) { } + + get(): Observable { + const url = this.baseUrl; + return this.http.get(url); + } +}