This implements a proposal in #10599.
Complementary method to listreceivedbyaddress that can be useful for statistics gathering and various layer 2 protocols like TumbleBit (ping @NicolasDorier) and authentication protocols I’m currently working on.
Since this replaces ListReceived with ListByAddress parameterized with received/sent flag, other methods like listsentbylabel (complementary to listreceivedbylabel) and getsentbyaddress (complementary to getreceivedbyaddress) can be implemented as well.