API
Guides
Data decoder

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

  1. Node.js and npm (opens in a new tab) when using the Safe{Core} SDK.
  2. Have a Safe account.

Steps

Install dependencies


_10
yarn add @safe-global/api-kit

Imports


_10
import SafeApiKit from '@safe-global/api-kit'

Decode transaction data


_10
// Initialize the API Kit
_10
const apiKit = new SafeApiKit({
_10
chainId: 11155111n
_10
})
_10
_10
const data = "0x095ea7b3000000000000000000000000e6fc577e87f7c977c4393300417dcc592d90acf8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
_10
const 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.

Was this page helpful?