Skip to main content

πŸ” Monad Meta Aggregator Swap API Guide

This guide shows how to fetch a swap quote using the monad meta aggregator API with viem in typescript.


🌐 endpoint​

GET https://app.clober.io/api/chains/143/quote

πŸ“₯ query parameters​

nametypedescription
inputTokenAddressstringaddress of the input token (e.g. native ETH is 0x0000000000000000000000000000000000000000)
outputTokenAddressstringaddress of the token you want to receive
amountInstringamount of input token in wei
slippageLimitPercentstringslippage limit in percent (e.g. "1" for 1%)
userAddressstring (optinal)user's wallet address (if userAddress is not provided, the API will not build a transaction)
skipUserValidationboolean (optional)if true, skips user validation checks (default: false)

πŸ“¦ example request​

GET https://app.clober.io/api/chains/143/quote?inputTokenAddress=0x0000000000000000000000000000000000000000&outputTokenAddress=0x754704Bc059F8C67012fEd69BC8A327a5aafb603&amountIn=1000000000000000&slippageLimitPercent=1&userAddress=0x5F79EE8f8fA862E98201120d83c4eC39D9468D49

πŸ§ͺ using viem + typescript​

import axios from 'axios'
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { monad } from 'viem/chains'

const account = privateKeyToAccount('0xYOUR_PRIVATE_KEY')
const client = createWalletClient({
account,
chain: monad,
transport: http(),
})

async function fetchAndExecuteQuote() {
const inputToken = '0x0000000000000000000000000000000000000000' // native currency
const outputToken = '0x754704Bc059F8C67012fEd69BC8A327a5aafb603' // usdc
const amountIn = '1000000000000000000' // 1 MON in wei
const slippage = '1'
const userAddress = account.address

try {
const { data } = await axios.get('https://app.clober.io/api/chains/143/quote', {
params: {
inputTokenAddress: inputToken,
outputTokenAddress: outputToken,
amountIn,
slippageLimitPercent: slippage,
userAddress,
},
}) as {
data: {
bestQuote: {
aggregator: string
amountOut: string
transaction: {
to: `0x${string}`
data: `0x${string}`
value: string
gas: string
gasPrice: string
}
}
}
}

const best = data.bestQuote
console.log('βœ… best aggregator:', best.aggregator)
console.log('πŸ” expected amountOut:', best.amountOut)

const tx = best.transaction

const hash = await client.sendTransaction({
to: tx.to as `0x${string}`,
data: tx.data as `0x${string}`,
value: BigInt(tx.value),
gas: BigInt(tx.gas),
gasPrice: BigInt(tx.gasPrice),
})

console.log('πŸš€ sent tx hash:', hash)
} catch (err) {
console.error('❌ error while quoting or sending tx:', err)
}
}

fetchAndExecuteQuote()

πŸ“˜ sample response​

this is a sample response from the monad meta aggregator quote api. it includes the best available quote and a list of all quotes from supported aggregators.

