Best Practices
When working with the Actions SDK, following these best practices will help you create more effective and user-friendly Actions:
Keep Actions Simple and Focused: Each Action should have a clear, single purpose. If you find an Action becoming too complex, consider breaking it into multiple Actions.
Use Descriptive Titles and Labels: Make sure your Action's title, description, and labels clearly communicate what the Action does. This helps users understand the purpose of the Action at a glance.
Provide Meaningful Error Messages: When defining error responses, make them informative and actionable. Help the user understand what went wrong and how they might resolve the issue.
Utilize Input Validation: When asking for user input, use appropriate input types and validation to ensure data integrity and improve user experience.
Leverage Global Inputs: Use global inputs (like the user's wallet address) where appropriate to minimize the amount of information users need to input manually.
Design for Different Network Conditions: Consider how your Action will behave under different network conditions or when transactions take longer than expected. Provide appropriate feedback to the user.
Test Thoroughly: Test your Actions under various conditions and on different networks (mainnet, testnet) to ensure they behave as expected.
Keep Security in Mind: When dealing with transactions, always consider the security implications. Never hardcode private keys or sensitive information in your Actions.
Use Computed Inputs Wisely: Computed inputs can be powerful for creating dynamic Actions, but use them judiciously to avoid overly complex logic.
Document Your Actions: Provide clear documentation for your Actions, especially if they're intended for use by other developers.
Stay Updated: Keep your Actions SDK and related dependencies up to date to benefit from the latest features and security updates.
Consider Gas Costs: When designing Actions that involve transactions, be mindful of the potential gas costs for users. Consider implementing gas estimation where appropriate.
By following these best practices, you can create Actions that are more robust, user-friendly, and maintainable.
Last updated