@acta-markets/ts-sdk 0.0.9-beta → 0.0.10-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.
@@ -309,6 +309,7 @@ describe("events parsing", () => {
309
309
  u64(4000),
310
310
  Buffer.from(orderId),
311
311
  u64(5000), // total_premium
312
+ u64(6000), // created_at
312
313
  ]));
313
314
  const d = (0, events_1.decodeActaEventLine)(line);
314
315
  expect(d.kind).toBe(events_1.EventKind.OpenPosition);
@@ -325,6 +326,7 @@ describe("events parsing", () => {
325
326
  expect(d.event.validUntil).toBe(4000n);
326
327
  expect(Buffer.from(d.event.orderId)).toEqual(Buffer.from(orderId));
327
328
  expect(d.event.totalPremium).toBe(5000n);
329
+ expect(d.event.createdAt).toBe(6000n);
328
330
  }
329
331
  }
330
332
  // 12: DepositFundsToPosition
@@ -7,7 +7,7 @@
7
7
  * @see https://github.com/codama-idl/codama
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS = exports.ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED = exports.ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED = exports.ACTA_CONTRACT_ERROR__ORACLE_CLOSE_TOO_EARLY = exports.ACTA_CONTRACT_ERROR__UNAUTHORIZED = exports.ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP = exports.ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID = exports.ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS = exports.ACTA_CONTRACT_ERROR__MINT_MISMATCH = exports.ACTA_CONTRACT_ERROR__MATH_OVERFLOW = exports.ACTA_CONTRACT_ERROR__INVALID_INSTRUCTION_DATA = exports.ACTA_CONTRACT_ERROR__SIGNED_MESSAGE_MISMATCH = exports.ACTA_CONTRACT_ERROR__SIGNER_MISMATCH = exports.ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT = exports.ACTA_CONTRACT_ERROR__INVALID_ORDER_ID = exports.ACTA_CONTRACT_ERROR__POSITION_TYPE_MISMATCH = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_ITM = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_SETTLED = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_OPEN = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_OPEN = exports.ACTA_CONTRACT_ERROR__ORACLE_INVALID_PRICE = exports.ACTA_CONTRACT_ERROR__ORACLE_INACTIVE = exports.ACTA_CONTRACT_ERROR__ORACLE_STALE = exports.ACTA_CONTRACT_ERROR__ORACLE_EXPIRY_MISMATCH = exports.ACTA_CONTRACT_ERROR__INVALID_ORACLE_ACCOUNT = exports.ACTA_CONTRACT_ERROR__INVALID_ORACLE_TYPE = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_EMPTY = exports.ACTA_CONTRACT_ERROR__MARKET_EXPIRED = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_FINALIZED = exports.ACTA_CONTRACT_ERROR__MARKET_FINALIZED = exports.ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER = exports.ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED = exports.ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED = exports.ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED = exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA = exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT = exports.ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED = exports.ACTA_CONTRACT_ERROR__INVALID_PDA = exports.ACTA_CONTRACT_ERROR__INVALID_OWNER = exports.ACTA_CONTRACT_ERROR__NOT_SIGNED = void 0;
10
+ exports.ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT = exports.ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS = exports.ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED = exports.ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED = exports.ACTA_CONTRACT_ERROR__ORACLE_CLOSE_TOO_EARLY = exports.ACTA_CONTRACT_ERROR__UNAUTHORIZED = exports.ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP = exports.ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID = exports.ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS = exports.ACTA_CONTRACT_ERROR__MINT_MISMATCH = exports.ACTA_CONTRACT_ERROR__MATH_OVERFLOW = exports.ACTA_CONTRACT_ERROR__INVALID_INSTRUCTION_DATA = exports.ACTA_CONTRACT_ERROR__SIGNED_MESSAGE_MISMATCH = exports.ACTA_CONTRACT_ERROR__SIGNER_MISMATCH = exports.ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT = exports.ACTA_CONTRACT_ERROR__INVALID_ORDER_ID = exports.ACTA_CONTRACT_ERROR__POSITION_TYPE_MISMATCH = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_ITM = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_SETTLED = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_FUNDED = exports.ACTA_CONTRACT_ERROR__POSITION_NOT_OPEN = exports.ACTA_CONTRACT_ERROR__POSITION_ALREADY_OPEN = exports.ACTA_CONTRACT_ERROR__ORACLE_INVALID_PRICE = exports.ACTA_CONTRACT_ERROR__ORACLE_INACTIVE = exports.ACTA_CONTRACT_ERROR__ORACLE_STALE = exports.ACTA_CONTRACT_ERROR__ORACLE_EXPIRY_MISMATCH = exports.ACTA_CONTRACT_ERROR__INVALID_ORACLE_ACCOUNT = exports.ACTA_CONTRACT_ERROR__INVALID_ORACLE_TYPE = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_EMPTY = exports.ACTA_CONTRACT_ERROR__MARKET_EXPIRED = exports.ACTA_CONTRACT_ERROR__MARKET_NOT_FINALIZED = exports.ACTA_CONTRACT_ERROR__MARKET_FINALIZED = exports.ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER = exports.ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED = exports.ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED = exports.ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED = exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA = exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT = exports.ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED = exports.ACTA_CONTRACT_ERROR__INVALID_PDA = exports.ACTA_CONTRACT_ERROR__INVALID_OWNER = exports.ACTA_CONTRACT_ERROR__NOT_SIGNED = void 0;
11
11
  exports.getActaContractErrorMessage = getActaContractErrorMessage;
12
12
  exports.isActaContractError = isActaContractError;
13
13
  const kit_1 = require("@solana/kit");
@@ -96,11 +96,14 @@ exports.ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED = 0x430; // 1072
96
96
  exports.ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED = 0x431; // 1073
97
97
  /** OracleHasActiveMarkets: Oracle is still linked to active markets */
98
98
  exports.ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS = 0x432; // 1074
99
+ /** DuplicateAccount: Duplicate account passed to instruction */
100
+ exports.ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT = 0x433; // 1075
99
101
  let actaContractErrorMessages;
100
102
  if (process.env.NODE_ENV !== "production") {
101
103
  actaContractErrorMessages = {
102
104
  [exports.ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED]: `Account already initialized`,
103
105
  [exports.ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED]: `Account not initialized`,
106
+ [exports.ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT]: `Duplicate account passed to instruction`,
104
107
  [exports.ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS]: `Balance is below the required amount`,
105
108
  [exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT]: `Wrong number of accounts`,
106
109
  [exports.ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA]: `Account data corrupted or wrong format`,
@@ -2349,6 +2349,11 @@
2349
2349
  "code": 1074,
2350
2350
  "name": "OracleHasActiveMarkets",
2351
2351
  "msg": "Oracle is still linked to active markets"
2352
+ },
2353
+ {
2354
+ "code": 1075,
2355
+ "name": "DuplicateAccount",
2356
+ "msg": "Duplicate account passed to instruction"
2352
2357
  }
2353
2358
  ]
2354
2359
  }
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ACTA_IDL_SHA256 = void 0;
4
- exports.ACTA_IDL_SHA256 = "64e4296b125327045af22a09a12faa5bd903a8e3c9b9e86c7313d533ba591f01";
4
+ exports.ACTA_IDL_SHA256 = "2f68d4442e5eb2098a5cdc76fb3465c48d6aff9bc1cda6b27f3b45eeff35bffb";
@@ -311,6 +311,14 @@ class ActaWsClient extends TypedEventEmitter {
311
311
  });
312
312
  return requestId;
313
313
  }
314
+ getTokenCaps(args) {
315
+ const requestId = this.nextRequestId();
316
+ this.send({
317
+ type: "GetTokenCaps",
318
+ data: { request_id: requestId, include_markets: args?.include_markets },
319
+ });
320
+ return requestId;
321
+ }
314
322
  logout() {
315
323
  this.send({ type: "Logout" });
316
324
  }
@@ -535,6 +543,12 @@ class ActaWsClient extends TypedEventEmitter {
535
543
  }
536
544
  this.emit("activeRfqs", message.data.rfqs);
537
545
  break;
546
+ case "TokenCaps":
547
+ this.emit("tokenCaps", message.data);
548
+ break;
549
+ case "MyCaps":
550
+ this.emit("myCaps", message.data);
551
+ break;
538
552
  case "MyActiveRfqs":
539
553
  this.handleMyActiveRfqs(message.data);
540
554
  break;
@@ -669,6 +683,9 @@ class ActaWsClient extends TypedEventEmitter {
669
683
  case "ChainEvent":
670
684
  this.handleChainEvent(message.data);
671
685
  break;
686
+ case "RfqSkipped":
687
+ this.emit("rfqSkipped", message.data);
688
+ break;
672
689
  case "Pong":
673
690
  break;
674
691
  case "Error":
@@ -307,6 +307,7 @@ describe("events parsing", () => {
307
307
  u64(4000),
308
308
  Buffer.from(orderId),
309
309
  u64(5000), // total_premium
310
+ u64(6000), // created_at
310
311
  ]));
311
312
  const d = decodeActaEventLine(line);
312
313
  expect(d.kind).toBe(EventKind.OpenPosition);
@@ -323,6 +324,7 @@ describe("events parsing", () => {
323
324
  expect(d.event.validUntil).toBe(4000n);
324
325
  expect(Buffer.from(d.event.orderId)).toEqual(Buffer.from(orderId));
325
326
  expect(d.event.totalPremium).toBe(5000n);
327
+ expect(d.event.createdAt).toBe(6000n);
326
328
  }
327
329
  }
328
330
  // 12: DepositFundsToPosition
@@ -90,7 +90,9 @@ export declare const ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED = 1072;
90
90
  export declare const ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED = 1073;
91
91
  /** OracleHasActiveMarkets: Oracle is still linked to active markets */
92
92
  export declare const ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS = 1074;
93
- export type ActaContractError = typeof ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED | typeof ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED | typeof ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS | typeof ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT | typeof ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA | typeof ACTA_CONTRACT_ERROR__INVALID_INSTRUCTION_DATA | typeof ACTA_CONTRACT_ERROR__INVALID_ORACLE_ACCOUNT | typeof ACTA_CONTRACT_ERROR__INVALID_ORACLE_TYPE | typeof ACTA_CONTRACT_ERROR__INVALID_ORDER_ID | typeof ACTA_CONTRACT_ERROR__INVALID_OWNER | typeof ACTA_CONTRACT_ERROR__INVALID_PDA | typeof ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID | typeof ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT | typeof ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP | typeof ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED | typeof ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER | typeof ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED | typeof ACTA_CONTRACT_ERROR__MARKET_EXPIRED | typeof ACTA_CONTRACT_ERROR__MARKET_FINALIZED | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_EMPTY | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_FINALIZED | typeof ACTA_CONTRACT_ERROR__MATH_OVERFLOW | typeof ACTA_CONTRACT_ERROR__MINT_MISMATCH | typeof ACTA_CONTRACT_ERROR__NOT_SIGNED | typeof ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED | typeof ACTA_CONTRACT_ERROR__ORACLE_CLOSE_TOO_EARLY | typeof ACTA_CONTRACT_ERROR__ORACLE_EXPIRY_MISMATCH | typeof ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS | typeof ACTA_CONTRACT_ERROR__ORACLE_INACTIVE | typeof ACTA_CONTRACT_ERROR__ORACLE_INVALID_PRICE | typeof ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED | typeof ACTA_CONTRACT_ERROR__ORACLE_STALE | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_FUNDED | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_OPEN | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_SETTLED | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_FUNDED | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_ITM | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_OPEN | typeof ACTA_CONTRACT_ERROR__POSITION_TYPE_MISMATCH | typeof ACTA_CONTRACT_ERROR__SIGNED_MESSAGE_MISMATCH | typeof ACTA_CONTRACT_ERROR__SIGNER_MISMATCH | typeof ACTA_CONTRACT_ERROR__UNAUTHORIZED;
93
+ /** DuplicateAccount: Duplicate account passed to instruction */
94
+ export declare const ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT = 1075;
95
+ export type ActaContractError = typeof ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED | typeof ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED | typeof ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT | typeof ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS | typeof ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT | typeof ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA | typeof ACTA_CONTRACT_ERROR__INVALID_INSTRUCTION_DATA | typeof ACTA_CONTRACT_ERROR__INVALID_ORACLE_ACCOUNT | typeof ACTA_CONTRACT_ERROR__INVALID_ORACLE_TYPE | typeof ACTA_CONTRACT_ERROR__INVALID_ORDER_ID | typeof ACTA_CONTRACT_ERROR__INVALID_OWNER | typeof ACTA_CONTRACT_ERROR__INVALID_PDA | typeof ACTA_CONTRACT_ERROR__INVALID_PROGRAM_ID | typeof ACTA_CONTRACT_ERROR__INVALID_SIGNATURE_COUNT | typeof ACTA_CONTRACT_ERROR__INVALID_TIMESTAMP | typeof ACTA_CONTRACT_ERROR__MAKER_ALREADY_REGISTERED | typeof ACTA_CONTRACT_ERROR__MAKER_NOT_OWNER | typeof ACTA_CONTRACT_ERROR__MAKER_NOT_REGISTERED | typeof ACTA_CONTRACT_ERROR__MARKET_EXPIRED | typeof ACTA_CONTRACT_ERROR__MARKET_FINALIZED | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_EMPTY | typeof ACTA_CONTRACT_ERROR__MARKET_NOT_FINALIZED | typeof ACTA_CONTRACT_ERROR__MATH_OVERFLOW | typeof ACTA_CONTRACT_ERROR__MINT_MISMATCH | typeof ACTA_CONTRACT_ERROR__NOT_SIGNED | typeof ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED | typeof ACTA_CONTRACT_ERROR__ORACLE_CLOSE_TOO_EARLY | typeof ACTA_CONTRACT_ERROR__ORACLE_EXPIRY_MISMATCH | typeof ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS | typeof ACTA_CONTRACT_ERROR__ORACLE_INACTIVE | typeof ACTA_CONTRACT_ERROR__ORACLE_INVALID_PRICE | typeof ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED | typeof ACTA_CONTRACT_ERROR__ORACLE_STALE | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_FUNDED | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_OPEN | typeof ACTA_CONTRACT_ERROR__POSITION_ALREADY_SETTLED | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_FUNDED | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_ITM | typeof ACTA_CONTRACT_ERROR__POSITION_NOT_OPEN | typeof ACTA_CONTRACT_ERROR__POSITION_TYPE_MISMATCH | typeof ACTA_CONTRACT_ERROR__SIGNED_MESSAGE_MISMATCH | typeof ACTA_CONTRACT_ERROR__SIGNER_MISMATCH | typeof ACTA_CONTRACT_ERROR__UNAUTHORIZED;
94
96
  export declare function getActaContractErrorMessage(code: ActaContractError): string;
