Amadeus Relay has announced the alpha version of its API to make token exchange simpler for dApps has been launched and is now up and running. Amadeus is a relayer working on top of 0x protocol that expects to offer dApps an easy, fast and trustworthy way to exchange ERC20 tokens.
It focuses mostly on providing the most accurate and liquid market values of assets to dApps willing to use it. It adheres to the 0x Standard Relayer API so that dApps have a common and clear interface to work with.
Remember to note, the API is in alpha version and is using Metamask on the Kovan Testnet, so in order to use it, developers should have Metamask installed and log in to their account and connect Metamask to the Kovan test network. A summary of how the API works and how to integrate it with a dApp is below.
The first step to make a full use of the Amadeus API is getting token pairs to trade calling the endpoint GET token_pairs. Amadeus returns an array of tokens combined in pairs and with that information the dApp can choose which tokens to trade.
To proceed, use the endpoint GET orders. There are three different ways to use it and depending on interest, there will be three different parameters:
1) you want to get orders of two specific tokens
2) you want to get orders of one specific token
3) you want to get all available orders
- After getting the orders, developers can choose the most interesting order to complete from an array of orders returned by the function above.
- Once the amount wanting to exchange is in the user wallet and allowed the 0x protocol to interact with the funds, the method fillOrder can be called to complete the order.
- In order to make sure that the exchange was successful, check it in Metamask and see that the quantities of the tokens chosen to be exchanged have changed.
Tips
- Amadeus says that if currently not possessing any money you can get some using Kovan faucet.
- The API works with “WETH” instead “ETH”, because ETH itself does not conform to the ERC20 token interface. If a user does not have WETH, it can be exchanged with ETH using a command that in the documentation under step 3.
- The 0x protocol allows trade of tokens directly from accounts without sending them to an intermediate place. But to do this, it is needed to authorize 0x to interact with funds by calling the function setUnlimitedProxyAllowanceAsync.
The Amadeus team said:
“Our work continues and soon we will launch a demo with a step by step on how to use the API. From there, we will focus on adding some features to the API and also keep helping partners and anyone interested in using it. Please, take a look and give us some feedback. And don’t forget, if you want to integrate Amadeus API into your project, make sure to contact us at [email protected] we will be very glad to help.”