Skip to main content

Get price for a swap

POST /api/v1/price

Use this API to quickly get the fee data for a cross-chain swap.

Request Body required
  • from string (chain:token) required

    The initial chain and token type. See supported chains.

  • to string (chain:token) required

    The target chain and token type. See supported chains.

  • amount string_of_number required

    Amount of tokens to initialize the cross-chain swap.

  • fromAddress address

    The address on initial chain to initialize the cross-chain swap.

  • fromContract boolean

    The fromAddress parameter can refer to either an externally owned address (EOA) or a smart contract address. This API will check the token balance when the swap originates from an EOA, but this step will be bypassed if initiated from a smart contract. If you intend to send a swap from a smart contract that has not yet been deployed, you should set the fromContract parameter to true.

Responses

Successful operation

Schema
  • result object

    Fee data of this swap

  • serviceFee string_of_number

    Fee charged by Meson protocol

  • lpFee string_of_number

    Fee charged by liquidity providers on Meson

  • totalFee string_of_number

    Total fee to be charged

  • converted optional

    For some swap routes (i.e. arb:usdc -> merlin:btc) token conversion is allowed.

  • amount string_of_number

    Amount of converted token to receive

  • token string

    Converted token

Loading...