MakerNegotiator
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
- MakerNegotiator
Index
Constructors
Methods
Constructors
constructor
+ new MakerNegotiator(comitClient
: ComitClient, executionParams
: ExecutionParams, tryParams
: TryParams): MakerNegotiator
Defined in src/negotiation/maker/maker_negotiator.ts:19
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: MakerNegotiator
Methods
addOrder
▸ addOrder(order
: Order): boolean
Defined in src/negotiation/maker/maker_negotiator.ts:48
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 src/negotiation/maker/maker_negotiator.ts:81
Get the ExecutionParams of the maker.
Returns: ExecutionParams
The ExecutionParams of the maker.
getOrderById
▸ getOrderById(orderId
: string): Order | undefined
Defined in src/negotiation/maker/maker_negotiator.ts:73
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 src/negotiation/maker/maker_negotiator.ts:64
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 src/negotiation/maker/maker_negotiator.ts:107
Returns: string | undefined
The maker's HttpService URL.
listen
▸ listen(port
: number, hostname?
: undefined | string): Promise‹void›
Defined in src/negotiation/maker/maker_negotiator.ts:116
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 src/negotiation/maker/maker_negotiator.ts:94
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›