Fixed default JsonRpcSigner (#532).
This commit is contained in:
parent
9122310481
commit
5ba6a616a6
@ -58,20 +58,20 @@ 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") {
|
} else if (typeof(addressOrIndex) === "number") {
|
||||||
defineReadOnly(this, "_index", addressOrIndex);
|
defineReadOnly(this, "_index", addressOrIndex);
|
||||||
defineReadOnly(this, "_address", null);
|
defineReadOnly(this, "_address", null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
errors.throwError("invalid address or index", errors.INVALID_ARGUMENT, { argument: "addressOrIndex", value: addressOrIndex });
|
errors.throwError("invalid address or index", errors.INVALID_ARGUMENT, { argument: "addressOrIndex", value: addressOrIndex });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
connect(provider: Provider): JsonRpcSigner {
|
connect(provider: Provider): JsonRpcSigner {
|
||||||
return errors.throwError("cannot alter JSON-RPC Signer connection", errors.UNSUPPORTED_OPERATION, {
|
return errors.throwError("cannot alter JSON-RPC Signer connection", errors.UNSUPPORTED_OPERATION, {
|
||||||
|
Loading…
Reference in New Issue
Block a user