Skip to content

Commit 1e31b34

Browse files
committed
Fixed ENS names for JsonRpcSigner.
1 parent 7deb4c1 commit 1e31b34

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/providers/src.ts/json-rpc-provider.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,22 @@ export class JsonRpcSigner extends Signer implements TypedDataSigner {
183183
transaction.gasLimit = this.provider.estimateGas(estimate);
184184
}
185185

186+
if (transaction.to != null) {
187+
transaction.to = Promise.resolve(transaction.to).then(async (to) => {
188+
if (to == null) { return null; }
189+
const address = await this.provider.resolveName(to);
190+
if (address == null) {
191+
logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to);
192+
}
193+
return address;
194+
});
195+
}
196+
186197
return resolveProperties({
187198
tx: resolveProperties(transaction),
188199
sender: fromAddress
189200
}).then(({ tx, sender }) => {
201+
190202
if (tx.from != null) {
191203
if (tx.from.toLowerCase() !== sender) {
192204
logger.throwArgumentError("from address mismatch", "transaction", transaction);

0 commit comments

Comments
 (0)