Commit d163c9a2 authored by dev0tion's avatar dev0tion

Add recover component

parent ee8ee60b
<h1>Recover your wallet</h1>
<p>
Welcome, please complete the form below to recover your wallet.
</p>
<div class="form-group">
<label for="name">Mnemonic:</label>
<input class="form-control" type="text" #walletMnemonic required>
</div>
<div class="form-group">
<label for="name">Password:</label>
<input class="form-control" type="password" #walletPassword required>
</div>
<div class="form-group">
<label for="name">Date of creation (yyyy-MM-dd):</label>
<input class="form-control" type="password" #walletDate required>
</div>
<div class="form-group">
<label for="networklabel">Network:</label>
<select name="network" #walletNetwork>
<option value="main">Main</option>
<option value="test">Testnet</option>
</select>
</div>
<button type="submit" (click)="recoverWallet(walletMnemonic.value, walletPassword.value, walletDate.value, walletNetwork.value)">Recover</button>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RecoverComponent } from './recover.component';
describe('RecoverComponent', () => {
let component: RecoverComponent;
let fixture: ComponentFixture<RecoverComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecoverComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RecoverComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { ApiService } from '../../shared/api/api.service'
import { WalletRecovery } from '../../shared/wallet-recovery'
@Component({
selector: 'app-recover',
templateUrl: './recover.component.html',
styleUrls: ['./recover.component.css']
})
export class RecoverComponent implements OnInit {
constructor(private apiService: ApiService) { }
private walletRecovery: WalletRecovery;
private responseBody: string;
ngOnInit() {
}
private recoverWallet(mnemonic: string, password: string, creationDate: string, network: string) {
this.walletRecovery.mnemonic = mnemonic;
this.walletRecovery.password = password;
this.walletRecovery.date = creationDate;
this.walletRecovery.network = network;
this.apiService
.recoverWallet(this.walletRecovery)
.subscribe((response: string) => this.responseBody = response,
() => console.log("recoverWallet() completed"));
}
}
\ No newline at end of file
export class SafeCreation {
password: string;
network: string;
folderPath: string;
name: string;
}
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