Commit 3361c94d authored by dev0tion's avatar dev0tion

Add unused addresses

parent 9dc6941a
......@@ -36,5 +36,19 @@
"timestamp": "2016.12.20. 1:15:36"
}
]
}
},
"receive":
{
"success": "true",
"addresses":
[
"mzz63n3n89KVeHQXRqJEVsQX8MZj5zeqCw",
"mhm1pFe2hH7yqkdQhwbBQ8qLnMZqfL6jXb",
"mmRzqMDBrfNxMfryQSYec3rfPHXURNapBA",
"my2ELDBqLGVz1ER7CMynDqG4BUpV2pwfR5",
"mmwccp4GefhPn4P6Mui6DGLGzHTVyQ12tD",
"miTedyDXJAz6GYMRasiJk9M3ibnGnb99M1",
"mrsb39MmPceSPfKAURTH23hYgLRH1M1Uhg"
]
}
}
\ No newline at end of file
import { Observable } from 'rxjs/Observable';
import { Component, OnInit } from '@angular/core';
import { ApiService } from '../../shared/api/api.service';
@Component({
selector: 'is-connected',
template: 'Wallet connected to API: {{result}}',
})
export class ApiComponent implements OnInit {
result: string;
constructor(private apiService: ApiService) {}
ngOnInit() {
this.apiService
.isConnected()
.subscribe((data: string) => this.result = data,
() => console.log("isConnected() complete from init"));
if (!this.result) {
this.result = "false"
}
}
}
......@@ -2,9 +2,6 @@
<h1>
Please create a new wallet.
</h1>
<div>
<is-connected></is-connected>
</div>
<div class="form-group">
<label for="name">Name:</label>
<input class="form-control" type="text" #walletName required>
......
......@@ -5,7 +5,6 @@ import { RouterModule } from '@angular/router';
import { SetupComponent } from './setup.component';
import { CreateComponent } from './create/create.component';
import { ApiComponent } from './create/api.component';
import { SharedModule } from '../shared/shared.module';
......@@ -20,8 +19,7 @@ import { SetupRoutingModule } from './setup-routing.module';
],
declarations: [
CreateComponent,
SetupComponent,
ApiComponent
SetupComponent
],
exports: [ SetupComponent ],
providers: []
......
......@@ -42,6 +42,13 @@ export class ApiService {
.catch(this.handleError);
}
getUnusedReceiveAddresses(): Observable<any> {
return this.http
.get(this.webApiUrl + '/wallet/receive')
.map((response:Response) => response.json())
.catch(this.handleError);
}
createWallet(data: SafeCreation): Observable<any> {
console.log(JSON.stringify(data));
return this.http
......
......@@ -22,8 +22,7 @@ export class HistoryComponent {
this.apiService.getWalletHistory()
.subscribe(
response => this.transactions = response.history,
error => this.errorMessage = <any>error,
() => console.log(this.transactions)
error => this.errorMessage = <any>error
);
}
}
<div class="content-wrapper">
<h1>Receive</h1>
<div>
<label>Unused Receive Addresses</label>
<div>
<table *ngIf="addresses">
<thead>
<th>Unused Receive Addresses: </th>
</thead>
<tr *ngFor="let address of addresses">
<td>{{ address }}</td>
</tr>
</table>
</div>
</div>
<div>
......
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { ApiService } from '../../shared/api/api.service'
@Component({
selector: 'receive-component',
......@@ -7,5 +9,20 @@ import { Component } from '@angular/core';
})
export class ReceiveComponent {
constructor(private apiService: ApiService) {}
private addresses: any;
private errorMessage: string;
ngOnInit() {
this.getUnusedReceiveAddresses();
}
private getUnusedReceiveAddresses() {
this.apiService.getUnusedReceiveAddresses()
.subscribe(
response => this.addresses = response.addresses,
error => this.errorMessage = <any>error
);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment