Skip to content

Commit

Permalink
Fixed possible UnhandledPromiseException for bad ENS names.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jul 30, 2021
1 parent 593b488 commit 63f8b28
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/abstract-signer/src.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,11 @@ export abstract class Signer {
}

// Populates all fields in a transaction, signs it and sends it to the network
sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse> {
async sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse> {
this._checkProvider("sendTransaction");
return this.populateTransaction(transaction).then((tx) => {
return this.signTransaction(tx).then((signedTx) => {
return this.provider.sendTransaction(signedTx);
});
});
const tx = await this.populateTransaction(transaction);
const signedTx = await this.signTransaction(tx);
return await this.provider.sendTransaction(signedTx);
}

async getChainId(): Promise<number> {
Expand Down Expand Up @@ -209,6 +207,9 @@ export abstract class Signer {
}
return address;
});

// Prevent this error from causing an UnhandledPromiseException
tx.to.catch((error) => { });
}

// Do not allow mixing pre-eip-1559 and eip-1559 proerties
Expand Down

0 comments on commit 63f8b28

Please sign in to comment.