Version: 0.13.0

Negotiator

Handles the negotiation on the maker side of a trade. Bundles functionality to create orders for a maker and make them available for the taker.

Hierarchy

  • Negotiator

Index

Constructors

Methods

Constructors

constructor

+ new Negotiator(comitClient: ComitClient, executionParams: ExecutionParams, tryParams: TryParams): Negotiator

Defined in negotiation/maker/negotiator.ts:21

Parameters:

NameTypeDescription
comitClientComitClientThe ComitClient of the taker for swap execution.
executionParamsExecutionParamsThe ExecutionParams of the maker for swap execution.
tryParamsTryParamsThe TryParams of the maker for swap execution.

Returns: Negotiator

Methods

addOrder

addOrder(order: Order): boolean

Defined in negotiation/maker/negotiator.ts:50

Add an Order to the order book.

Parameters:

NameTypeDescription
orderOrderThe order to add.

Returns: boolean

True if the order parameters are valid and were successfully added to the order book, false otherwise.


getExecutionParams

getExecutionParams(): ExecutionParams

Defined in negotiation/maker/negotiator.ts:83

Get the ExecutionParams of the maker.

Returns: ExecutionParams

The ExecutionParams of the maker.


getOrderById

getOrderById(orderId: string): Order | undefined

Defined in negotiation/maker/negotiator.ts:75

Get an Order by Order.id.

Parameters:

NameTypeDescription
orderIdstringThe Order.id.

Returns: Order | undefined

An Order or undefined if there is no Order for the given id.


getOrderByTradingPair

getOrderByTradingPair(tradingPair: string): Order | undefined

Defined in negotiation/maker/negotiator.ts:66

Get an Order by trading pair (e.g. ethereum-ether-bitcoin-bitcoin).

Parameters:

NameTypeDescription
tradingPairstringA trading pair (e.g. bitcoin-bitcoin-ethereum-erc20).

Returns: Order | undefined

An Order or undefined if there is no Order for the given trading pair.


getUrl

getUrl(): string | undefined

Defined in negotiation/maker/negotiator.ts:109

Returns: string | undefined

The maker's HttpService URL.


listen

listen(port: number, hostname?: undefined | string): Promise‹void›

Defined in negotiation/maker/negotiator.ts:118

Exposes the maker's HttpService on the given port and hostname.

Parameters:

NameTypeDescription
portnumberThe port where the HttpService should be exposed.
hostname?undefined | stringOptionally a hostname can be provided as well.

Returns: Promise‹void›


takeOrder

takeOrder(swapId: string, order: Order): Promise‹void›

Defined in negotiation/maker/negotiator.ts:96

Take an order by accepting the swap request on the maker side.

This function uses the given swapId and order to find a matching Swap using the ComitClient. If a matching Swap can be found {@link Swap#accept} is called.

Parameters:

NameTypeDescription
swapIdstringThe id of a swap.
orderOrderThe order corresponding to the swap.

Returns: Promise‹void›