@@ -13,28 +13,6 @@ export type SubscriptionRequest = {
1313 network : Network ;
1414} ;
1515
16- export type WebSocketConnection = GetWebSocketsResult [ number ] ;
17-
18- /**
19- * Once the Subscriber acknowledges the subscription request,
20- * it generates a subscrption ID, and the subscription is pending (waiting for the confirmation message).
21- */
22- export type PendingSubscription = SubscriptionRequest & {
23- readonly id : string ;
24- readonly status : 'pending' ;
25- readonly requestId : string ; // Same a the field `id`
26- readonly createdAt : string ; // ISO string
27- } ;
28-
29- // After server confirms the subscription
30- export type ConfirmedSubscription = Omit < PendingSubscription , 'status' > & {
31- readonly status : 'confirmed' ;
32- readonly rpcSubscriptionId : number ; // Server's confirmation ID
33- readonly confirmedAt : string ; // ISO string
34- } ;
35-
36- // Union type for all states
37- export type Subscription = PendingSubscription | ConfirmedSubscription ;
3816export type SubscriptionCallbacks = {
3917 /**
4018 * A callback that will be called when a notification is received.
@@ -76,3 +54,26 @@ export type SubscriptionCallbacks = {
7654 */
7755 onConnectionRecovery ?: ( ) => Promise < void > ;
7856} ;
57+
58+ export type WebSocketConnection = GetWebSocketsResult [ number ] ;
59+
60+ /**
61+ * Once the Subscriber acknowledges the subscription request,
62+ * it generates a subscrption ID, and the subscription is pending (waiting for the confirmation message).
63+ */
64+ export type PendingSubscription = SubscriptionRequest & {
65+ readonly id : string ;
66+ readonly status : 'pending' ;
67+ readonly requestId : string ; // Same a the field `id`
68+ readonly createdAt : string ; // ISO string
69+ } ;
70+
71+ // After server confirms the subscription
72+ export type ConfirmedSubscription = Omit < PendingSubscription , 'status' > & {
73+ readonly status : 'confirmed' ;
74+ readonly rpcSubscriptionId : number ; // Server's confirmation ID
75+ readonly confirmedAt : string ; // ISO string
76+ } ;
77+
78+ // Union type for all states
79+ export type Subscription = PendingSubscription | ConfirmedSubscription ;
0 commit comments