@liberfi.io/react-predict 0.1.49 → 0.1.51
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 +48 -4
- package/dist/index.d.ts +48 -4
- package/dist/index.js +118 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +115 -19
- package/dist/index.mjs.map +1 -1
- package/dist/{server-rYuNULuJ.d.mts → server-eKqIns8z.d.mts} +49 -2
- package/dist/{server-rYuNULuJ.d.ts → server-eKqIns8z.d.ts} +49 -2
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +46 -14
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +46 -14
- package/dist/server.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -172,10 +172,11 @@ interface EventSummary {
|
|
|
172
172
|
image_url?: string;
|
|
173
173
|
status: EventStatus;
|
|
174
174
|
}
|
|
175
|
-
/** Lightweight market summary embedded in a trade. */
|
|
175
|
+
/** Lightweight market summary embedded in a trade or order. */
|
|
176
176
|
interface MarketSummary {
|
|
177
177
|
slug: string;
|
|
178
178
|
question: string;
|
|
179
|
+
image_url?: string;
|
|
179
180
|
status: MarketStatus;
|
|
180
181
|
}
|
|
181
182
|
/** A single trade record. */
|
|
@@ -519,6 +520,10 @@ interface PredictOrder {
|
|
|
519
520
|
created_at?: number;
|
|
520
521
|
expires_at?: number;
|
|
521
522
|
provider_meta?: ProviderMeta;
|
|
523
|
+
/** Enriched event context (populated by multi-wallet endpoint). */
|
|
524
|
+
event?: EventSummary;
|
|
525
|
+
/** Enriched market context (populated by multi-wallet endpoint). */
|
|
526
|
+
market?: MarketSummary;
|
|
522
527
|
}
|
|
523
528
|
/** Query parameters for `GET /api/v1/orders`. */
|
|
524
529
|
interface ListOrdersParams {
|
|
@@ -529,6 +534,17 @@ interface ListOrdersParams {
|
|
|
529
534
|
asset_id?: string;
|
|
530
535
|
next_cursor?: string;
|
|
531
536
|
}
|
|
537
|
+
/** Query parameters for multi-wallet `GET /api/v1/orders` mode. */
|
|
538
|
+
interface ListOrdersMultiParams {
|
|
539
|
+
kalshi_user?: string;
|
|
540
|
+
polymarket_user?: string;
|
|
541
|
+
}
|
|
542
|
+
/** Response from multi-wallet `GET /api/v1/orders`. */
|
|
543
|
+
interface PredictOrdersResponse {
|
|
544
|
+
user?: string;
|
|
545
|
+
wallets?: Record<string, string>;
|
|
546
|
+
orders: PredictOrder[];
|
|
547
|
+
}
|
|
532
548
|
/** Result of `DELETE /api/v1/orders/{id}`. */
|
|
533
549
|
interface CancelOrderResult {
|
|
534
550
|
cancelled: string[];
|
|
@@ -690,6 +706,16 @@ interface EventStats {
|
|
|
690
706
|
avg_liquidity: number;
|
|
691
707
|
active_sources: number;
|
|
692
708
|
}
|
|
709
|
+
/** Response from the available-shares endpoint. */
|
|
710
|
+
interface AvailableSharesResponse {
|
|
711
|
+
source: ProviderSource;
|
|
712
|
+
market: string;
|
|
713
|
+
side: string;
|
|
714
|
+
total_shares: number;
|
|
715
|
+
active_order_shares: number;
|
|
716
|
+
available_shares: number;
|
|
717
|
+
precision: number;
|
|
718
|
+
}
|
|
693
719
|
|
|
694
720
|
/**
|
|
695
721
|
* HTTP client for the prediction-server REST API.
|
|
@@ -770,6 +796,18 @@ declare class PredictClient {
|
|
|
770
796
|
kalshi_user?: string;
|
|
771
797
|
polymarket_user?: string;
|
|
772
798
|
}, source?: ProviderSource): Promise<PositionsResponse>;
|
|
799
|
+
/**
|
|
800
|
+
* Get the number of shares available for selling, accounting for active orders.
|
|
801
|
+
*
|
|
802
|
+
* Maps to `GET /api/v1/available-shares?source=...&user=...&market=...&side=...`.
|
|
803
|
+
*
|
|
804
|
+
* @param source - Provider source.
|
|
805
|
+
* @param user - Wallet address.
|
|
806
|
+
* @param market - Market slug.
|
|
807
|
+
* @param side - Position side ("yes" or "no").
|
|
808
|
+
* @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
|
|
809
|
+
*/
|
|
810
|
+
getAvailableShares(source: ProviderSource, user: string, market: string, side: string, headers?: Record<string, string>): Promise<AvailableSharesResponse>;
|
|
773
811
|
/**
|
|
774
812
|
* Get the on-chain USDC balance for a wallet.
|
|
775
813
|
*
|
|
@@ -786,6 +824,15 @@ declare class PredictClient {
|
|
|
786
824
|
* @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
|
|
787
825
|
*/
|
|
788
826
|
listOrders(params: ListOrdersParams, headers?: Record<string, string>): Promise<PredictPage<PredictOrder>>;
|
|
827
|
+
/**
|
|
828
|
+
* Multi-wallet order listing with enriched market/event context.
|
|
829
|
+
*
|
|
830
|
+
* Maps to `GET /api/v1/orders?kalshi_user=...&polymarket_user=...`.
|
|
831
|
+
*
|
|
832
|
+
* @param params - Per-provider wallet addresses.
|
|
833
|
+
* @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
|
|
834
|
+
*/
|
|
835
|
+
listOrdersMulti(params: ListOrdersMultiParams, headers?: Record<string, string>): Promise<PredictOrdersResponse>;
|
|
789
836
|
/**
|
|
790
837
|
* Maps to `GET /api/v1/orders/:id?source=...`.
|
|
791
838
|
*
|
|
@@ -1433,4 +1480,4 @@ interface ClobOrderPayload {
|
|
|
1433
1480
|
*/
|
|
1434
1481
|
declare function buildClobPayload(signedOrder: SignedOrder, owner: string): ClobOrderPayload;
|
|
1435
1482
|
|
|
1436
|
-
export {
|
|
1483
|
+
export { createPredictClient as $, type AvailableSharesResponse as A, type BalanceResponse as B, type Candlestick as C, type DFlowQuoteRequest as D, type EventStats as E, type DFlowKYCStatus as F, type PolymarketSetupStatus as G, type WithdrawBuildRequest as H, type WithdrawSubmitResponse as I, type WithdrawSubmitRequest as J, type WithdrawStatusResponse as K, type ListEventsParams as L, type MatchesParams as M, type PolymarketDepositAddresses as N, type Orderbook as O, PredictClient as P, type PolymarketWithdrawResponse as Q, type PolymarketWithdrawRequest as R, type SimilarEventsParams as S, type TickSizeResponse as T, type WsConnectionStatus as U, type WsDataMessage as V, type WithdrawBuildResponse as W, type WsPriceEvent as X, type WsOrderbookEvent as Y, type WsTradeEvent as Z, type CreateOrderInput as _, PredictWsClient as a, type PolymarketL2HeadersInput as a$, createPredictWsClient as a0, type PredictWsClientConfig as a1, type ProviderMeta as a2, type PredictTag as a3, type SettlementSource as a4, type MarketStatus as a5, type MarketResult as a6, type MarketOutcome as a7, type OrderbookLevel as a8, type TradeType as a9, type WsServerMessage as aA, type WsPongMessage as aB, type WsSubscribedMessage as aC, type WsErrorCode as aD, type WsErrorMessage as aE, eventQueryKey as aF, fetchEvent as aG, resolveTagSlug as aH, resolveEventsParams as aI, infiniteEventsQueryKey as aJ, fetchEventsPage as aK, type ResolveEventsParamsInput as aL, type TagSlugSelection as aM, marketQueryKey as aN, fetchMarket as aO, matchesQueryKey as aP, matchQueryKey as aQ, fetchMatchesPage as aR, matchMarketsQueryKey as aS, fetchMatchMarketsPage as aT, CLOB_AUTH_DOMAIN as aU, CLOB_AUTH_TYPES as aV, buildClobAuthMessage as aW, hmacSha256Base64 as aX, buildPolymarketL2Headers as aY, derivePolymarketApiKey as aZ, type HttpMethod as a_, type EventSummary as aa, type MarketSummary as ab, type PricePoint as ac, type PredictPosition as ad, type OrderStatus as ae, type OrderSide as af, type DFlowOrderContext as ag, type PolymarketOrderType as ah, type DepositBuildRequest as ai, type DepositBuildResponse as aj, type DepositSubmitRequest as ak, type DepositSubmitResponse as al, type DepositStatusResponse as am, type UnsignedTx as an, type MatchStatus as ao, type MatchGroupEntry as ap, type MatchGroupMarket as aq, type MatchSortField as ar, type MatchesStats as as, type MatchConfidenceTier as at, type MatchMarketFlat as au, type WsChannel as av, type WsChannelEvent as aw, type WsClientMessage as ax, type WsSubscribeMessage as ay, type WsPingMessage as az, type PredictPage as b, type PolymarketL2Headers as b0, type BuildClobAuthMessageInput as b1, CTF_EXCHANGE_ADDRESS as b2, NEG_RISK_CTF_EXCHANGE_ADDRESS as b3, USDC_ADDRESS as b4, POLYGON_CHAIN_ID as b5, buildCtfExchangeDomain as b6, CTF_ORDER_TYPES as b7, ORDER_TYPE as b8, SIDE as b9, buildOrderMessage as ba, buildSignedOrder as bb, buildClobPayload as bc, type ClobOrderPayload as bd, type BuildOrderMessageInput as be, type OrderMessage as bf, type SignedOrder as bg, DEFAULT_PAGE_SIZE as bh, type PredictEvent as c, type ProviderSource as d, type EventStatus as e, type EventSortField as f, type PredictMarket as g, type ListMarketTradesParams as h, type PredictTrade as i, type PriceHistoryRange as j, type PriceHistoryResponse as k, type ListCandlesticksParams as l, type PositionsResponse as m, type ListOrdersParams as n, type PredictOrder as o, type ListOrdersMultiParams as p, type PredictOrdersResponse as q, type CancelOrderResult as r, type MatchGroupPage as s, type MatchGroup as t, type MatchMarketParams as u, type MatchMarketPage as v, type ListTradesParams as w, type DFlowQuoteResponse as x, type DFlowSubmitResponse as y, type DFlowSubmitRequest as z };
|
|
@@ -172,10 +172,11 @@ interface EventSummary {
|
|
|
172
172
|
image_url?: string;
|
|
173
173
|
status: EventStatus;
|
|
174
174
|
}
|
|
175
|
-
/** Lightweight market summary embedded in a trade. */
|
|
175
|
+
/** Lightweight market summary embedded in a trade or order. */
|
|
176
176
|
interface MarketSummary {
|
|
177
177
|
slug: string;
|
|
178
178
|
question: string;
|
|
179
|
+
image_url?: string;
|
|
179
180
|
status: MarketStatus;
|
|
180
181
|
}
|
|
181
182
|
/** A single trade record. */
|
|
@@ -519,6 +520,10 @@ interface PredictOrder {
|
|
|
519
520
|
created_at?: number;
|
|
520
521
|
expires_at?: number;
|
|
521
522
|
provider_meta?: ProviderMeta;
|
|
523
|
+
/** Enriched event context (populated by multi-wallet endpoint). */
|
|
524
|
+
event?: EventSummary;
|
|
525
|
+
/** Enriched market context (populated by multi-wallet endpoint). */
|
|
526
|
+
market?: MarketSummary;
|
|
522
527
|
}
|
|
523
528
|
/** Query parameters for `GET /api/v1/orders`. */
|
|
524
529
|
interface ListOrdersParams {
|
|
@@ -529,6 +534,17 @@ interface ListOrdersParams {
|
|
|
529
534
|
asset_id?: string;
|
|
530
535
|
next_cursor?: string;
|
|
531
536
|
}
|
|
537
|
+
/** Query parameters for multi-wallet `GET /api/v1/orders` mode. */
|
|
538
|
+
interface ListOrdersMultiParams {
|
|
539
|
+
kalshi_user?: string;
|
|
540
|
+
polymarket_user?: string;
|
|
541
|
+
}
|
|
542
|
+
/** Response from multi-wallet `GET /api/v1/orders`. */
|
|
543
|
+
interface PredictOrdersResponse {
|
|
544
|
+
user?: string;
|
|
545
|
+
wallets?: Record<string, string>;
|
|
546
|
+
orders: PredictOrder[];
|
|
547
|
+
}
|
|
532
548
|
/** Result of `DELETE /api/v1/orders/{id}`. */
|
|
533
549
|
interface CancelOrderResult {
|
|
534
550
|
cancelled: string[];
|
|
@@ -690,6 +706,16 @@ interface EventStats {
|
|
|
690
706
|
avg_liquidity: number;
|
|
691
707
|
active_sources: number;
|
|
692
708
|
}
|
|
709
|
+
/** Response from the available-shares endpoint. */
|
|
710
|
+
interface AvailableSharesResponse {
|
|
711
|
+
source: ProviderSource;
|
|
712
|
+
market: string;
|
|
713
|
+
side: string;
|
|
714
|
+
total_shares: number;
|
|
715
|
+
active_order_shares: number;
|
|
716
|
+
available_shares: number;
|
|
717
|
+
precision: number;
|
|
718
|
+
}
|
|
693
719
|
|
|
694
720
|
/**
|
|
695
721
|
* HTTP client for the prediction-server REST API.
|
|
@@ -770,6 +796,18 @@ declare class PredictClient {
|
|
|
770
796
|
kalshi_user?: string;
|
|
771
797
|
polymarket_user?: string;
|
|
772
798
|
}, source?: ProviderSource): Promise<PositionsResponse>;
|
|
799
|
+
/**
|
|
800
|
+
* Get the number of shares available for selling, accounting for active orders.
|
|
801
|
+
*
|
|
802
|
+
* Maps to `GET /api/v1/available-shares?source=...&user=...&market=...&side=...`.
|
|
803
|
+
*
|
|
804
|
+
* @param source - Provider source.
|
|
805
|
+
* @param user - Wallet address.
|
|
806
|
+
* @param market - Market slug.
|
|
807
|
+
* @param side - Position side ("yes" or "no").
|
|
808
|
+
* @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
|
|
809
|
+
*/
|
|
810
|
+
getAvailableShares(source: ProviderSource, user: string, market: string, side: string, headers?: Record<string, string>): Promise<AvailableSharesResponse>;
|
|
773
811
|
/**
|
|
774
812
|
* Get the on-chain USDC balance for a wallet.
|
|
775
813
|
*
|
|
@@ -786,6 +824,15 @@ declare class PredictClient {
|
|
|
786
824
|
* @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
|
|
787
825
|
*/
|
|
788
826
|
listOrders(params: ListOrdersParams, headers?: Record<string, string>): Promise<PredictPage<PredictOrder>>;
|
|
827
|
+
/**
|
|
828
|
+
* Multi-wallet order listing with enriched market/event context.
|
|
829
|
+
*
|
|
830
|
+
* Maps to `GET /api/v1/orders?kalshi_user=...&polymarket_user=...`.
|
|
831
|
+
*
|
|
832
|
+
* @param params - Per-provider wallet addresses.
|
|
833
|
+
* @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
|
|
834
|
+
*/
|
|
835
|
+
listOrdersMulti(params: ListOrdersMultiParams, headers?: Record<string, string>): Promise<PredictOrdersResponse>;
|
|
789
836
|
/**
|
|
790
837
|
* Maps to `GET /api/v1/orders/:id?source=...`.
|
|
791
838
|
*
|
|
@@ -1433,4 +1480,4 @@ interface ClobOrderPayload {
|
|
|
1433
1480
|
*/
|
|
1434
1481
|
declare function buildClobPayload(signedOrder: SignedOrder, owner: string): ClobOrderPayload;
|
|
1435
1482
|
|
|
1436
|
-
export {
|
|
1483
|
+
export { createPredictClient as $, type AvailableSharesResponse as A, type BalanceResponse as B, type Candlestick as C, type DFlowQuoteRequest as D, type EventStats as E, type DFlowKYCStatus as F, type PolymarketSetupStatus as G, type WithdrawBuildRequest as H, type WithdrawSubmitResponse as I, type WithdrawSubmitRequest as J, type WithdrawStatusResponse as K, type ListEventsParams as L, type MatchesParams as M, type PolymarketDepositAddresses as N, type Orderbook as O, PredictClient as P, type PolymarketWithdrawResponse as Q, type PolymarketWithdrawRequest as R, type SimilarEventsParams as S, type TickSizeResponse as T, type WsConnectionStatus as U, type WsDataMessage as V, type WithdrawBuildResponse as W, type WsPriceEvent as X, type WsOrderbookEvent as Y, type WsTradeEvent as Z, type CreateOrderInput as _, PredictWsClient as a, type PolymarketL2HeadersInput as a$, createPredictWsClient as a0, type PredictWsClientConfig as a1, type ProviderMeta as a2, type PredictTag as a3, type SettlementSource as a4, type MarketStatus as a5, type MarketResult as a6, type MarketOutcome as a7, type OrderbookLevel as a8, type TradeType as a9, type WsServerMessage as aA, type WsPongMessage as aB, type WsSubscribedMessage as aC, type WsErrorCode as aD, type WsErrorMessage as aE, eventQueryKey as aF, fetchEvent as aG, resolveTagSlug as aH, resolveEventsParams as aI, infiniteEventsQueryKey as aJ, fetchEventsPage as aK, type ResolveEventsParamsInput as aL, type TagSlugSelection as aM, marketQueryKey as aN, fetchMarket as aO, matchesQueryKey as aP, matchQueryKey as aQ, fetchMatchesPage as aR, matchMarketsQueryKey as aS, fetchMatchMarketsPage as aT, CLOB_AUTH_DOMAIN as aU, CLOB_AUTH_TYPES as aV, buildClobAuthMessage as aW, hmacSha256Base64 as aX, buildPolymarketL2Headers as aY, derivePolymarketApiKey as aZ, type HttpMethod as a_, type EventSummary as aa, type MarketSummary as ab, type PricePoint as ac, type PredictPosition as ad, type OrderStatus as ae, type OrderSide as af, type DFlowOrderContext as ag, type PolymarketOrderType as ah, type DepositBuildRequest as ai, type DepositBuildResponse as aj, type DepositSubmitRequest as ak, type DepositSubmitResponse as al, type DepositStatusResponse as am, type UnsignedTx as an, type MatchStatus as ao, type MatchGroupEntry as ap, type MatchGroupMarket as aq, type MatchSortField as ar, type MatchesStats as as, type MatchConfidenceTier as at, type MatchMarketFlat as au, type WsChannel as av, type WsChannelEvent as aw, type WsClientMessage as ax, type WsSubscribeMessage as ay, type WsPingMessage as az, type PredictPage as b, type PolymarketL2Headers as b0, type BuildClobAuthMessageInput as b1, CTF_EXCHANGE_ADDRESS as b2, NEG_RISK_CTF_EXCHANGE_ADDRESS as b3, USDC_ADDRESS as b4, POLYGON_CHAIN_ID as b5, buildCtfExchangeDomain as b6, CTF_ORDER_TYPES as b7, ORDER_TYPE as b8, SIDE as b9, buildOrderMessage as ba, buildSignedOrder as bb, buildClobPayload as bc, type ClobOrderPayload as bd, type BuildOrderMessageInput as be, type OrderMessage as bf, type SignedOrder as bg, DEFAULT_PAGE_SIZE as bh, type PredictEvent as c, type ProviderSource as d, type EventStatus as e, type EventSortField as f, type PredictMarket as g, type ListMarketTradesParams as h, type PredictTrade as i, type PriceHistoryRange as j, type PriceHistoryResponse as k, type ListCandlesticksParams as l, type PositionsResponse as m, type ListOrdersParams as n, type PredictOrder as o, type ListOrdersMultiParams as p, type PredictOrdersResponse as q, type CancelOrderResult as r, type MatchGroupPage as s, type MatchGroup as t, type MatchMarketParams as u, type MatchMarketPage as v, type ListTradesParams as w, type DFlowQuoteResponse as x, type DFlowSubmitResponse as y, type DFlowSubmitRequest as z };
|
package/dist/server.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { B as BalanceResponse,
|
|
1
|
+
export { B as BalanceResponse, b1 as BuildClobAuthMessageInput, be as BuildOrderMessageInput, aU as CLOB_AUTH_DOMAIN, aV as CLOB_AUTH_TYPES, b2 as CTF_EXCHANGE_ADDRESS, b7 as CTF_ORDER_TYPES, r as CancelOrderResult, C as Candlestick, bd as ClobOrderPayload, _ as CreateOrderInput, bh as DEFAULT_PAGE_SIZE, ag as DFlowOrderContext, D as DFlowQuoteRequest, x as DFlowQuoteResponse, z as DFlowSubmitRequest, y as DFlowSubmitResponse, ai as DepositBuildRequest, aj as DepositBuildResponse, am as DepositStatusResponse, ak as DepositSubmitRequest, al as DepositSubmitResponse, f as EventSortField, e as EventStatus, aa as EventSummary, a_ as HttpMethod, l as ListCandlesticksParams, L as ListEventsParams, h as ListMarketTradesParams, n as ListOrdersParams, w as ListTradesParams, a7 as MarketOutcome, a6 as MarketResult, a5 as MarketStatus, ab as MarketSummary, at as MatchConfidenceTier, t as MatchGroup, ap as MatchGroupEntry, aq as MatchGroupMarket, s as MatchGroupPage, au as MatchMarketFlat, v as MatchMarketPage, u as MatchMarketParams, ar as MatchSortField, ao as MatchStatus, M as MatchesParams, as as MatchesStats, b3 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b8 as ORDER_TYPE, bf as OrderMessage, af as OrderSide, ae as OrderStatus, O as Orderbook, a8 as OrderbookLevel, b5 as POLYGON_CHAIN_ID, b0 as PolymarketL2Headers, a$ as PolymarketL2HeadersInput, ah as PolymarketOrderType, m as PositionsResponse, P as PredictClient, c as PredictEvent, g as PredictMarket, o as PredictOrder, b as PredictPage, ad as PredictPosition, a3 as PredictTag, i as PredictTrade, a as PredictWsClient, a1 as PredictWsClientConfig, j as PriceHistoryRange, k as PriceHistoryResponse, ac as PricePoint, a2 as ProviderMeta, d as ProviderSource, aL as ResolveEventsParamsInput, b9 as SIDE, a4 as SettlementSource, bg as SignedOrder, S as SimilarEventsParams, aM as TagSlugSelection, a9 as TradeType, b4 as USDC_ADDRESS, an as UnsignedTx, av as WsChannel, aw as WsChannelEvent, ax as WsClientMessage, U as WsConnectionStatus, V as WsDataMessage, aD as WsErrorCode, aE as WsErrorMessage, Y as WsOrderbookEvent, az as WsPingMessage, aB as WsPongMessage, X as WsPriceEvent, aA as WsServerMessage, ay as WsSubscribeMessage, aC as WsSubscribedMessage, Z as WsTradeEvent, aW as buildClobAuthMessage, bc as buildClobPayload, b6 as buildCtfExchangeDomain, ba as buildOrderMessage, aY as buildPolymarketL2Headers, bb as buildSignedOrder, $ as createPredictClient, a0 as createPredictWsClient, aZ as derivePolymarketApiKey, aF as eventQueryKey, aG as fetchEvent, aK as fetchEventsPage, aO as fetchMarket, aT as fetchMatchMarketsPage, aR as fetchMatchesPage, aX as hmacSha256Base64, aJ as infiniteEventsQueryKey, aN as marketQueryKey, aS as matchMarketsQueryKey, aQ as matchQueryKey, aP as matchesQueryKey, aI as resolveEventsParams, aH as resolveTagSlug } from './server-eKqIns8z.mjs';
|
package/dist/server.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { B as BalanceResponse,
|
|
1
|
+
export { B as BalanceResponse, b1 as BuildClobAuthMessageInput, be as BuildOrderMessageInput, aU as CLOB_AUTH_DOMAIN, aV as CLOB_AUTH_TYPES, b2 as CTF_EXCHANGE_ADDRESS, b7 as CTF_ORDER_TYPES, r as CancelOrderResult, C as Candlestick, bd as ClobOrderPayload, _ as CreateOrderInput, bh as DEFAULT_PAGE_SIZE, ag as DFlowOrderContext, D as DFlowQuoteRequest, x as DFlowQuoteResponse, z as DFlowSubmitRequest, y as DFlowSubmitResponse, ai as DepositBuildRequest, aj as DepositBuildResponse, am as DepositStatusResponse, ak as DepositSubmitRequest, al as DepositSubmitResponse, f as EventSortField, e as EventStatus, aa as EventSummary, a_ as HttpMethod, l as ListCandlesticksParams, L as ListEventsParams, h as ListMarketTradesParams, n as ListOrdersParams, w as ListTradesParams, a7 as MarketOutcome, a6 as MarketResult, a5 as MarketStatus, ab as MarketSummary, at as MatchConfidenceTier, t as MatchGroup, ap as MatchGroupEntry, aq as MatchGroupMarket, s as MatchGroupPage, au as MatchMarketFlat, v as MatchMarketPage, u as MatchMarketParams, ar as MatchSortField, ao as MatchStatus, M as MatchesParams, as as MatchesStats, b3 as NEG_RISK_CTF_EXCHANGE_ADDRESS, b8 as ORDER_TYPE, bf as OrderMessage, af as OrderSide, ae as OrderStatus, O as Orderbook, a8 as OrderbookLevel, b5 as POLYGON_CHAIN_ID, b0 as PolymarketL2Headers, a$ as PolymarketL2HeadersInput, ah as PolymarketOrderType, m as PositionsResponse, P as PredictClient, c as PredictEvent, g as PredictMarket, o as PredictOrder, b as PredictPage, ad as PredictPosition, a3 as PredictTag, i as PredictTrade, a as PredictWsClient, a1 as PredictWsClientConfig, j as PriceHistoryRange, k as PriceHistoryResponse, ac as PricePoint, a2 as ProviderMeta, d as ProviderSource, aL as ResolveEventsParamsInput, b9 as SIDE, a4 as SettlementSource, bg as SignedOrder, S as SimilarEventsParams, aM as TagSlugSelection, a9 as TradeType, b4 as USDC_ADDRESS, an as UnsignedTx, av as WsChannel, aw as WsChannelEvent, ax as WsClientMessage, U as WsConnectionStatus, V as WsDataMessage, aD as WsErrorCode, aE as WsErrorMessage, Y as WsOrderbookEvent, az as WsPingMessage, aB as WsPongMessage, X as WsPriceEvent, aA as WsServerMessage, ay as WsSubscribeMessage, aC as WsSubscribedMessage, Z as WsTradeEvent, aW as buildClobAuthMessage, bc as buildClobPayload, b6 as buildCtfExchangeDomain, ba as buildOrderMessage, aY as buildPolymarketL2Headers, bb as buildSignedOrder, $ as createPredictClient, a0 as createPredictWsClient, aZ as derivePolymarketApiKey, aF as eventQueryKey, aG as fetchEvent, aK as fetchEventsPage, aO as fetchMarket, aT as fetchMatchMarketsPage, aR as fetchMatchesPage, aX as hmacSha256Base64, aJ as infiniteEventsQueryKey, aN as marketQueryKey, aS as matchMarketsQueryKey, aQ as matchQueryKey, aP as matchesQueryKey, aI as resolveEventsParams, aH as resolveTagSlug } from './server-eKqIns8z.js';
|
package/dist/server.js
CHANGED
|
@@ -212,6 +212,28 @@ var PredictClient = class {
|
|
|
212
212
|
return await utils.httpGet(url);
|
|
213
213
|
}
|
|
214
214
|
// -------------------------------------------------------------------------
|
|
215
|
+
// Available shares (for sell flow)
|
|
216
|
+
// -------------------------------------------------------------------------
|
|
217
|
+
/**
|
|
218
|
+
* Get the number of shares available for selling, accounting for active orders.
|
|
219
|
+
*
|
|
220
|
+
* Maps to `GET /api/v1/available-shares?source=...&user=...&market=...&side=...`.
|
|
221
|
+
*
|
|
222
|
+
* @param source - Provider source.
|
|
223
|
+
* @param user - Wallet address.
|
|
224
|
+
* @param market - Market slug.
|
|
225
|
+
* @param side - Position side ("yes" or "no").
|
|
226
|
+
* @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
|
|
227
|
+
*/
|
|
228
|
+
async getAvailableShares(source, user, market, side, headers) {
|
|
229
|
+
const query = buildQuery({ source, user, market, side });
|
|
230
|
+
const url = `${this.endpoint}/api/v1/available-shares${query}`;
|
|
231
|
+
return await utils.httpGet(
|
|
232
|
+
url,
|
|
233
|
+
headers ? { headers } : void 0
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
// -------------------------------------------------------------------------
|
|
215
237
|
// Balance
|
|
216
238
|
// -------------------------------------------------------------------------
|
|
217
239
|
/**
|
|
@@ -244,6 +266,22 @@ var PredictClient = class {
|
|
|
244
266
|
headers ? { headers } : void 0
|
|
245
267
|
);
|
|
246
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Multi-wallet order listing with enriched market/event context.
|
|
271
|
+
*
|
|
272
|
+
* Maps to `GET /api/v1/orders?kalshi_user=...&polymarket_user=...`.
|
|
273
|
+
*
|
|
274
|
+
* @param params - Per-provider wallet addresses.
|
|
275
|
+
* @param headers - Optional extra headers (e.g. Polymarket POLY_* HMAC headers).
|
|
276
|
+
*/
|
|
277
|
+
async listOrdersMulti(params, headers) {
|
|
278
|
+
const query = buildQuery(params);
|
|
279
|
+
const url = `${this.endpoint}/api/v1/orders${query}`;
|
|
280
|
+
return await utils.httpGet(
|
|
281
|
+
url,
|
|
282
|
+
headers ? { headers } : void 0
|
|
283
|
+
);
|
|
284
|
+
}
|
|
247
285
|
/**
|
|
248
286
|
* Maps to `GET /api/v1/orders/:id?source=...`.
|
|
249
287
|
*
|
|
@@ -947,17 +985,13 @@ var DEFAULT_ROUNDING = { size: 2, price: 2, amount: 4 };
|
|
|
947
985
|
function decimalPlaces(n, d) {
|
|
948
986
|
return parseFloat(n.toFixed(d));
|
|
949
987
|
}
|
|
988
|
+
function floorDecimalPlaces(n, d) {
|
|
989
|
+
const factor = 10 ** d;
|
|
990
|
+
return Math.floor(n * factor) / factor;
|
|
991
|
+
}
|
|
950
992
|
function toMicroUsdc(amount) {
|
|
951
993
|
return BigInt(Math.round(amount * 1e6));
|
|
952
994
|
}
|
|
953
|
-
function ceilMicro(raw, maxDecimals) {
|
|
954
|
-
const factor = BigInt(10 ** (6 - maxDecimals));
|
|
955
|
-
return (raw + factor - 1n) / factor * factor;
|
|
956
|
-
}
|
|
957
|
-
function floorMicro(raw, maxDecimals) {
|
|
958
|
-
const factor = BigInt(10 ** (6 - maxDecimals));
|
|
959
|
-
return raw / factor * factor;
|
|
960
|
-
}
|
|
961
995
|
function normalizeTokenId(tokenId) {
|
|
962
996
|
if (tokenId.startsWith("0x") || tokenId.startsWith("0X")) {
|
|
963
997
|
return BigInt(tokenId).toString(10);
|
|
@@ -968,14 +1002,12 @@ function buildOrderMessage(input) {
|
|
|
968
1002
|
const side = input.side === "BUY" ? SIDE.BUY : SIDE.SELL;
|
|
969
1003
|
const rc = ROUNDING_CONFIG[input.tickSize] ?? DEFAULT_ROUNDING;
|
|
970
1004
|
const rawPrice = decimalPlaces(input.price, rc.price);
|
|
971
|
-
const rawSize = decimalPlaces(input.size, rc.size);
|
|
972
|
-
const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
|
|
1005
|
+
const rawSize = side === SIDE.SELL ? floorDecimalPlaces(input.size, rc.size) : decimalPlaces(input.size, rc.size);
|
|
973
1006
|
const sizeInMicro = toMicroUsdc(rawSize);
|
|
1007
|
+
const rawAmount = decimalPlaces(rawSize * rawPrice, rc.amount);
|
|
974
1008
|
const amountInMicro = toMicroUsdc(rawAmount);
|
|
975
|
-
const
|
|
976
|
-
const
|
|
977
|
-
const makerAmount = side === SIDE.BUY ? usdcMicro.toString() : sharesMicro.toString();
|
|
978
|
-
const takerAmount = side === SIDE.BUY ? sharesMicro.toString() : usdcMicro.toString();
|
|
1009
|
+
const makerAmount = side === SIDE.BUY ? amountInMicro.toString() : sizeInMicro.toString();
|
|
1010
|
+
const takerAmount = side === SIDE.BUY ? sizeInMicro.toString() : amountInMicro.toString();
|
|
979
1011
|
const maker = input.funderAddress ?? input.signerAddress;
|
|
980
1012
|
return {
|
|
981
1013
|
salt: Math.floor(Math.random() * 1e15).toString(),
|