Fixed default JsonRpcSigner (#532).

This commit is contained in:
Richard Moore 2019-05-30 20:18:21 -04:00
parent 9122310481
commit 5ba6a616a6
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295

@ -58,18 +58,18 @@ export class JsonRpcSigner extends Signer {
defineReadOnly(this, "provider", provider); defineReadOnly(this, "provider", provider);
// Statically attach to a given address
if (addressOrIndex == null) { addressOrIndex = 0; } if (addressOrIndex == null) { addressOrIndex = 0; }
if (addressOrIndex) {
if (typeof(addressOrIndex) === "string") { if (typeof(addressOrIndex) === "string") {
defineReadOnly(this, "_address", this.provider.formatter.address(addressOrIndex)); defineReadOnly(this, "_address", this.provider.formatter.address(addressOrIndex));
defineReadOnly(this, "_index", null); defineReadOnly(this, "_index", null);
} else if (typeof(addressOrIndex) === "number") {
defineReadOnly(this, "_index", addressOrIndex); } else if (typeof(addressOrIndex) === "number") {
defineReadOnly(this, "_address", null); defineReadOnly(this, "_index", addressOrIndex);
} else { defineReadOnly(this, "_address", null);
errors.throwError("invalid address or index", errors.INVALID_ARGUMENT, { argument: "addressOrIndex", value: addressOrIndex });
} } else {
errors.throwError("invalid address or index", errors.INVALID_ARGUMENT, { argument: "addressOrIndex", value: addressOrIndex });
} }
} }