Removing address from JsonRpcSigner and cache address (#263).

This commit is contained in:
Richard Moore 2018-08-27 13:27:59 +02:00
parent 2b9d8d6d6a
commit 280dc56a74
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295

@ -78,12 +78,14 @@ export class JsonRpcSigner extends Signer {
}
}
/* May add back in the future; for now it is considered confusing. :)
get address(): string {
if (!this._address) {
errors.throwError('no sync sync address available; use getAddress', errors.UNSUPPORTED_OPERATION, { operation: 'address' });
}
return this._address
}
*/
getAddress(): Promise<string> {
if (this._address) {
@ -94,7 +96,8 @@ export class JsonRpcSigner extends Signer {
if (accounts.length <= this._index) {
errors.throwError('unknown account #' + this._index, errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });
}
return getAddress(accounts[this._index]);
this._address = getAddress(accounts[this._index]);
return this._address;
});
}