Required packages:
Transactions confirmation can be on-chain and off-chain.
import EthersSafe from '@gnosis.pm/safe-core-sdk'
const safeSdk = await EthersSafe.create({ ethers, safeAddress, providerOrSigner })
const signature = await safeSdk.signTransaction(safeTransaction)
This implies that the signature must be published through the Safe Transaction Service API, using the @gnosis.pm/safe-service-client.
const safeService = new SafeServiceClient(SAFE_TRANSACTION_SERVICE_URL)
const safeTxHash = await safeCoreSdk.getTransactionHash(transaction)
await safeServiceClient.confirmTransaction(safeTxHash, signature.data)
const txHash = await safeSdk.getTransactionHash(safeTransaction)
const approveTxResponse = await safeSdk.approveTransactionHash(txHash)
await approveTxResponse.wait()
It is also possible to retrieve all the owners who approved a transaction:
const ownersWhoApproved = await safeSdk.getOwnersWhoApprovedTx(txHash)
const txResponse = await safeSDk.executeTransaction(safeTransaction)
await txResponse.wait()
The transaction execution includes the signing of the transaction, so if there is only one missing signature to reach the threshold, the signature step can be skipped, and the transaction can be executed directly.
Go to top