@acta-markets/ts-sdk 0.0.20-beta → 0.0.22-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.
@@ -1,4 +1,5 @@
1
1
  import type { Address } from "@solana/addresses";
2
+ import type { ClaimErrorReason, InviteErrorReason, TakerStatus } from "./referral";
2
3
  export type UuidString = string;
3
4
  export type RequestId = string;
4
5
  export type PubkeyBase58 = string;
@@ -173,7 +174,8 @@ export type ClientMessage = {
173
174
  data: {
174
175
  request_id: RequestId;
175
176
  channels: WsChannel[];
176
- markets?: string[];
177
+ underlying_mints?: string[];
178
+ quote_mints?: string[];
177
179
  };
178
180
  } | {
179
181
  type: "Unsubscribe";
@@ -181,6 +183,66 @@ export type ClientMessage = {
181
183
  request_id: RequestId;
182
184
  channels: WsChannel[];
183
185
  };
186
+ } | {
187
+ type: "AddMints";
188
+ data: {
189
+ request_id: RequestId;
190
+ underlying_mints?: string[];
191
+ quote_mints?: string[];
192
+ };
193
+ } | {
194
+ type: "RemoveMints";
195
+ data: {
196
+ request_id: RequestId;
197
+ underlying_mints?: string[];
198
+ quote_mints?: string[];
199
+ };
200
+ } | {
201
+ type: "AddChannels";
202
+ data: {
203
+ request_id: RequestId;
204
+ channels: WsChannel[];
205
+ };
206
+ } | {
207
+ type: "RemoveChannels";
208
+ data: {
209
+ request_id: RequestId;
210
+ channels: WsChannel[];
211
+ };
212
+ } | {
213
+ type: "RedeemInvite";
214
+ data: {
215
+ request_id: RequestId;
216
+ code: string;
217
+ };
218
+ } | {
219
+ type: "ClaimReferralCode";
220
+ data: {
221
+ request_id: RequestId;
222
+ code: string;
223
+ };
224
+ } | {
225
+ type: "GetMyReferralInfo";
226
+ data: {
227
+ request_id: RequestId;
228
+ };
229
+ };
230
+ export type InviteRedeemedData = {
231
+ request_id: RequestId;
232
+ referral_code: string;
233
+ };
234
+ export type ReferralCodeClaimedData = {
235
+ request_id: RequestId;
236
+ referral_code: string;
237
+ };
238
+ export type MyReferralInfoData = {
239
+ request_id: RequestId;
240
+ referral_code: string;
241
+ status: TakerStatus;
242
+ total_invited: number;
243
+ invited_this_period: number;
244
+ max_invites_per_period: number;
245
+ next_slot_frees_in_seconds: number;
184
246
  };
185
247
  export type GetMarketDescriptorsMessage = {
186
248
  request_id: RequestId;
@@ -503,6 +565,25 @@ export type ServerMessage = {
503
565
  request_id: RequestId;
504
566
  unsubscribed: WsChannel[];
505
567
  };
568
+ } | {
569
+ type: "SubscriptionUpdated";
570
+ data: {
571
+ request_id: RequestId;
572
+ channels: WsChannel[];
573
+ underlying_mints?: string[];
574
+ quote_mints?: string[];
575
+ };
576
+ } | {
577
+ type: "RequireInvite";
578
+ } | {
579
+ type: "InviteRedeemed";
580
+ data: InviteRedeemedData;
581
+ } | {
582
+ type: "ReferralCodeClaimed";
583
+ data: ReferralCodeClaimedData;
584
+ } | {
585
+ type: "MyReferralInfo";
586
+ data: MyReferralInfoData;
506
587
  };
