thirdweb-dev / engine

The most powerful backend engine for web3 apps.
https://thirdweb.com/engine
Apache License 2.0
152 stars 59 forks source link

support `errorMessage` field for mined but reverted userops #637

Closed d4mr closed 2 months ago

d4mr commented 2 months ago

This commit adds support for handling error messages in mined transactions. The MinedTransaction type in types.ts now includes an optional errorMessage field. In the mineTransactionWorker.ts file, the code has been updated to retrieve and store the error message if the userOpReceipt is not successful. This allows for better error handling and reporting for mined transactions.


PR-Codex overview

This PR adds functionality to capture error messages for mined transactions and updates mineUserOp function to handle user operation receipts.

Detailed summary

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

d4mr commented 2 months ago

tested:

{
    "result": {
        "queueId": "346eff2c-8fab-4f89-b6e1-0888d7e765aa",
        "status": "mined",
        "chainId": "421614",
        "fromAddress": "0xEf553047b160395c2e14268860660A3F55f09141",
        "toAddress": "0x71B6267b5b2b0B64EE058C3D27D58e4E14e7327f",
        ...
        "errorMessage": "UserOp failed with reason: 'not minter.' at txHash: 0x21904b8721a876711444788a8ec81d11cde7ad42c6a5a07ec1349a65af6150b0",
        ...
    }
}