@liberfi.io/react-predict 0.3.45 → 0.3.47
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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{server-BYvRRFCr.d.mts → server-Byq4PK9C.d.mts} +37 -1
- package/dist/{server-BYvRRFCr.d.ts → server-Byq4PK9C.d.ts} +37 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +11 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +12 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { httpGet,
|
|
1
|
+
import { httpGet, httpPost, httpDelete } from '@liberfi.io/utils';
|
|
2
2
|
import { createContext, useMemo, useState, useRef, useCallback, useContext, useEffect } from 'react';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useQuery, useInfiniteQuery, useQueries, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
@@ -113,6 +113,17 @@ var PredictClient = class {
|
|
|
113
113
|
const url = `${this.endpoint}/api/v1/markets/${encodeURIComponent(slug)}/orderbook${query}`;
|
|
114
114
|
return await httpGet(url);
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Maps to `POST /api/v1/markets/orderbooks`.
|
|
118
|
+
* Fetches order books for many markets in a single request (max 100 items).
|
|
119
|
+
* Results are returned in the same order as `items`; per-item failures are
|
|
120
|
+
* reported via `OrderbookBatchResult.error` and never fail the whole batch.
|
|
121
|
+
*/
|
|
122
|
+
async getOrderbooks(items) {
|
|
123
|
+
const url = `${this.endpoint}/api/v1/markets/orderbooks`;
|
|
124
|
+
const res = await httpPost(url, { items });
|
|
125
|
+
return res.results;
|
|
126
|
+
}
|
|
116
127
|
/** Maps to `GET /api/v1/markets/:slug/trades?source=...`. */
|
|
117
128
|
async listMarketTrades(slug, params) {
|
|
118
129
|
const query = buildQuery(params);
|