Kupowałeś and zgubiłeś are also correct in this example.
It clearly specifies "your" wallet, so I wrote "... twoj portfel", and it was NOT accepted. If it was "...when you lost the wallet" then I would have written ".... gdy zgubiles portfel". Reported but I don't think they will bother responding.
I used swojego portfel
Swojego is either genitive or masculine animate accusative, but portfel is masculine inanimate accusative, so we need swój in this sentence.