fix: `TransactionReceiptQuery` should return filled out receipt even if the query failed
@@ -262,7 +262,16 @@ func (query *TransactionReceiptQuery) Execute(client *Client) (TransactionReceip
if err != nil {
if precheckErr, ok := err.(ErrHederaPreCheckStatus); ok {
- return TransactionReceipt{}, _NewErrHederaReceiptStatus(precheckErr.TxID, precheckErr.Status)
+ receipt := TransactionReceipt{}
+ if resp.query.GetTransactionGetReceipt() != nil {
+ receipt = _TransactionReceiptFromProtobuf(resp.query.GetTransactionGetReceipt().GetReceipt())
+ }
+
+ return receipt, ErrHederaReceiptStatus{
+ TxID: precheckErr.TxID,
+ Status: precheckErr.Status,
+ Receipt: receipt,
+ }
}
return TransactionReceipt{}, err
}
