Vault API Endpoints

GET /api/v1/vaults

List all available vaults with current APY and TVL.

bash
curl https://api.nester.finance/api/v1/vaults
json
{
    "success": true,
    "data": [
        {
            "id": "vault_conservative_01",
            "name": "Conservative",
            "type": "conservative",
            "apy": 7.2,
            "tvl": 250000,
            "total_depositors": 45,
            "status": "active",
            "allocations": [
                { "source": "Blend", "percentage": 60, "apy": 7.0 },
                { "source": "Aave", "percentage": 40, "apy": 7.5 }
            ]
        },
        {
            "id": "vault_balanced_01",
            "name": "Balanced",
            "type": "balanced",
            "apy": 9.5,
            "tvl": 580000,
            "total_depositors": 120,
            "status": "active",
            "allocations": [
                { "source": "Blend", "percentage": 40, "apy": 8.5 },
                { "source": "Kamino", "percentage": 35, "apy": 10.0 },
                { "source": "Aave", "percentage": 25, "apy": 9.0 }
            ]
        }
    ]
}

GET /api/v1/vaults/:id/allocations

Get detailed allocation breakdown for a specific vault.

POST /api/v1/deposit

Prepare a deposit transaction for wallet signing.

bash
curl -X POST https://api.nester.finance/api/v1/deposit \
  -H "Content-Type: application/json" \
  -d '{
    "vault_id": "vault_balanced_01",
    "amount": 1000,
    "wallet_address": "GBXYZ..."
  }'
json
{
    "success": true,
    "data": {
        "transaction_xdr": "AAAA...",
        "estimated_shares": 1000,
        "estimated_apy": 9.5,
        "network": "testnet"
    }
}

POST /api/v1/withdraw

Initiate a withdrawal from a vault.

bash
curl -X POST https://api.nester.finance/api/v1/withdraw \
  -H "Content-Type: application/json" \
  -d '{
    "vault_id": "vault_balanced_01",
    "shares": 500,
    "wallet_address": "GBXYZ..."
  }'
json
{
    "success": true,
    "data": {
        "transaction_xdr": "AAAA...",
        "amount": 525.50,
        "penalty": 0,
        "net_amount": 525.50,
        "maturity_status": "matured"
    }
}