Version: next

Order

Handles an order for the taker. It has helper functions to facilitate the handler of an order by a taker. This should only be instantiated via getOrder and should not be constructed from scratch.

Hierarchy

  • Order

Index

Constructors

Properties

Methods

Constructors

constructor

+ new Order(rawOrder: RawOrder, criteria: MatchingCriteria, takeOrder: function): Order

Defined in src/negotiation/taker/order.ts:33

**Note: This should not be used, Order should be created by using getOrder

Parameters:

rawOrder: RawOrder

The parameters of the order, as received from the maker.

criteria: MatchingCriteria

The criteria used to filter/retrieve this order.

takeOrder: function

Function passed from the TakerNegotiator to coordinate calls to cnd and the maker to effectively take the order and start the atomic swap execution.

▸ (rawOrder: RawOrder): Promise‹Swap | undefined›

Parameters:

NameType
rawOrderRawOrder

Returns: Order

Properties

criteria

criteria: MatchingCriteria

Defined in src/negotiation/taker/order.ts:43

The criteria used to filter/retrieve this order.


rawOrder

rawOrder: RawOrder

Defined in src/negotiation/taker/order.ts:42

The parameters of the order, as received from the maker.


takeOrder

takeOrder: function

Defined in src/negotiation/taker/order.ts:44

Function passed from the TakerNegotiator to coordinate calls to cnd and the maker to effectively take the order and start the atomic swap execution.

Type declaration:

▸ (rawOrder: RawOrder): Promise‹Swap | undefined›

Parameters:

NameType
rawOrderRawOrder

Methods

getOfferedRate

getOfferedRate(): BigNumber

Defined in src/negotiation/taker/order.ts:79

Returned the rate of the order offered by the maker.

Returns: BigNumber


isValid

isValid(): boolean

Defined in src/negotiation/taker/order.ts:62

Check that the order is valid and safe. Ensure that all properties are set and that the expiries are safe. It does not check whether the ledgers/assets are correct, this is done with matches.

Returns: boolean


matches

matches(): boolean

Defined in src/negotiation/taker/order.ts:50

description: Return whether an order matches the passed criteria.

Returns: boolean


take

take(): Promise‹Swap | undefined›

Defined in src/negotiation/taker/order.ts:70

Initiates the swap execution and tells the maker that we are taking this order. Does nothing if the order is invalid or does not match the passed criteria.

Returns: Promise‹Swap | undefined›