Gnosis Safe – Troubleshooting deploySafe Function Not Returning Transaction Hash

gnosisgnosis-safesafe-core-sdk

Currently when we call the const safeSdk: Safe = await safeFactory.deploySafe({ safeAccountConfig }) then we have to wait for the transaction success and mainly for the newly deployed safe address. The problem with this is that let's say the user calls this function in the frontend with Metamask and then immediately closes the web app then we have no way of knowing the newly deployed safe address and therefore not able to store it in our backend. So, I think one solution would be if call the safe proxy contract directly instead of calling via SDK but not sure will it be a correct way or not as it might not update the gnosis' safe service client.

What should be the possible solution to handle this?

Best Answer

Thank you for reporting this! We are facing the same issue when integrating the Safe Core SDK into the Safe web interface.

We will implement a solution for this in the following days.

EDIT: This is now available for >=v2.1.0. See https://github.com/gnosis/safe-core-sdk/tree/main/packages/safe-core-sdk#deploysafe for more details.

const callback = (txHash: string): void => {
  console.log({ txHash })
}
const safeSdk = await safeFactory.deploySafe({ safeAccountConfig, callback })