The node you are looking for is at Pitches - Transposing pitches with minimum accidentals (« smart » transpose).