Amadeus API Launch
Two months ago nine people got together to start working on Amadeus Relay with the intention of building an API that would make token exchange easy for dApps. Since then, our team has been working hard and today, we are glad to announce that the alpha version of Amadeus API is up and running!
If you don’t know Amadeus yet we can say in a few words that it is a relayer working on top of 0x protocol that expects to offer dApps a simple, fast and trustworthy way to exchange ERC20 tokens. It focus mostly on providing the most accurate and liquidable market values of assets to dApps willing to use it; and to adhere to the Standard Relayer API (https://github.com/0xProject/standard-relayer-api) so that dApps have a common and clear interface to work with.
Below we will summarize how the API works and how you can integrate it with your dApp. If you need more information, the complete documentation can be found at: https://amadeusrelay.github.io/AmadeusRelayFrontend/.
It is important to note that the API is in alpha version and we’re using Metamask on the Kovan Testnet, so in order to use it you should (i) have Metamask installed in your browser, (ii) log in into your account and (iii) connect Metamask to Kovan test network.
The first step to make a full use of our API is getting token pairs to trade calling the endpoint GET token_pairs. Amadeus returns an array of token 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 your interest you will use different parameters:
- you want to get orders of two specific tokens
- you want to get orders of one specific token
- you want to get all available orders
After getting the orders, you can choose the most interesting order to complete from an array of orders returned by the function above.
Once you have the amount you want to exchange in your wallet and have allowed 0x protocol to interact with your funds the method fillOrder can be called to complete the order.
In order to make sure that your exchange was successful you can check it in your Metamask and see that the quantities of the tokens chosen to be exchanged have changed.
Nice Tips to you:
- If you don’t have any money you can get some using Kovan faucet: https://github.com/kovan-testnet/faucet
- Our API works with “WETH” instead “ETH”, because ETH itself does not conform to the ERC20 token interface. If you don’t have WETH, you can exchange with ETH using a command that we have described in the documentation under Step 3.
- 0x protocol allows you to trade your tokens directly from your account without sending them to an intermediate place. But to do this, you’ll need to authorize 0x to interact with your funds by calling the function setUnlimitedProxyAllowanceAsync.
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@example.com we will be very glad to help.