Protocol Kit Reference
Deployment
getSafeAddressFromDeploymentTx

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


_21
import { getSafeAddressFromDeploymentTx } from '@safe-global/protocol-kit'
_21
import { createWalletClient, http } from 'viem'
_21
import { privateKeyToAccount } from 'viem/accounts'
_21
import { sepolia } from 'viem/chains'
_21
import { waitForTransactionReceipt } from 'viem/actions'
_21
import { protocolKit } from './setup.ts'
_21
_21
const account = privateKeyToAccount('0x...')
_21
const client = createWalletClient({
_21
account,
_21
chain: sepolia,
_21
transport: http('https://rpc.ankr.com/eth_sepolia')
_21
})
_21
const transactionReceipt = await waitForTransactionReceipt(client, {
_21
hash: '0x...'
_21
})
_21
_21
const safeAddress = getSafeAddressFromDeploymentTx(
_21
transactionReceipt,
_21
safeVersion: '1.4.1'
_21
)

Parameters

transactionReceipt

  • Type: FormattedTransactionReceipt

The transaction receipt of the Safe deployment.


_10
const safeAddress = getSafeAddressFromDeploymentTx(
_10
transactionReceipt,
_10
'1.4.1'
_10
)

safeVersion

The version of the Safe account.


_10
const safeAddress = getSafeAddressFromDeploymentTx(
_10
transactionReceipt,
_10
'1.4.1'
_10
)

Returns

string

The address of the deployed Safe account.

Was this page helpful?