@acta-markets/ts-sdk 0.0.21-beta → 0.0.23-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/chain/instructions.position.d.ts +1 -0
- package/dist/chain/instructions.position.js +1 -0
- package/dist/cjs/chain/instructions.position.js +1 -0
- package/dist/cjs/generated/errors/actaContract.js +4 -1
- package/dist/cjs/generated/instructions/settlePosition.js +11 -3
- package/dist/cjs/idl/acta_contract.json +11 -1
- package/dist/cjs/idl/hash.js +1 -1
- package/dist/cjs/ws/auth.js +14 -11
- package/dist/cjs/ws/client.js +100 -1
- package/dist/cjs/ws/client.test.js +1 -1
- package/dist/cjs/ws/flows.js +20 -0
- 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/generated/instructions/settlePosition.d.ts +5 -1
- package/dist/generated/instructions/settlePosition.js +11 -3
- package/dist/idl/acta_contract.json +11 -1
- 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 +40 -1
- package/dist/ws/client.js +101 -2
- package/dist/ws/client.test.js +1 -1
- package/dist/ws/flows.d.ts +13 -1
- package/dist/ws/flows.js +19 -0
- 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 +142 -48
- 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;
|
|
@@ -79,6 +80,12 @@ export type ClientMessage = {
|
|
|
79
80
|
} | {
|
|
80
81
|
type: "Quote";
|
|
81
82
|
data: QuoteMessage;
|
|
83
|
+
} | {
|
|
84
|
+
type: "ReplaceQuote";
|
|
85
|
+
data: ReplaceQuoteMessage;
|
|
86
|
+
} | {
|
|
87
|
+
type: "BatchQuotes";
|
|
88
|
+
data: BatchQuotesMessage;
|
|
82
89
|
} | {
|
|
83
90
|
type: "CancelQuote";
|
|
84
91
|
data: {
|
|
@@ -208,6 +215,40 @@ export type ClientMessage = {
|
|
|
208
215
|
request_id: RequestId;
|
|
209
216
|
channels: WsChannel[];
|
|
210
217
|
};
|
|
218
|
+
} | {
|
|
219
|
+
type: "RedeemInvite";
|
|
220
|
+
data: {
|
|
221
|
+
request_id: RequestId;
|
|
222
|
+
code: string;
|
|
223
|
+
};
|
|
224
|
+
} | {
|
|
225
|
+
type: "ClaimReferralCode";
|
|
226
|
+
data: {
|
|
227
|
+
request_id: RequestId;
|
|
228
|
+
code: string;
|
|
229
|
+
};
|
|
230
|
+
} | {
|
|
231
|
+
type: "GetMyReferralInfo";
|
|
232
|
+
data: {
|
|
233
|
+
request_id: RequestId;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
export type InviteRedeemedData = {
|
|
237
|
+
request_id: RequestId;
|
|
238
|
+
referral_code: string;
|
|
239
|
+
};
|
|
240
|
+
export type ReferralCodeClaimedData = {
|
|
241
|
+
request_id: RequestId;
|
|
242
|
+
referral_code: string;
|
|
243
|
+
};
|
|
244
|
+
export type MyReferralInfoData = {
|
|
245
|
+
request_id: RequestId;
|
|
246
|
+
referral_code: string;
|
|
247
|
+
status: TakerStatus;
|
|
248
|
+
total_invited: number;
|
|
249
|
+
invited_this_period: number;
|
|
250
|
+
max_invites_per_period: number;
|
|
251
|
+
next_slot_frees_in_seconds: number;
|
|
211
252
|
};
|
|
212
253
|
export type GetMarketDescriptorsMessage = {
|
|
213
254
|
request_id: RequestId;
|
|
@@ -287,6 +328,22 @@ export type QuoteMessage = {
|
|
|
287
328
|
order_id: OrderIdHex32;
|
|
288
329
|
signature: string;
|
|
289
330
|
};
|
|
331
|
+
export type ReplaceQuoteMessage = {
|
|
332
|
+
/** orderId of the quote being replaced (64-char hex). */
|
|
333
|
+
old_order_id: OrderIdHex32;
|
|
334
|
+
rfq_id: UuidString;
|
|
335
|
+
strike: WsU64;
|
|
336
|
+
price: WsU64;
|
|
337
|
+
valid_until: WsU64;
|
|
338
|
+
nonce: WsU64;
|
|
339
|
+
/** New 32-byte orderId (sha256) encoded as hex (64 chars). */
|
|
340
|
+
order_id: OrderIdHex32;
|
|
341
|
+
/** base58 ed25519 signature over the NEW `order_id`. */
|
|
342
|
+
signature: string;
|
|
343
|
+
};
|
|
344
|
+
export type BatchQuotesMessage = {
|
|
345
|
+
quotes: QuoteMessage[];
|
|
346
|
+
};
|
|
290
347
|
export type MarketDescriptor = {
|
|
291
348
|
chain_id: WsU64;
|
|
292
349
|
program_id: Address<string>;
|
|
@@ -538,6 +595,17 @@ export type ServerMessage = {
|
|
|
538
595
|
underlying_mints?: string[];
|
|
539
596
|
quote_mints?: string[];
|
|
540
597
|
};
|
|
598
|
+
} | {
|
|
599
|
+
type: "RequireInvite";
|
|
600
|
+
} | {
|
|
601
|
+
type: "InviteRedeemed";
|
|
602
|
+
data: InviteRedeemedData;
|
|
603
|
+
} | {
|
|
604
|
+
type: "ReferralCodeClaimed";
|
|
605
|
+
data: ReferralCodeClaimedData;
|
|
606
|
+
} | {
|
|
607
|
+
type: "MyReferralInfo";
|
|
608
|
+
data: MyReferralInfoData;
|
|
541
609
|
};
|
|
542
610
|
export type MarketDescriptorInfo = {
|
|
543
611
|
market: MarketDescriptor;
|
|
@@ -577,128 +645,154 @@ export type QuoteRefreshRequestedMessage = {
|
|
|
577
645
|
reason: QuoteRefreshReason;
|
|
578
646
|
};
|
|
579
647
|
export type ServerError = {
|
|
580
|
-
type: "
|
|
648
|
+
type: "Unauthenticated";
|
|
581
649
|
data: {
|
|
582
650
|
action: AuthRequiredAction;
|
|
583
651
|
};
|
|
584
652
|
} | {
|
|
585
|
-
type: "
|
|
653
|
+
type: "Unauthorized";
|
|
586
654
|
data: {
|
|
587
655
|
role: UserRole;
|
|
588
656
|
action: AuthRequiredAction;
|
|
589
657
|
};
|
|
590
658
|
} | {
|
|
591
|
-
type: "
|
|
659
|
+
type: "RfqNotFound";
|
|
592
660
|
} | {
|
|
593
|
-
type: "
|
|
661
|
+
type: "RfqNotActive";
|
|
594
662
|
} | {
|
|
595
|
-
type: "
|
|
663
|
+
type: "RfqAlreadyLocked";
|
|
664
|
+
} | {
|
|
665
|
+
type: "InvalidState";
|
|
596
666
|
data: {
|
|
597
667
|
state: RfqStateError;
|
|
598
668
|
};
|
|
599
669
|
} | {
|
|
600
|
-
type: "
|
|
670
|
+
type: "QuoteLocked";
|
|
601
671
|
data: {
|
|
602
672
|
reason: QuoteLockedReason;
|
|
603
673
|
};
|
|
604
674
|
} | {
|
|
605
|
-
type: "
|
|
675
|
+
type: "QuoteNotFound";
|
|
676
|
+
} | {
|
|
677
|
+
type: "QuoteExpired";
|
|
678
|
+
} | {
|
|
679
|
+
type: "QuoteExpiryTooShort";
|
|
680
|
+
data: {
|
|
681
|
+
min_seconds: WsU32;
|
|
682
|
+
};
|
|
606
683
|
} | {
|
|
607
|
-
type: "
|
|
684
|
+
type: "InvalidStrike";
|
|
608
685
|
} | {
|
|
609
|
-
type: "
|
|
686
|
+
type: "InvalidValidUntil";
|
|
610
687
|
} | {
|
|
611
|
-
type: "
|
|
688
|
+
type: "OrderIdMismatch";
|
|
612
689
|
} | {
|
|
613
|
-
type: "
|
|
690
|
+
type: "UnknownOrder";
|
|
614
691
|
} | {
|
|
615
|
-
type: "
|
|
692
|
+
type: "SignatureTimeout";
|
|
616
693
|
} | {
|
|
617
|
-
type: "
|
|
694
|
+
type: "OracleNotReady";
|
|
618
695
|
} | {
|
|
619
|
-
type: "
|
|
696
|
+
type: "OraclePriceStale";
|
|
620
697
|
data: {
|
|
621
698
|
age_seconds: WsU64;
|
|
622
699
|
};
|
|
623
700
|
} | {
|
|
624
|
-
type: "
|
|
701
|
+
type: "OraclePriceNotReady";
|
|
625
702
|
} | {
|
|
626
|
-
type: "
|
|
703
|
+
type: "InvalidPositionType";
|
|
627
704
|
} | {
|
|
628
|
-
type: "
|
|
705
|
+
type: "InvalidMarket";
|
|
629
706
|
data: {
|
|
630
707
|
pubkey: string;
|
|
631
708
|
};
|
|
632
709
|
} | {
|
|
633
|
-
type: "
|
|
710
|
+
type: "MarketMetadataIncomplete";
|
|
634
711
|
data: {
|
|
635
712
|
details: string;
|
|
636
713
|
};
|
|
637
714
|
} | {
|
|
638
|
-
type: "
|
|
715
|
+
type: "TokenMetadataIncomplete";
|
|
639
716
|
data: {
|
|
640
717
|
details: string;
|
|
641
718
|
};
|
|
642
719
|
} | {
|
|
643
|
-
type: "
|
|
720
|
+
type: "RateLimit";
|
|
644
721
|
data: RateLimitReason;
|
|
645
722
|
} | {
|
|
646
|
-
type: "
|
|
723
|
+
type: "Cap";
|
|
724
|
+
data: CapErrorData;
|
|
725
|
+
} | {
|
|
726
|
+
type: "InternalError";
|
|
727
|
+
} | {
|
|
728
|
+
type: "KernelNotAvailable";
|
|
729
|
+
} | {
|
|
730
|
+
type: "DbDisabled";
|
|
731
|
+
data: {
|
|
732
|
+
feature: DbFeature;
|
|
733
|
+
};
|
|
734
|
+
} | {
|
|
735
|
+
type: "ServerShuttingDown";
|
|
736
|
+
} | {
|
|
737
|
+
type: "Generic";
|
|
738
|
+
data: {
|
|
739
|
+
code: ErrorCode;
|
|
740
|
+
message: ErrorMessage;
|
|
741
|
+
};
|
|
742
|
+
} | {
|
|
743
|
+
type: "InviteRequired";
|
|
744
|
+
} | {
|
|
745
|
+
type: "Invite";
|
|
746
|
+
data: InviteErrorReason;
|
|
747
|
+
} | {
|
|
748
|
+
type: "Claim";
|
|
749
|
+
data: ClaimErrorReason;
|
|
750
|
+
} | {
|
|
751
|
+
type: "generic";
|
|
647
752
|
data: {
|
|
753
|
+
code: ErrorCode;
|
|
754
|
+
message: ErrorMessage;
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
* Externally-tagged union for rust's `CapError`. Only one key is
|
|
759
|
+
* present at a time. Lock-step with
|
|
760
|
+
* `rust-backend/acta-types/src/errors.rs::CapError`.
|
|
761
|
+
*/
|
|
762
|
+
export type CapErrorData = {
|
|
763
|
+
token_oi_cap_exceeded: {
|
|
648
764
|
underlying_mint: string;
|
|
649
765
|
current: WsU64;
|
|
650
766
|
limit: WsU64;
|
|
651
767
|
};
|
|
652
768
|
} | {
|
|
653
|
-
|
|
654
|
-
data: {
|
|
769
|
+
market_oi_cap_exceeded: {
|
|
655
770
|
market_id: string;
|
|
656
771
|
current: WsU64;
|
|
657
772
|
limit: WsU64;
|
|
658
773
|
};
|
|
659
774
|
} | {
|
|
660
|
-
|
|
661
|
-
data: {
|
|
775
|
+
maker_position_cap_exceeded: {
|
|
662
776
|
current: WsU32;
|
|
663
777
|
limit: WsU32;
|
|
664
778
|
};
|
|
665
779
|
} | {
|
|
666
|
-
|
|
667
|
-
data: {
|
|
780
|
+
maker_notional_cap_exceeded: {
|
|
668
781
|
underlying_mint: string;
|
|
669
782
|
current: WsU64;
|
|
670
783
|
limit: WsU64;
|
|
671
784
|
};
|
|
672
785
|
} | {
|
|
673
|
-
|
|
674
|
-
data: {
|
|
786
|
+
maker_insufficient_balance: {
|
|
675
787
|
available: WsU64;
|
|
676
788
|
required: WsU64;
|
|
677
789
|
};
|
|
678
790
|
} | {
|
|
679
|
-
|
|
680
|
-
data: {
|
|
791
|
+
quote_notional_cap_exceeded: {
|
|
681
792
|
quote_mint: string;
|
|
682
793
|
current: WsU64;
|
|
683
794
|
limit: WsU64;
|
|
684
795
|
};
|
|
685
|
-
} | {
|
|
686
|
-
type: "internal_error";
|
|
687
|
-
} | {
|
|
688
|
-
type: "kernel_not_available";
|
|
689
|
-
} | {
|
|
690
|
-
type: "db_disabled";
|
|
691
|
-
data: {
|
|
692
|
-
feature: DbFeature;
|
|
693
|
-
};
|
|
694
|
-
} | {
|
|
695
|
-
type: "server_shutting_down";
|
|
696
|
-
} | {
|
|
697
|
-
type: "generic";
|
|
698
|
-
data: {
|
|
699
|
-
code: ErrorCode;
|
|
700
|
-
message: ErrorMessage;
|
|
701
|
-
};
|
|
702
796
|
};
|
|
703
797
|
/** Confirms quote was received and validated. */
|
|
704
798
|
export type QuoteAcknowledgedMessage = {
|