Skip to content

Commit 6e9e2a5

Browse files
authored
Merge pull request #2099 from drift-labs/jack/fix-yellowstream-grpc-client
fix: error with filters
2 parents 6530d82 + 758075c commit 6e9e2a5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sdk/src/accounts/grpcProgramAccountSubscriber.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as Buffer from 'buffer';
55
import { WebSocketProgramAccountSubscriber } from './webSocketProgramAccountSubscriber';
66
import {
77
Client,
8-
ClientDuplexStream,
98
CommitmentLevel,
109
createClient,
1110
SubscribeRequest,
@@ -16,7 +15,7 @@ export class grpcProgramAccountSubscriber<
1615
T,
1716
> extends WebSocketProgramAccountSubscriber<T> {
1817
private client: Client;
19-
private stream: ClientDuplexStream<SubscribeRequest, SubscribeUpdate>;
18+
private stream: Awaited<ReturnType<Client['subscribe']>>;
2019
private commitmentLevel: CommitmentLevel;
2120
public listenerId?: number;
2221

@@ -91,19 +90,18 @@ export class grpcProgramAccountSubscriber<
9190
this.onChange = onChange;
9291

9392
// Subscribe with grpc
94-
this.stream =
95-
(await this.client.subscribe()) as unknown as typeof this.stream;
93+
this.stream = await this.client.subscribe();
9694

9795
const filters = this.options.filters.map((filter) => {
9896
return {
9997
memcmp: {
100-
offset: filter.memcmp.offset.toString(),
98+
offset: filter.memcmp.offset,
10199
base58: filter.memcmp.bytes,
102100
},
103101
};
104102
});
105103

106-
const request: SubscribeRequest = {
104+
const request = {
107105
slots: {},
108106
accounts: {
109107
drift: {
@@ -120,6 +118,7 @@ export class grpcProgramAccountSubscriber<
120118
entry: {},
121119
transactionsStatus: {},
122120
};
121+
123122
this.stream.on('data', (chunk: SubscribeUpdate) => {
124123
if (!chunk.account) {
125124
return;

0 commit comments

Comments
 (0)