@drift-labs/sdk 2.131.0-beta.1 → 2.131.0-beta.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.131.0-beta.1
1
+ 2.131.0-beta.2
@@ -9,7 +9,6 @@ export declare class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber
9
9
  private stream;
10
10
  private commitmentLevel;
11
11
  listenerId?: number;
12
- private enableReconnect;
13
12
  private constructor();
14
13
  static create<U>(grpcConfigs: GrpcConfigs, accountName: string, program: Program, accountPublicKey: PublicKey, decodeBuffer?: (buffer: Buffer) => U, resubOpts?: ResubOpts): Promise<grpcAccountSubscriber<U>>;
15
14
  subscribe(onChange: (data: T) => void): Promise<void>;
@@ -29,11 +29,10 @@ const Buffer = __importStar(require("buffer"));
29
29
  const webSocketAccountSubscriber_1 = require("./webSocketAccountSubscriber");
30
30
  const grpc_1 = require("../isomorphic/grpc");
31
31
  class grpcAccountSubscriber extends webSocketAccountSubscriber_1.WebSocketAccountSubscriber {
32
- constructor(client, commitmentLevel, accountName, program, accountPublicKey, decodeBuffer, resubOpts, enableReconnect = false) {
32
+ constructor(client, commitmentLevel, accountName, program, accountPublicKey, decodeBuffer, resubOpts) {
33
33
  super(accountName, program, accountPublicKey, decodeBuffer, resubOpts);
34
34
  this.client = client;
35
35
  this.commitmentLevel = commitmentLevel;
36
- this.enableReconnect = enableReconnect;
37
36
  }
38
37
  static async create(grpcConfigs, accountName, program, accountPublicKey, decodeBuffer, resubOpts) {
39
38
  var _a, _b;
@@ -41,7 +40,7 @@ class grpcAccountSubscriber extends webSocketAccountSubscriber_1.WebSocketAccoun
41
40
  const commitmentLevel =
42
41
  // @ts-ignore :: isomorphic exported enum fails typescript but will work at runtime
43
42
  (_b = grpcConfigs.commitmentLevel) !== null && _b !== void 0 ? _b : CommitmentLevel.CONFIRMED;
44
- return new grpcAccountSubscriber(client, commitmentLevel, accountName, program, accountPublicKey, decodeBuffer, resubOpts, grpcConfigs.enableReconnect);
43
+ return new grpcAccountSubscriber(client, commitmentLevel, accountName, program, accountPublicKey, decodeBuffer, resubOpts);
45
44
  }
46
45
  async subscribe(onChange) {
47
46
  if (this.listenerId != null || this.isUnsubscribing) {
@@ -71,19 +70,6 @@ class grpcAccountSubscriber extends webSocketAccountSubscriber_1.WebSocketAccoun
71
70
  entry: {},
72
71
  transactionsStatus: {},
73
72
  };
74
- if (this.enableReconnect) {
75
- this.stream.on('error', (error) => {
76
- // @ts-ignore
77
- if (error.code === 1) {
78
- // expected: 1 CANCELLED: Cancelled on client
79
- console.error('GRPC (grpcAccountSubscriber) Cancelled on client caught:', error);
80
- return;
81
- }
82
- else {
83
- console.error('GRPC (grpcAccountSubscriber) unexpected error caught:', error);
84
- }
85
- });
86
- }
87
73
  this.stream.on('data', (chunk) => {
88
74
  var _a;
89
75
  if (!chunk.account) {
@@ -160,8 +146,6 @@ class grpcAccountSubscriber extends webSocketAccountSubscriber_1.WebSocketAccoun
160
146
  reject(err);
161
147
  }
162
148
  });
163
- this.stream.cancel();
164
- this.stream.destroy();
165
149
  }).catch((reason) => {
166
150
  console.error(reason);
167
151
  throw reason;
@@ -9,7 +9,6 @@ export declare class grpcProgramAccountSubscriber<T> extends WebSocketProgramAcc
9
9
  private stream;
10
10
  private commitmentLevel;
11
11
  listenerId?: number;
12
- private enableReconnect;
13
12
  private constructor();
14
13
  static create<U>(grpcConfigs: GrpcConfigs, subscriptionName: string, accountDiscriminator: string, program: Program, decodeBufferFn: (accountName: string, ix: Buffer) => U, options?: {
15
14
  filters: MemcmpFilter[];
@@ -35,11 +35,10 @@ const grpc_1 = require("../isomorphic/grpc");
35
35
  class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber {
36
36
  constructor(client, commitmentLevel, subscriptionName, accountDiscriminator, program, decodeBufferFn, options = {
37
37
  filters: [],
38
- }, resubOpts, enableReconnect = false) {
38
+ }, resubOpts) {
39
39
  super(subscriptionName, accountDiscriminator, program, decodeBufferFn, options, resubOpts);
40
40
  this.client = client;
41
41
  this.commitmentLevel = commitmentLevel;
42
- this.enableReconnect = enableReconnect;
43
42
  }
44
43
  static async create(grpcConfigs, subscriptionName, accountDiscriminator, program, decodeBufferFn, options = {
45
44
  filters: [],
@@ -49,7 +48,7 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
49
48
  const commitmentLevel =
50
49
  // @ts-ignore :: isomorphic exported enum fails typescript but will work at runtime
51
50
  (_b = grpcConfigs.commitmentLevel) !== null && _b !== void 0 ? _b : CommitmentLevel.CONFIRMED;
52
- return new grpcProgramAccountSubscriber(client, commitmentLevel, subscriptionName, accountDiscriminator, program, decodeBufferFn, options, resubOpts, grpcConfigs.enableReconnect);
51
+ return new grpcProgramAccountSubscriber(client, commitmentLevel, subscriptionName, accountDiscriminator, program, decodeBufferFn, options, resubOpts);
53
52
  }
54
53
  async subscribe(onChange) {
55
54
  if (this.listenerId != null || this.isUnsubscribing) {
@@ -84,19 +83,6 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
84
83
  entry: {},
85
84
  transactionsStatus: {},
86
85
  };
87
- if (this.enableReconnect) {
88
- this.stream.on('error', (error) => {
89
- // @ts-ignore
90
- if (error.code === 1) {
91
- // expected: 1 CANCELLED: Cancelled on client
92
- console.error('GRPC (grpcProgramAccountSubscriber) Cancelled on client caught:', error);
93
- return;
94
- }
95
- else {
96
- console.error('GRPC (grpcProgramAccountSubscriber) unexpected error caught:', error);
97
- }
98
- });
99
- }
100
86
  this.stream.on('data', (chunk) => {
101
87
  var _a;
102
88
  if (!chunk.account) {
@@ -179,8 +165,6 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
179
165
  reject(err);
180
166
  }
181
167
  });
182
- this.stream.cancel();
183
- this.stream.destroy();
184
168
  }).catch((reason) => {
185
169
  console.error(reason);
186
170
  throw reason;
@@ -9,7 +9,6 @@ export declare class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber
9
9
  private stream;
10
10
  private commitmentLevel;
11
11
  listenerId?: number;
12
- private enableReconnect;
13
12
  private constructor();
14
13
  static create<U>(grpcConfigs: GrpcConfigs, accountName: string, program: Program, accountPublicKey: PublicKey, decodeBuffer?: (buffer: Buffer) => U, resubOpts?: ResubOpts): Promise<grpcAccountSubscriber<U>>;
15
14
  subscribe(onChange: (data: T) => void): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"grpcAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcAccountSubscriber.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAU1E,qBAAa,qBAAqB,CAAC,CAAC,CAAE,SAAQ,0BAA0B,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAwD;IACtE,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,eAAe,CAAU;IAEjC,OAAO;WAgBa,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,SAAS,EAC3B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,EACpC,SAAS,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAsBrB,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAsGrD,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAwC1D"}
1
+ {"version":3,"file":"grpcAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcAccountSubscriber.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAU1E,qBAAa,qBAAqB,CAAC,CAAC,CAAE,SAAQ,0BAA0B,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAwD;IACtE,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO;WAca,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,SAAS,EAC3B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,EACpC,SAAS,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAqBrB,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkFrD,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsC1D"}
@@ -29,11 +29,10 @@ const Buffer = __importStar(require("buffer"));
29
29
  const webSocketAccountSubscriber_1 = require("./webSocketAccountSubscriber");
30
30
  const grpc_1 = require("../isomorphic/grpc");
31
31
  class grpcAccountSubscriber extends webSocketAccountSubscriber_1.WebSocketAccountSubscriber {
32
- constructor(client, commitmentLevel, accountName, program, accountPublicKey, decodeBuffer, resubOpts, enableReconnect = false) {
32
+ constructor(client, commitmentLevel, accountName, program, accountPublicKey, decodeBuffer, resubOpts) {
33
33
  super(accountName, program, accountPublicKey, decodeBuffer, resubOpts);
34
34
  this.client = client;
35
35
  this.commitmentLevel = commitmentLevel;
36
- this.enableReconnect = enableReconnect;
37
36
  }
38
37
  static async create(grpcConfigs, accountName, program, accountPublicKey, decodeBuffer, resubOpts) {
39
38
  var _a, _b;
@@ -41,7 +40,7 @@ class grpcAccountSubscriber extends webSocketAccountSubscriber_1.WebSocketAccoun
41
40
  const commitmentLevel =
42
41
  // @ts-ignore :: isomorphic exported enum fails typescript but will work at runtime
43
42
  (_b = grpcConfigs.commitmentLevel) !== null && _b !== void 0 ? _b : CommitmentLevel.CONFIRMED;
44
- return new grpcAccountSubscriber(client, commitmentLevel, accountName, program, accountPublicKey, decodeBuffer, resubOpts, grpcConfigs.enableReconnect);
43
+ return new grpcAccountSubscriber(client, commitmentLevel, accountName, program, accountPublicKey, decodeBuffer, resubOpts);
45
44
  }
46
45
  async subscribe(onChange) {
47
46
  if (this.listenerId != null || this.isUnsubscribing) {
@@ -71,19 +70,6 @@ class grpcAccountSubscriber extends webSocketAccountSubscriber_1.WebSocketAccoun
71
70
  entry: {},
72
71
  transactionsStatus: {},
73
72
  };
74
- if (this.enableReconnect) {
75
- this.stream.on('error', (error) => {
76
- // @ts-ignore
77
- if (error.code === 1) {
78
- // expected: 1 CANCELLED: Cancelled on client
79
- console.error('GRPC (grpcAccountSubscriber) Cancelled on client caught:', error);
80
- return;
81
- }
82
- else {
83
- console.error('GRPC (grpcAccountSubscriber) unexpected error caught:', error);
84
- }
85
- });
86
- }
87
73
  this.stream.on('data', (chunk) => {
88
74
  var _a;
89
75
  if (!chunk.account) {
@@ -160,8 +146,6 @@ class grpcAccountSubscriber extends webSocketAccountSubscriber_1.WebSocketAccoun
160
146
  reject(err);
161
147
  }
162
148
  });
163
- this.stream.cancel();
164
- this.stream.destroy();
165
149
  }).catch((reason) => {
166
150
  console.error(reason);
167
151
  throw reason;
@@ -9,7 +9,6 @@ export declare class grpcProgramAccountSubscriber<T> extends WebSocketProgramAcc
9
9
  private stream;
10
10
  private commitmentLevel;
11
11
  listenerId?: number;
12
- private enableReconnect;
13
12
  private constructor();
14
13
  static create<U>(grpcConfigs: GrpcConfigs, subscriptionName: string, accountDiscriminator: string, program: Program, decodeBufferFn: (accountName: string, ix: Buffer) => U, options?: {
15
14
  filters: MemcmpFilter[];
@@ -1 +1 @@
1
- {"version":3,"file":"grpcProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcProgramAccountSubscriber.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAUxF,qBAAa,4BAA4B,CACxC,CAAC,CACA,SAAQ,iCAAiC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAwD;IACtE,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,eAAe,CAAU;IAEjC,OAAO;WA0Ba,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,CAAC,EACtD,OAAO,GAAE;QAAE,OAAO,EAAE,YAAY,EAAE,CAAA;KAEjC,EACD,SAAS,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;IAuBrC,SAAS,CACd,QAAQ,EAAE,CACT,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,KACV,IAAI,GACP,OAAO,CAAC,IAAI,CAAC;IAiHH,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAwCxD"}
1
+ {"version":3,"file":"grpcProgramAccountSubscriber.d.ts","sourceRoot":"","sources":["../../../src/accounts/grpcProgramAccountSubscriber.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAUxF,qBAAa,4BAA4B,CACxC,CAAC,CACA,SAAQ,iCAAiC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAwD;IACtE,OAAO,CAAC,eAAe,CAAkB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE3B,OAAO;WAwBa,MAAM,CAAC,CAAC,EAC3B,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,CAAC,EACtD,OAAO,GAAE;QAAE,OAAO,EAAE,YAAY,EAAE,CAAA;KAEjC,EACD,SAAS,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;IAsBrC,SAAS,CACd,QAAQ,EAAE,CACT,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,KACV,IAAI,GACP,OAAO,CAAC,IAAI,CAAC;IA6FH,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCxD"}
@@ -35,11 +35,10 @@ const grpc_1 = require("../isomorphic/grpc");
35
35
  class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber {
36
36
  constructor(client, commitmentLevel, subscriptionName, accountDiscriminator, program, decodeBufferFn, options = {
37
37
  filters: [],
38
- }, resubOpts, enableReconnect = false) {
38
+ }, resubOpts) {
39
39
  super(subscriptionName, accountDiscriminator, program, decodeBufferFn, options, resubOpts);
40
40
  this.client = client;
41
41
  this.commitmentLevel = commitmentLevel;
42
- this.enableReconnect = enableReconnect;
43
42
  }
44
43
  static async create(grpcConfigs, subscriptionName, accountDiscriminator, program, decodeBufferFn, options = {
45
44
  filters: [],
@@ -49,7 +48,7 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
49
48
  const commitmentLevel =
50
49
  // @ts-ignore :: isomorphic exported enum fails typescript but will work at runtime
51
50
  (_b = grpcConfigs.commitmentLevel) !== null && _b !== void 0 ? _b : CommitmentLevel.CONFIRMED;
52
- return new grpcProgramAccountSubscriber(client, commitmentLevel, subscriptionName, accountDiscriminator, program, decodeBufferFn, options, resubOpts, grpcConfigs.enableReconnect);
51
+ return new grpcProgramAccountSubscriber(client, commitmentLevel, subscriptionName, accountDiscriminator, program, decodeBufferFn, options, resubOpts);
53
52
  }
54
53
  async subscribe(onChange) {
55
54
  if (this.listenerId != null || this.isUnsubscribing) {
@@ -84,19 +83,6 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
84
83
  entry: {},
85
84
  transactionsStatus: {},
86
85
  };
87
- if (this.enableReconnect) {
88
- this.stream.on('error', (error) => {
89
- // @ts-ignore
90
- if (error.code === 1) {
91
- // expected: 1 CANCELLED: Cancelled on client
92
- console.error('GRPC (grpcProgramAccountSubscriber) Cancelled on client caught:', error);
93
- return;
94
- }
95
- else {
96
- console.error('GRPC (grpcProgramAccountSubscriber) unexpected error caught:', error);
97
- }
98
- });
99
- }
100
86
  this.stream.on('data', (chunk) => {
101
87
  var _a;
102
88
  if (!chunk.account) {
@@ -179,8 +165,6 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
179
165
  reject(err);
180
166
  }
181
167
  });
182
- this.stream.cancel();
183
- this.stream.destroy();
184
168
  }).catch((reason) => {
185
169
  console.error(reason);
186
170
  throw reason;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.131.0-beta.1",
3
+ "version": "2.131.0-beta.2",
4
4
  "main": "lib/node/index.js",
5
5
  "types": "lib/node/index.d.ts",
6
6
  "browser": "./lib/browser/index.js",
@@ -18,7 +18,6 @@ export class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber<T> {
18
18
  private stream: ClientDuplexStream<SubscribeRequest, SubscribeUpdate>;
19
19
  private commitmentLevel: CommitmentLevel;
20
20
  public listenerId?: number;
21
- private enableReconnect: boolean;
22
21
 
23
22
  private constructor(
24
23
  client: Client,
@@ -27,13 +26,11 @@ export class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber<T> {
27
26
  program: Program,
28
27
  accountPublicKey: PublicKey,
29
28
  decodeBuffer?: (buffer: Buffer) => T,
30
- resubOpts?: ResubOpts,
31
- enableReconnect = false
29
+ resubOpts?: ResubOpts
32
30
  ) {
33
31
  super(accountName, program, accountPublicKey, decodeBuffer, resubOpts);
34
32
  this.client = client;
35
33
  this.commitmentLevel = commitmentLevel;
36
- this.enableReconnect = enableReconnect;
37
34
  }
38
35
 
39
36
  public static async create<U>(
@@ -60,8 +57,7 @@ export class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber<T> {
60
57
  program,
61
58
  accountPublicKey,
62
59
  decodeBuffer,
63
- resubOpts,
64
- grpcConfigs.enableReconnect
60
+ resubOpts
65
61
  );
66
62
  }
67
63
 
@@ -95,26 +91,6 @@ export class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber<T> {
95
91
  entry: {},
96
92
  transactionsStatus: {},
97
93
  };
98
-
99
- if (this.enableReconnect) {
100
- this.stream.on('error', (error) => {
101
- // @ts-ignore
102
- if (error.code === 1) {
103
- // expected: 1 CANCELLED: Cancelled on client
104
- console.error(
105
- 'GRPC (grpcAccountSubscriber) Cancelled on client caught:',
106
- error
107
- );
108
- return;
109
- } else {
110
- console.error(
111
- 'GRPC (grpcAccountSubscriber) unexpected error caught:',
112
- error
113
- );
114
- }
115
- });
116
- }
117
-
118
94
  this.stream.on('data', (chunk: SubscribeUpdate) => {
119
95
  if (!chunk.account) {
120
96
  return;
@@ -196,8 +172,6 @@ export class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber<T> {
196
172
  reject(err);
197
173
  }
198
174
  });
199
- this.stream.cancel();
200
- this.stream.destroy();
201
175
  }).catch((reason) => {
202
176
  console.error(reason);
203
177
  throw reason;
@@ -20,7 +20,6 @@ export class grpcProgramAccountSubscriber<
20
20
  private stream: ClientDuplexStream<SubscribeRequest, SubscribeUpdate>;
21
21
  private commitmentLevel: CommitmentLevel;
22
22
  public listenerId?: number;
23
- private enableReconnect: boolean;
24
23
 
25
24
  private constructor(
26
25
  client: Client,
@@ -32,8 +31,7 @@ export class grpcProgramAccountSubscriber<
32
31
  options: { filters: MemcmpFilter[] } = {
33
32
  filters: [],
34
33
  },
35
- resubOpts?: ResubOpts,
36
- enableReconnect = false
34
+ resubOpts?: ResubOpts
37
35
  ) {
38
36
  super(
39
37
  subscriptionName,
@@ -45,7 +43,6 @@ export class grpcProgramAccountSubscriber<
45
43
  );
46
44
  this.client = client;
47
45
  this.commitmentLevel = commitmentLevel;
48
- this.enableReconnect = enableReconnect;
49
46
  }
50
47
 
51
48
  public static async create<U>(
@@ -76,8 +73,7 @@ export class grpcProgramAccountSubscriber<
76
73
  program,
77
74
  decodeBufferFn,
78
75
  options,
79
- resubOpts,
80
- grpcConfigs.enableReconnect
76
+ resubOpts
81
77
  );
82
78
  }
83
79
 
@@ -123,26 +119,6 @@ export class grpcProgramAccountSubscriber<
123
119
  entry: {},
124
120
  transactionsStatus: {},
125
121
  };
126
-
127
- if (this.enableReconnect) {
128
- this.stream.on('error', (error) => {
129
- // @ts-ignore
130
- if (error.code === 1) {
131
- // expected: 1 CANCELLED: Cancelled on client
132
- console.error(
133
- 'GRPC (grpcProgramAccountSubscriber) Cancelled on client caught:',
134
- error
135
- );
136
- return;
137
- } else {
138
- console.error(
139
- 'GRPC (grpcProgramAccountSubscriber) unexpected error caught:',
140
- error
141
- );
142
- }
143
- });
144
- }
145
-
146
122
  this.stream.on('data', (chunk: SubscribeUpdate) => {
147
123
  if (!chunk.account) {
148
124
  return;
@@ -230,8 +206,6 @@ export class grpcProgramAccountSubscriber<
230
206
  reject(err);
231
207
  }
232
208
  });
233
- this.stream.cancel();
234
- this.stream.destroy();
235
209
  }).catch((reason) => {
236
210
  console.error(reason);
237
211
  throw reason;