Design APIs with clean abstractions, logical data organization, and proper layer separation. Structure interfaces to group related data hierarchically and provide convenient helper functions instead of requiring manual object construction.
Key principles:
Example of good API design:
// Instead of manual object construction:
let currentTransactionParams = {
account: account.address,
abi: ucs03ZkgmAbi,
chain: sepolia,
// ... many more fields
}
// Provide helper constructors:
const params = createTransactionParams({
sourceChain: Chain,
ucs03address: Address,
value: BigInt,
baseToken: Address,
receiver: Hex
});
For GraphQL APIs, structure queries to reflect logical relationships and handle data processing at the appropriate layer rather than pushing complexity to consumers.
Enter the URL of a public GitHub repository