Skip to content

Commit aa2746a

Browse files
authored
Merge pull request #1380 from starknet-io/ws-rpc-0.8.1
feat: update to rpc 0.8.1
2 parents ab7aa0a + 83e17b8 commit aa2746a

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

package-lock.json

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@
106106
"isows": "^1.0.6",
107107
"lossless-json": "^4.0.1",
108108
"pako": "^2.0.4",
109-
"starknet-types-07": "npm:@starknet-io/types-js@^0.7.10",
110-
"starknet-types-08": "npm:@starknet-io/[email protected].0-beta.10",
109+
"starknet-types-07": "npm:@starknet-io/types-js@~0.7.10",
110+
"starknet-types-08": "npm:@starknet-io/types-js@~0.8.1",
111111
"ts-mixer": "^6.0.3",
112112
"ws": "^8.18.0"
113113
},

src/channel/ws_0_8.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,11 @@ export class WebSocketChannel {
157157
/**
158158
* Assign implementation to this method to listen unsubscription
159159
*/
160-
public onUnsubscribe: (this: WebSocketChannel, _subscriptionId: number) => any = () => {};
160+
public onUnsubscribe: (this: WebSocketChannel, _subscriptionId: SUBSCRIPTION_ID) => any =
161+
() => {};
161162

162-
private onUnsubscribeLocal: (this: WebSocketChannel, _subscriptionId: number) => any = () => {};
163+
private onUnsubscribeLocal: (this: WebSocketChannel, _subscriptionId: SUBSCRIPTION_ID) => any =
164+
() => {};
163165

164166
/**
165167
* JSON RPC latest sent message id
@@ -171,7 +173,7 @@ export class WebSocketChannel {
171173
* subscriptions ids
172174
* mapped by keys WSSubscriptions
173175
*/
174-
readonly subscriptions: Map<string, number> = new Map();
176+
readonly subscriptions: Map<string, SUBSCRIPTION_ID> = new Map();
175177

176178
/**
177179
* Construct class and event listeners
@@ -323,7 +325,7 @@ export class WebSocketChannel {
323325
* @param subscriptionId
324326
* @param ref internal usage, only for managed subscriptions
325327
*/
326-
public async unsubscribe(subscriptionId: number, ref?: string) {
328+
public async unsubscribe(subscriptionId: SUBSCRIPTION_ID, ref?: string) {
327329
const status = (await this.sendReceive('starknet_unsubscribe', {
328330
subscription_id: subscriptionId,
329331
})) as boolean;
@@ -346,7 +348,7 @@ export class WebSocketChannel {
346348
* const subscriptionId = await webSocketChannel.waitForUnsubscription();
347349
* ```
348350
*/
349-
public async waitForUnsubscription(forSubscriptionId?: number) {
351+
public async waitForUnsubscription(forSubscriptionId?: SUBSCRIPTION_ID) {
350352
// unsubscribe
351353
return new Promise((resolve, reject) => {
352354
if (!this.websocket) return;

0 commit comments

Comments
 (0)