user4960: I'm doing integration tests with Emulation
As far as I understand under emulation wallets have initial funds.
Example:
test :: IO ()
test = runEmulatorTraceIO $ do
    let 
        w1 = knownWallet 1
        walletAddress = mockWalletAddress w1
        # how to get utxos for walletAddress under emulator ????


user6113: This helper function can help you. It returns the list of TxOutRef and TxOut owned by an address.
import Control.Lens
import qualified Data.Map as Map
import Ledger 
import Ledger.Index
import Plutus.Trace.Emulator qualified as Trace

getUtxos :: Address -> Trace.EmulatorTrace [(TxOutRef, TxOut)]
getUtxos addr = do
    state <- Trace.chainState
    let utxoIndex = getIndex $ state ^. Trace.index 
        utxos     =  [(oref, o) | (oref, o) <- Map.toList utxoIndex, txOutAddress o == addr]
    pure utxos    


4960: <p>I'm doing integration tests with Emulation
As far as I understand under emulation wallets have initial funds.</p>
<p>Example:</p>
<pre><code>test :: IO ()
test = runEmulatorTraceIO $ do
    let 
        w1 = knownWallet 1
        walletAddress = mockWalletAddress w1
        # how to get utxos for walletAddress under emulator ????
</code></pre>
 6113: <p>This helper function can help you. It returns the list of <strong>TxOutRef</strong> and <strong>TxOut</strong> owned by an address.</p>
<pre><code>import Control.Lens
import qualified Data.Map as Map
import Ledger 
import Ledger.Index
import Plutus.Trace.Emulator qualified as Trace

getUtxos :: Address -&gt; Trace.EmulatorTrace [(TxOutRef, TxOut)]
getUtxos addr = do
    state &lt;- Trace.chainState
    let utxoIndex = getIndex $ state ^. Trace.index 
        utxos     =  [(oref, o) | (oref, o) &lt;- Map.toList utxoIndex, txOutAddress o == addr]
    pure utxos    
</code></pre>
