A transformer provides AC, your PSU provides 12V DC. That makes an important difference to me.
Connect the motor power only and directly to the driver board. Also connect Arduino GND to the board GND, so that no motor current can flow through a digital GND wire.
Make sure that the encoder is isolated from the motor wires.