95
97
  export declare function isActaContractError<TProgramErrorCode extends ActaContractError>(error: unknown, transactionMessage: {
96
98
  instructions: Record<number, {
@@ -91,11 +91,14 @@ export const ACTA_CONTRACT_ERROR__ORACLE_ALREADY_UPDATED = 0x430; // 1072
91
91
  export const ACTA_CONTRACT_ERROR__ORACLE_SOURCE_LOCKED = 0x431; // 1073
92
92
  /** OracleHasActiveMarkets: Oracle is still linked to active markets */
93
93
  export const ACTA_CONTRACT_ERROR__ORACLE_HAS_ACTIVE_MARKETS = 0x432; // 1074
94
+ /** DuplicateAccount: Duplicate account passed to instruction */
95
+ export const ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT = 0x433; // 1075
94
96
  let actaContractErrorMessages;
95
97
  if (process.env.NODE_ENV !== "production") {
96
98
  actaContractErrorMessages = {
97
99
  [ACTA_CONTRACT_ERROR__ACCOUNT_ALREADY_INITIALIZED]: `Account already initialized`,
98
100
  [ACTA_CONTRACT_ERROR__ACCOUNT_NOT_INITIALIZED]: `Account not initialized`,
101
+ [ACTA_CONTRACT_ERROR__DUPLICATE_ACCOUNT]: `Duplicate account passed to instruction`,
99
102
  [ACTA_CONTRACT_ERROR__INSUFFICIENT_FUNDS]: `Balance is below the required amount`,
100
103
  [ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_COUNT]: `Wrong number of accounts`,
101
104
  [ACTA_CONTRACT_ERROR__INVALID_ACCOUNT_DATA]: `Account data corrupted or wrong format`,
@@ -2349,6 +2349,11 @@
2349
2349
  "code": 1074,
2350
2350
  "name": "OracleHasActiveMarkets",
2351
2351
  "msg": "Oracle is still linked to active markets"
2352
+ },
2353
+ {
2354
+ "code": 1075,
2355
+ "name": "DuplicateAccount",
2356
+ "msg": "Duplicate account passed to instruction"
2352
2357
  }
2353
2358
  ]
2354
2359
  }
@@ -1 +1 @@
1
- export declare const ACTA_IDL_SHA256 = "64e4296b125327045af22a09a12faa5bd903a8e3c9b9e86c7313d533ba591f01";
1
+ export declare const ACTA_IDL_SHA256 = "2f68d4442e5eb2098a5cdc76fb3465c48d6aff9bc1cda6b27f3b45eeff35bffb";
package/dist/idl/hash.js CHANGED
@@ -1 +1 @@
1
- export const ACTA_IDL_SHA256 = "64e4296b125327045af22a09a12faa5bd903a8e3c9b9e86c7313d533ba591f01";
1
+ export const ACTA_IDL_SHA256 = "2f68d4442e5eb2098a5cdc76fb3465c48d6aff9bc1cda6b27f3b45eeff35bffb";
@@ -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, GlobalStats, MarketDescriptorInfo, MarketInfo, MyActiveRfqInfo, MyActiveRfqsMessage, OrderStatusMessage, PositionInfo, QuoteAcknowledgedMessage, QuoteBestStatusMessage, QuoteCancelledMessage, QuoteMessage, QuoteRefreshRequestedMessage, QuoteOutbidMessage, QuoteReceivedMessage, QuoteSelectedMessage, QuotesUpdateMessage, RfqBroadcastMessage, RfqClosedMessage, RfqCreatedMessage, 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, 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";
@@ -76,6 +76,7 @@ export type ActaWsClientEvents = {
76
76
  subscriptions: (msg: SubscriptionsMessage) => void;
77
77
  activeRfqs: (rfqs: ActiveRfqInfo[]) => void;
78
78
  rfqBroadcast: (rfq: RfqBroadcastMessage) => void;
79
+ rfqSkipped: (msg: RfqSkippedMessage) => void;
79
80
  rfqCreated: (msg: RfqCreatedMessage) => void;
80
81
  rfqClosed: (msg: RfqClosedMessage) => void;
81
82
  quoteReceived: (quote: QuoteReceivedMessage) => void;
@@ -213,6 +214,9 @@ export declare class ActaWsClient extends TypedEventEmitter<ActaWsClientEvents>
213
214
  }): RequestId;
214
215
  getMyActiveRfqs(): RequestId;
215
216
  getActiveRfqs(): RequestId;
217
+ getTokenCaps(args?: {
218
+ include_markets?: boolean;
219
+ }): RequestId;
216
220
  logout(): void;
217
221
  getOrderStatus(orderIdHex: string): RequestId;
218
222
  cancelRfq(rfqId: string): RequestId;
package/dist/ws/client.js CHANGED
@@ -308,6 +308,14 @@ export class ActaWsClient extends TypedEventEmitter {
308
308
  });
