APIs

The following APIs are implemented by peers on the network to make and take liquidity.

Quote API

Quotes indicate prices at which a peer is interested in trading.

getMaxQuote

Given a token pair, return a quote object with the maximum amounts a maker is willing to trade.

getMaxQuote(
signerToken: string,
senderToken: string
): Quote

Param

Type

Description

senderToken

address

The token the sender would transfer.

signerToken

address

The token the signer would transfer.

A successful getMaxQuote returns a Quote object.

getSenderSideQuote

Given a signerAmount and token pair, return a complete quote. The senderAmount value is the amount the taker would send. The taker is buying from the maker.

getSenderSideQuote(
signerAmount: string,
signerToken: string,
senderToken: string
): Quote

Param

Type

Description

signerAmount

uint256

Amount of ERC-20 the signer would transfer.

senderToken

address

Token the sender would transfer.

signerToken

address

Token the signer would transfer.

A successful getSenderSideQuote returns a Quote object including the requested senderAmount.

getSignerSideQuote

Given a senderAmount and token pair, return a complete quote. The signerAmount value is the amount the maker would send. The taker is selling to the maker.

getSignerSideQuote(
senderAmount: string,
senderToken: string,
signerToken: string
): Quote

Param

Type

Description

senderAmount

uint256

Amount of ERC-20 the sender would transfer.

senderToken

address

Token the sender would transfer.

signerToken

address

Token the signer would transfer.

A successful getSignerSideQuote returns a Quote object including the requested signerAmount

Order API

Orders are priced and executable swaps that indicate all parties to a trade.

getSenderSideOrder

Given a signerAmount, senderWallet, and token pair, return a complete order. The senderAmount value is the amount the taker would send. The taker is buying from you.

getSenderSideOrder(
signerAmount: string,
signerToken: string,
senderToken: string,
senderWallet: string
): Order

Param

Type

Description

signerAmount

uint256

Amount of ERC-20 the signer would transfer.

signerToken

address

Token the signer would transfer.

senderToken

address

Token the sender would transfer.

senderWallet

address

Wallet of the sender.

A successful getSenderSideOrder returns a signed Order object including the requested senderAmount.

getSignerSideOrder

Given a senderAmount, senderWallet, and token pair, return a complete order. The signerAmount value is the amount you would send. The taker is selling to you.

getSignerSideOrder(
senderAmount: string,
signerToken: string,
senderToken: string,
senderWallet: string
): Order

Param

Type

Description

senderAmount

uint256

The amount of ERC-20 the sender would transfer.

signerToken

address

The token the signer would transfer.

senderToken

address

The token the sender would transfer.

senderWallet

address

The wallet of the sender.

A successful getSignerSideOrder returns a signed Order object including the requested signerAmount.

Last Look API

Last look is to say that, after having emitted an indicative quote, a maker may accept or decline an order provided to it by a taker. Quotes are primarily served through the Quote API, but other methods to disseminate pricing information may exist, for example SetRule events on Delegate contracts.

provideOrder

Given an Order, assess its price, and conditionally perform a swap.

provideOrder(
order: Order
)

Param

Type

Description

order

Order

Order to swap.