@@ -157,9 +157,11 @@ export class WebSocketChannel {
157
157
/**
158
158
* Assign implementation to this method to listen unsubscription
159
159
*/
160
- public onUnsubscribe : ( this : WebSocketChannel , _subscriptionId : number ) => any = ( ) => { } ;
160
+ public onUnsubscribe : ( this : WebSocketChannel , _subscriptionId : SUBSCRIPTION_ID ) => any =
161
+ ( ) => { } ;
161
162
162
- private onUnsubscribeLocal : ( this : WebSocketChannel , _subscriptionId : number ) => any = ( ) => { } ;
163
+ private onUnsubscribeLocal : ( this : WebSocketChannel , _subscriptionId : SUBSCRIPTION_ID ) => any =
164
+ ( ) => { } ;
163
165
164
166
/**
165
167
* JSON RPC latest sent message id
@@ -171,7 +173,7 @@ export class WebSocketChannel {
171
173
* subscriptions ids
172
174
* mapped by keys WSSubscriptions
173
175
*/
174
- readonly subscriptions : Map < string , number > = new Map ( ) ;
176
+ readonly subscriptions : Map < string , SUBSCRIPTION_ID > = new Map ( ) ;
175
177
176
178
/**
177
179
* Construct class and event listeners
@@ -323,7 +325,7 @@ export class WebSocketChannel {
323
325
* @param subscriptionId
324
326
* @param ref internal usage, only for managed subscriptions
325
327
*/
326
- public async unsubscribe ( subscriptionId : number , ref ?: string ) {
328
+ public async unsubscribe ( subscriptionId : SUBSCRIPTION_ID , ref ?: string ) {
327
329
const status = ( await this . sendReceive ( 'starknet_unsubscribe' , {
328
330
subscription_id : subscriptionId ,
329
331
} ) ) as boolean ;
@@ -346,7 +348,7 @@ export class WebSocketChannel {
346
348
* const subscriptionId = await webSocketChannel.waitForUnsubscription();
347
349
* ```
348
350
*/
349
- public async waitForUnsubscription ( forSubscriptionId ?: number ) {
351
+ public async waitForUnsubscription ( forSubscriptionId ?: SUBSCRIPTION_ID ) {
350
352
// unsubscribe
351
353
return new Promise ( ( resolve , reject ) => {
352
354
if ( ! this . websocket ) return ;
0 commit comments