309
309
  return requestId;
310
310
  }
311
+ getTokenCaps(args) {
312
+ const requestId = this.nextRequestId();
313
+ this.send({
314
+ type: "GetTokenCaps",
315
+ data: { request_id: requestId, include_markets: args?.include_markets },
316
+ });
317
+ return requestId;
318
+ }
311
319
  logout() {
312
320
  this.send({ type: "Logout" });
313
321
  }
@@ -532,6 +540,12 @@ export class ActaWsClient extends TypedEventEmitter {
532
540
  }
533
541
  this.emit("activeRfqs", message.data.rfqs);
534
542
  break;
543
+ case "TokenCaps":
544
+ this.emit("tokenCaps", message.data);
545
+ break;
546
+ case "MyCaps":
547
+ this.emit("myCaps", message.data);
548
+ break;
535
549
  case "MyActiveRfqs":
536
550
  this.handleMyActiveRfqs(message.data);
537
551
  break;
@@ -666,6 +680,9 @@ export class ActaWsClient extends TypedEventEmitter {
666
680
  case "ChainEvent":
667
681
  this.handleChainEvent(message.data);
668
682
  break;
683
+ case "RfqSkipped":
684
+ this.emit("rfqSkipped", message.data);
685
+ break;
669
686
  case "Pong":
670
687
  break;
671
688
  case "Error":
@@ -157,6 +157,12 @@ export type ClientMessage = {
157
157
  } | {
158
158
  type: "GetMakerBalances";
159
159
  data: GetMakerBalancesMessage;
160
+ } | {
161
+ type: "GetTokenCaps";
162
+ data: GetTokenCapsMessage;
163
+ } | {
164
+ type: "GetMyCaps";
165
+ data: GetMyCapsMessage;
160
166
  } | {
161
167
  type: "GetSubscriptions";
162
168
  data: GetSubscriptionsMessage;
@@ -373,6 +379,12 @@ export type ServerMessage = {
373
379
  } | {
374
380
  type: "MakerBalances";
375
381
  data: MakerBalancesMessage;
382
+ } | {
383
+ type: "TokenCaps";
384
+ data: TokenCapsMessage;
385
+ } | {
386
+ type: "MyCaps";
387
+ data: MyCapsMessage;
376
388
  } | {
377
389
  type: "Subscriptions";
378
390
  data: SubscriptionsMessage;
@@ -454,6 +466,9 @@ export type ServerMessage = {
454
466
  } | {
455
467
  type: "StatsUpdate";
456
468
  data: StatsUpdateMessage;
469
+ } | {
470
+ type: "RfqSkipped";
471
+ data: RfqSkippedMessage;
457
472
  } | {
458
473
  type: "Pong";
459
474
  data: {
@@ -566,6 +581,46 @@ export type ServerError = {
566
581
  } | {
567
582
  type: "rate_limit";
568
583
  data: RateLimitReason;
584
+ } | {
585
+ type: "token_oi_cap_exceeded";
586
+ data: {
587
+ underlying_mint: string;
588
+ current: WsU64;
589
+ limit: WsU64;
590
+ };
591
+ } | {
592
+ type: "market_oi_cap_exceeded";
593
+ data: {
594
+ market_id: string;
595
+ current: WsU64;
596
+ limit: WsU64;
597
+ };
598
+ } | {
599
+ type: "maker_position_cap_exceeded";
600
+ data: {
601
+ current: WsU32;
602
+ limit: WsU32;
603
+ };
604
+ } | {
605
+ type: "maker_notional_cap_exceeded";
606
+ data: {
607
+ underlying_mint: string;
608
+ current: WsU64;
609
+ limit: WsU64;
610
+ };
611
+ } | {
612
+ type: "maker_insufficient_balance";
613
+ data: {
614
+ available: WsU64;
615
+ required: WsU64;
616
+ };
617
+ } | {
618
+ type: "quote_notional_cap_exceeded";
619
+ data: {
620
+ quote_mint: string;
621
+ current: WsU64;
622
+ limit: WsU64;
623
+ };
569
624
  } | {
570
625
  type: "internal_error";
571
626
  } | {
@@ -735,6 +790,68 @@ export type MakerMintBalance = {
735
790
  locked_as_collateral: WsU64;
736
791
  available: WsU64;
737
792
  };
793
+ export type GetTokenCapsMessage = {
794
+ request_id: RequestId;
795
+ include_markets?: boolean;
796
+ };
797
+ export type GetMyCapsMessage = {
798
+ request_id: RequestId;
799
+ };
800
+ export type RfqSkippedMessage = {
801
+ rfq_id: UuidString;
802
+ market_id: string;
803
+ quantity: WsU64;
804
+ reason: string;
805
+ };
806
+ export type QuoteCapInfo = {
807
+ quote_mint: string;
808
+ symbol: string;
809
+ current_notional: WsU64;
810
+ max_notional: WsU64;
811
+ utilization: number;
812
+ };
813
+ export type TokenCapsMessage = {
814
+ request_id: RequestId;
815
+ tokens: TokenCapInfo[];
816
+ markets?: MarketCapInfo[];
817
+ quotes?: QuoteCapInfo[];
818
+ };
819
+ export type MyCapsMessage = {
820
+ request_id: RequestId;
821
+ positions: MakerPositionCapInfo;
822
+ notional: MakerNotionalCapInfo[];
823
+ balances: MakerBalanceCapInfo[];
824
+ };
825
+ export type TokenCapInfo = {
826
+ underlying_mint: string;
827
+ symbol: string;
828
+ current_oi: WsU64;
829
+ max_oi: WsU64;
830
+ utilization: number;
831
+ };
832
+ export type MarketCapInfo = {
833
+ market_id: string;
834
+ current_oi: WsU64;
835
+ max_oi: WsU64;
836
+ utilization: number;
837
+ };
838
+ export type MakerPositionCapInfo = {
839
+ current: WsU32;
840
+ limit: WsU32;
841
+ };
842
+ export type MakerNotionalCapInfo = {
843
+ underlying_mint: string;
844
+ symbol: string;
845
+ current: WsU64;
846
+ limit: WsU64;
847
+ };
848
+ export type MakerBalanceCapInfo = {
849
+ mint: string;
850
+ symbol: string;
851
+ deposited: WsU64;
852
+ committed: WsU64;
853
+ available: WsU64;
854
+ };
738
855
  export type SubscriptionsMessage = {
739
856
  request_id: RequestId;
740
857
  channels: WsChannel[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acta-markets/ts-sdk",
3
- "version": "0.0.9-beta",
3
+ "version": "0.0.10-beta",
4
4
  "description": "TypeScript SDK for Acta Protocol",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",