Can i jailbrake my iphone 7 that i have with sprint on their iphone forever plan & still trade it in when the next one comes out?

Side question: can i trade it in for a product red iphone?

Technically jailbreaking voids the warranty, but I don't think they'd notice if you restored it back to official firmware before trading it in.