Skip to content

Commit

Permalink
Fixed default JsonRpcSigner (#532).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed May 31, 2019
1 parent 9122310 commit 5ba6a61
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/providers/src.ts/json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ export class JsonRpcSigner extends Signer {

defineReadOnly(this, "provider", provider);

// Statically attach to a given address
if (addressOrIndex == null) { addressOrIndex = 0; }
if (addressOrIndex) {
if (typeof(addressOrIndex) === "string") {
defineReadOnly(this, "_address", this.provider.formatter.address(addressOrIndex));
defineReadOnly(this, "_index", null);
} else if (typeof(addressOrIndex) === "number") {
defineReadOnly(this, "_index", addressOrIndex);
defineReadOnly(this, "_address", null);
} else {
errors.throwError("invalid address or index", errors.INVALID_ARGUMENT, { argument: "addressOrIndex", value: addressOrIndex });
}

if (typeof(addressOrIndex) === "string") {
defineReadOnly(this, "_address", this.provider.formatter.address(addressOrIndex));
defineReadOnly(this, "_index", null);

} else if (typeof(addressOrIndex) === "number") {
defineReadOnly(this, "_index", addressOrIndex);
defineReadOnly(this, "_address", null);

} else {
errors.throwError("invalid address or index", errors.INVALID_ARGUMENT, { argument: "addressOrIndex", value: addressOrIndex });
}
}

Expand Down

0 comments on commit 5ba6a61

Please sign in to comment.