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
-
Copy the template:
cd projects cp -r template-txn your-protocol-name
-
Update package.json:
{ "name": "@absinthe/your-protocol-name", "description": "Absinthe adapter for YourProtocol" }
-
Add your contract ABIs:
# Replace mint.json with your actual contract ABIs
-
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 } ] }
-
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
-
Wrap in Single Quotes
- The final string should be wrapped in single quotes ('...') when setting it in your .env file.
-
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.
-
Generate types and run:
pnpm typegen # Generate ABI types pnpm codegen # Generate TypeORM models pnpm migration # Run database migrations pnpm dev # Start development
-
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
- Update