2017-08-28 17:43:57 +00:00
|
|
|
// @flow
|
2017-09-12 00:26:16 +00:00
|
|
|
import type { IWallet } from './IWallet';
|
2017-08-28 17:43:57 +00:00
|
|
|
|
2017-09-12 00:26:16 +00:00
|
|
|
export default class DeterministicWallet implements IWallet {
|
2017-08-28 17:43:57 +00:00
|
|
|
address: string;
|
|
|
|
dPath: string;
|
2017-09-15 19:29:38 +00:00
|
|
|
index: number;
|
2017-08-28 17:43:57 +00:00
|
|
|
|
2017-09-15 19:29:38 +00:00
|
|
|
constructor(address: string, dPath: string, index: number) {
|
2017-08-28 17:43:57 +00:00
|
|
|
this.address = address;
|
|
|
|
this.dPath = dPath;
|
2017-09-15 19:29:38 +00:00
|
|
|
this.index = index;
|
2017-08-28 17:43:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
getAddress(): Promise<string> {
|
|
|
|
return Promise.resolve(this.address);
|
|
|
|
}
|
|
|
|
|
|
|
|
getPath(): string {
|
2017-09-15 19:29:38 +00:00
|
|
|
return `${this.dPath}/${this.index}`;
|
2017-08-28 17:43:57 +00:00
|
|
|
}
|
|
|
|
}
|