# n8n-nodes-defillama

[![npm version](https://badge.fury.io/js/@cryptodevops%2Fn8n-nodes-defillama.svg)](https://badge.fury.io/js/@cryptodevops%2Fn8n-nodes-defillama)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Custom n8n node for DefiLlama API - Access DeFi protocols data, TVL, yields, and chain analytics with AI-powered insights.

## 🚀 Features

- **Protocol Analytics**: Get detailed information about DeFi protocols
- **TVL Data**: Access Total Value Locked data for protocols and chains
- **Yield Farming**: Discover yield farming opportunities across DeFi
- **Chain Analytics**: Analyze blockchain-specific DeFi metrics
- **Fees & Revenue**: Track protocol fees and revenue metrics
- **Stablecoins**: Monitor stablecoin market data and prices
- **DEX Analytics**: Access DEX volume and trading data
- **Bridge Analytics**: Cross-chain bridge volume and activity
- **Oracle Data**: Oracle protocols and Total Value Secured (TVS)
- **DeFi Categories**: Browse protocols by category
- **Fundraising**: Track DeFi raises and funding rounds
- **Security**: Monitor DeFi hacks and security incidents
- **AI Agent Mode**: Get AI-powered summaries and insights
- **Real-time Data**: Access live DeFi market data

## 📦 Installation

### Community Nodes (Recommended)

1. Go to **Settings** → **Community Nodes** in your n8n instance
2. Click **Install a community node**
3. Enter: `@cryptodevops/n8n-nodes-defillama`
4. Click **Install**

### Manual Installation

```bash
# In your n8n installation directory
npm install @cryptodevops/n8n-nodes-defillama

# Restart n8n
```

### Docker Installation

```bash
# Add to your n8n Docker environment
docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -e N8N_CUSTOM_EXTENSIONS="@cryptodevops/n8n-nodes-defillama" \
  n8nio/n8n
```

## 🎯 Available Operations

### Protocol Operations
- **List Protocols**: Get all DeFi protocols with TVL data
- **Get Protocol**: Detailed information about a specific protocol
- **Get Protocol TVL**: Simple TVL value for a protocol
- **Get Protocol Fees**: Protocol-specific fees and revenue data

### Chain Operations
- **List Chains**: Get all blockchain networks with TVL
- **Get Chain TVL**: Historical TVL data for a specific chain

### Yield Operations
- **Get Yield Pools**: Discover yield farming opportunities

### TVL Operations
- **Get Historical TVL**: Historical TVL data across all chains

### Fees & Revenue Operations
- **Get Fees Overview**: Overview of DeFi protocol fees and revenue
- **Get Protocol Fees**: Detailed fees data for specific protocols

### Stablecoin Operations
- **List Stablecoins**: Get all stablecoins with market data
- **Get Stablecoin Charts**: Historical price and supply charts
- **Get Stablecoin Prices**: Current stablecoin prices

### DEX Operations
- **Get DEXs Overview**: Overview of DEX volumes and metrics
- **Get DEX Volume**: Volume data for specific DEX

### Bridge Operations
- **List Bridges**: Get all cross-chain bridges
- **Get Bridge Volume**: Volume data for specific bridge

### Oracle Operations
- **List Oracles**: Get oracle protocols with TVS data

### Category Operations
- **List Categories**: Browse DeFi protocols by category

### Fundraising Operations
- **List Raises**: Track DeFi funding rounds and raises

### Security Operations
- **List Hacks**: Monitor DeFi security incidents and hacks

## 🤖 AI Agent Mode

Enable AI Agent mode to get intelligent summaries and insights:

```json
{
  "aiMode": true,
  "includeSummary": true
}
```

## 🔧 Configuration

### Optional API Key
While most endpoints work without authentication, you can optionally configure an API key:

1. Create **DefiLlama API** credentials
2. Add your API key (if you have one)
3. Use in your workflows

### Example Workflow

```json
{
  "nodes": [
    {
      "name": "Get Top Protocols",
      "type": "@cryptodevops/n8n-nodes-defillama",
      "parameters": {
        "resource": "protocol",
        "operation": "listProtocols",
        "additionalFields": {
          "maxResults": 10,
          "minTvl": 1000000000,
          "aiMode": true
        }
      }
    }
  ]
}
```

## 📊 Data Sources

This node connects to:
- **DefiLlama API**: `https://api.llama.fi/`
- **DefiLlama Yields**: `https://yields.llama.fi/`

## 🔗 Links

- [DefiLlama Website](https://defillama.com/)
- [API Documentation](https://defillama.com/docs/api)
- [GitHub Repository](https://github.com/GitCryptoDevOps/n8n-defillama-api)
- [n8n Community](https://community.n8n.io/)

## 📝 License

MIT License - see [LICENSE](LICENSE) file for details.

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## 📞 Support

- GitHub Issues: [Report a bug](https://github.com/GitCryptoDevOps/n8n-defillama-api/issues)
- n8n Community: [Get help](https://community.n8n.io/)

---

Made with ❤️ by [GitCryptoDevOps](https://github.com/GitCryptoDevOps)