API: Get solana leader's IP and TPU port list for next N secs.

Job ID: 39247239

Budget: $30 – $250 CAD

Code need to be wrote in Rust.
The API takes a slot number(current_slot) and seconds(window_n) as input and calculates who will be leader in next window_n secs, return the list of validator IP/Port as output. The return list/Vec should be sorted in time ascend way and same validator should be merged into one entry(for example if there's 8 slots for one validator in next window_n secs, should return only one entry for that validator).
The API should get leader schedule and cluster nodes from RPC ONCE per epoch.

The API is defined as

struct LeaderInfo {
validator: String,
ip: String,
tpu_port: u16,
slot: u64, //the earliest slot for this validator.
}
fn get_leaders(current_slot: u64, window_n: u16) -> Result<Vec<LeaderInfo>, Error>
~
Related categories: Blockchain Rust Solana