getSafeAddressFromDeploymentTx
Returns the Safe address from a Safe deployment transaction receipt.
It scans the events emitted during the execution of the transaction to identify the creation event (opens in a new tab) and return its address.
Usage
_21import { getSafeAddressFromDeploymentTx } from '@safe-global/protocol-kit'_21import { createWalletClient, http } from 'viem'_21import { privateKeyToAccount } from 'viem/accounts'_21import { sepolia } from 'viem/chains'_21import { waitForTransactionReceipt } from 'viem/actions'_21import { protocolKit } from './setup.ts'_21_21const account = privateKeyToAccount('0x...')_21const client = createWalletClient({_21 account,_21 chain: sepolia,_21 transport: http('https://rpc.ankr.com/eth_sepolia')_21})_21const transactionReceipt = await waitForTransactionReceipt(client, {_21 hash: '0x...'_21})_21_21const safeAddress = getSafeAddressFromDeploymentTx(_21 transactionReceipt,_21 safeVersion: '1.4.1'_21)
Parameters
transactionReceipt
- Type:
FormattedTransactionReceipt
The transaction receipt of the Safe deployment.
_10const safeAddress = getSafeAddressFromDeploymentTx(_10 transactionReceipt,_10 '1.4.1'_10)
safeVersion
The version of the Safe account.
_10const safeAddress = getSafeAddressFromDeploymentTx(_10 transactionReceipt,_10 '1.4.1'_10)
Returns
string
The address of the deployed Safe account.