Blockdaemon · Capability

Blockdaemon DeFi API — DEX Swaps

DEX swap pricing, aggregation, and transaction construction (with optional approval) across 200+ decentralized exchanges via the Blockdaemon DeFi API (expand.network).

Run with Naftiko BlockdaemonDeFiDEXSwaps

What You Can Do

POST
Createdexswap — Create a DEX swap.
/v1/defi/dex/swap

MCP Tools

blockdaemon-get-dex-quotes

Aggregate swap quotes across DEXs.

read-only idempotent
blockdaemon-create-dex-swap

Create a DEX swap transaction.

blockdaemon-create-dex-swap-with-approval

Create approval+swap pair (EIP-5792/EIP-7702 capable).

Capability Spec

defi-dex-swap.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Blockdaemon DeFi API — DEX Swaps
  description: DEX swap pricing, aggregation, and transaction construction (with optional approval) across
    200+ decentralized exchanges via the Blockdaemon DeFi API (expand.network).
  tags:
  - Blockdaemon
  - DeFi
  - DEX
  - Swaps
  created: '2026-05-25'
  modified: '2026-05-25'
binds:
- namespace: env
  keys:
    BLOCKDAEMON_API_KEY: BLOCKDAEMON_API_KEY
capability:
  consumes:
  - type: http
    namespace: defi-dex-swap
    baseUri: https://api.expand.network
    description: DeFi API DEX endpoints.
    resources:
    - name: dex-price
      path: /dex/getprice
      operations:
      - name: getdexprice
        method: GET
        description: Get a swap quotation for a token pair along a specified path.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: dexId
          in: query
          type: string
          required: true
        - name: path
          in: query
          type: string
          required: true
        - name: amountIn
          in: query
          type: string
          required: true
    - name: dex-quotes
      path: /dex/getquotes
      operations:
      - name: getdexquotes
        method: GET
        description: Aggregate swap quotes across multiple DEXs for a token pair.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: chainId
          in: query
          type: string
          required: true
        - name: from
          in: query
          type: string
          required: true
        - name: to
          in: query
          type: string
          required: true
        - name: amount
          in: query
          type: string
          required: true
    - name: dex-swap
      path: /dex/swap
      operations:
      - name: createdexswap
        method: POST
        description: Create a DEX swap transaction.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          required: true
    - name: dex-swap-with-approval
      path: /dex/swapWithApproval
      operations:
      - name: createdexswapwithapproval
        method: POST
        description: Create both token approval and swap transactions in a single call (supports EIP-5792/EIP-7702
          batching).
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          required: true
    authentication:
      type: apikey
      key: X-API-Key
      value: '{{env.BLOCKDAEMON_API_KEY}}'
      placement: header
  exposes:
  - type: rest
    namespace: defi-dex-swap-rest
    port: 8080
    description: REST adapter for DEX swaps.
    resources:
    - path: /v1/defi/dex/swap
      name: dex-swap
      description: REST surface for DEX swap creation.
      operations:
      - method: POST
        name: createdexswap
        description: Create a DEX swap.
        call: defi-dex-swap.createdexswap
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: defi-dex-swap-mcp
    port: 9090
    transport: http
    description: MCP adapter for DEX swaps.
    tools:
    - name: blockdaemon-get-dex-quotes
      description: Aggregate swap quotes across DEXs.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: defi-dex-swap.getdexquotes
      with:
        chainId: tools.chainId
        from: tools.from
        to: tools.to
        amount: tools.amount
      outputParameters:
      - type: object
        mapping: $.
    - name: blockdaemon-create-dex-swap
      description: Create a DEX swap transaction.
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: defi-dex-swap.createdexswap
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: blockdaemon-create-dex-swap-with-approval
      description: Create approval+swap pair (EIP-5792/EIP-7702 capable).
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: defi-dex-swap.createdexswapwithapproval
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.