Open
Description
Overview
Enhance niljs transaction methods to return both transaction hash and detailed status information without requiring developers to manually loop through nested JSON structures.
Background
Currently, when using methods like smartAccount.sendTransaction
or smartAccount.deployContract
, developers only receive a transaction hash. To determine transaction status and error information, they must call client.getTransactionReceipt
, then manually loop through complex nested JSON structures to check for failure flags and extract error messages.
Feature Requirements
Improve transaction-related methods in niljs to:
- Return transaction hash along with parsed status information in a single response
- Automatically extract and surface error messages when transactions fail
- Eliminate the need for manual JSON traversal to determine transaction outcomes
Technical Implementation Steps
-
Create a transaction result parser:
- Implement logic to traverse transaction receipt JSON
- Extract status flags and error messages from nested structures
- Transform complex receipt data into developer-friendly format
-
Enhance transaction method return objects:
- Return both transaction hash and parsed status information
- Include formatted error messages when transactions fail
- Provide boolean success indicator for quick status checks
-
Update interfaces:
- Modify return types for all transaction methods
- Ensure backward compatibility with existing code
- Document new return object structure
-
Implement error categorization:
- Standardize error message formats
- Group common error types for easier handling
- Provide context-specific error information
Technical References
Acceptance Criteria
- All transaction methods return an object containing:
- Transaction hash
- Success/failure status
- Detailed error message when applicable
- Developers no longer need to manually traverse nested JSON
- Failed transactions have clear, actionable error messages
- Existing code expecting only transaction hash continues to work
- Changes follow consistent patterns across the library
Metadata
Metadata
Assignees
Labels
No labels