Servers are processes that implement the Quote and Order APIs using JSON-RPC 2.0 over HTTPS.
Add the @airswap/protocols
package to your application.
$ yarn add @airswap/protocols
Import the Server client.
import { Server } from '@airswap/protocols'
Create a new Server
client.
public constructor(locator: string)
Param | Type | Optionality | Description |
|
|
| URL of the server, If no scheme provided, |
Example Create a client to connect to https://maker.example.com/
.
const server = new Server('maker.example.com')
Example Create a client to connect to a local development server.
const server = new Server('http://localhost:3000')
Servers implement the Quote
API.
Example Call getMaxQuote
on a local development Server.
const server = new Server('http://localhost:3000')const quote = await server.getMaxQuote(senderToken, signerToken)
Servers implement the Order
API.
Example Call getSenderSideOrder
on a local development Server.
const wallet = new ethers.Wallet('...')const server = new Server('http://localhost:3000')const quote = await server.getSenderSideOrder(signerAmount,signerToken,senderToken,wallet.address,)