Transaction data decoder
This guide shows how to use the Safe Transaction Service API to decode transaction data for contract interactions.
The different steps are implemented using Curl (opens in a new tab) requests and the Safe{Core} SDK (opens in a new tab) TypeScript library.
Prerequisites
- Node.js and npm (opens in a new tab) when using the Safe{Core} SDK.
- Have a Safe account.
Steps
Install dependencies
_10yarn add @safe-global/api-kit
Imports
_10import SafeApiKit from '@safe-global/api-kit'
Decode transaction data
_10// Initialize the API Kit_10const apiKit = new SafeApiKit({_10 chainId: 11155111n_10})_10_10const data = "0x095ea7b3000000000000000000000000e6fc577e87f7c977c4393300417dcc592d90acf8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"_10const dataDecoded = await apiKit.decodeData(data)_10_10// This decoded data is also included as dataDecoded in the response of the apiKit's getMultisigTransactions, getModuleTransactions, and getAllTransactions methods.