Can I sell a plugin that extends an existing premium theme(that's not mine)

So, I’m a freelancer wordpress developer… I recently made a custom plugin for a client, that plugin EXTENDS the functionality of a certain premium theme; which means the plugin is actually based on the theme and can’t work anywhere else.
So I was wondering:
Does that conflict with any copyright laws or something of that sort? And is such a plugin accepted as a product on Codecanyon

There are add-ons available on codecanyon, although these tend to be extensions of plugins rather than of a theme itself.

It should be ok but I’d suggest double checking with support and also making sure you let the theme author know/get permission from them potentially.