The client will ask for a specific thing to be done. Give the client a specific price for that thing. That's it.
How you calculate that is your business. Personally, I figure out the worst-case scenario and price it for that. If I finish earlier, because of my brilliance, well we can just call that profit.
You're happy because you just finished something high quality and in good time. The client is thrilled because they knew what they were going to pay, got what they wanted, and got it quickly and professionally. The client didn't have to worry about hourly rates or daily rates, unexpected surprises, etc. they knew what they were going to pay. You took the risk out of the transaction for the client and made a good amount of cash for yourself. Everybody wins.