Looking at the above, I can approve a transaction taking the txHash from the API. But if I want to execute the transaction as below it takes a safeTransaction

const ethAdapterOwner3 = new EthersAdapter({ ethers, signer: owner3 })
const safeSdk3 = await safeSdk2.connect({ ethAdapter: ethAdapterOwner3, safeAddress })
const executeTxResponse = await safeSdk3.executeTransaction(safeTransaction)
await executeTxResponse.wait()

How do I load back the safeTransaction? My usecase is that when a transaction is created, owners will be notified and they'll be informed to login to the app to sign the transactions.


1 Answer 1


All the parameters of a Safe transaction are available via the Safe transaction service. The Safe core sdk provides a Safe Service Client package for easy interaction with the api.

There you can use the safeService.getTransaction(safeTxHash) to retrieve the information.

Full example would be along the lines of:

import SafeServiceClient from '@gnosis.pm/safe-service-client'

// Mainnet service url
const safeService = new SafeServiceClient('https://safe-transaction.mainnet.gnosis.io')
const apiTx: SafeMultisigTransactionResponse = await safeService.getTransaction(safeTxHash)
const safeTx = await safeSdk3.createTransaction({
  data: apiTx.data || "0x",
  gasPrice: parseInt(apiTx.gasPrice)
// Sign transaction as owner 3
await safeSdk3.signTransaction(safeTx)
const { hash } = await safeSdk3.executeTransaction(safeTx)

Currently it is not easily possible to use the confirmations from the service with the core sdk.

You can map the confirmations returned from the api with the following code:

import { EthSignSignature } from '@gnosis.pm/safe-core-sdk'
apiTx.confirmations?.forEach((confirmation) => {
  safeTx.addSignature(new EthSignSignature(confirmation.owner, confirmation.signature))

I created the following issues to improve this flow:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.