@gardenfi/orderbook 2.2.1-beta.2 → 2.2.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +22 -26
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +72 -76
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +15 -48
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +374 -81
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +186 -378
- package/dist/src/index.d.ts +1 -3
- package/dist/src/lib/asset.d.ts +0 -3
- package/dist/src/lib/orderbook/orderbook.d.ts +4 -3
- package/dist/src/lib/orderbook/orderbook.types.d.ts +10 -9
- package/package.json +2 -2
- package/dist/src/lib/orders/orders.types.d.ts +0 -60
- package/dist/src/lib/orders/ordersProvider.d.ts +0 -14
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { AsyncResult } from '@gardenfi/utils';
|
|
2
|
-
import { CreateOrder, MatchedOrder, PaginatedData, PaginationConfig } from '../orderbook/orderbook.types';
|
|
3
|
-
|
|
4
|
-
export interface IOrderProvider {
|
|
5
|
-
/**
|
|
6
|
-
* Get the order from orderbook based on provided Id and match status.
|
|
7
|
-
* @param id - The create Id of the order
|
|
8
|
-
* @template T - If true, returns matched order, else returns create order (unmatched Order).
|
|
9
|
-
* @returns {AsyncResult<T extends true ? MatchedOrder : CreateOrder, string>} A promise that resolves to the order.
|
|
10
|
-
*/
|
|
11
|
-
getOrder<T extends boolean>(id: string, matched: T): AsyncResult<T extends true ? MatchedOrder : CreateOrder, string>;
|
|
12
|
-
/**
|
|
13
|
-
* Get all matched orders from the orderbook associated with the `address`.
|
|
14
|
-
* @param address The address to get the orders for.
|
|
15
|
-
* @param pending If true, returns pending orders, else returns all matched orders.
|
|
16
|
-
* @param paginationConfig - The configuration for the pagination.
|
|
17
|
-
* @returns {AsyncResult<PaginatedData<MatchedOrder>, string>} A promise that resolves to the orders.
|
|
18
|
-
*/
|
|
19
|
-
getMatchedOrders(address: string, pending: boolean, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<MatchedOrder>, string>;
|
|
20
|
-
/**
|
|
21
|
-
* Get all unmatched orders from the orderbook associated with the `address`.
|
|
22
|
-
* @param address The address to get the orders for.
|
|
23
|
-
* @param paginationConfig - The configuration for the pagination.
|
|
24
|
-
* @returns {AsyncResult<PaginatedData<CreateOrder>, string>} A promise that resolves to the orders.
|
|
25
|
-
*/
|
|
26
|
-
getUnMatchedOrders(address: string, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<CreateOrder>, string>;
|
|
27
|
-
/**
|
|
28
|
-
* Get all orders from the orderbook based on the match status.
|
|
29
|
-
* @param matched - If true, returns matched orders, else returns unmatched orders.
|
|
30
|
-
* @param paginationConfig - The configuration for the pagination.
|
|
31
|
-
* @returns {AsyncResult<PaginatedData<T extends true ? MatchedOrder : CreateOrder>, string>} A promise that resolves to the orders.
|
|
32
|
-
*/
|
|
33
|
-
getOrders<T extends boolean>(matched: T, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<T extends true ? MatchedOrder : CreateOrder>, string>;
|
|
34
|
-
/**
|
|
35
|
-
* Polls for every provided interval and returns matched and unmatched orders associated on the account.
|
|
36
|
-
* @param account The account to subscribe to
|
|
37
|
-
* @param matched If true, returns matched orders, else returns unmatched orders
|
|
38
|
-
* @param cb Th ack to be called when the orders are updated
|
|
39
|
-
* @param interval The interval to poll for updates
|
|
40
|
-
*
|
|
41
|
-
* Example usage:
|
|
42
|
-
*
|
|
43
|
-
* ```js
|
|
44
|
-
* const unsubscribe =await orderbook.subscribeOrders(account, matched, interval, handleOrders, paginationConfig);
|
|
45
|
-
*
|
|
46
|
-
* // Unsubscribe after 20 seconds
|
|
47
|
-
* setTimeout(() => {
|
|
48
|
-
* unsubscribe();
|
|
49
|
-
* console.log('Unsubscribed from orders');
|
|
50
|
-
* }, 20000);
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
subscribeOrders<T extends boolean>(account: string, matched: T, interval: number, cb: (orders: PaginatedData<T extends true ? MatchedOrder : CreateOrder>) => Promise<void>, pending?: boolean, paginationConfig?: PaginationConfig): Promise<() => void>;
|
|
54
|
-
/**
|
|
55
|
-
* Returns the current orders count associated with the provided address. Used to calculate nonce for secret generation.
|
|
56
|
-
* @param address The address to get the orders count for.
|
|
57
|
-
* @returns {AsyncResult<number, string>} A promise that resolves to the orders count.
|
|
58
|
-
*/
|
|
59
|
-
getOrdersCount(address: string): AsyncResult<number, string>;
|
|
60
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IOrderProvider } from './orders.types';
|
|
2
|
-
import { CreateOrder, MatchedOrder, PaginatedData, PaginationConfig } from '../orderbook/orderbook.types';
|
|
3
|
-
import { AsyncResult, Url } from '@gardenfi/utils';
|
|
4
|
-
|
|
5
|
-
export declare class OrdersProvider implements IOrderProvider {
|
|
6
|
-
private url;
|
|
7
|
-
constructor(url: string | Url);
|
|
8
|
-
getOrder<T extends boolean>(id: string, matched: T): AsyncResult<T extends true ? MatchedOrder : CreateOrder, string>;
|
|
9
|
-
getMatchedOrders(address: string, pending: boolean, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<MatchedOrder>, string>;
|
|
10
|
-
getUnMatchedOrders(address: string, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<CreateOrder>, string>;
|
|
11
|
-
getOrders<T extends boolean>(matched: T, paginationConfig?: PaginationConfig): AsyncResult<PaginatedData<T extends true ? MatchedOrder : CreateOrder>, string>;
|
|
12
|
-
subscribeOrders<T extends boolean>(account: string, matched: T, interval: number, cb: (orders: PaginatedData<T extends true ? MatchedOrder : CreateOrder>) => Promise<void>, pending?: boolean, paginationConfig?: PaginationConfig): Promise<() => void>;
|
|
13
|
-
getOrdersCount(address: string): AsyncResult<number, string>;
|
|
14
|
-
}
|