Which SolvePnp method returns the most accurate translation and rotation?

I want to find a target with my camera. I need the transformation T_B^t= where B is the base and t is the target (i.ie the target in the base frame). From the function hand-eye() I get the transformation T_C^G. The other matrices that exist is the T_C^t which is the target in the camera frame and the T_B^G transformation from base to gripper. To get the target is this the correct formula?

{T_C^G}^{-1}=T_G^C
T_B^T=T_B^G\cdot T_G^C \cdot T_C^t

In the code I found this line:

    Mat T_base2cam = homogeneousInverse(T_cam2gripper) * homogeneousInverse(T_gripper2base);

However, I dont get the order and the inverse and i am not sure if this is the one i am looking for. Where is the eye in hand part?

I tried the one from the code and it looks like It might be what I am looking for. Is it possible that you can explain it? Why am I wrong?