@@ -1460,12 +1460,27 @@ export class TransactionResponse implements TransactionLike<string>, Transaction
14601460 return ;
14611461 } ;
14621462
1463+ const checkReceipt = ( receipt : null | TransactionReceipt ) => {
1464+ if ( receipt == null || receipt . status !== 0 ) { return receipt ; }
1465+ assert ( false , "transaction execution reverted" , "CALL_EXCEPTION" , {
1466+ action : "sendTransaction" ,
1467+ data : null , reason : null , invocation : null , revert : null ,
1468+ transaction : {
1469+ to : receipt . to ,
1470+ from : receipt . from ,
1471+ data : "" // @TODO : in v7, split out sendTransaction properties
1472+ } , receipt
1473+ } ) ;
1474+ } ;
1475+
14631476 const receipt = await this . provider . getTransactionReceipt ( this . hash ) ;
14641477
1465- if ( confirms === 0 ) { return receipt ; }
1478+ if ( confirms === 0 ) { return checkReceipt ( receipt ) ; }
14661479
14671480 if ( receipt ) {
1468- if ( ( await receipt . confirmations ( ) ) >= confirms ) { return receipt ; }
1481+ if ( ( await receipt . confirmations ( ) ) >= confirms ) {
1482+ return checkReceipt ( receipt ) ;
1483+ }
14691484
14701485 } else {
14711486 // Check for a replacement; throws if a replacement was found
@@ -1496,9 +1511,10 @@ export class TransactionResponse implements TransactionLike<string>, Transaction
14961511 // Done; return it!
14971512 if ( ( await receipt . confirmations ( ) ) >= confirms ) {
14981513 cancel ( ) ;
1499- resolve ( receipt ) ;
1514+ try {
1515+ resolve ( checkReceipt ( receipt ) ) ;
1516+ } catch ( error ) { reject ( error ) ; }
15001517 }
1501-
15021518 } ;
15031519 cancellers . push ( ( ) => { this . provider . off ( this . hash , txListener ) ; } ) ;
15041520 this . provider . on ( this . hash , txListener ) ;
0 commit comments