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:
Name | Type | Description |
---|---|---|
comitClient | ComitClient | The ComitClient of the taker for swap execution. |
executionParams | ExecutionParams | The ExecutionParams of the maker for swap execution. |
tryParams | TryParams | The 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:
Name | Type | Description |
---|---|---|
order | Order | The 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
Parameters:
Name | Type | Description |
---|---|---|
orderId | string | The 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:
Name | Type | Description |
---|---|---|
tradingPair | string | A 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:
Name | Type | Description |
---|---|---|
port | number | The port where the HttpService should be exposed. |
hostname? | undefined | string | Optionally 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:
Name | Type | Description |
---|---|---|
swapId | string | The id of a swap. |
order | Order | The order corresponding to the swap. |
Returns: Promise‹void›