The following from Get help with iCloud Photos - Apple Support may describe what you did and may help undo that:
How do I remove all iCloud Photos content from iCloud and my devices?
To turn off your iCloud Photos everywhere, follow these steps:
- On your iPhone, iPad, or iPod touch, go to Settings > [your name] > iCloud > Manage Storage > Photos, then tap Disable & Delete.
- On your Mac, go to Apple menu > System Preferences, then click Apple ID. Choose iCloud, then click Manage. Select Photos, then click Turn Off and Delete.
If you change your mind, follow the steps above on your device then select Undo Delete.
Photos and videos are stored in your account for 30 days. To download your photos and videos on your iOS device, go to Settings > [your name] > iCloud > Photos and select Download and Keep Originals. On your Mac, open Photos, choose Photos > Preferences, then click iCloud, then select Download Originals to this Mac. You can also select the photos and videos that you want to download from iCloud.com.
If you still have the old phone and are able to undo the delete, when you are again ready to clear the old phone, use the following procedure. It won't affect iCloud or your new phone: What to do before you sell, give away, or trade in your iPhone, iPad, or iPod touch - Apple Support