@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.
- package/dist/cjs/generated/errors/actaContract.js +4 -1
- package/dist/cjs/idl/acta_contract.json +5 -0
- package/dist/cjs/idl/hash.js +1 -1
- package/dist/cjs/ws/auth.js +14 -11
- package/dist/cjs/ws/client.js +225 -16
- package/dist/cjs/ws/client.test.js +1 -1
- package/dist/cjs/ws/index.js +1 -0
- package/dist/cjs/ws/referral.js +57 -0
- package/dist/cjs/ws/referral.test.js +55 -0
- package/dist/generated/errors/actaContract.d.ts +3 -1
- package/dist/generated/errors/actaContract.js +3 -0
- package/dist/idl/acta_contract.json +5 -0
- package/dist/idl/hash.d.ts +1 -1
- package/dist/idl/hash.js +1 -1
- package/dist/ws/auth.d.ts +10 -7
- package/dist/ws/auth.js +14 -11
- package/dist/ws/client.d.ts +76 -4
- package/dist/ws/client.js +225 -16
- package/dist/ws/client.test.js +1 -1
- package/dist/ws/index.d.ts +1 -0
- package/dist/ws/index.js +1 -0
- package/dist/ws/referral.d.ts +53 -0
- package/dist/ws/referral.js +51 -0
- package/dist/ws/referral.test.d.ts +1 -0
- package/dist/ws/referral.test.js +53 -0
- package/dist/ws/types.d.ts +158 -50
- package/package.json +1 -1
package/dist/ws/types.d.ts
CHANGED
|
@@ -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
|
-
|
|
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: "
|
|
626
|
+
type: "Unauthenticated";
|
|
546
627
|
data: {
|
|
547
628
|
action: AuthRequiredAction;
|
|
548
629
|
};
|
|
549
630
|
} | {
|
|
550
|
-
type: "
|
|
631
|
+
type: "Unauthorized";
|
|
551
632
|
data: {
|
|
552
633
|
role: UserRole;
|
|
553
634
|
action: AuthRequiredAction;
|
|
554
635
|
};
|
|
555
636
|
} | {
|
|
556
|
-
type: "
|
|
637
|
+
type: "RfqNotFound";
|
|
638
|
+
} | {
|
|
639
|
+
type: "RfqNotActive";
|
|
557
640
|
} | {
|
|
558
|
-
type: "
|
|
641
|
+
type: "RfqAlreadyLocked";
|
|
559
642
|
} | {
|
|
560
|
-
type: "
|
|
643
|
+
type: "InvalidState";
|
|
561
644
|
data: {
|
|
562
645
|
state: RfqStateError;
|
|
563
646
|
};
|
|
564
647
|
} | {
|
|
565
|
-
type: "
|
|
648
|
+
type: "QuoteLocked";
|
|
566
649
|
data: {
|
|
567
650
|
reason: QuoteLockedReason;
|
|
568
651
|
};
|
|
569
652
|
} | {
|
|
570
|
-
type: "
|
|
653
|
+
type: "QuoteNotFound";
|
|
571
654
|
} | {
|
|
572
|
-
type: "
|
|
655
|
+
type: "QuoteExpired";
|
|
656
|
+
} | {
|
|
657
|
+
type: "QuoteExpiryTooShort";
|
|
658
|
+
data: {
|
|
659
|
+
min_seconds: WsU32;
|
|
660
|
+
};
|
|
661
|
+
} | {
|
|
662
|
+
type: "InvalidStrike";
|
|
573
663
|
} | {
|
|
574
|
-
type: "
|
|
664
|
+
type: "InvalidValidUntil";
|
|
575
665
|
} | {
|
|
576
|
-
type: "
|
|
666
|
+
type: "OrderIdMismatch";
|
|
577
667
|
} | {
|
|
578
|
-
type: "
|
|
668
|
+
type: "UnknownOrder";
|
|
579
669
|
} | {
|
|
580
|
-
type: "
|
|
670
|
+
type: "SignatureTimeout";
|
|
581
671
|
} | {
|
|
582
|
-
type: "
|
|
672
|
+
type: "OracleNotReady";
|
|
583
673
|
} | {
|
|
584
|
-
type: "
|
|
674
|
+
type: "OraclePriceStale";
|
|
585
675
|
data: {
|
|
586
676
|
age_seconds: WsU64;
|
|
587
677
|
};
|
|
588
678
|
} | {
|
|
589
|
-
type: "
|
|
679
|
+
type: "OraclePriceNotReady";
|
|
590
680
|
} | {
|
|
591
|
-
type: "
|
|
681
|
+
type: "InvalidPositionType";
|
|
592
682
|
} | {
|
|
593
|
-
type: "
|
|
683
|
+
type: "InvalidMarket";
|
|
594
684
|
data: {
|
|
595
685
|
pubkey: string;
|
|
596
686
|
};
|
|
597
687
|
} | {
|
|
598
|
-
type: "
|
|
688
|
+
type: "MarketMetadataIncomplete";
|
|
599
689
|
data: {
|
|
600
690
|
details: string;
|
|
601
691
|
};
|
|
602
692
|
} | {
|
|
603
|
-
type: "
|
|
693
|
+
type: "TokenMetadataIncomplete";
|
|
604
694
|
data: {
|
|
605
695
|
details: string;
|
|
606
696
|
};
|
|
607
697
|
} | {
|
|
608
|
-
type: "
|
|
698
|
+
type: "RateLimit";
|
|
609
699
|
data: RateLimitReason;
|
|
610
700
|
} | {
|
|
611
|
-
type: "
|
|
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
|
-
|
|
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
|
-
|
|
626
|
-
data: {
|
|
753
|
+
maker_position_cap_exceeded: {
|
|
627
754
|
current: WsU32;
|
|
628
755
|
limit: WsU32;
|
|
629
756
|
};
|
|
630
757
|
} | {
|
|
631
|
-
|
|
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
|
-
|
|
639
|
-
data: {
|
|
764
|
+
maker_insufficient_balance: {
|
|
640
765
|
available: WsU64;
|
|
641
766
|
required: WsU64;
|
|
642
767
|
};
|
|
643
768
|
} | {
|
|
644
|
-
|
|
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
|
-
|
|
992
|
+
underlying_mints?: string[];
|
|
993
|
+
quote_mints?: string[];
|
|
886
994
|
};
|
|
887
995
|
export type IndicativePricesRequestMessage = {
|
|
888
996
|
request_id: RequestId;
|