In most states, a complaint acts as the official charging document to charge you with possession with intent to deliver. The fact that you allegedly sold to an undercover cop is why you were charge with "intent to deliver" and not just simple possession.