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.4 KB
Raw Blame
import { createAction, PieceAuth, Property } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { MEMPOOL_API_BASE_URL } from '../../common';

export const getTransactionOutspend = createAction({
 auth:PieceAuth.None(),
  name: 'get_transaction_outspend',
  displayName: 'Get Transaction Output Spend Status',
  description: 'Get the spending status of a specific transaction output',
  audience: 'both',
  aiMetadata: { description: 'Check whether one specific output (by transaction ID plus 0-based output index/vout) has been spent. Pick this when you care about a single output; use Get All Transaction Output Spend Statuses to check every output of a transaction at once. Read-only.', idempotent: true },
  // category: 'Transactions',
  props: {
    txid: Property.ShortText({
      displayName: 'Transaction ID',
      description: 'The transaction ID to check output spending status',
      required: true,
    }),
    vout: Property.Number({
      displayName: 'Output Index',
      description: 'The index of the output to check (0-based)',
      required: true,
    }),
  },
  async run({ propsValue }) {
    const response = await httpClient.sendRequest({
      method: HttpMethod.GET,
      url: `${MEMPOOL_API_BASE_URL}/api/tx/${propsValue.txid}/outspend/${propsValue.vout}`,
    });
    return response.body;
  },
});