Usually, the first wallet upgrade occurs at the pawnshop, and then with gems. A hint about the formulas is found in one of the books in the Agranor library (Book of Fusions, the book usually becomes available as part of the story).