@limitless-exchange/sdk 0.0.2 → 0.0.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/README.md +65 -6
- package/dist/index.d.mts +252 -155
- package/dist/index.d.ts +252 -155
- package/dist/index.js +273 -209
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +273 -208
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -309,14 +309,6 @@ declare enum OrderType {
|
|
|
309
309
|
/** Good-Til-Cancelled: Remain on orderbook until filled or cancelled */
|
|
310
310
|
GTC = "GTC"
|
|
311
311
|
}
|
|
312
|
-
/**
|
|
313
|
-
* Market type enum.
|
|
314
|
-
* @public
|
|
315
|
-
*/
|
|
316
|
-
declare enum MarketType {
|
|
317
|
-
CLOB = "CLOB",
|
|
318
|
-
NEGRISK = "NEGRISK"
|
|
319
|
-
}
|
|
320
312
|
/**
|
|
321
313
|
* Signature type enum.
|
|
322
314
|
* @public
|
|
@@ -342,11 +334,6 @@ interface BaseOrderArgs {
|
|
|
342
334
|
* Order side (BUY or SELL)
|
|
343
335
|
*/
|
|
344
336
|
side: Side;
|
|
345
|
-
/**
|
|
346
|
-
* Market type (CLOB or NEGRISK)
|
|
347
|
-
* @defaultValue 'CLOB'
|
|
348
|
-
*/
|
|
349
|
-
marketType?: MarketType;
|
|
350
337
|
/**
|
|
351
338
|
* Expiration timestamp (0 for no expiration)
|
|
352
339
|
* @defaultValue '0'
|
|
@@ -684,13 +671,9 @@ interface OrderSigningConfig {
|
|
|
684
671
|
*/
|
|
685
672
|
chainId: number;
|
|
686
673
|
/**
|
|
687
|
-
* Contract address for verification
|
|
674
|
+
* Contract address for verification (from venue.exchange)
|
|
688
675
|
*/
|
|
689
676
|
contractAddress: string;
|
|
690
|
-
/**
|
|
691
|
-
* Market type (CLOB or NEGRISK)
|
|
692
|
-
*/
|
|
693
|
-
marketType: MarketType;
|
|
694
677
|
}
|
|
695
678
|
|
|
696
679
|
/**
|
|
@@ -931,6 +914,35 @@ interface MarketOutcome {
|
|
|
931
914
|
*/
|
|
932
915
|
price?: number;
|
|
933
916
|
}
|
|
917
|
+
/**
|
|
918
|
+
* Venue information for CLOB markets.
|
|
919
|
+
*
|
|
920
|
+
* @remarks
|
|
921
|
+
* Contains contract addresses required for trading:
|
|
922
|
+
* - exchange: Used as verifyingContract for EIP-712 order signing
|
|
923
|
+
* - adapter: Required for NegRisk/Grouped market SELL approvals
|
|
924
|
+
*
|
|
925
|
+
* @public
|
|
926
|
+
*/
|
|
927
|
+
interface Venue {
|
|
928
|
+
/**
|
|
929
|
+
* Exchange contract address.
|
|
930
|
+
*
|
|
931
|
+
* @remarks
|
|
932
|
+
* This address is used as the verifyingContract in EIP-712 order signing.
|
|
933
|
+
* All BUY orders require USDC approval to this address.
|
|
934
|
+
* Simple CLOB SELL orders require CT approval to this address.
|
|
935
|
+
*/
|
|
936
|
+
exchange: string;
|
|
937
|
+
/**
|
|
938
|
+
* Adapter contract address.
|
|
939
|
+
*
|
|
940
|
+
* @remarks
|
|
941
|
+
* Required for NegRisk/Grouped markets only.
|
|
942
|
+
* SELL orders on NegRisk markets require CT approval to both exchange AND adapter.
|
|
943
|
+
*/
|
|
944
|
+
adapter: string;
|
|
945
|
+
}
|
|
934
946
|
/**
|
|
935
947
|
* Market token IDs for CLOB markets.
|
|
936
948
|
* @public
|
|
@@ -1063,6 +1075,17 @@ interface Market {
|
|
|
1063
1075
|
* Market settings (CLOB only)
|
|
1064
1076
|
*/
|
|
1065
1077
|
settings?: MarketSettings;
|
|
1078
|
+
/**
|
|
1079
|
+
* Venue information for CLOB markets.
|
|
1080
|
+
*
|
|
1081
|
+
* @remarks
|
|
1082
|
+
* Contains exchange and adapter contract addresses for order signing and approvals.
|
|
1083
|
+
* The exchange address is used as verifyingContract in EIP-712 signatures.
|
|
1084
|
+
*
|
|
1085
|
+
* Performance tip: Call getMarket() before createOrder() to cache venue data
|
|
1086
|
+
* and avoid additional API requests during order creation.
|
|
1087
|
+
*/
|
|
1088
|
+
venue?: Venue;
|
|
1066
1089
|
/**
|
|
1067
1090
|
* Market logo URL
|
|
1068
1091
|
*/
|
|
@@ -2552,22 +2575,34 @@ declare const SIGNING_MESSAGE_TEMPLATE = "Welcome to Limitless.exchange! Please
|
|
|
2552
2575
|
declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2553
2576
|
/**
|
|
2554
2577
|
* Contract addresses by network
|
|
2578
|
+
*
|
|
2579
|
+
* @remarks
|
|
2580
|
+
* Note: CLOB and NegRisk exchange addresses are provided dynamically via the venue system
|
|
2581
|
+
* (market.venue.exchange and market.venue.adapter). These addresses vary per market and
|
|
2582
|
+
* should be fetched from the API rather than hardcoded.
|
|
2583
|
+
*
|
|
2555
2584
|
* @public
|
|
2556
2585
|
*/
|
|
2557
2586
|
declare const CONTRACT_ADDRESSES: {
|
|
2558
2587
|
readonly 8453: {
|
|
2559
|
-
readonly
|
|
2560
|
-
readonly
|
|
2588
|
+
readonly USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
2589
|
+
readonly CTF: "0xC9c98965297Bc527861c898329Ee280632B76e18";
|
|
2561
2590
|
};
|
|
2562
2591
|
readonly 84532: {
|
|
2563
|
-
readonly
|
|
2564
|
-
readonly
|
|
2592
|
+
readonly USDC: "0x...";
|
|
2593
|
+
readonly CTF: "0x...";
|
|
2565
2594
|
};
|
|
2566
2595
|
};
|
|
2567
2596
|
/**
|
|
2568
|
-
* Get contract address for
|
|
2597
|
+
* Get contract address for tokens (USDC or CTF)
|
|
2598
|
+
*
|
|
2599
|
+
* @remarks
|
|
2600
|
+
* For CLOB and NegRisk exchange addresses, use the venue system instead:
|
|
2601
|
+
* - Fetch market via `marketFetcher.getMarket(slug)`
|
|
2602
|
+
* - Use `market.venue.exchange` for signing and approvals
|
|
2603
|
+
* - Use `market.venue.adapter` for NegRisk adapter approvals
|
|
2569
2604
|
*
|
|
2570
|
-
* @param
|
|
2605
|
+
* @param contractType - Contract type (USDC or CTF)
|
|
2571
2606
|
* @param chainId - Chain ID (default: 8453 for Base mainnet)
|
|
2572
2607
|
* @returns Contract address
|
|
2573
2608
|
*
|
|
@@ -2575,7 +2610,7 @@ declare const CONTRACT_ADDRESSES: {
|
|
|
2575
2610
|
*
|
|
2576
2611
|
* @public
|
|
2577
2612
|
*/
|
|
2578
|
-
declare function getContractAddress(
|
|
2613
|
+
declare function getContractAddress(contractType: 'USDC' | 'CTF', chainId?: number): string;
|
|
2579
2614
|
|
|
2580
2615
|
/**
|
|
2581
2616
|
* Order builder for constructing unsigned order payloads.
|
|
@@ -2639,8 +2674,7 @@ declare class OrderBuilder {
|
|
|
2639
2674
|
* const fokOrder = builder.buildOrder({
|
|
2640
2675
|
* tokenId: '123456',
|
|
2641
2676
|
* makerAmount: 50, // 50 USDC to spend
|
|
2642
|
-
* side: Side.BUY
|
|
2643
|
-
* marketType: MarketType.CLOB
|
|
2677
|
+
* side: Side.BUY
|
|
2644
2678
|
* });
|
|
2645
2679
|
*
|
|
2646
2680
|
* // GTC order (price + size)
|
|
@@ -2648,8 +2682,7 @@ declare class OrderBuilder {
|
|
|
2648
2682
|
* tokenId: '123456',
|
|
2649
2683
|
* price: 0.38,
|
|
2650
2684
|
* size: 22.123, // Will be rounded to tick-aligned: 22.123 shares
|
|
2651
|
-
* side: Side.BUY
|
|
2652
|
-
* marketType: MarketType.CLOB
|
|
2685
|
+
* side: Side.BUY
|
|
2653
2686
|
* });
|
|
2654
2687
|
* ```
|
|
2655
2688
|
*/
|
|
@@ -2803,8 +2836,7 @@ declare class OrderSigner {
|
|
|
2803
2836
|
* ```typescript
|
|
2804
2837
|
* const signature = await signer.signOrder(unsignedOrder, {
|
|
2805
2838
|
* chainId: 8453,
|
|
2806
|
-
* contractAddress: '0x...'
|
|
2807
|
-
* marketType: MarketType.CLOB
|
|
2839
|
+
* contractAddress: '0x...'
|
|
2808
2840
|
* });
|
|
2809
2841
|
* ```
|
|
2810
2842
|
*/
|
|
@@ -2891,6 +2923,139 @@ declare function validateUnsignedOrder(order: UnsignedOrder): void;
|
|
|
2891
2923
|
*/
|
|
2892
2924
|
declare function validateSignedOrder(order: SignedOrder): void;
|
|
2893
2925
|
|
|
2926
|
+
/**
|
|
2927
|
+
* Market data fetcher for Limitless Exchange.
|
|
2928
|
+
* @module markets/fetcher
|
|
2929
|
+
*/
|
|
2930
|
+
|
|
2931
|
+
/**
|
|
2932
|
+
* Market data fetcher for retrieving market information and orderbooks.
|
|
2933
|
+
*
|
|
2934
|
+
* @remarks
|
|
2935
|
+
* This class provides methods to fetch market data, orderbooks, and prices
|
|
2936
|
+
* from the Limitless Exchange API.
|
|
2937
|
+
*
|
|
2938
|
+
* Venue caching: When fetching market data, venue information is automatically
|
|
2939
|
+
* cached for efficient order signing. This eliminates redundant API calls when
|
|
2940
|
+
* creating orders for the same market.
|
|
2941
|
+
*
|
|
2942
|
+
* @public
|
|
2943
|
+
*/
|
|
2944
|
+
declare class MarketFetcher {
|
|
2945
|
+
private httpClient;
|
|
2946
|
+
private logger;
|
|
2947
|
+
private venueCache;
|
|
2948
|
+
/**
|
|
2949
|
+
* Creates a new market fetcher instance.
|
|
2950
|
+
*
|
|
2951
|
+
* @param httpClient - HTTP client for API requests
|
|
2952
|
+
* @param logger - Optional logger for debugging (default: no logging)
|
|
2953
|
+
*
|
|
2954
|
+
* @example
|
|
2955
|
+
* ```typescript
|
|
2956
|
+
* const fetcher = new MarketFetcher(httpClient);
|
|
2957
|
+
* ```
|
|
2958
|
+
*/
|
|
2959
|
+
constructor(httpClient: HttpClient, logger?: ILogger);
|
|
2960
|
+
/**
|
|
2961
|
+
* Gets active markets with query parameters and pagination support.
|
|
2962
|
+
*
|
|
2963
|
+
* @param params - Query parameters for filtering and pagination
|
|
2964
|
+
* @returns Promise resolving to active markets response
|
|
2965
|
+
* @throws Error if API request fails
|
|
2966
|
+
*
|
|
2967
|
+
* @example
|
|
2968
|
+
* ```typescript
|
|
2969
|
+
* // Get 8 markets sorted by LP rewards
|
|
2970
|
+
* const response = await fetcher.getActiveMarkets({
|
|
2971
|
+
* limit: 8,
|
|
2972
|
+
* sortBy: 'lp_rewards'
|
|
2973
|
+
* });
|
|
2974
|
+
* console.log(`Found ${response.data.length} of ${response.totalMarketsCount} markets`);
|
|
2975
|
+
*
|
|
2976
|
+
* // Get page 2
|
|
2977
|
+
* const page2 = await fetcher.getActiveMarkets({
|
|
2978
|
+
* limit: 8,
|
|
2979
|
+
* page: 2,
|
|
2980
|
+
* sortBy: 'ending_soon'
|
|
2981
|
+
* });
|
|
2982
|
+
* ```
|
|
2983
|
+
*/
|
|
2984
|
+
getActiveMarkets(params?: ActiveMarketsParams): Promise<ActiveMarketsResponse>;
|
|
2985
|
+
/**
|
|
2986
|
+
* Gets a single market by slug.
|
|
2987
|
+
*
|
|
2988
|
+
* @remarks
|
|
2989
|
+
* Automatically caches venue information for efficient order signing.
|
|
2990
|
+
* Always call this method before creating orders to ensure venue data
|
|
2991
|
+
* is available and avoid additional API requests.
|
|
2992
|
+
*
|
|
2993
|
+
* @param slug - Market slug identifier
|
|
2994
|
+
* @returns Promise resolving to market details
|
|
2995
|
+
* @throws Error if API request fails or market not found
|
|
2996
|
+
*
|
|
2997
|
+
* @example
|
|
2998
|
+
* ```typescript
|
|
2999
|
+
* const market = await fetcher.getMarket('bitcoin-price-2024');
|
|
3000
|
+
* console.log(`Market: ${market.title}`);
|
|
3001
|
+
*
|
|
3002
|
+
* // Venue is now cached for order signing
|
|
3003
|
+
* await orderClient.createOrder({
|
|
3004
|
+
* marketSlug: 'bitcoin-price-2024',
|
|
3005
|
+
* ...
|
|
3006
|
+
* });
|
|
3007
|
+
* ```
|
|
3008
|
+
*/
|
|
3009
|
+
getMarket(slug: string): Promise<Market>;
|
|
3010
|
+
/**
|
|
3011
|
+
* Gets cached venue information for a market.
|
|
3012
|
+
*
|
|
3013
|
+
* @remarks
|
|
3014
|
+
* Returns venue data previously cached by getMarket() call.
|
|
3015
|
+
* Used internally by OrderClient for efficient order signing.
|
|
3016
|
+
*
|
|
3017
|
+
* @param slug - Market slug identifier
|
|
3018
|
+
* @returns Cached venue information, or undefined if not in cache
|
|
3019
|
+
*
|
|
3020
|
+
* @example
|
|
3021
|
+
* ```typescript
|
|
3022
|
+
* const venue = fetcher.getVenue('bitcoin-price-2024');
|
|
3023
|
+
* if (venue) {
|
|
3024
|
+
* console.log(`Exchange: ${venue.exchange}`);
|
|
3025
|
+
* }
|
|
3026
|
+
* ```
|
|
3027
|
+
*/
|
|
3028
|
+
getVenue(slug: string): Venue | undefined;
|
|
3029
|
+
/**
|
|
3030
|
+
* Gets the orderbook for a CLOB market.
|
|
3031
|
+
*
|
|
3032
|
+
* @param slug - Market slug identifier
|
|
3033
|
+
* @returns Promise resolving to orderbook data
|
|
3034
|
+
* @throws Error if API request fails
|
|
3035
|
+
*
|
|
3036
|
+
* @example
|
|
3037
|
+
* ```typescript
|
|
3038
|
+
* const orderbook = await fetcher.getOrderBook('bitcoin-price-2024');
|
|
3039
|
+
* console.log(`Bids: ${orderbook.bids.length}, Asks: ${orderbook.asks.length}`);
|
|
3040
|
+
* ```
|
|
3041
|
+
*/
|
|
3042
|
+
getOrderBook(slug: string): Promise<OrderBook>;
|
|
3043
|
+
/**
|
|
3044
|
+
* Gets the current price for a token.
|
|
3045
|
+
*
|
|
3046
|
+
* @param tokenId - Token ID
|
|
3047
|
+
* @returns Promise resolving to price information
|
|
3048
|
+
* @throws Error if API request fails
|
|
3049
|
+
*
|
|
3050
|
+
* @example
|
|
3051
|
+
* ```typescript
|
|
3052
|
+
* const price = await fetcher.getPrice('123456');
|
|
3053
|
+
* console.log(`Current price: ${price.price}`);
|
|
3054
|
+
* ```
|
|
3055
|
+
*/
|
|
3056
|
+
getPrice(tokenId: string): Promise<MarketPrice>;
|
|
3057
|
+
}
|
|
3058
|
+
|
|
2894
3059
|
/**
|
|
2895
3060
|
* Order client for managing orders on Limitless Exchange.
|
|
2896
3061
|
* @module orders/client
|
|
@@ -2900,9 +3065,11 @@ declare function validateSignedOrder(order: SignedOrder): void;
|
|
|
2900
3065
|
* Configuration for the order client.
|
|
2901
3066
|
*
|
|
2902
3067
|
* @remarks
|
|
2903
|
-
* The order client
|
|
2904
|
-
*
|
|
2905
|
-
*
|
|
3068
|
+
* The order client auto-configures signing based on venue data from the API.
|
|
3069
|
+
* Custom signingConfig is optional for advanced use cases.
|
|
3070
|
+
*
|
|
3071
|
+
* Performance tip: Provide a shared marketFetcher instance to enable venue caching
|
|
3072
|
+
* across market fetches and order creation, avoiding redundant API calls.
|
|
2906
3073
|
*
|
|
2907
3074
|
* @public
|
|
2908
3075
|
*/
|
|
@@ -2928,23 +3095,41 @@ interface OrderClientConfig {
|
|
|
2928
3095
|
*/
|
|
2929
3096
|
userData: UserData;
|
|
2930
3097
|
/**
|
|
2931
|
-
*
|
|
3098
|
+
* Custom signing configuration (optional)
|
|
2932
3099
|
*
|
|
2933
3100
|
* @remarks
|
|
2934
|
-
*
|
|
2935
|
-
*
|
|
2936
|
-
*
|
|
2937
|
-
* @defaultValue MarketType.CLOB
|
|
3101
|
+
* If not provided, SDK will auto-configure from venue data.
|
|
3102
|
+
* Useful for custom deployments or testing.
|
|
2938
3103
|
*/
|
|
2939
|
-
|
|
3104
|
+
signingConfig?: OrderSigningConfig;
|
|
2940
3105
|
/**
|
|
2941
|
-
*
|
|
3106
|
+
* Shared MarketFetcher instance for venue caching (optional)
|
|
2942
3107
|
*
|
|
2943
3108
|
* @remarks
|
|
2944
|
-
*
|
|
2945
|
-
*
|
|
3109
|
+
* When provided, enables efficient venue caching across market fetches and order creation.
|
|
3110
|
+
* If not provided, OrderClient creates its own internal MarketFetcher instance.
|
|
3111
|
+
*
|
|
3112
|
+
* Best practice: Share the same MarketFetcher instance between market operations
|
|
3113
|
+
* and order creation for optimal performance.
|
|
3114
|
+
*
|
|
3115
|
+
* @example
|
|
3116
|
+
* ```typescript
|
|
3117
|
+
* const marketFetcher = new MarketFetcher(httpClient);
|
|
3118
|
+
* const orderClient = new OrderClient({
|
|
3119
|
+
* httpClient,
|
|
3120
|
+
* wallet,
|
|
3121
|
+
* userData,
|
|
3122
|
+
* marketFetcher // Shared instance
|
|
3123
|
+
* });
|
|
3124
|
+
*
|
|
3125
|
+
* // Venue is cached
|
|
3126
|
+
* await marketFetcher.getMarket('bitcoin-2024');
|
|
3127
|
+
*
|
|
3128
|
+
* // Uses cached venue, no extra API call
|
|
3129
|
+
* await orderClient.createOrder({ marketSlug: 'bitcoin-2024', ... });
|
|
3130
|
+
* ```
|
|
2946
3131
|
*/
|
|
2947
|
-
|
|
3132
|
+
marketFetcher?: MarketFetcher;
|
|
2948
3133
|
/**
|
|
2949
3134
|
* Optional logger
|
|
2950
3135
|
*/
|
|
@@ -2957,17 +3142,21 @@ interface OrderClientConfig {
|
|
|
2957
3142
|
* This class provides high-level methods for order operations,
|
|
2958
3143
|
* abstracting away HTTP details and order signing complexity.
|
|
2959
3144
|
*
|
|
3145
|
+
* Uses dynamic venue addressing for EIP-712 order signing. For best performance,
|
|
3146
|
+
* always call marketFetcher.getMarket() before creating orders to cache venue data.
|
|
3147
|
+
*
|
|
2960
3148
|
* @example
|
|
2961
3149
|
* ```typescript
|
|
2962
3150
|
* const orderClient = new OrderClient({
|
|
2963
3151
|
* httpClient,
|
|
2964
3152
|
* wallet,
|
|
2965
|
-
*
|
|
2966
|
-
*
|
|
3153
|
+
* userData: {
|
|
3154
|
+
* userId: 123,
|
|
3155
|
+
* feeRateBps: 100
|
|
3156
|
+
* },
|
|
2967
3157
|
* signingConfig: {
|
|
2968
3158
|
* chainId: 8453,
|
|
2969
|
-
* contractAddress: '0x...'
|
|
2970
|
-
* marketType: MarketType.CLOB
|
|
3159
|
+
* contractAddress: '0x...'
|
|
2971
3160
|
* }
|
|
2972
3161
|
* });
|
|
2973
3162
|
*
|
|
@@ -2987,6 +3176,7 @@ declare class OrderClient {
|
|
|
2987
3176
|
private httpClient;
|
|
2988
3177
|
private orderBuilder;
|
|
2989
3178
|
private orderSigner;
|
|
3179
|
+
private marketFetcher;
|
|
2990
3180
|
private ownerId;
|
|
2991
3181
|
private signingConfig;
|
|
2992
3182
|
private logger;
|
|
@@ -2994,8 +3184,6 @@ declare class OrderClient {
|
|
|
2994
3184
|
* Creates a new order client instance.
|
|
2995
3185
|
*
|
|
2996
3186
|
* @param config - Order client configuration
|
|
2997
|
-
*
|
|
2998
|
-
* @throws Error if neither marketType nor signingConfig is provided
|
|
2999
3187
|
*/
|
|
3000
3188
|
constructor(config: OrderClientConfig);
|
|
3001
3189
|
/**
|
|
@@ -3003,24 +3191,31 @@ declare class OrderClient {
|
|
|
3003
3191
|
*
|
|
3004
3192
|
* @remarks
|
|
3005
3193
|
* This method handles the complete order creation flow:
|
|
3006
|
-
* 1.
|
|
3007
|
-
* 2.
|
|
3008
|
-
* 3.
|
|
3194
|
+
* 1. Resolve venue address (from cache or API)
|
|
3195
|
+
* 2. Build unsigned order
|
|
3196
|
+
* 3. Sign with EIP-712 using venue.exchange as verifyingContract
|
|
3197
|
+
* 4. Submit to API
|
|
3198
|
+
*
|
|
3199
|
+
* Performance best practice: Always call marketFetcher.getMarket(marketSlug)
|
|
3200
|
+
* before createOrder() to cache venue data and avoid additional API requests.
|
|
3009
3201
|
*
|
|
3010
3202
|
* @param params - Order parameters
|
|
3011
3203
|
* @returns Promise resolving to order response
|
|
3012
3204
|
*
|
|
3013
|
-
* @throws Error if order creation fails
|
|
3205
|
+
* @throws Error if order creation fails or venue not found
|
|
3014
3206
|
*
|
|
3015
3207
|
* @example
|
|
3016
3208
|
* ```typescript
|
|
3209
|
+
* // Best practice: fetch market first to cache venue
|
|
3210
|
+
* const market = await marketFetcher.getMarket('bitcoin-2024');
|
|
3211
|
+
*
|
|
3017
3212
|
* const order = await orderClient.createOrder({
|
|
3018
|
-
* tokenId:
|
|
3213
|
+
* tokenId: market.tokens.yes,
|
|
3019
3214
|
* price: 0.65,
|
|
3020
3215
|
* size: 100,
|
|
3021
3216
|
* side: Side.BUY,
|
|
3022
3217
|
* orderType: OrderType.GTC,
|
|
3023
|
-
* marketSlug: '
|
|
3218
|
+
* marketSlug: 'bitcoin-2024'
|
|
3024
3219
|
* });
|
|
3025
3220
|
*
|
|
3026
3221
|
* console.log(`Order created: ${order.order.id}`);
|
|
@@ -3131,104 +3326,6 @@ declare class OrderClient {
|
|
|
3131
3326
|
signOrder(order: UnsignedOrder): Promise<string>;
|
|
3132
3327
|
}
|
|
3133
3328
|
|
|
3134
|
-
/**
|
|
3135
|
-
* Market data fetcher for Limitless Exchange.
|
|
3136
|
-
* @module markets/fetcher
|
|
3137
|
-
*/
|
|
3138
|
-
|
|
3139
|
-
/**
|
|
3140
|
-
* Market data fetcher for retrieving market information and orderbooks.
|
|
3141
|
-
*
|
|
3142
|
-
* @remarks
|
|
3143
|
-
* This class provides methods to fetch market data, orderbooks, and prices
|
|
3144
|
-
* from the Limitless Exchange API.
|
|
3145
|
-
*
|
|
3146
|
-
* @public
|
|
3147
|
-
*/
|
|
3148
|
-
declare class MarketFetcher {
|
|
3149
|
-
private httpClient;
|
|
3150
|
-
private logger;
|
|
3151
|
-
/**
|
|
3152
|
-
* Creates a new market fetcher instance.
|
|
3153
|
-
*
|
|
3154
|
-
* @param httpClient - HTTP client for API requests
|
|
3155
|
-
* @param logger - Optional logger for debugging (default: no logging)
|
|
3156
|
-
*
|
|
3157
|
-
* @example
|
|
3158
|
-
* ```typescript
|
|
3159
|
-
* const fetcher = new MarketFetcher(httpClient);
|
|
3160
|
-
* ```
|
|
3161
|
-
*/
|
|
3162
|
-
constructor(httpClient: HttpClient, logger?: ILogger);
|
|
3163
|
-
/**
|
|
3164
|
-
* Gets active markets with query parameters and pagination support.
|
|
3165
|
-
*
|
|
3166
|
-
* @param params - Query parameters for filtering and pagination
|
|
3167
|
-
* @returns Promise resolving to active markets response
|
|
3168
|
-
* @throws Error if API request fails
|
|
3169
|
-
*
|
|
3170
|
-
* @example
|
|
3171
|
-
* ```typescript
|
|
3172
|
-
* // Get 8 markets sorted by LP rewards
|
|
3173
|
-
* const response = await fetcher.getActiveMarkets({
|
|
3174
|
-
* limit: 8,
|
|
3175
|
-
* sortBy: 'lp_rewards'
|
|
3176
|
-
* });
|
|
3177
|
-
* console.log(`Found ${response.data.length} of ${response.totalMarketsCount} markets`);
|
|
3178
|
-
*
|
|
3179
|
-
* // Get page 2
|
|
3180
|
-
* const page2 = await fetcher.getActiveMarkets({
|
|
3181
|
-
* limit: 8,
|
|
3182
|
-
* page: 2,
|
|
3183
|
-
* sortBy: 'ending_soon'
|
|
3184
|
-
* });
|
|
3185
|
-
* ```
|
|
3186
|
-
*/
|
|
3187
|
-
getActiveMarkets(params?: ActiveMarketsParams): Promise<ActiveMarketsResponse>;
|
|
3188
|
-
/**
|
|
3189
|
-
* Gets a single market by slug.
|
|
3190
|
-
*
|
|
3191
|
-
* @param slug - Market slug identifier
|
|
3192
|
-
* @returns Promise resolving to market details
|
|
3193
|
-
* @throws Error if API request fails or market not found
|
|
3194
|
-
*
|
|
3195
|
-
* @example
|
|
3196
|
-
* ```typescript
|
|
3197
|
-
* const market = await fetcher.getMarket('bitcoin-price-2024');
|
|
3198
|
-
* console.log(`Market: ${market.title}`);
|
|
3199
|
-
* ```
|
|
3200
|
-
*/
|
|
3201
|
-
getMarket(slug: string): Promise<Market>;
|
|
3202
|
-
/**
|
|
3203
|
-
* Gets the orderbook for a CLOB market.
|
|
3204
|
-
*
|
|
3205
|
-
* @param slug - Market slug identifier
|
|
3206
|
-
* @returns Promise resolving to orderbook data
|
|
3207
|
-
* @throws Error if API request fails
|
|
3208
|
-
*
|
|
3209
|
-
* @example
|
|
3210
|
-
* ```typescript
|
|
3211
|
-
* const orderbook = await fetcher.getOrderBook('bitcoin-price-2024');
|
|
3212
|
-
* console.log(`Bids: ${orderbook.bids.length}, Asks: ${orderbook.asks.length}`);
|
|
3213
|
-
* ```
|
|
3214
|
-
*/
|
|
3215
|
-
getOrderBook(slug: string): Promise<OrderBook>;
|
|
3216
|
-
/**
|
|
3217
|
-
* Gets the current price for a token.
|
|
3218
|
-
*
|
|
3219
|
-
* @param tokenId - Token ID
|
|
3220
|
-
* @returns Promise resolving to price information
|
|
3221
|
-
* @throws Error if API request fails
|
|
3222
|
-
*
|
|
3223
|
-
* @example
|
|
3224
|
-
* ```typescript
|
|
3225
|
-
* const price = await fetcher.getPrice('123456');
|
|
3226
|
-
* console.log(`Current price: ${price.price}`);
|
|
3227
|
-
* ```
|
|
3228
|
-
*/
|
|
3229
|
-
getPrice(tokenId: string): Promise<MarketPrice>;
|
|
3230
|
-
}
|
|
3231
|
-
|
|
3232
3329
|
/**
|
|
3233
3330
|
* Portfolio data fetcher for Limitless Exchange.
|
|
3234
3331
|
* @module portfolio/fetcher
|
|
@@ -3550,4 +3647,4 @@ declare class WebSocketClient {
|
|
|
3550
3647
|
private getChannelFromKey;
|
|
3551
3648
|
}
|
|
3552
3649
|
|
|
3553
|
-
export { type AMMPosition, APIError, type ActiveMarketsParams, type ActiveMarketsResponse, type ActiveMarketsSortBy, type AmmPriceEntry, type AuthResult, AuthenticatedClient, type AuthenticatedClientConfig, Authenticator, BASE_SEPOLIA_CHAIN_ID, type BaseOrderArgs, type CLOBPosition, CONTRACT_ADDRESSES, type ClientType, type CollateralToken, ConsoleLogger, type CreatedOrder, DEFAULT_API_URL, DEFAULT_CHAIN_ID, DEFAULT_WS_URL, type FOKOrderArgs, type FillEvent, type GTCOrderArgs, HttpClient, type HttpClientConfig, type ILogger, type LatestTrade, type LoginOptions, type Market, type MarketCreator, MarketFetcher, type MarketMetadata, type MarketOutcome, type MarketPrice, type MarketSettings, type MarketTokens,
|
|
3650
|
+
export { type AMMPosition, APIError, type ActiveMarketsParams, type ActiveMarketsResponse, type ActiveMarketsSortBy, type AmmPriceEntry, type AuthResult, AuthenticatedClient, type AuthenticatedClientConfig, Authenticator, BASE_SEPOLIA_CHAIN_ID, type BaseOrderArgs, type CLOBPosition, CONTRACT_ADDRESSES, type ClientType, type CollateralToken, ConsoleLogger, type CreatedOrder, DEFAULT_API_URL, DEFAULT_CHAIN_ID, DEFAULT_WS_URL, type FOKOrderArgs, type FillEvent, type GTCOrderArgs, HttpClient, type HttpClientConfig, type ILogger, type LatestTrade, type LoginOptions, type Market, type MarketCreator, MarketFetcher, type MarketMetadata, type MarketOutcome, type MarketPrice, type MarketSettings, type MarketTokens, type MarketUpdate, type MarketsResponse, MessageSigner, type ModeInfo, type NewOrderPayload, type NewPriceData, NoOpLogger, type OrderArgs, type OrderBook, OrderBuilder, OrderClient, type OrderClientConfig, type OrderMatch, type OrderResponse, OrderSigner, type OrderSigningConfig, OrderType, type OrderUpdate, type OrderbookData, type OrderbookEntry, type OrderbookUpdate, PortfolioFetcher, type PortfolioPositionsResponse, type PortfolioSummary, type Position, type PositionMarket, type PositionSide, type PriceOracleMetadata, type PriceUpdate, type ReferralData, RetryConfig, type RetryConfigOptions, RetryableClient, SIGNING_MESSAGE_TEMPLATE, Side, type SignatureHeaders, SignatureType, type SignedOrder, type SubscriptionChannel, type SubscriptionOptions, type TokenBalance, type TradeEvent, type TradePrices, type TradingMode, type TransactionEvent, type UnsignedOrder, type UserData, type UserProfile, type UserRank, ValidationError, type Venue, WebSocketClient, type WebSocketConfig, type WebSocketEvents, WebSocketState, ZERO_ADDRESS, getContractAddress, retryOnErrors, validateOrderArgs, validateSignedOrder, validateUnsignedOrder, withRetry };
|