@limitless-exchange/sdk 0.0.1 → 0.0.2
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 +6 -0
- package/dist/index.d.mts +578 -40
- package/dist/index.d.ts +578 -40
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -30,26 +30,138 @@ interface SignatureHeaders {
|
|
|
30
30
|
'x-signature': string;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* User
|
|
33
|
+
* User rank information.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
interface UserRank {
|
|
37
|
+
/**
|
|
38
|
+
* Rank ID
|
|
39
|
+
*/
|
|
40
|
+
id: number;
|
|
41
|
+
/**
|
|
42
|
+
* Rank name
|
|
43
|
+
*/
|
|
44
|
+
name: string;
|
|
45
|
+
/**
|
|
46
|
+
* Fee rate in basis points
|
|
47
|
+
*/
|
|
48
|
+
feeRateBps: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Referral data for a user.
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
interface ReferralData {
|
|
55
|
+
/**
|
|
56
|
+
* Referral creation timestamp
|
|
57
|
+
*/
|
|
58
|
+
createdAt: string;
|
|
59
|
+
/**
|
|
60
|
+
* Referral ID
|
|
61
|
+
*/
|
|
62
|
+
id: number;
|
|
63
|
+
/**
|
|
64
|
+
* Referred user's profile ID
|
|
65
|
+
*/
|
|
66
|
+
referredProfileId: number;
|
|
67
|
+
/**
|
|
68
|
+
* Profile picture URL
|
|
69
|
+
*/
|
|
70
|
+
pfpUrl: string | null;
|
|
71
|
+
/**
|
|
72
|
+
* Display name
|
|
73
|
+
*/
|
|
74
|
+
displayName: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* User profile information returned after authentication (1:1 with API response).
|
|
34
78
|
* @public
|
|
35
79
|
*/
|
|
36
80
|
interface UserProfile {
|
|
81
|
+
/**
|
|
82
|
+
* User ID (used as ownerId for orders)
|
|
83
|
+
*/
|
|
84
|
+
id: number;
|
|
37
85
|
/**
|
|
38
86
|
* User's Ethereum address (EOA)
|
|
39
87
|
*/
|
|
40
88
|
account: string;
|
|
89
|
+
/**
|
|
90
|
+
* Client type used for authentication
|
|
91
|
+
*/
|
|
92
|
+
client: ClientType;
|
|
93
|
+
/**
|
|
94
|
+
* User rank information containing feeRateBps
|
|
95
|
+
*/
|
|
96
|
+
rank?: UserRank;
|
|
97
|
+
/**
|
|
98
|
+
* Account creation timestamp
|
|
99
|
+
*/
|
|
100
|
+
createdAt?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Username
|
|
103
|
+
*/
|
|
104
|
+
username?: string;
|
|
41
105
|
/**
|
|
42
106
|
* Display name for the user
|
|
43
107
|
*/
|
|
44
|
-
displayName
|
|
108
|
+
displayName?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Profile picture URL
|
|
111
|
+
*/
|
|
112
|
+
pfpUrl?: string;
|
|
113
|
+
/**
|
|
114
|
+
* User bio
|
|
115
|
+
*/
|
|
116
|
+
bio?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Social media URL
|
|
119
|
+
*/
|
|
120
|
+
socialUrl?: string;
|
|
45
121
|
/**
|
|
46
122
|
* Smart wallet address (optional, required for ETHERSPOT client)
|
|
47
123
|
*/
|
|
48
124
|
smartWallet?: string;
|
|
49
125
|
/**
|
|
50
|
-
*
|
|
126
|
+
* Trade wallet option
|
|
51
127
|
*/
|
|
52
|
-
|
|
128
|
+
tradeWalletOption?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Embedded account address
|
|
131
|
+
*/
|
|
132
|
+
embeddedAccount?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Total points
|
|
135
|
+
*/
|
|
136
|
+
points?: number;
|
|
137
|
+
/**
|
|
138
|
+
* Accumulative points
|
|
139
|
+
*/
|
|
140
|
+
accumulativePoints?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Whether enrolled in points program
|
|
143
|
+
*/
|
|
144
|
+
enrolledInPointsProgram?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Position on leaderboard
|
|
147
|
+
*/
|
|
148
|
+
leaderboardPosition?: number;
|
|
149
|
+
/**
|
|
150
|
+
* Whether user is in top 100
|
|
151
|
+
*/
|
|
152
|
+
isTop100?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Whether user is a captain
|
|
155
|
+
*/
|
|
156
|
+
isCaptain?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* List of referral information
|
|
159
|
+
*/
|
|
160
|
+
referralData?: ReferralData[];
|
|
161
|
+
/**
|
|
162
|
+
* Count of referred users
|
|
163
|
+
*/
|
|
164
|
+
referredUsersCount?: number;
|
|
53
165
|
}
|
|
54
166
|
/**
|
|
55
167
|
* Mode information from authentication response.
|
|
@@ -585,35 +697,177 @@ interface OrderSigningConfig {
|
|
|
585
697
|
* Market-related types for Limitless Exchange.
|
|
586
698
|
* @module types/markets
|
|
587
699
|
*/
|
|
700
|
+
/**
|
|
701
|
+
* Collateral token information.
|
|
702
|
+
* @public
|
|
703
|
+
*/
|
|
704
|
+
interface CollateralToken {
|
|
705
|
+
/**
|
|
706
|
+
* Token contract address
|
|
707
|
+
*/
|
|
708
|
+
address: string;
|
|
709
|
+
/**
|
|
710
|
+
* Token decimals
|
|
711
|
+
*/
|
|
712
|
+
decimals: number;
|
|
713
|
+
/**
|
|
714
|
+
* Token symbol (e.g., "USDC")
|
|
715
|
+
*/
|
|
716
|
+
symbol: string;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Market creator information.
|
|
720
|
+
* @public
|
|
721
|
+
*/
|
|
722
|
+
interface MarketCreator {
|
|
723
|
+
/**
|
|
724
|
+
* Creator name
|
|
725
|
+
*/
|
|
726
|
+
name: string;
|
|
727
|
+
/**
|
|
728
|
+
* Creator image URL
|
|
729
|
+
*/
|
|
730
|
+
imageURI?: string;
|
|
731
|
+
/**
|
|
732
|
+
* Creator link URL
|
|
733
|
+
*/
|
|
734
|
+
link?: string;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Market metadata.
|
|
738
|
+
* @public
|
|
739
|
+
*/
|
|
740
|
+
interface MarketMetadata {
|
|
741
|
+
/**
|
|
742
|
+
* Fee enabled flag
|
|
743
|
+
*/
|
|
744
|
+
fee: boolean;
|
|
745
|
+
/**
|
|
746
|
+
* Banner flag
|
|
747
|
+
*/
|
|
748
|
+
isBannered?: boolean;
|
|
749
|
+
/**
|
|
750
|
+
* Polymarket arbitrage flag
|
|
751
|
+
*/
|
|
752
|
+
isPolyArbitrage?: boolean;
|
|
753
|
+
/**
|
|
754
|
+
* Market making flag
|
|
755
|
+
*/
|
|
756
|
+
shouldMarketMake?: boolean;
|
|
757
|
+
/**
|
|
758
|
+
* Opening price for oracle markets
|
|
759
|
+
*/
|
|
760
|
+
openPrice?: string;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Market settings for CLOB markets.
|
|
764
|
+
* @public
|
|
765
|
+
*/
|
|
766
|
+
interface MarketSettings {
|
|
767
|
+
/**
|
|
768
|
+
* Minimum order size
|
|
769
|
+
*/
|
|
770
|
+
minSize: string;
|
|
771
|
+
/**
|
|
772
|
+
* Maximum spread allowed
|
|
773
|
+
*/
|
|
774
|
+
maxSpread: number;
|
|
775
|
+
/**
|
|
776
|
+
* Daily reward amount
|
|
777
|
+
*/
|
|
778
|
+
dailyReward: string;
|
|
779
|
+
/**
|
|
780
|
+
* Rewards epoch duration
|
|
781
|
+
*/
|
|
782
|
+
rewardsEpoch: string;
|
|
783
|
+
/**
|
|
784
|
+
* Constant parameter
|
|
785
|
+
*/
|
|
786
|
+
c: string;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Trade prices for different order types.
|
|
790
|
+
* @public
|
|
791
|
+
*/
|
|
792
|
+
interface TradePrices {
|
|
793
|
+
/**
|
|
794
|
+
* Buy prices (market and limit) for yes/no tokens
|
|
795
|
+
*/
|
|
796
|
+
buy: {
|
|
797
|
+
market: [number, number];
|
|
798
|
+
limit: [number, number];
|
|
799
|
+
};
|
|
800
|
+
/**
|
|
801
|
+
* Sell prices (market and limit) for yes/no tokens
|
|
802
|
+
*/
|
|
803
|
+
sell: {
|
|
804
|
+
market: [number, number];
|
|
805
|
+
limit: [number, number];
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Price oracle metadata for oracle-based markets.
|
|
810
|
+
* @public
|
|
811
|
+
*/
|
|
812
|
+
interface PriceOracleMetadata {
|
|
813
|
+
/**
|
|
814
|
+
* Asset ticker symbol
|
|
815
|
+
*/
|
|
816
|
+
ticker: string;
|
|
817
|
+
/**
|
|
818
|
+
* Asset type (e.g., "CRYPTO")
|
|
819
|
+
*/
|
|
820
|
+
assetType: string;
|
|
821
|
+
/**
|
|
822
|
+
* Pyth Network price feed address
|
|
823
|
+
*/
|
|
824
|
+
pythAddress: string;
|
|
825
|
+
/**
|
|
826
|
+
* Price feed symbol
|
|
827
|
+
*/
|
|
828
|
+
symbol: string;
|
|
829
|
+
/**
|
|
830
|
+
* Asset name
|
|
831
|
+
*/
|
|
832
|
+
name: string;
|
|
833
|
+
/**
|
|
834
|
+
* Logo URL
|
|
835
|
+
*/
|
|
836
|
+
logo: string;
|
|
837
|
+
}
|
|
588
838
|
/**
|
|
589
839
|
* Orderbook entry (bid or ask).
|
|
840
|
+
* Matches API response format exactly (1:1 parity).
|
|
841
|
+
*
|
|
590
842
|
* @public
|
|
591
843
|
*/
|
|
592
844
|
interface OrderbookEntry {
|
|
593
845
|
/**
|
|
594
|
-
* Price per share
|
|
846
|
+
* Price per share (0-1 range)
|
|
595
847
|
*/
|
|
596
848
|
price: number;
|
|
597
849
|
/**
|
|
598
|
-
* Size in shares
|
|
850
|
+
* Size in shares
|
|
599
851
|
*/
|
|
600
852
|
size: number;
|
|
601
853
|
/**
|
|
602
|
-
* Order side (BUY or SELL)
|
|
854
|
+
* Order side ("BUY" or "SELL")
|
|
603
855
|
*/
|
|
604
856
|
side: string;
|
|
605
857
|
}
|
|
606
858
|
/**
|
|
607
859
|
* Complete orderbook for a market.
|
|
860
|
+
* Matches API response format exactly (1:1 parity).
|
|
861
|
+
*
|
|
608
862
|
* @public
|
|
609
863
|
*/
|
|
610
864
|
interface OrderBook {
|
|
611
865
|
/**
|
|
612
|
-
* Bid orders (buy orders)
|
|
866
|
+
* Bid orders (buy orders) sorted by price descending
|
|
613
867
|
*/
|
|
614
868
|
bids: OrderbookEntry[];
|
|
615
869
|
/**
|
|
616
|
-
* Ask orders (sell orders)
|
|
870
|
+
* Ask orders (sell orders) sorted by price ascending
|
|
617
871
|
*/
|
|
618
872
|
asks: OrderbookEntry[];
|
|
619
873
|
/**
|
|
@@ -621,13 +875,21 @@ interface OrderBook {
|
|
|
621
875
|
*/
|
|
622
876
|
tokenId: string;
|
|
623
877
|
/**
|
|
624
|
-
*
|
|
878
|
+
* Adjusted midpoint price between best bid and ask
|
|
879
|
+
*/
|
|
880
|
+
adjustedMidpoint: number;
|
|
881
|
+
/**
|
|
882
|
+
* Maximum allowed spread for the market
|
|
883
|
+
*/
|
|
884
|
+
maxSpread: string;
|
|
885
|
+
/**
|
|
886
|
+
* Minimum order size allowed
|
|
625
887
|
*/
|
|
626
888
|
minSize: string;
|
|
627
889
|
/**
|
|
628
|
-
* Last trade price
|
|
890
|
+
* Last trade price for the market
|
|
629
891
|
*/
|
|
630
|
-
lastTradePrice
|
|
892
|
+
lastTradePrice: number;
|
|
631
893
|
}
|
|
632
894
|
/**
|
|
633
895
|
* Market price information.
|
|
@@ -670,7 +932,17 @@ interface MarketOutcome {
|
|
|
670
932
|
price?: number;
|
|
671
933
|
}
|
|
672
934
|
/**
|
|
673
|
-
*
|
|
935
|
+
* Market token IDs for CLOB markets.
|
|
936
|
+
* @public
|
|
937
|
+
*/
|
|
938
|
+
interface MarketTokens {
|
|
939
|
+
yes: string;
|
|
940
|
+
no: string;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Complete market information (1:1 with API response).
|
|
944
|
+
* Handles both CLOB single markets and NegRisk group markets.
|
|
945
|
+
*
|
|
674
946
|
* @public
|
|
675
947
|
*/
|
|
676
948
|
interface Market {
|
|
@@ -679,9 +951,9 @@ interface Market {
|
|
|
679
951
|
*/
|
|
680
952
|
id: number;
|
|
681
953
|
/**
|
|
682
|
-
* Market
|
|
954
|
+
* Market slug identifier
|
|
683
955
|
*/
|
|
684
|
-
|
|
956
|
+
slug: string;
|
|
685
957
|
/**
|
|
686
958
|
* Market title
|
|
687
959
|
*/
|
|
@@ -693,19 +965,23 @@ interface Market {
|
|
|
693
965
|
/**
|
|
694
966
|
* Market description
|
|
695
967
|
*/
|
|
696
|
-
description
|
|
968
|
+
description?: string;
|
|
697
969
|
/**
|
|
698
|
-
*
|
|
970
|
+
* Collateral token information
|
|
699
971
|
*/
|
|
700
|
-
|
|
972
|
+
collateralToken: CollateralToken;
|
|
701
973
|
/**
|
|
702
|
-
*
|
|
974
|
+
* Human-readable expiration date
|
|
703
975
|
*/
|
|
704
|
-
|
|
976
|
+
expirationDate: string;
|
|
705
977
|
/**
|
|
706
|
-
*
|
|
978
|
+
* Expiration timestamp in milliseconds
|
|
707
979
|
*/
|
|
708
|
-
|
|
980
|
+
expirationTimestamp: number;
|
|
981
|
+
/**
|
|
982
|
+
* Whether market is expired
|
|
983
|
+
*/
|
|
984
|
+
expired?: boolean;
|
|
709
985
|
/**
|
|
710
986
|
* Creation timestamp
|
|
711
987
|
*/
|
|
@@ -714,12 +990,133 @@ interface Market {
|
|
|
714
990
|
* Last update timestamp
|
|
715
991
|
*/
|
|
716
992
|
updatedAt: string;
|
|
993
|
+
/**
|
|
994
|
+
* Market categories
|
|
995
|
+
*/
|
|
996
|
+
categories: string[];
|
|
717
997
|
/**
|
|
718
998
|
* Market status
|
|
719
999
|
*/
|
|
720
|
-
status
|
|
1000
|
+
status: string;
|
|
1001
|
+
/**
|
|
1002
|
+
* Creator information
|
|
1003
|
+
*/
|
|
1004
|
+
creator: MarketCreator;
|
|
1005
|
+
/**
|
|
1006
|
+
* Market tags
|
|
1007
|
+
*/
|
|
1008
|
+
tags: string[];
|
|
1009
|
+
/**
|
|
1010
|
+
* Trade type (clob or amm)
|
|
1011
|
+
*/
|
|
1012
|
+
tradeType: string;
|
|
1013
|
+
/**
|
|
1014
|
+
* Market type (single or group)
|
|
1015
|
+
*/
|
|
1016
|
+
marketType: string;
|
|
1017
|
+
/**
|
|
1018
|
+
* Priority index for sorting
|
|
1019
|
+
*/
|
|
1020
|
+
priorityIndex: number;
|
|
1021
|
+
/**
|
|
1022
|
+
* Market metadata
|
|
1023
|
+
*/
|
|
1024
|
+
metadata: MarketMetadata;
|
|
1025
|
+
/**
|
|
1026
|
+
* Trading volume
|
|
1027
|
+
*/
|
|
1028
|
+
volume?: string;
|
|
1029
|
+
/**
|
|
1030
|
+
* Formatted trading volume
|
|
1031
|
+
*/
|
|
1032
|
+
volumeFormatted?: string;
|
|
1033
|
+
/**
|
|
1034
|
+
* Condition ID (CLOB only)
|
|
1035
|
+
*/
|
|
1036
|
+
conditionId?: string;
|
|
1037
|
+
/**
|
|
1038
|
+
* NegRisk request ID (CLOB only)
|
|
1039
|
+
*/
|
|
1040
|
+
negRiskRequestId?: string | null;
|
|
1041
|
+
/**
|
|
1042
|
+
* Token IDs for yes/no outcomes (CLOB only)
|
|
1043
|
+
* @example
|
|
1044
|
+
* {
|
|
1045
|
+
* yes: "27687694610130623013351012526567944730242898906227824547270172934678693687246",
|
|
1046
|
+
* no: "9288900480010863316984252765488448624297561656655547117581633191173128271467"
|
|
1047
|
+
* }
|
|
1048
|
+
*/
|
|
1049
|
+
tokens?: MarketTokens;
|
|
1050
|
+
/**
|
|
1051
|
+
* Current prices [yes, no] (CLOB only)
|
|
1052
|
+
*/
|
|
1053
|
+
prices?: number[];
|
|
1054
|
+
/**
|
|
1055
|
+
* Trade prices for buy/sell market/limit orders (CLOB only)
|
|
1056
|
+
*/
|
|
1057
|
+
tradePrices?: TradePrices;
|
|
1058
|
+
/**
|
|
1059
|
+
* Whether market is rewardable (CLOB only)
|
|
1060
|
+
*/
|
|
1061
|
+
isRewardable?: boolean;
|
|
1062
|
+
/**
|
|
1063
|
+
* Market settings (CLOB only)
|
|
1064
|
+
*/
|
|
1065
|
+
settings?: MarketSettings;
|
|
1066
|
+
/**
|
|
1067
|
+
* Market logo URL
|
|
1068
|
+
*/
|
|
1069
|
+
logo?: string | null;
|
|
1070
|
+
/**
|
|
1071
|
+
* Price oracle metadata (oracle markets only)
|
|
1072
|
+
*/
|
|
1073
|
+
priceOracleMetadata?: PriceOracleMetadata;
|
|
1074
|
+
/**
|
|
1075
|
+
* Order within group (group markets only)
|
|
1076
|
+
*/
|
|
1077
|
+
orderInGroup?: number;
|
|
1078
|
+
/**
|
|
1079
|
+
* Winning outcome index
|
|
1080
|
+
*/
|
|
1081
|
+
winningOutcomeIndex?: number | null;
|
|
1082
|
+
/**
|
|
1083
|
+
* Outcome token names (group only)
|
|
1084
|
+
*/
|
|
1085
|
+
outcomeTokens?: string[];
|
|
1086
|
+
/**
|
|
1087
|
+
* OG image URI (group only)
|
|
1088
|
+
*/
|
|
1089
|
+
ogImageURI?: string;
|
|
1090
|
+
/**
|
|
1091
|
+
* NegRisk market ID (group only)
|
|
1092
|
+
*/
|
|
1093
|
+
negRiskMarketId?: string;
|
|
1094
|
+
/**
|
|
1095
|
+
* Child markets in group (group only)
|
|
1096
|
+
*/
|
|
1097
|
+
markets?: Market[];
|
|
1098
|
+
/**
|
|
1099
|
+
* Daily reward for group (group only)
|
|
1100
|
+
*/
|
|
1101
|
+
dailyReward?: string;
|
|
1102
|
+
/**
|
|
1103
|
+
* Market contract address
|
|
1104
|
+
* @deprecated Use conditionId instead
|
|
1105
|
+
*/
|
|
1106
|
+
address?: string | null;
|
|
1107
|
+
/**
|
|
1108
|
+
* Market type (CLOB or AMM)
|
|
1109
|
+
* @deprecated Use tradeType instead
|
|
1110
|
+
*/
|
|
1111
|
+
type?: string;
|
|
1112
|
+
/**
|
|
1113
|
+
* Market outcomes
|
|
1114
|
+
* @deprecated Use tokens for CLOB markets
|
|
1115
|
+
*/
|
|
1116
|
+
outcomes?: MarketOutcome[];
|
|
721
1117
|
/**
|
|
722
1118
|
* Resolution timestamp
|
|
1119
|
+
* @deprecated Use expirationTimestamp instead
|
|
723
1120
|
*/
|
|
724
1121
|
resolutionDate?: string;
|
|
725
1122
|
}
|
|
@@ -749,7 +1146,7 @@ interface MarketsResponse {
|
|
|
749
1146
|
* Sort options for active markets.
|
|
750
1147
|
* @public
|
|
751
1148
|
*/
|
|
752
|
-
type ActiveMarketsSortBy = 'lp_rewards' | 'ending_soon' | 'newest' | 'high_value';
|
|
1149
|
+
type ActiveMarketsSortBy = 'lp_rewards' | 'ending_soon' | 'newest' | 'high_value' | 'liquidity';
|
|
753
1150
|
/**
|
|
754
1151
|
* Query parameters for active markets endpoint.
|
|
755
1152
|
* @public
|
|
@@ -1132,6 +1529,7 @@ interface PortfolioSummary {
|
|
|
1132
1529
|
* WebSocket types for real-time data streaming.
|
|
1133
1530
|
* @module types/websocket
|
|
1134
1531
|
*/
|
|
1532
|
+
|
|
1135
1533
|
/**
|
|
1136
1534
|
* WebSocket connection configuration.
|
|
1137
1535
|
* @public
|
|
@@ -1177,22 +1575,36 @@ declare enum WebSocketState {
|
|
|
1177
1575
|
* Subscription channels for WebSocket events.
|
|
1178
1576
|
* @public
|
|
1179
1577
|
*/
|
|
1180
|
-
type SubscriptionChannel = 'orderbook' | 'trades' | 'orders' | 'fills' | 'markets' | 'prices';
|
|
1578
|
+
type SubscriptionChannel = 'orderbook' | 'trades' | 'orders' | 'fills' | 'markets' | 'prices' | 'subscribe_market_prices' | 'subscribe_positions' | 'subscribe_transactions';
|
|
1579
|
+
/**
|
|
1580
|
+
* Orderbook data structure (nested object in OrderbookUpdate).
|
|
1581
|
+
* @public
|
|
1582
|
+
*/
|
|
1583
|
+
interface OrderbookData {
|
|
1584
|
+
/** List of bid orders sorted by price descending */
|
|
1585
|
+
bids: OrderbookEntry[];
|
|
1586
|
+
/** List of ask orders sorted by price ascending */
|
|
1587
|
+
asks: OrderbookEntry[];
|
|
1588
|
+
/** Token ID for the orderbook */
|
|
1589
|
+
tokenId: string;
|
|
1590
|
+
/** Adjusted midpoint price */
|
|
1591
|
+
adjustedMidpoint: number;
|
|
1592
|
+
/** Maximum spread allowed */
|
|
1593
|
+
maxSpread: number;
|
|
1594
|
+
/** Minimum order size */
|
|
1595
|
+
minSize: number;
|
|
1596
|
+
}
|
|
1181
1597
|
/**
|
|
1182
|
-
* Orderbook update event.
|
|
1598
|
+
* Orderbook update event - matches API format exactly.
|
|
1183
1599
|
* @public
|
|
1184
1600
|
*/
|
|
1185
1601
|
interface OrderbookUpdate {
|
|
1602
|
+
/** Market slug identifier (camelCase to match API) */
|
|
1186
1603
|
marketSlug: string;
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
asks: Array<{
|
|
1192
|
-
price: number;
|
|
1193
|
-
size: number;
|
|
1194
|
-
}>;
|
|
1195
|
-
timestamp: number;
|
|
1604
|
+
/** Nested orderbook data object */
|
|
1605
|
+
orderbook: OrderbookData;
|
|
1606
|
+
/** Timestamp as Date or number after serialization */
|
|
1607
|
+
timestamp: Date | number | string;
|
|
1196
1608
|
}
|
|
1197
1609
|
/**
|
|
1198
1610
|
* Trade event.
|
|
@@ -1245,14 +1657,79 @@ interface MarketUpdate {
|
|
|
1245
1657
|
timestamp: number;
|
|
1246
1658
|
}
|
|
1247
1659
|
/**
|
|
1248
|
-
* Price update event.
|
|
1660
|
+
* Price update event (deprecated - use NewPriceData for AMM prices).
|
|
1661
|
+
*
|
|
1662
|
+
* Note: This type does not match the actual API response.
|
|
1663
|
+
* Use NewPriceData for the correct AMM price update format.
|
|
1664
|
+
*
|
|
1249
1665
|
* @public
|
|
1666
|
+
* @deprecated
|
|
1250
1667
|
*/
|
|
1251
1668
|
interface PriceUpdate {
|
|
1252
1669
|
marketSlug: string;
|
|
1253
1670
|
price: number;
|
|
1254
1671
|
timestamp: number;
|
|
1255
1672
|
}
|
|
1673
|
+
/**
|
|
1674
|
+
* Single AMM price entry in updatedPrices array.
|
|
1675
|
+
* @public
|
|
1676
|
+
*/
|
|
1677
|
+
interface AmmPriceEntry {
|
|
1678
|
+
/** Market ID */
|
|
1679
|
+
marketId: number;
|
|
1680
|
+
/** Market contract address */
|
|
1681
|
+
marketAddress: string;
|
|
1682
|
+
/** YES token price (0-1 range) */
|
|
1683
|
+
yesPrice: number;
|
|
1684
|
+
/** NO token price (0-1 range) */
|
|
1685
|
+
noPrice: number;
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* AMM price update event (newPriceData) - matches API format exactly.
|
|
1689
|
+
* @public
|
|
1690
|
+
*/
|
|
1691
|
+
interface NewPriceData {
|
|
1692
|
+
/** Market contract address (camelCase to match API) */
|
|
1693
|
+
marketAddress: string;
|
|
1694
|
+
/** Array of price updates for this market */
|
|
1695
|
+
updatedPrices: AmmPriceEntry[];
|
|
1696
|
+
/** Blockchain block number */
|
|
1697
|
+
blockNumber: number;
|
|
1698
|
+
/** Timestamp as Date or number after serialization */
|
|
1699
|
+
timestamp: Date | number | string;
|
|
1700
|
+
}
|
|
1701
|
+
/**
|
|
1702
|
+
* Transaction event (blockchain transaction status).
|
|
1703
|
+
* @public
|
|
1704
|
+
*/
|
|
1705
|
+
interface TransactionEvent {
|
|
1706
|
+
/** User ID (optional) */
|
|
1707
|
+
userId?: number;
|
|
1708
|
+
/** Transaction hash (optional) */
|
|
1709
|
+
txHash?: string;
|
|
1710
|
+
/** Transaction status */
|
|
1711
|
+
status: 'CONFIRMED' | 'FAILED';
|
|
1712
|
+
/** Transaction source */
|
|
1713
|
+
source: string;
|
|
1714
|
+
/** Transaction timestamp */
|
|
1715
|
+
timestamp: Date | string;
|
|
1716
|
+
/** Market address (optional) */
|
|
1717
|
+
marketAddress?: string;
|
|
1718
|
+
/** Market slug identifier (optional) */
|
|
1719
|
+
marketSlug?: string;
|
|
1720
|
+
/** Token ID (optional) */
|
|
1721
|
+
tokenId?: string;
|
|
1722
|
+
/** Condition ID (optional) */
|
|
1723
|
+
conditionId?: string;
|
|
1724
|
+
/** Amount of contracts (optional, in string format) */
|
|
1725
|
+
amountContracts?: string;
|
|
1726
|
+
/** Amount of collateral (optional, in string format) */
|
|
1727
|
+
amountCollateral?: string;
|
|
1728
|
+
/** Price (optional, in string format) */
|
|
1729
|
+
price?: string;
|
|
1730
|
+
/** Trade side (optional) */
|
|
1731
|
+
side?: 'BUY' | 'SELL';
|
|
1732
|
+
}
|
|
1256
1733
|
/**
|
|
1257
1734
|
* WebSocket event types.
|
|
1258
1735
|
* @public
|
|
@@ -1275,9 +1752,13 @@ interface WebSocketEvents {
|
|
|
1275
1752
|
*/
|
|
1276
1753
|
reconnecting: (attempt: number) => void;
|
|
1277
1754
|
/**
|
|
1278
|
-
* Orderbook updates
|
|
1755
|
+
* Orderbook updates (CLOB markets) - API event name: orderbookUpdate
|
|
1279
1756
|
*/
|
|
1280
|
-
|
|
1757
|
+
orderbookUpdate: (data: OrderbookUpdate) => void;
|
|
1758
|
+
/**
|
|
1759
|
+
* AMM price updates - API event name: newPriceData
|
|
1760
|
+
*/
|
|
1761
|
+
newPriceData: (data: NewPriceData) => void;
|
|
1281
1762
|
/**
|
|
1282
1763
|
* Trade events
|
|
1283
1764
|
*/
|
|
@@ -1295,7 +1776,16 @@ interface WebSocketEvents {
|
|
|
1295
1776
|
*/
|
|
1296
1777
|
market: (data: MarketUpdate) => void;
|
|
1297
1778
|
/**
|
|
1298
|
-
*
|
|
1779
|
+
* Position updates
|
|
1780
|
+
*/
|
|
1781
|
+
positions: (data: any) => void;
|
|
1782
|
+
/**
|
|
1783
|
+
* Transaction events (blockchain confirmations)
|
|
1784
|
+
*/
|
|
1785
|
+
tx: (data: TransactionEvent) => void;
|
|
1786
|
+
/**
|
|
1787
|
+
* Price updates (deprecated - use newPriceData)
|
|
1788
|
+
* @deprecated
|
|
1299
1789
|
*/
|
|
1300
1790
|
price: (data: PriceUpdate) => void;
|
|
1301
1791
|
}
|
|
@@ -1402,6 +1892,54 @@ interface HttpClientConfig {
|
|
|
1402
1892
|
* @defaultValue NoOpLogger (no logging)
|
|
1403
1893
|
*/
|
|
1404
1894
|
logger?: ILogger;
|
|
1895
|
+
/**
|
|
1896
|
+
* Enable HTTP connection pooling with keepAlive
|
|
1897
|
+
* @defaultValue true
|
|
1898
|
+
* @remarks
|
|
1899
|
+
* When enabled, HTTP connections are reused across requests, reducing latency by 30-50%.
|
|
1900
|
+
* Recommended for production environments with high request volume.
|
|
1901
|
+
*/
|
|
1902
|
+
keepAlive?: boolean;
|
|
1903
|
+
/**
|
|
1904
|
+
* Maximum number of sockets to allow per host
|
|
1905
|
+
* @defaultValue 50
|
|
1906
|
+
* @remarks
|
|
1907
|
+
* Controls the connection pool size. Higher values allow more concurrent requests
|
|
1908
|
+
* but consume more system resources.
|
|
1909
|
+
*/
|
|
1910
|
+
maxSockets?: number;
|
|
1911
|
+
/**
|
|
1912
|
+
* Maximum number of free sockets to keep open per host
|
|
1913
|
+
* @defaultValue 10
|
|
1914
|
+
* @remarks
|
|
1915
|
+
* Determines how many idle connections to maintain in the pool.
|
|
1916
|
+
* Keeping connections open reduces latency for subsequent requests.
|
|
1917
|
+
*/
|
|
1918
|
+
maxFreeSockets?: number;
|
|
1919
|
+
/**
|
|
1920
|
+
* Socket timeout in milliseconds
|
|
1921
|
+
* @defaultValue 60000
|
|
1922
|
+
* @remarks
|
|
1923
|
+
* Time to wait before closing an idle socket connection.
|
|
1924
|
+
*/
|
|
1925
|
+
socketTimeout?: number;
|
|
1926
|
+
/**
|
|
1927
|
+
* Additional headers to include in all requests
|
|
1928
|
+
* @remarks
|
|
1929
|
+
* These headers will be merged with default headers and sent with every request.
|
|
1930
|
+
* Can be overridden by per-request headers.
|
|
1931
|
+
*
|
|
1932
|
+
* @example
|
|
1933
|
+
* ```typescript
|
|
1934
|
+
* const client = new HttpClient({
|
|
1935
|
+
* additionalHeaders: {
|
|
1936
|
+
* 'X-Custom-Header': 'value',
|
|
1937
|
+
* 'X-API-Version': 'v1'
|
|
1938
|
+
* }
|
|
1939
|
+
* });
|
|
1940
|
+
* ```
|
|
1941
|
+
*/
|
|
1942
|
+
additionalHeaders?: Record<string, string>;
|
|
1405
1943
|
}
|
|
1406
1944
|
/**
|
|
1407
1945
|
* HTTP client wrapper for Limitless Exchange API.
|
|
@@ -3012,4 +3550,4 @@ declare class WebSocketClient {
|
|
|
3012
3550
|
private getChannelFromKey;
|
|
3013
3551
|
}
|
|
3014
3552
|
|
|
3015
|
-
export { type AMMPosition, APIError, type ActiveMarketsParams, type ActiveMarketsResponse, type ActiveMarketsSortBy, type AuthResult, AuthenticatedClient, type AuthenticatedClientConfig, Authenticator, BASE_SEPOLIA_CHAIN_ID, type BaseOrderArgs, type CLOBPosition, CONTRACT_ADDRESSES, type ClientType, 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, MarketFetcher, type MarketOutcome, type MarketPrice, MarketType, type MarketUpdate, type MarketsResponse, MessageSigner, type ModeInfo, type NewOrderPayload, NoOpLogger, type OrderArgs, type OrderBook, OrderBuilder, OrderClient, type OrderClientConfig, type OrderMatch, type OrderResponse, OrderSigner, type OrderSigningConfig, OrderType, type OrderUpdate, type OrderbookEntry, type OrderbookUpdate, PortfolioFetcher, type PortfolioPositionsResponse, type PortfolioSummary, type Position, type PositionMarket, type PositionSide, type PriceUpdate, RetryConfig, type RetryConfigOptions, RetryableClient, SIGNING_MESSAGE_TEMPLATE, Side, type SignatureHeaders, SignatureType, type SignedOrder, type SubscriptionChannel, type SubscriptionOptions, type TokenBalance, type TradeEvent, type TradingMode, type UnsignedOrder, type UserData, type UserProfile, ValidationError, WebSocketClient, type WebSocketConfig, type WebSocketEvents, WebSocketState, ZERO_ADDRESS, getContractAddress, retryOnErrors, validateOrderArgs, validateSignedOrder, validateUnsignedOrder, withRetry };
|
|
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, MarketType, 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, WebSocketClient, type WebSocketConfig, type WebSocketEvents, WebSocketState, ZERO_ADDRESS, getContractAddress, retryOnErrors, validateOrderArgs, validateSignedOrder, validateUnsignedOrder, withRetry };
|