Public Key Best Practices
Recommendations
Validate First
Always validate addresses using validateAddress() before performing public key lookups to avoid unnecessary API calls and handle invalid input gracefully.
Batch Requests
Use getPublicKeysInfo() for multiple addresses to reduce network overhead and improve performance compared to individual lookups.
Handle Missing Data
Not all addresses have associated public key information. Check for missing entries in the returned map and handle these cases appropriately.
Cache Results
Public key information does not change once established. Results can be cached indefinitely to minimize redundant API calls.
Contract Flag
Set isContract to true when resolving contract addresses to ensure the correct key hierarchy is returned.
Enable Logging
Use logErrors: true during development to identify addresses that fail resolution and diagnose lookup issues.