πŸ’»MicroSwap API Specification

Step 1: Query Swap Route

Basic GET API:

https://api.microswap.org/aggregator/v2/quote?chainId=250&from=?&to=&receiver=&source=

Curl sample

curl --location --request GET β€˜https://api.microswap.org/aggregator/v2/quote?chainId=250&from=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&amount=1000000000000000000&slippage=0.003&to=0x28a92dde19d9989f39a49905d7c9c2fac7799bdf&source=microswap&receiver=0x19369328B9d837F5E5248FaE4c30b9a6A5C18a7C’

Request query parameters

GET URL: https://api.microswap.org/aggregator/v2/quote

Query Parameters

Name
Type
Description

chainId*

integer

Currently, we support Fantom ( 250)

The list with expand as usage increase

from*

string

ERC20 token contract address to sell

to*

string

ERC20 token contract address to buy

amount*

integer

buy amount of ERC20 tokens in wei

slippage

float

Default = 0.005 (equal 0.5%)

deadline

integer

Unix timestamp, transaction will fail if it's not executed before this deadline

receiver

string

Destination receiver wallet address

!Important: it's allowed to be empty for quote-query only

Receiver can't be empty if you intent to use encoded data to perform swap

source*

string

Referrer , this is to attribute volume to traffic source. We use this info to build up referral program at later stages.

Response sample:

Step 2: Encode Preferred Swap Route

Basic API:

POST URL: https://api.microswap.org/aggregator/v2/quote

Param sample:

Response sample:

Response payload

Field
Sub field
Type
Description

encodedData

json object

router

string

MicroSwap Router smart contract address

The address is returned here because it's frequently updated

data

string

Data encoded for given quote. Client just need to submit this data to given provided contract address returned at "router"

maxReturn

json object

from

string

ERC20 token contract address to sell

to

string

ERC20 token contract address to buy

totalFrom

string

buy amount of ERC20 tokens in wei

totalTo

numeric string

best sell amount of ERC20 tokens in wei

totalGas

number

gasPrice

numeric string

paths

array of object

swap paths, for display purpose

Step 3: Execute Swap Transaction On-Chain

Integration example:

Last updated