{
"bestQuote": {
"amountOut": "1033",
"aggregator": "EisenFinance",
"transaction": {
"data": "0x5973bd5e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb60300000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000003fe000000000000000000000000ece5e77f9a9846c4d69555eb44e0cff8b5f03f1e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005c4e3665a4300000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000ca9d6973a2375f8269c50c113ce57d61d4e5180c00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004c435f10401000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000003ff0000000000000000000000000000000000000000000000000000000000000409000000000000000000000000000000000000000000000000000001d1a94a200000000000000000000000000000000000000000000000000000000000000001400000000000000000000000007b58a24c5628881a141d630f101db433d419b37200000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000003000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000003bd359c1119da7da1d913d1c4d2b7c461115433a000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb603000000000000000000000000000000000000000000000000000000000000000800010000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000010001000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000044295f843300000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e4707ea9bd00000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003f3bd359c1119da7da1d913d1c4d2b7c461115433a204faca1764b154221e35c0d20abb3c525710498000bb8754704bc059f8c67012fed69bc8a327a5aafb60300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gas": "1062619",
"gasPrice": "102000000000",
"value": "1000000000000000",
"to": "0x7B58A24C5628881a141D630f101Db433D419B372",
"from": "0x5F79EE8f8fA862E98201120d83c4eC39D9468D49"
},
"executionMilliseconds": 391.571966999676
},
"allQuotes": [
{
"amountOut": "1033",
"aggregator": "EisenFinance",
"transaction": {
"data": "0x5973bd5e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb60300000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000003fe000000000000000000000000ece5e77f9a9846c4d69555eb44e0cff8b5f03f1e00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005c4e3665a4300000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000ca9d6973a2375f8269c50c113ce57d61d4e5180c00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000004c435f10401000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000003ff0000000000000000000000000000000000000000000000000000000000000409000000000000000000000000000000000000000000000000000001d1a94a200000000000000000000000000000000000000000000000000000000000000001400000000000000000000000007b58a24c5628881a141d630f101db433d419b37200000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000003000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000003bd359c1119da7da1d913d1c4d2b7c461115433a000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb603000000000000000000000000000000000000000000000000000000000000000800010000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000010001000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000044295f843300000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e4707ea9bd00000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003f3bd359c1119da7da1d913d1c4d2b7c461115433a204faca1764b154221e35c0d20abb3c525710498000bb8754704bc059f8c67012fed69bc8a327a5aafb60300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gas": "1062619",
"gasPrice": "102000000000",
"value": "1000000000000000",
"to": "0x7B58A24C5628881a141D630f101Db433D419B372",
"from": "0x5F79EE8f8fA862E98201120d83c4eC39D9468D49"
},
"executionMilliseconds": 391.571966999676
},
{
"amountOut": "1033",
"aggregator": "Monorail",
"transaction": {
"data": "0x5973bd5e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb60300000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000003fe000000000000000000000000a68a7f0601effdc65c64d9c47ca1b18d96b4352c00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003a4f99cae990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb60300000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000003fe0000000000000000000000007b58a24c5628881a141d630f101db433d419b3720000000000000000000000000000000000000000000000000000000069244876000000000000000000000000000000000000000000000000000f5aff1c677931000000000000000000000000000000000000000000000000187aef6fc5e4654b000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005f5e10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003bd359c1119da7da1d913d1c4d2b7c461115433a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000003bd359c1119da7da1d913d1c4d2b7c461115433a00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000d6145b2d3f379919e8cdeda7b97e37c4b2ca9c400000000000000000000000003bd359c1119da7da1d913d1c4d2b7c461115433a000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb60300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000bb800000000000000000000000000000000000000000000000000000000",
"gas": "1032861",
"gasPrice": "102000000000",
"value": "1000000000000000",
"to": "0x7B58A24C5628881a141D630f101Db433D419B372",
"from": "0x5F79EE8f8fA862E98201120d83c4eC39D9468D49"
},
"executionMilliseconds": 892.723174000159
},
{
"amountOut": "1030",
"aggregator": "KyberSwap",
"transaction": {
"data": "0x5973bd5e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb60300000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000003fb0000000000000000000000006131b5fae19ea4f9d964eac0408e4408b66337b500000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bc4e21fd0e9000000000000000000000000000000000000000000000000000000000000002000000000000000000000000063242a4ea82847b20e506b63b0e2e2eff0cc6cb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000640000000000000000000038d7ea4c68000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000004146b3ff7ffef891e1e20f084ee15efd60527a7f2ddb5b7978c6924a6d8a6a6533371d611d5a7b64df3261a4753c6c6d658cd596b42c384fc353dc018cc550c10d1c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005400000000000000000000000007b58a24c5628881a141d630f101db433d419b372000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001800000000000000000000360051c89600000000000000000000003baf82d03a000000000000000000000038d7ea4c680000000000000000000000000000000040700000000000000000000000000000000000000000000010000000f42400000000000000000000000000000004f82e73edb06d29ff62c91ec8f5ff06571bdeb29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029e8d608000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000000000161f598cd0000000000000000aa8d9c04006a73739a3a05f4c7d8c2eb10f50b710000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000007b58a24c5628881a141d630f101db433d419b37200000000000000000000000000000000000000000000000000000000000000000000000000000000000000003bd359c1119da7da1d913d1c4d2b7c461115433a8000000000000000000000003b9aca00000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000038d7ea4c68000567e636a0000000000020002579f9adf88710f296889ecbe31af66367ca6c86300000000000000000000000000000000000000000000000000000000000000800000000000000000000000007b58a24c5628881a141d630f101db433d419b37200000000000000000000000000000000000000000000000000000000000000200000000300000000000003e88e0344626815aaf9df2c39605a4cbf55c0d91bed000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb6038000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb6030000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000007b58a24c5628881a141d630f101db433d419b37200000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000003fb000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000027d7b22536f75726365223a22636c6f626572222c22416d6f756e74496e555344223a22302e30303039373835353730313736323639353632222c22416d6f756e744f7574555344223a22302e30303131323637303836393139333237373334222c22526566657272616c223a22222c22466c616773223a302c22416d6f756e744f7574223a2231303330222c2254696d657374616d70223a313736333938353436372c22526f7574654944223a2233313838343632362d383233352d346234352d623863362d6462326334623936386133373a64613835333838612d373961332d343865332d616264612d303763616262373631623735222c22496e74656772697479496e666f223a7b224b65794944223a2231222c225369676e6174757265223a22546f6836526a41496f3279627a47534e4758494f2f61426a725a364172772f7443445863565974726a6f7268306267492f417252366f4e4f626a64644957512f773376596e31746856794f7753714f657851784567532b424a6f79616f69594f312f3176645a4f5462394333677a5674554c67304d546d79337962754b6d53785274466b69746974394668624c2f6f3357697866396855725557776f644f63675759713065532b34686e6f343273557a48635648302f536e39613733464e51767061742f31527a4c33474f7a736643764a77486c5a48422f2f704b725973706f42705970705065635a745745626a64736564787142365a7567716a457a702b34332f7941476866766645554f476e7a4d6b4c512f6277724b434b4c50394f677a784275326a6d3761337648434830554b463136457a304d2b4e50526b664b617970513655716d6266395645386136383676724d4f30673d3d227d7d00000000000000000000000000000000000000000000000000000000000000",
"gas": "950554",
"gasPrice": "102000000000",
"value": "1000000000000000",
"to": "0x7B58A24C5628881a141D630f101Db433D419B372",
"from": "0x5F79EE8f8fA862E98201120d83c4eC39D9468D49"
},
"executionMilliseconds": 559.701727000065
},
{
"amountOut": "48",
"aggregator": "Clober",
"transaction": {
"data": "0x5973bd5e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb60300000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000019b68a2b909d96c05b623050c276fbd457de8e8300000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000204c0e8e89a000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000069244cea000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000f2dbe84fb6e603efc401eb30ab4a34fd881c4d3a14f024a2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000002f00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000754704bc059f8c67012fed69bc8a327a5aafb603000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gas": "901420",
"gasPrice": "102000000000",
"value": "1000000000000000",
"to": "0x7B58A24C5628881a141D630f101Db433D419B372",
"from": "0x5F79EE8f8fA862E98201120d83c4eC39D9468D49"
},
"executionMilliseconds": 164.567960999906
}
]
}
  • amountOut: expected output token amount after the swap (in smallest unit, e.g. wei)
  • aggregator: name of the aggregator/router that provides the quote
  • transaction: full transaction object that can be submitted via viem.sendTransaction()
    • from: address that will initiate the transaction (usually user’s wallet address)
    • to: router contract address to be called
    • data: encoded calldata for executing the swap
    • value: amount of ETH to send along with the transaction (if input is native ETH)
    • gas: suggested gas limit for executing the swap
    • gasPrice: suggested gas price in wei
  • executionMilliseconds: time taken to compute this quote (used for diagnostics)