Basic Liquid Asset support.

This commit is contained in:
softsimon
2020-04-28 17:10:31 +07:00
parent 7e7b536acb
commit b2d2fd225c
11 changed files with 466 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Block, Transaction, Address, Outspend, Recent } from '../interfaces/electrs.interface';
import { Block, Transaction, Address, Outspend, Recent, Asset } from '../interfaces/electrs.interface';
const API_BASE_URL = document.location.protocol + '//' + document.location.hostname + ':' + document.location.port + '/electrs';
@@ -54,4 +54,16 @@ export class ElectrsApiService {
return this.httpClient.get<Transaction[]>(API_BASE_URL + '/address/' + address + '/txs/chain/' + txid);
}
getAsset$(assetId: string): Observable<Asset> {
return this.httpClient.get<Asset>(API_BASE_URL + '/asset/' + assetId);
}
getAssetTransactions$(assetId: string): Observable<Transaction[]> {
return this.httpClient.get<Transaction[]>(API_BASE_URL + '/asset/' + assetId + '/txs');
}
getAssetTransactionsFromHash$(assetId: string, txid: string): Observable<Transaction[]> {
return this.httpClient.get<Transaction[]>(API_BASE_URL + '/asset/' + assetId + '/txs/chain/' + txid);
}
}

View File

@@ -157,6 +157,14 @@ export class WebsocketService {
this.websocketSubject.next({ 'track-address': 'stop' });
}
startTrackAsset(asset: string) {
this.websocketSubject.next({ 'track-asset': asset });
}
stopTrackingAsset() {
this.websocketSubject.next({ 'track-asset': 'stop' });
}
fetchStatistics(historicalDate: string) {
this.websocketSubject.next({ historicalDate });
}