If you use dried beans, soak them overnight and then cook them in fresh water without salt until they are soft.
Pour the beans into a colander and collect the liquid. Peel the onion and chop finely. Wash the tomatoes, remove the stems and cut the tomatoes into small cubes.
Heat oil or ghee in a saucepan and fry the onions in it over medium heat for about 3 minutes until golden brown. Add the tomatoes and fry for 1 minute. Mix all the spices well and add to the onions and tomatoes together with the beans, stir well and fry for 5 minutes while stirring.
Deglaze with a little cooking liquid from the beans or some of the liquid collected from the glass and cook for another 5 minutes over medium heat. Season to taste with salt.