@acta-markets/ts-sdk 0.0.16-beta → 0.0.18-beta
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/cjs/ws/client.js +11 -0
- package/dist/ws/client.d.ts +3 -1
- package/dist/ws/client.js +11 -0
- package/dist/ws/types.d.ts +69 -0
- package/package.json +1 -1
package/dist/cjs/ws/client.js
CHANGED
|
@@ -327,6 +327,14 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
327
327
|
});
|
|
328
328
|
return requestId;
|
|
329
329
|
}
|
|
330
|
+
getTokenMarketsInfo(underlyingMint) {
|
|
331
|
+
const requestId = this.nextRequestId();
|
|
332
|
+
this.send({
|
|
333
|
+
type: "GetTokenMarketsInfo",
|
|
334
|
+
data: { request_id: requestId, underlying_mint: underlyingMint },
|
|
335
|
+
});
|
|
336
|
+
return requestId;
|
|
337
|
+
}
|
|
330
338
|
logout() {
|
|
331
339
|
this.send({ type: "Logout" });
|
|
332
340
|
}
|
|
@@ -569,6 +577,9 @@ class ActaWsClient extends TypedEventEmitter {
|
|
|
569
577
|
case "EarnSummary":
|
|
570
578
|
this.emit("earnSummary", message.data);
|
|
571
579
|
break;
|
|
580
|
+
case "TokenMarketsInfo":
|
|
581
|
+
this.emit("tokenMarketsInfo", message.data);
|
|
582
|
+
break;
|
|
572
583
|
case "RfqBroadcast":
|
|
573
584
|
// Keep local RFQ state reasonably fresh even without a new snapshot.
|
|
574
585
|
if (!this.state.activeRfqs.has(message.data.rfq_id)) {
|
package/dist/ws/client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { AuthProvider } from "./auth";
|
|
3
3
|
import type { SignerLike } from "../chain/orders";
|
|
4
4
|
import type { Address } from "@solana/addresses";
|
|
5
|
-
import type { ActiveRfqInfo, ChainEventMessage, EarnSummaryData, GlobalStats, MarketDescriptorInfo, MarketInfo, MyActiveRfqInfo, MyActiveRfqsMessage, OrderStatusMessage, PositionInfo, QuoteAcknowledgedMessage, QuoteBestStatusMessage, QuoteCancelledMessage, QuoteMessage, QuoteRefreshRequestedMessage, QuoteOutbidMessage, QuoteReceivedMessage, QuoteSelectedMessage, QuotesUpdateMessage, RfqBroadcastMessage, RfqClosedMessage, RfqCreatedMessage, RfqSkippedMessage, RfqRequestMessage, RfqAvailableAgainMessage, QuoteExpiredMessage, QuoteFilledMessage, IndicativePricesMessage, IndicativePricesRequestMessage, IndicativePricesResponseMessage, GetIndicativePricesMessage, RequestId, ServerMessage, SnapshotMessage, StatsDelta, SubscriptionsMessage, TokenInfo, TradeInfo, UuidString, VersionMismatchMessage, WelcomeMessage, WsChannel } from "./types";
|
|
5
|
+
import type { ActiveRfqInfo, ChainEventMessage, EarnSummaryData, TokenMarketsInfoData, GlobalStats, MarketDescriptorInfo, MarketInfo, MyActiveRfqInfo, MyActiveRfqsMessage, OrderStatusMessage, PositionInfo, QuoteAcknowledgedMessage, QuoteBestStatusMessage, QuoteCancelledMessage, QuoteMessage, QuoteRefreshRequestedMessage, QuoteOutbidMessage, QuoteReceivedMessage, QuoteSelectedMessage, QuotesUpdateMessage, RfqBroadcastMessage, RfqClosedMessage, RfqCreatedMessage, RfqSkippedMessage, RfqRequestMessage, RfqAvailableAgainMessage, QuoteExpiredMessage, QuoteFilledMessage, IndicativePricesMessage, IndicativePricesRequestMessage, IndicativePricesResponseMessage, GetIndicativePricesMessage, RequestId, ServerMessage, SnapshotMessage, StatsDelta, SubscriptionsMessage, TokenInfo, TradeInfo, UuidString, VersionMismatchMessage, WelcomeMessage, WsChannel } from "./types";
|
|
6
6
|
export type ConnectionState = "disconnected" | "connecting" | "authenticating" | "authenticated" | "error";
|
|
7
7
|
export type ClientRole = "taker" | "maker";
|
|
8
8
|
export type PendingMessagesOverflowPolicy = "drop_oldest" | "drop_newest" | "throw";
|
|
@@ -74,6 +74,7 @@ export type ActaWsClientEvents = {
|
|
|
74
74
|
}) => void;
|
|
75
75
|
statsUpdate: (stats: GlobalStats) => void;
|
|
76
76
|
earnSummary: (data: EarnSummaryData) => void;
|
|
77
|
+
tokenMarketsInfo: (data: TokenMarketsInfoData) => void;
|
|
77
78
|
subscriptions: (msg: SubscriptionsMessage) => void;
|
|
78
79
|
activeRfqs: (rfqs: ActiveRfqInfo[]) => void;
|
|
79
80
|
rfqBroadcast: (rfq: RfqBroadcastMessage) => void;
|
|
@@ -219,6 +220,7 @@ export declare class ActaWsClient extends TypedEventEmitter<ActaWsClientEvents>
|
|
|
219
220
|
include_markets?: boolean;
|
|
220
221
|
}): RequestId;
|
|
221
222
|
getEarnSummary(): RequestId;
|
|
223
|
+
getTokenMarketsInfo(underlyingMint: string): RequestId;
|
|
222
224
|
logout(): void;
|
|
223
225
|
getOrderStatus(orderIdHex: string): RequestId;
|
|
224
226
|
cancelRfq(rfqId: string): RequestId;
|
package/dist/ws/client.js
CHANGED
|
@@ -324,6 +324,14 @@ export class ActaWsClient extends TypedEventEmitter {
|
|
|
324
324
|
});
|
|
325
325
|
return requestId;
|
|
326
326
|
}
|
|
327
|
+
getTokenMarketsInfo(underlyingMint) {
|
|
328
|
+
const requestId = this.nextRequestId();
|
|
329
|
+
this.send({
|
|
330
|
+
type: "GetTokenMarketsInfo",
|
|
331
|
+
data: { request_id: requestId, underlying_mint: underlyingMint },
|
|
332
|
+
});
|
|
333
|
+
return requestId;
|
|
334
|
+
}
|
|
327
335
|
logout() {
|
|
328
336
|
this.send({ type: "Logout" });
|
|
329
337
|
}
|
|
@@ -566,6 +574,9 @@ export class ActaWsClient extends TypedEventEmitter {
|
|
|
566
574
|
case "EarnSummary":
|
|
567
575
|
this.emit("earnSummary", message.data);
|
|
568
576
|
break;
|
|
577
|
+
case "TokenMarketsInfo":
|
|
578
|
+
this.emit("tokenMarketsInfo", message.data);
|
|
579
|
+
break;
|
|
569
580
|
case "RfqBroadcast":
|
|
570
581
|
// Keep local RFQ state reasonably fresh even without a new snapshot.
|
|
571
582
|
if (!this.state.activeRfqs.has(message.data.rfq_id)) {
|
package/dist/ws/types.d.ts
CHANGED
|
@@ -154,6 +154,12 @@ export type ClientMessage = {
|
|
|
154
154
|
} | {
|
|
155
155
|
type: "GetEarnSummary";
|
|
156
156
|
data: GetEarnSummaryMessage;
|
|
157
|
+
} | {
|
|
158
|
+
type: "GetTokenMarketsInfo";
|
|
159
|
+
data: GetTokenMarketsInfoMessage;
|
|
160
|
+
} | {
|
|
161
|
+
type: "GetMyTrades";
|
|
162
|
+
data: GetMyTradesMessage;
|
|
157
163
|
} | {
|
|
158
164
|
type: "GetSubscriptions";
|
|
159
165
|
data: GetSubscriptionsMessage;
|
|
@@ -460,6 +466,12 @@ export type ServerMessage = {
|
|
|
460
466
|
} | {
|
|
461
467
|
type: "EarnSummary";
|
|
462
468
|
data: EarnSummaryData;
|
|
469
|
+
} | {
|
|
470
|
+
type: "TokenMarketsInfo";
|
|
471
|
+
data: TokenMarketsInfoData;
|
|
472
|
+
} | {
|
|
473
|
+
type: "MyTrades";
|
|
474
|
+
data: MyTradesMessage;
|
|
463
475
|
} | {
|
|
464
476
|
type: "RfqSkipped";
|
|
465
477
|
data: RfqSkippedMessage;
|
|
@@ -1057,6 +1069,8 @@ export type EarnAssetSummary = {
|
|
|
1057
1069
|
cap_total: WsU64;
|
|
1058
1070
|
cap_used: WsU64;
|
|
1059
1071
|
strikes_count: number;
|
|
1072
|
+
nearest_market_pda: string;
|
|
1073
|
+
markets_count: WsU32;
|
|
1060
1074
|
nearest_expiry_ts: number;
|
|
1061
1075
|
};
|
|
1062
1076
|
export type EarnSummaryData = {
|
|
@@ -1064,6 +1078,61 @@ export type EarnSummaryData = {
|
|
|
1064
1078
|
assets: EarnAssetSummary[];
|
|
1065
1079
|
computed_at: number;
|
|
1066
1080
|
};
|
|
1081
|
+
export type GetTokenMarketsInfoMessage = {
|
|
1082
|
+
request_id: RequestId;
|
|
1083
|
+
underlying_mint: string;
|
|
1084
|
+
};
|
|
1085
|
+
export type TokenMarketIndicatives = {
|
|
1086
|
+
position_type: PositionType;
|
|
1087
|
+
updated_at: WsU64;
|
|
1088
|
+
is_stale: boolean;
|
|
1089
|
+
strikes: Array<{
|
|
1090
|
+
strike: WsU64;
|
|
1091
|
+
best_price?: WsU64 | null;
|
|
1092
|
+
}>;
|
|
1093
|
+
};
|
|
1094
|
+
export type TokenMarketEntry = {
|
|
1095
|
+
market_pda: string;
|
|
1096
|
+
expiry_ts: WsU64;
|
|
1097
|
+
is_put: boolean;
|
|
1098
|
+
indicatives: TokenMarketIndicatives[];
|
|
1099
|
+
};
|
|
1100
|
+
export type TokenMarketsInfoData = {
|
|
1101
|
+
request_id: RequestId;
|
|
1102
|
+
underlying_symbol: string;
|
|
1103
|
+
underlying_decimals: WsU64;
|
|
1104
|
+
quote_symbol: string;
|
|
1105
|
+
quote_decimals: WsU64;
|
|
1106
|
+
size_rule: PositionSizeRule;
|
|
1107
|
+
reference_price: WsU64;
|
|
1108
|
+
markets: TokenMarketEntry[];
|
|
1109
|
+
};
|
|
1110
|
+
export type GetMyTradesMessage = {
|
|
1111
|
+
request_id: RequestId;
|
|
1112
|
+
limit?: WsU32;
|
|
1113
|
+
/** Unix timestamp seconds cursor for keyset pagination. */
|
|
1114
|
+
cursor?: WsU64;
|
|
1115
|
+
cursor_id?: UuidString;
|
|
1116
|
+
market?: string;
|
|
1117
|
+
};
|
|
1118
|
+
export type MakerTradeInfo = {
|
|
1119
|
+
id: UuidString;
|
|
1120
|
+
rfq_id: UuidString;
|
|
1121
|
+
market_pda: string;
|
|
1122
|
+
position_type: PositionType;
|
|
1123
|
+
taker: string;
|
|
1124
|
+
strike: WsU64;
|
|
1125
|
+
quantity: WsU64;
|
|
1126
|
+
price: WsU64;
|
|
1127
|
+
tx_signature?: string | null;
|
|
1128
|
+
position_pda?: string | null;
|
|
1129
|
+
confirmed_at: WsU64;
|
|
1130
|
+
};
|
|
1131
|
+
export type MyTradesMessage = {
|
|
1132
|
+
request_id: RequestId;
|
|
1133
|
+
trades: MakerTradeInfo[];
|
|
1134
|
+
has_more: boolean;
|
|
1135
|
+
};
|
|
1067
1136
|
export type StatsDelta = {
|
|
1068
1137
|
volume_added?: WsU64 | null;
|
|
1069
1138
|
trades_added?: WsU32 | null;
|