API endpoints

The Madhouse API is a powerful interface that aggregates liquidity from multiple decentralized exchanges to provide the best swap rates for users. It supports multiple chains and protocols, offering a seamless experience for token swaps.

Quick Start

curl -X 'GET' \
  'https://api.madhouse.ag/swap/v1/protocols?chain=10143' \
  -H 'accept: application/json'

Authentication

Currently, the API does not require authentication. Rate limiting is implemented to ensure fair usage.

Endpoints

Get Quote

Retrieves a quote for swapping tokens across different DEX protocols.

Endpoint: GET /swap/v1/quote

Query Parameters:

Parameter
Type
Required
Description
Example

chain

string

Yes

Chain ID

10143

tokenIn

string

Yes

Address of the input token

0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701 (WMON)

tokenOut

string

Yes

Address of the output token

0xf817257fed379853cDe0fa4F97AB987181B1E5Ea (USDC)

amountIn

string

Yes

Amount of input token to swap

1000000000000000000 (1 WMON)

slippage

number

Yes

Maximum acceptable slippage

0.002 (0.2%)

protocols

string

No

Comma-separated list of protocols that will be used for routing (default: all protocols)

uniswap-v2,uniswap-v3

includeTokenInfo

boolean

No

Include detailed token information (default: false)

true

includePoolInfo

boolean

No

Include pool information (default: false)

true

referrerAddress

string

No

Address of the referrer

0x203AfE76e5de5fa0Ee542fc7B7B713e1c5425701

Example Request:

curl -X 'GET' \
  'https://api.madhouse.ag/swap/v1/quote?chain=10143&tokenIn=0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701&tokenOut=0xf817257fed379853cde0fa4f97ab987181b1e5ea&amountIn=1000000000000000000&protocols=uniswap-v2,uniswap-v3&slippage=0.002&includeTokenInfo=true' \
  -H 'accept: application/json'

Example Response:

{
  "tokenIn": {
    "address": "0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701",
    "name": "Wrapped Monad",
    "symbol": "WMON",
    "decimals": 18
  },
  "tokenOut": {
    "address": "0xf817257fed379853cDe0fa4F97AB987181B1E5Ea",
    "name": "USD Coin",
    "symbol": "USDC",
    "decimals": 6
  },
  "amountOut": "1617900",
  "routes": [
    {
      "pool": "0x5323821de342c56b80c99fbc7cd725f2da8eb87b",
      "fromToken": {
        "address": "0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701",
        "name": "Testnet MON Token",
        "symbol": "MON",
        "decimals": 18
      },
      "toToken": {
        "address": "0xf817257fed379853cDe0fa4F97AB987181B1E5Ea",
        "name": "USD Coin",
        "symbol": "USDC",
        "decimals": 6
      },
      "percent": 1
    }
  ],
  "tx": {
    "to": "0x1e538356d3cfe7fa04696a92515add4a895ecb65",
    "data": "0x...",
    "value": "1000000000000000000"
  }
}

Get Tokens

Retrieves a list of supported tokens for a specific chain.

Endpoint: GET /swap/v1/tokens

Query Parameters:

Parameter
Type
Required
Description
Example

chain

string

Yes

Chain ID

10143 (Monad Testnet)

Example Request:

curl -X 'GET' \
  'https://api.madhouse.ag/swap/v1/tokens?chain=10143' \
  -H 'accept: application/json'

Example Response:

{
  "tokens":[
    {
      "address": "0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701",
      "name": "Wrapped Monad",
      "symbol": "WMON",
      "decimals": 18
    },
    {
      "address": "0xf817257fed379853cDe0fa4F97AB987181B1E5Ea",
      "name": "USD Coin",
      "symbol": "USDC",
      "decimals": 6
    }
  ]
}

Get Protocols

Retrieves a list of supported DEX protocols for a specific chain.

Endpoint: GET /swap/v1/protocols

Query Parameters:

Parameter
Type
Required
Description
Example

chain

string

Yes

Chain ID

10143 (Monad Testnet)

Example Request:

curl -X 'GET' \
  'https://api.madhouse.ag/swap/v1/protocols?chain=10143' \
  -H 'accept: application/json'

Example Response:

{
  "protocols": [
    {
      "id": "uniswap-v2",
      "name": "Uniswap (v2)"
    },
    {
      "id": "uniswap-v3",
      "name": "Uniswap (v3)"
    }
  ]
}

Supported Chains

The API supports the following chains:

  • Monad Testnet

Supported Protocols

The API supports the following DEX protocols:

Protocol
Type
Monad

Uniswap (v2)

Dex

βœ…

Uniswap (v3)

Dex

βœ…

PancakeSwap (v2)

Dex

βœ…

PancakeSwap (v3)

Dex

βœ…

Balancer

Dex

βœ…

Atlantis (v2)

Dex

βœ…

Atlantis (v4)

Dex

βœ…

OctoSwap (v1)

Dex

βœ…

OctoSwap (v2)

Dex

βœ…

GlacierFi

Dex

βœ…

Purps

Dex

βœ…

zkSwap v2

CLOB

βœ…

Crystal

CLOB

βœ…

Kuru

Staking

βœ…

aPriori

Staking

βœ…

Kintsu

Staking

βœ…

Magma

Staking

βœ…

FastLane

Staking

βœ…

Support

For any questions or issues, please contact our support team.

Last updated