Toast the whole spices. Put the coriander, cumin and fennel seeds in a dry small pan over medium heat and shake for 2 minutes, until they smell nutty and a shade darker. Tip onto a plate to cool, then grind fine in a spice grinder or mortar.
Make the paste. Blend the shallots, garlic, ginger, galangal, lemongrass, ground toasted spices, turmeric, chili powder, salt, sugar and water to a thick, fairly smooth paste. Scrape down the sides a couple of times. Add another tablespoon of water only if the blender will not catch.
Marinate. Toss the chicken pieces with the paste in a bowl until every piece is coated. Cover and refrigerate for at least 30 minutes, or up to overnight. Longer is better.
Coat. Just before cooking, sprinkle the rice flour and cornstarch over the marinated chicken and toss again so the paste turns tacky and slightly dry on the surface. Do not rinse off the marinade; the flour binds to it.
Preheat the air fryer to 400F (200C) for 3 minutes. Lightly oil the basket or rack. Arrange half the chicken in a single layer with space between the pieces, then drizzle or spray with a little of the oil.
Air fry for 9 minutes, flip each piece, tuck the curry leaves in the gaps, and cook another 8 to 9 minutes until the crust is deep golden with darker edges and the thickest piece reads at least 170F (77C) on a thermometer. Thighs are more forgiving than breast, so a few degrees over is fine.
Transfer to a plate and repeat with the second batch. Pile the crisp curry leaves on top and serve hot with lime wedges, rice and sambal.