According to the Plutus team, the standard way of generating signed transactions containing smart contracts is to have the off-chain code generate a so called unbalanced transaction that is then, in a second step, balanced and signed by the user's wallet. The newest Nami-demo of the PAB repository follows this spirit and makes the observation that this balanceTx
method is currently missing in the Nami API. The demo implements a work around method for balancing and comments that this method could be deleted once Nami implements a proper API analog (see line 71 here).
I asked on the Nami repository if we could expect a method for balancing transactions soon: see-here. The answer was that such a method would be difficult to implement as smart contract execution costs —which are affected by the balancing— need to be factored into the fees and that this calculation needs the availability of Plutus Core (which I guess is not easily achievable for web extensions).
The only way left for implementing smart contracts is to hand over a fully built transaction to the wallet. When using the PAB, the Contract instance would need to build it using the wallet address (and optionally a pre-defined UTxO for the collateral) of the user. I haven't seen any code showing how to achieve this in the GitHub repository. How can this be done ?