Best Practices and Common Issues
Best Practices
Wallet Usage
Import wallet instance directly (e.g., untitledWallet)
Use wallet.info.name for chain wallet initialization
Ensure wallet is properly configured
Add Encoders Early
Add all required encoders before using the signing client
Add them in your component initialization or setup phase
Error Handling
Always wrap signing operations in try-catch blocks
Handle specific error types appropriately
Provide user feedback for transaction status
Fee Estimation
Always provide appropriate fees for transactions
Consider using fee estimation for complex transactions
Include enough gas for the operation
Message Construction
Use MessageComposer for type-safe message creation
Validate message parameters before sending
Include all required fields in messages
Common Issues
Wallet Configuration
Error: "Wallet not properly configured"
Solution: Ensure wallet is properly imported and configured
Missing Encoders
Error: "Unknown message type"
Solution: Add the required encoder using
addEncoders
Invalid Message Format
Error: "Invalid message format"
Solution: Use MessageComposer to create messages
Insufficient Fees
Error: "Insufficient fees"
Solution: Increase the fee amount or gas limit
Contract Execution Errors
Error: "Contract execution failed"
Solution: Check contract message format and parameters