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,20 +58,20 @@ 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 });
}
}
}
connect(provider: Provider): JsonRpcSigner {
return errors.throwError("cannot alter JSON-RPC Signer connection", errors.UNSUPPORTED_OPERATION, {