matic.js internally use ExitUtil for generating proofs. It is a class which has different methods for helping with exit utilities.
buildPayloadForExit
It exposesbuildPayloadForExit method which can be used to generate proof.
Generating proof using a bridge client
Every bridge client, includingPOSClient exposes the exitUtil property.