Fixed ENS names for JsonRpcSigner.
This commit is contained in:
parent
7deb4c174a
commit
1e31b34a5a
@ -183,10 +183,22 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner {
|
|||||||
transaction.gasLimit = this.provider.estimateGas(estimate);
|
transaction.gasLimit = this.provider.estimateGas(estimate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (transaction.to != null) {
|
||||||
|
transaction.to = Promise.resolve(transaction.to).then(async (to) => {
|
||||||
|
if (to == null) { return null; }
|
||||||
|
const address = await this.provider.resolveName(to);
|
||||||
|
if (address == null) {
|
||||||
|
logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to);
|
||||||
|
}
|
||||||
|
return address;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return resolveProperties({
|
return resolveProperties({
|
||||||
tx: resolveProperties(transaction),
|
tx: resolveProperties(transaction),
|
||||||
sender: fromAddress
|
sender: fromAddress
|
||||||
}).then(({ tx, sender }) => {
|
}).then(({ tx, sender }) => {
|
||||||
|
|
||||||
if (tx.from != null) {
|
if (tx.from != null) {
|
||||||
if (tx.from.toLowerCase() !== sender) {
|
if (tx.from.toLowerCase() !== sender) {
|
||||||
logger.throwArgumentError("from address mismatch", "transaction", transaction);
|
logger.throwArgumentError("from address mismatch", "transaction", transaction);
|
||||||
|
Loading…
Reference in New Issue
Block a user