Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.3 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';

export const getTransactionLogs = createAction({
  name: 'get_transaction_logs',
  classification: 'SEARCH',
  displayName: 'Get Transaction Logs',
  description: 'Get list of logs generated by a transaction',
  audience: 'both',
  aiMetadata: { description: 'List the event logs emitted by one Ethereum transaction, identified by its hash (decoded contract events with topics and data). Read-only. Use this to inspect what events a transaction fired; for the resulting account/storage changes use Get Transaction State Changes instead.', idempotent: true },
  // category: 'Transactions',
  props: {
    transactionHash: Property.ShortText({
      displayName: 'Transaction Hash',
      description: 'Hash of the transaction to fetch logs for',
      required: true,
    }),
  },
  async run(context) {
    const response = await httpClient.sendRequest({
      method: HttpMethod.GET,
      url: `https://eth.blockscout.com/api/v2/transactions/${context.propsValue.transactionHash}/logs`,
    });
    if (response.status !== 200) {
      throw new Error(`Blockscout API request failed with status ${response.status}`);
    }
    return response.body;
  },
});