|
|
@@ -22,6 +22,7 @@ import {
|
|
|
} from 'hslayers-ng';
|
|
|
|
|
|
import { BcInfoService } from './bc-info.service';
|
|
|
+import { Purchase } from './purchase/purchase.component';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'blockchain-info',
|
|
|
@@ -47,32 +48,7 @@ export class BcInfoComponent implements HsPanelComponent, OnInit {
|
|
|
data: any;
|
|
|
name: string = "bc-panel";
|
|
|
|
|
|
- lastTransfers: Array<any> = [
|
|
|
- {
|
|
|
- hash: "dafsdfagfsdgsrggfsdfasdfgghvccvbgdfgdsf",
|
|
|
- user: "kunickyd@test",
|
|
|
- timestamp: "20.3.2021 14:35",
|
|
|
- extent: "[36, 58, 78, 65]",
|
|
|
- amount: "58.5",
|
|
|
- expanded: true
|
|
|
- },
|
|
|
- {
|
|
|
- hash: "ddafs65432df456d4fsa54as9d8f4df",
|
|
|
- user: "kunickyd@test",
|
|
|
- timestamp: "20.3.2021 14:35",
|
|
|
- extent: "[36, 58, 78, 65]",
|
|
|
- amount: "58.5",
|
|
|
- expanded: false
|
|
|
- },
|
|
|
- {
|
|
|
- hash: "54d6afs54df488d8da98f7d75dddafdf5d5f5d5f5d5fd",
|
|
|
- user: "kunickyd@test",
|
|
|
- timestamp: "20.3.2021 14:35",
|
|
|
- extent: "[36, 58, 78, 65]",
|
|
|
- amount: "58.5",
|
|
|
- expanded: true
|
|
|
- }
|
|
|
- ];
|
|
|
+ lastPurchases: Array<Purchase>;
|
|
|
|
|
|
constructor(
|
|
|
private bcInfoService: BcInfoService,
|
|
|
@@ -86,8 +62,9 @@ export class BcInfoComponent implements HsPanelComponent, OnInit {
|
|
|
this.onExtentChanged = this.onExtentChanged.bind(this);
|
|
|
}
|
|
|
|
|
|
- async ngOnInit(): Promise<void> {
|
|
|
- await this.refreshUserBalance();
|
|
|
+ ngOnInit(): void {
|
|
|
+ this.refreshUserBalance();
|
|
|
+ this.refreshPurchaseHistory();
|
|
|
}
|
|
|
|
|
|
async refreshUserBalance(): Promise<void> {
|
|
|
@@ -96,6 +73,10 @@ export class BcInfoComponent implements HsPanelComponent, OnInit {
|
|
|
this.getUserBalanceInProgress = false;
|
|
|
}
|
|
|
|
|
|
+ async refreshPurchaseHistory(): Promise<void> {
|
|
|
+ this.lastPurchases = (await this.bcInfoService.getTransfers(this.user)) as Array<Purchase>;
|
|
|
+ }
|
|
|
+
|
|
|
isVisible(): boolean {
|
|
|
return this.hsLayoutService.panelVisible(this.name);
|
|
|
}
|
|
|
@@ -123,7 +104,12 @@ export class BcInfoComponent implements HsPanelComponent, OnInit {
|
|
|
//console.log(transformedExtent);
|
|
|
|
|
|
this.paymentHash = await this.bcInfoService.transferAssets(this.user, this.userPrivateKey, this.assetId, transformedExtent, this.price);
|
|
|
+
|
|
|
+ await this.bcInfoService.archiveTransfer(this.user, this.price, this.paymentHash, transformedExtent, Date.now());
|
|
|
+
|
|
|
+ this.refreshPurchaseHistory();
|
|
|
this.refreshUserBalance();
|
|
|
+
|
|
|
this.dataUrl = await this.bcInfoService.requestData(this.paymentHash, this.user);//"https://eo.lesprojekt.cz/produkty/S2/2020/S2A_MSIL2A_20200422T095031_N9999_R079_T33UXQ_20201127T165009_NDVI.tif"
|
|
|
|
|
|
this.buyInProgress = false;
|
|
|
@@ -155,7 +141,7 @@ export class BcInfoComponent implements HsPanelComponent, OnInit {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
onTest() {
|
|
|
//this.bcInfoService.getUserTransactions(this.user, this.userPrivateKey);
|