From 280dc56a747876973c78d7afae4d315840868ae9 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Mon, 27 Aug 2018 13:27:59 +0200 Subject: [PATCH] Removing address from JsonRpcSigner and cache address (#263). --- src.ts/providers/json-rpc-provider.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src.ts/providers/json-rpc-provider.ts b/src.ts/providers/json-rpc-provider.ts index 3efe88722..c5efd6e2e 100644 --- a/src.ts/providers/json-rpc-provider.ts +++ b/src.ts/providers/json-rpc-provider.ts @@ -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 { 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; }); }