Updated

A Los Angeles man was arrested Wednesday on charges that he sold counterfeit opioid pills to Mac Miller two days before the rapper died of an overdose.

Cameron James Pettit, 23, who lives in the Hollywood Hills, is expected to appear in court later Wednesday, federal prosecutors said in a statement.

The 26-year-old Miller was found dead by his assistant at his San Fernando Valley home on Sept. 7, 2018.

MAC MILLER DIED FROM MIX OF FENTANYL, COCAINE AND ETHANOL, CORONER SAYS

A Drug Enforcement Agency affidavit alleges that Miller asked Pettit for oxycodone and other drugs, but on Sept. 5, 2018, Pettit gave Miller counterfeit oxycodone pills laced with the powerful opioid fentanyl.

An autopsy found that Miller died from an accidental overdose, via a combination of fentanyl, cocaine and alcohol.

Rapper Mac Miller performs on his Space Migration Tour at Festival Pier in Philadelphia. (Owen Sweeney/Invision/AP, File)

Authorities found drugs they believe were from Pettit in Miller's home, and evidence that Miller had crushed and sniffed oxycodone provided by Pettit.

ARIANA GRANDE GETS EMOTIONAL IN 'VOGUE' INTERVIEW ABOUT MAC MILLER, MANCHESTER BOMBING AND PETE DAVIDSON

Pettit has only been charged with providing the drugs, however, and not with having a direct role in Miller's death.

After reports of Miller's death circulated, Pettit sent an Instagram message to a friend saying, "Most likely I will die in jail," according to the affidavit.

Investigators also obtained text messages between Miller and Pettit before the sale, in which Miller proclaims his love for oxycodone, or "percs" for the brand name Percocet, and also asks for "bars" of Xanax and a "ball" of cocaine.

ARIANA GRANDE REMEMBERS LATE BOYFRIEND, MAC MILLER, ON HIS 27TH BIRTHDAY: 'MISS U'

"When can u get em?" Miller asks, according to a transcript of the exchange contained in court filings.

"Probably in an hour or 2. They are 30 ea," Pettit replies.

FILE - In this July 13, 2013 file photo, rapper Mac Miller performs on his Space Migration Tour at Festival Pier in Philadelphia. Miller, the platinum hip-hop star whose rhymes vacillated from party raps to lyrics about depression and drug use, has died at the age of 26. A family statement released through his publicists says Miller died Friday, Sept. 7, 2018, and there are no further details available on how he died. (Photo by Owen Sweeney/Invision/AP, File)

The 26-year-old Miller was found dead by his assistant at his San Fernando Valley home on Sept. 7, 2018. (Photo by Owen Sweeney/Invision/AP, File)

"Any chance I can get 10 of those, 10 bars and a ball?" Miller asks.

"Yeah for sure," Pettit replies.

CLICK HERE TO GET THE FOX NEWS APP

The rapper, a Pittsburgh native whose work brought him wide respect in the hip-hop community, was in a two-year relationship with Ariana Grande that ended earlier in 2018.

He is the latest musician whose death has been linked in recent years to a national wave of opioid abuse and overdoses. Prince died in 2016 when he took counterfeit pills laced with fentanyl that looked like a generic version of the painkiller Vicodin.

Matthew Roberts, guitarist for the band 3 Doors Down, also died of an overdose in 2016, and had fentanyl and hydrocodone in his system.