You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use contract api as a fallback for decoding if signature based fails (#170)
### TL;DR
Improved transaction and log decoding logic by adding fallback mechanisms and validation checks.
### What changed?
- Extracted decoding logic into separate functions `decodeLogsIfNeeded` and `decodeTransactionsIfNeeded`
- Added validation to check if ABI decoding was successful by verifying name and signature fields
- Implemented fallback to contract service decoding when ABI decoding fails
- Simplified the main handler logic by consolidating decoding paths
### How to test?
1. Test log decoding with valid ABI:
- Send request with `decode=true` and valid event ABI
- Verify logs are decoded correctly
2. Test transaction decoding with invalid ABI:
- Send request with `decode=true` and invalid function ABI
- Verify fallback to contract service decoding
3. Test with decoding disabled:
- Send request with `decode=false`
- Verify raw logs/transactions are returned
### Why make this change?
The previous implementation didn't handle ABI decoding failures gracefully. This change ensures more reliable decoding by validating the results and falling back to the contract service when needed, improving the overall robustness of the API.
0 commit comments