import { Tabs } from 'nextra/components'
Decodes the specified Safe transaction data.
{/* */}
<Tabs items={['example.ts', 'setup.ts']}> <Tabs.Tab> ```typescript import { apiKit } from './setup.ts'
const data = '0x...'
const decodedData = await apiKit.decodeData(data)
```
</Tabs.Tab> <Tabs.Tab> ```typescript import SafeApiKit from '@safe-global/api-kit'
export const apiKit = new SafeApiKit({
chainId: 1n, // Mainnet
})
```
</Tabs.Tab>
{/* */}
Promise<DataDecoded>
The transaction data decoded.
type DataDecoded = {
readonly method: string
readonly parameters: DecodedParameters[]
}
- Type:
string
The Safe transaction data to decode.
const decodedData = await apiKit.decodeData('0x...')
- Type:
string
The address of the receiving contract. If provided, the decoded data will be more accurate, as in case of an ABI collision the Safe Transaction Service would know which ABI to use
const decodedData = await apiKit.decodeData(
'0x...',
'0x...'
)