Skip to content
Template-TXN (Transaction Tracking) 📈

When to use: For protocols that only need to track individual transactions without balance state.

Best for:

  • DEX swap tracking
  • Bonding curve protocols
  • Auction platforms
  • Simple transaction logging
  1. Copy the template:

    cd projects
    cp -r template-txn your-protocol-name
  2. Update package.json:

    {
      "name": "@absinthe/your-protocol-name",
      "description": "Absinthe adapter for YourProtocol"
    }
  3. Add your contract ABIs:

    # Replace mint.json with your actual contract ABIs
  4. Update configuration: Add to abs_config.json:

    {
      "txnTrackingProtocols": [
        // or appropriate protocol type
        {
          "type": "your-protocol-name",
          "name": "your-protocol-instance",
          "contractAddress": "0x...",
          "chainId": 1,
          "fromBlock": 12345678,
          "toBlock": 0
        }
      ]
    }
  5. Minify the JSON

    • Remove all whitespace and newlines to make it a single-line string.
    • You can use tools like jsonformatter.org or run:
      • cat abs_config.example.json | jq -c
  6. Wrap in Single Quotes

    • The final string should be wrapped in single quotes ('...') when setting it in your .env file.
  7. Set in Your Environment

  • Open your .env file and add or update the ABS_CONFIG line:
    • ABS_CONFIG='{"balanceFlushIntervalHours":6,"dexProtocols":[...]}'
  • Tip: If you don’t set ABS_CONFIG, the code will fall back to abs_config.example.json (see below). You can refer to Getting Started Guide for more details.
  1. Generate types and run:

    pnpm typegen   # Generate ABI types
    pnpm codegen   # Generate TypeORM models
    pnpm migration # Run database migrations
    pnpm dev       # Start development
  2. Customize the logic:

    • Update src/BatchProcessor.ts with your protocol's event handling
    • Modify src/processor.ts with correct events and contract addresses
    • Implement your specific business logic