507
588
  export type MarketDescriptorInfo = {
508
589
  market: MarketDescriptor;
@@ -542,128 +623,154 @@ export type QuoteRefreshRequestedMessage = {
542
623
  reason: QuoteRefreshReason;
543
624
  };
544
625
  export type ServerError = {
545
- type: "unauthenticated";
626
+ type: "Unauthenticated";
546
627
  data: {
547
628
  action: AuthRequiredAction;
548
629
  };
549
630
  } | {
550
- type: "unauthorized";
631
+ type: "Unauthorized";
551
632
  data: {
552
633
  role: UserRole;
553
634
  action: AuthRequiredAction;
554
635
  };
555
636
  } | {
556
- type: "rfq_not_found";
637
+ type: "RfqNotFound";
638
+ } | {
639
+ type: "RfqNotActive";
557
640
  } | {
558
- type: "rfq_not_active";
641
+ type: "RfqAlreadyLocked";
559
642
  } | {
560
- type: "invalid_state";
643
+ type: "InvalidState";
561
644
  data: {
562
645
  state: RfqStateError;
563
646
  };
564
647
  } | {
565
- type: "quote_locked";
648
+ type: "QuoteLocked";
566
649
  data: {
567
650
  reason: QuoteLockedReason;
568
651
  };
569
652
  } | {
570
- type: "quote_not_found";
653
+ type: "QuoteNotFound";
571
654
  } | {
572
- type: "quote_expired";
655
+ type: "QuoteExpired";
656
+ } | {
657
+ type: "QuoteExpiryTooShort";
658
+ data: {
659
+ min_seconds: WsU32;
660
+ };
661
+ } | {
662
+ type: "InvalidStrike";
573
663
  } | {
574
- type: "invalid_strike";
664
+ type: "InvalidValidUntil";
575
665
  } | {
576
- type: "invalid_valid_until";
666
+ type: "OrderIdMismatch";
577
667
  } | {
578
- type: "order_id_mismatch";
668
+ type: "UnknownOrder";
579
669
  } | {
580
- type: "signature_timeout";
670
+ type: "SignatureTimeout";
581
671
  } | {
582
- type: "oracle_not_ready";
672
+ type: "OracleNotReady";
583
673
  } | {
584
- type: "oracle_price_stale";
674
+ type: "OraclePriceStale";
585
675
  data: {
586
676
  age_seconds: WsU64;
587
677
  };
588
678
  } | {
589
- type: "oracle_price_not_ready";
679
+ type: "OraclePriceNotReady";
590
680
  } | {
591
- type: "invalid_position_type";
681
+ type: "InvalidPositionType";
592
682
  } | {
593
- type: "invalid_market";
683
+ type: "InvalidMarket";
594
684
  data: {
595
685
  pubkey: string;
596
686
  };
597
687
  } | {
598
- type: "market_metadata_incomplete";
688
+ type: "MarketMetadataIncomplete";
599
689
  data: {
600
690
  details: string;
601
691
  };
602
692
  } | {
603
- type: "token_metadata_incomplete";
693
+ type: "TokenMetadataIncomplete";
604
694
  data: {
605
695
  details: string;
606
696
  };
607
697
  } | {
608
- type: "rate_limit";
698
+ type: "RateLimit";
609
699
  data: RateLimitReason;
610
700
  } | {
611
- type: "token_oi_cap_exceeded";
701
+ type: "Cap";
702
+ data: CapErrorData;
703
+ } | {
704
+ type: "InternalError";
705
+ } | {
706
+ type: "KernelNotAvailable";
707
+ } | {
708
+ type: "DbDisabled";
612
709
  data: {
710
+ feature: DbFeature;
711
+ };
712
+ } | {
713
+ type: "ServerShuttingDown";
714
+ } | {
715
+ type: "Generic";
716
+ data: {
717
+ code: ErrorCode;
718
+ message: ErrorMessage;
719
+ };
720
+ } | {
721
+ type: "InviteRequired";
722
+ } | {
723
+ type: "Invite";
724
+ data: InviteErrorReason;
725
+ } | {
726
+ type: "Claim";
727
+ data: ClaimErrorReason;
728
+ } | {
729
+ type: "generic";
730
+ data: {
731
+ code: ErrorCode;
732
+ message: ErrorMessage;
733
+ };
734
+ };
735
+ /**
736
+ * Externally-tagged union for rust's `CapError`. Only one key is
737
+ * present at a time. Lock-step with
738
+ * `rust-backend/acta-types/src/errors.rs::CapError`.
739
+ */
740
+ export type CapErrorData = {
741
+ token_oi_cap_exceeded: {
613
742
  underlying_mint: string;
614
743
  current: WsU64;
615
744
  limit: WsU64;
616
745
  };
617
746
  } | {
618
- type: "market_oi_cap_exceeded";
619
- data: {
747
+ market_oi_cap_exceeded: {
620
748
  market_id: string;
621
749
  current: WsU64;
622
750
  limit: WsU64;
623
751
  };
624
752
  } | {
625
- type: "maker_position_cap_exceeded";
626
- data: {
753
+ maker_position_cap_exceeded: {
627
754
  current: WsU32;
628
755
  limit: WsU32;
629
756
  };
630
757
  } | {
631
- type: "maker_notional_cap_exceeded";
632
- data: {
758
+ maker_notional_cap_exceeded: {
633
759
  underlying_mint: string;
634
760
  current: WsU64;
635
761
  limit: WsU64;
636
762
  };
637
763
  } | {
638
- type: "maker_insufficient_balance";
639
- data: {
764
+ maker_insufficient_balance: {
640
765
  available: WsU64;
641
766
  required: WsU64;
642
767
  };
643
768
  } | {
644
- type: "quote_notional_cap_exceeded";
645
- data: {
769
+ quote_notional_cap_exceeded: {
646
770
  quote_mint: string;
647
771
  current: WsU64;
648
772
  limit: WsU64;
649
773
  };
650
- } | {
651
- type: "internal_error";
652
- } | {
653
- type: "kernel_not_available";
654
- } | {
655
- type: "db_disabled";
656
- data: {
657
- feature: DbFeature;
658
- };
659
- } | {
660
- type: "server_shutting_down";
661
- } | {
662
- type: "generic";
663
- data: {
664
- code: ErrorCode;
665
- message: ErrorMessage;
666
- };
667
774
  };
668
775
  /** Confirms quote was received and validated. */
669
776
  export type QuoteAcknowledgedMessage = {
@@ -882,7 +989,8 @@ export type MakerBalanceCapInfo = {
882
989
  export type SubscriptionsMessage = {
883
990
  request_id: RequestId;
884
991
  channels: WsChannel[];
885
- markets?: string[];
992
+ underlying_mints?: string[];
993
+ quote_mints?: string[];
886
994
  };
887
995
  export type IndicativePricesRequestMessage = {
888
996
  request_id: RequestId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acta-markets/ts-sdk",
3
- "version": "0.0.20-beta",
3
+ "version": "0.0.22-beta",
4
4
  "description": "TypeScript SDK for Acta Protocol",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",