The Giants essentially bought veteran infielder Zack Cozart's contract from the Angels on Tuesday to add a talented young prospect.

San Francisco acquired Cozart and middle infield prospect Will Wilson from the Angels for a player to be named later or cash. The Giants are taking on all of Cozart's $12.67 million contract for the 2020 season. Cozart will become a free agent in 2021. The 34-year-old, who has hit just .190 with five home runs the last two seasons, was an All-Star when healthy in 2017, but Wilson is the real prize of the deal.

Wilson was selected No. 15 overall by the Angels in the 2019 MLB Draft. He immediately became a top-10 Giants prospect after the trade. MLB Pipeline ranks him No. 10 overall in the team's farm system, and FanGraphs has him even higher.

Will Wilson enters as the #SFGiants No. 10 prospect https://t.co/3hoo4GnI60 — Dalton Johnson (@DaltonJ_Johnson) December 11, 2019

FanGraphs has Will Wilson as the #SFGiants No. 7 prospect https://t.co/OIO0vFC4QQ — Dalton Johnson (@DaltonJ_Johnson) December 11, 2019

The 21-year-old hit .275 with a .768 OPS and five home runs in 46 games at rookie ball in his debut season. He played 28 games at shortstop and 13 at second base. President of baseball operations Farhan Zaidi said Wilson will play both positions in the minor leagues, and the front office believes he will stick as a middle infielder.

[RELATED: New Giants prospect Wilson already hates rival Dodgers]

Wilson was a consensus All-American as a junior at NC State, and was voted ACC Defensive Player of the Year. He hit .352 with nine homers and a 1.089 OPS in his final season for the Wolfpack.

Prior to being traded to the Giants, Wilson was ranked as the Angels' No. 4 prospect, according to MLB Pipeline. He comes in lower with San Francisco, showing how much the Giants' farm system is on the rise with top prospects like Joey Bart, Heliot Ramos, Marco Luciano and others.