Building dApps and API with AirSwap

in #airswap5 years ago

AirSwap Header

In a previous article I introduced AirSwap, a peer-to-peer network for trading Ethereum ERC20 tokens. We also took a look at the Trading features of AirSwap and how it helped the crypto trader make profit by utilizing its Compare Tool as well as OTC services.

In this article, we shall discuss how AirSwap can be used by developers to create APIs and provide liquidity to the overall trade market.

On the AirSwap platform, Peers(users) connect to the network and use the Swap protocol to find and execute trades:
• Makers: provide liquidity
• Takers: take liquidity

As with most other platforms, Takers are inclined to use existing dApps for price discovery and execution, while Makers make use of APIs and libraries to provide quotes and signed orders.

Now, recall that AirSwap is a network for matching interested parties to facilitate peer-to-peer communication and trade of Ethereum-based tokens.

AirSwap streamlines trading by facilitating counterparty discovery and price negotiation off-chain, and execution of atomic swaps on-chain. This is achieved using 3rd-party software (APIs).

So what kinds of APIs can developers create with AirSwap?


Peers | Indexer | AirSwap.js


PEER API

The main entry point to the AirSwap network is a WebSocket interface that allows peers to communicate using a JSON RPC(remote procedure call protocol) and a set of methods defined by the Swap protocol: getQuote, getMaxQuote, getOrder.

With getQuote, a Taker makes a request stating the tokens they wish to swap and the amount they wish to send or receive . The Maker responds with a Quote containing the amount they will send or receive, depending on the parameters requested by the Taker. The syntax will look like this;

AirSwap Peer API getQuote

With getMaxQuote, the Taker does not specify any amount. Rather, the Maker sends back the maximum Quote sizes for the pair specified by the Taker. This basically tells the Taker the liquidity(that is, amount of available tokens available) for a trade. The syntax will look like this;

AirSwap Peer API getMaxQuote

getOrder is only used when the Taker is ready to execute an order. The Maker and user exchange cryptographic signed orders that are executed via a Swap Contract that facilitates the trade. The syntax will look like this;

AirSwap Peer API getOrder


INDEXER API

The Indexer is a special service that allows Makers and Takers to locate each other on the network. It acts as a mechanism for peer discovery and token utility. It is activated when a Maker stakes a certain amount of token on the network. This allows the Taker to "discover" the Maker.

AirSwap Indexer API

Takers can signal their intention to buy on the network using Query Intents.
AirSwap Indexer API Query Intent

Makers signal their intention to sell using Set Intents.

AirSwap Indexer API Set Intent


AirSwap.js

AirSwap.js is a JavaScript module containing a set of functions that allow developers to interact with the AirSwap network without having to deal with ABIs(application binary interface), signatures or raw websockets.

These functions are the underlying principles of many AirSwap products, including Instant and Spaces. Review AirSwap.js on GitHub.

You can also check out this detailed example frontend built with React and AirSwap.js.

AirSwap also has a couple of apps that developers can utilize to make their API interface more aesthetic and functional. These include


Widget | Instant | Spaces | DexIndex

Developers can also follow this tutorial on creating a Maker on AirSwap.

AirSwap also provides information on tools and protocols such as


WETH | Approvals | API Server | WebSocket

All these information and more is available on the AirSwap Developers Section.

To find out more about this exchange you can visit the AirSwap website.
You can also follow them on their social media channels


BitcoinTalk | Facebook |Youtube | Medium | GitHub | Reddit | Twitter


DISCLAIMER

The information provided here is for informational and entertainment purposes only. It should NOT be considered as financial and/or investment advice. No person should make any kind of financial decision without first consulting their own financial adviser and/or conducting their own research and due diligence.


Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.033
BTC 63869.25
ETH 3055.04
USDT 1.00
SBD 3.88