@acta-markets/ts-sdk 0.0.17-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 +35 -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,9 @@ export type ClientMessage = {
|
|
|
154
154
|
} | {
|
|
155
155
|
type: "GetEarnSummary";
|
|
156
156
|
data: GetEarnSummaryMessage;
|
|
157
|
+
} | {
|
|
158
|
+
type: "GetTokenMarketsInfo";
|
|
159
|
+
data: GetTokenMarketsInfoMessage;
|
|
157
160
|
} | {
|
|
158
161
|
type: "GetMyTrades";
|
|
159
162
|
data: GetMyTradesMessage;
|
|
@@ -463,6 +466,9 @@ export type ServerMessage = {
|
|
|
463
466
|
} | {
|
|
464
467
|
type: "EarnSummary";
|
|
465
468
|
data: EarnSummaryData;
|
|
469
|
+
} | {
|
|
470
|
+
type: "TokenMarketsInfo";
|
|
471
|
+
data: TokenMarketsInfoData;
|
|
466
472
|
} | {
|
|
467
473
|
type: "MyTrades";
|
|
468
474
|
data: MyTradesMessage;
|
|
@@ -1072,6 +1078,35 @@ export type EarnSummaryData = {
|
|
|
1072
1078
|
assets: EarnAssetSummary[];
|
|
1073
1079
|
computed_at: number;
|
|
1074
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
|
+
};
|
|
1075
1110
|
export type GetMyTradesMessage = {
|
|
1076
1111
|
request_id: RequestId;
|
|
1077
1112
|
limit?: WsU32;
|