Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.0

Parse data

Moralis makes it easy to parse data from ERC20 Transfers and Approvals, NFT Transfers and Approvals, and Smart Contract Events. Stream your smart contract events and use our code as a guide to quickly and accurately extract the data into a typed data structure.

Moralis automatically parses the following data for you:

  • ERC20 Transfers and Approvals
  • NFT Transfers and Approvals

Parsing Smart Contract Events

If you are streaming a smart contract event you can use the code below as a guide to extract the data from the webhook into a typed data structure.

import Moralis from 'moralis';
import { BigNumber } from '@moralisweb3/core';

const test = async () => {

interface URI{
value: string;
id: BigNumber;

const webhookData = {
confirmed: true,
chainId: '0x1',
abi: [
anonymous: false,
inputs: [
indexed: false,
internalType: 'string',
name: 'value',
type: 'string',
indexed: true,
internalType: 'uint256',
name: 'id',
type: 'uint256',
name: 'URI',
type: 'event',
streamId: 'b4dbc80e-8161-43d8-9c5a-05a8a4bba988',
tag: 'URI-listener',
retries: 0,
block: {
number: '15933519',
hash: '0x192357541e97093ebdf99b4a04e7e33726b6eb01f88f7ab3df3ab2dc5242147c',
timestamp: '1668009611',
logs: [
logIndex: '475',
address: '0x495f947276749ce646f68ac8c248420045cb7b5e',
data: '0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569687366326568636c78796d793467366836697163627361346c6961637a6f716b7373666b6e70787535796a356f67696a6f667175000000000000000000000000000000000000000000000000000000000000',
topic2: null,
topic3: null,
txs: [],
txsInternal: [],
erc20Transfers: [],
erc20Approvals: [],
nftApprovals: { ERC1155: [], ERC721: [] },
nftTransfers: [],

const decodedLogs = Moralis.Streams.parsedLogs<URI>(webhookData);