Before implementing custom API utilities, serializers, or type identification methods, check if equivalent functionality already exists in the codebase or standard libraries. This prevents code duplication, ensures consistency across the API surface, and leverages well-tested implementations.
Key practices:
Examples from the codebase:
// Instead of custom deserializer:
#[serde(default, deserialize_with = "deserialize_opt_u64_from_string")]
// Use existing utility:
// Available in serde_utils crate
// Instead of hardcoded type URLs:
type_url: "/ibc.applications.transfer.v1.MsgTransfer".to_string(),
// Use trait method:
type_url: MsgTransfer::type_url(),
// Avoid incompatible features:
#[sol(rpc, all_derives)] // Don't use 'rpc' in cosmwasm contracts
This approach reduces maintenance burden, improves code reliability, and maintains API consistency across the project.
Enter the URL of a public GitHub repository