Add transaction data service.
This commit is contained in:
parent
a4c287f9f7
commit
cbe51520fa
16
src/app/_services/transaction.service.spec.ts
Normal file
16
src/app/_services/transaction.service.spec.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { TransactionService } from './transaction.service';
|
||||||
|
|
||||||
|
describe('TransactionService', () => {
|
||||||
|
let service: TransactionService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(TransactionService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
27
src/app/_services/transaction.service.ts
Normal file
27
src/app/_services/transaction.service.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import {HttpClient} from '@angular/common/http';
|
||||||
|
import {map} from 'rxjs/operators';
|
||||||
|
import {Observable} from 'rxjs';
|
||||||
|
import {environment} from '../../environments/environment';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class TransactionService {
|
||||||
|
|
||||||
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
|
getAllTransactions(offset: number, limit: number): Observable<any> {
|
||||||
|
return this.http.get(`${environment.cicCacheUrl}/tx/${offset}/${limit}`)
|
||||||
|
.pipe(map(response => {
|
||||||
|
return response;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
getAddressTransactions(address: string, offset: number, limit: number): Observable<any> {
|
||||||
|
return this.http.get(`${environment.cicCacheUrl}/tx/${address}/${offset}/${limit}`)
|
||||||
|
.pipe(map(response => {
|
||||||
|
return response;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user