Skip to main content

ABI Format for Event Monitoring

Required Format​

Event subscriptions use the formattedAbiEvent parameter in this format:

formattedAbiEvent: 'event Transfer(address indexed from, address indexed to, uint256 value)'

Converting from Raw ABI​

Use abitype to convert raw ABI objects:

import { formatAbiItem } from 'abitype';

const rawEventAbi = {
anonymous: false,
inputs: [
{ indexed: true, name: 'from', type: 'address' },
{ indexed: true, name: 'to', type: 'address' },
{ indexed: false, name: 'value', type: 'uint256' },
],
name: 'Transfer',
type: 'event',
};

const formattedAbiEvent = formatAbiItem(rawEventAbi);
// Result: 'event Transfer(address indexed from, address indexed to, uint256 value)'

Common Examples​

// ERC20 events
'event Transfer(address indexed from, address indexed to, uint256 value)'
'event Approval(address indexed owner, address indexed spender, uint256 value)'

// Custom events
'event CustomEvent(uint256 indexed id, string data, bool flag)'

Automatic Validation​

MOUNTAIN automatically validates and formats event definitions during subscription creation. Invalid formats are rejected with detailed error messages.