@drift-labs/sdk-browser 2.157.0-beta.3 → 2.157.0-beta.5
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 +1 -1
- package/lib/browser/accounts/grpcProgramAccountSubscriber.js +3 -8
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.js +3 -8
- package/lib/node/isomorphic/grpc.node.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accounts/grpcProgramAccountSubscriber.ts +8 -8
- package/src/isomorphic/grpc.node.ts +3 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.157.0-beta.
|
|
1
|
+
2.157.0-beta.5
|
|
@@ -22,12 +22,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.grpcProgramAccountSubscriber = void 0;
|
|
30
|
-
const bs58_1 = __importDefault(require("bs58"));
|
|
31
27
|
const web3_js_1 = require("@solana/web3.js");
|
|
32
28
|
const Buffer = __importStar(require("buffer"));
|
|
33
29
|
const webSocketProgramAccountSubscriber_1 = require("./webSocketProgramAccountSubscriber");
|
|
@@ -56,13 +52,12 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
|
|
|
56
52
|
}
|
|
57
53
|
this.onChange = onChange;
|
|
58
54
|
// Subscribe with grpc
|
|
59
|
-
this.stream =
|
|
60
|
-
(await this.client.subscribe());
|
|
55
|
+
this.stream = await this.client.subscribe();
|
|
61
56
|
const filters = this.options.filters.map((filter) => {
|
|
62
57
|
return {
|
|
63
58
|
memcmp: {
|
|
64
|
-
offset: filter.memcmp.offset
|
|
65
|
-
|
|
59
|
+
offset: filter.memcmp.offset,
|
|
60
|
+
base58: filter.memcmp.bytes,
|
|
66
61
|
},
|
|
67
62
|
};
|
|
68
63
|
});
|
|
@@ -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;
|
|
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;AAC5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AASxF,qBAAa,4BAA4B,CACxC,CAAC,CACA,SAAQ,iCAAiC,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAA2C;IACzD,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;IA+FH,WAAW,CAAC,OAAO,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCxD"}
|
|
@@ -22,12 +22,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.grpcProgramAccountSubscriber = void 0;
|
|
30
|
-
const bs58_1 = __importDefault(require("bs58"));
|
|
31
27
|
const web3_js_1 = require("@solana/web3.js");
|
|
32
28
|
const Buffer = __importStar(require("buffer"));
|
|
33
29
|
const webSocketProgramAccountSubscriber_1 = require("./webSocketProgramAccountSubscriber");
|
|
@@ -56,13 +52,12 @@ class grpcProgramAccountSubscriber extends webSocketProgramAccountSubscriber_1.W
|
|
|
56
52
|
}
|
|
57
53
|
this.onChange = onChange;
|
|
58
54
|
// Subscribe with grpc
|
|
59
|
-
this.stream =
|
|
60
|
-
(await this.client.subscribe());
|
|
55
|
+
this.stream = await this.client.subscribe();
|
|
61
56
|
const filters = this.options.filters.map((filter) => {
|
|
62
57
|
return {
|
|
63
58
|
memcmp: {
|
|
64
|
-
offset: filter.memcmp.offset
|
|
65
|
-
|
|
59
|
+
offset: filter.memcmp.offset,
|
|
60
|
+
base58: filter.memcmp.bytes,
|
|
66
61
|
},
|
|
67
62
|
};
|
|
68
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc.node.d.ts","sourceRoot":"","sources":["../../../src/isomorphic/grpc.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,8BAA8B,CAAC;AACvD,OAAO,KAAK,EACX,gBAAgB,EAChB,eAAe,EACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGxE,YAAY,EACX,iBAAiB,EACjB,gBAAgB,IAAI,qBAAqB,EACzC,eAAe,IAAI,oBAAoB,GACvC,MAAM,oBAAoB,CAAC;AA4B5B,eAAO,MAAM,oBAAoB;;;;CAahC,CAAC;AAEF,eAAO,MAAM,qBAAqB,2DAajC,CAAC;AAGF,wBAAsB,iBAAiB,IAAI,OAAO,CACjD,cAAc,oBAAoB,EAAE,SAAS,CAC7C,CAGA;AAGD,wBAAsB,uBAAuB,IAAI,OAAO,CACvD,cAAc,oBAAoB,EAAE,eAAe,CACnD,CAGA;AAGD,wBAAsB,6BAA6B,IAAI,OAAO,CAC7D,cAAc,oBAAoB,EAAE,qBAAqB,CACzD,CAGA;AAKD,wBAAgB,cAAc,CAC7B,GAAG,IAAI,EAAE,UAAU,CAAC,cAAc,oBAAoB,EAAE,SAAS,CAAC,GAChE,UAAU,CAAC,cAAc,oBAAoB,EAAE,SAAS,CAAC,CAQ3D;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;AACnC,YAAY,EACX,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf,CAAC;AAGF,wBAAsB,YAAY,CACjC,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,MAAM,CAAC,GAC3C,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"grpc.node.d.ts","sourceRoot":"","sources":["../../../src/isomorphic/grpc.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,8BAA8B,CAAC;AACvD,OAAO,KAAK,EACX,gBAAgB,EAChB,eAAe,EACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGxE,YAAY,EACX,iBAAiB,EACjB,gBAAgB,IAAI,qBAAqB,EACzC,eAAe,IAAI,oBAAoB,GACvC,MAAM,oBAAoB,CAAC;AA4B5B,eAAO,MAAM,oBAAoB;;;;CAahC,CAAC;AAEF,eAAO,MAAM,qBAAqB,2DAajC,CAAC;AAGF,wBAAsB,iBAAiB,IAAI,OAAO,CACjD,cAAc,oBAAoB,EAAE,SAAS,CAC7C,CAGA;AAGD,wBAAsB,uBAAuB,IAAI,OAAO,CACvD,cAAc,oBAAoB,EAAE,eAAe,CACnD,CAGA;AAGD,wBAAsB,6BAA6B,IAAI,OAAO,CAC7D,cAAc,oBAAoB,EAAE,qBAAqB,CACzD,CAGA;AAKD,wBAAgB,cAAc,CAC7B,GAAG,IAAI,EAAE,UAAU,CAAC,cAAc,oBAAoB,EAAE,SAAS,CAAC,GAChE,UAAU,CAAC,cAAc,oBAAoB,EAAE,SAAS,CAAC,CAQ3D;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;AACnC,YAAY,EACX,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf,CAAC;AAGF,wBAAsB,YAAY,CACjC,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,MAAM,CAAC,GAC3C,OAAO,CAAC,MAAM,CAAC,CAKjB"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ResubOpts, GrpcConfigs } from './types';
|
|
2
2
|
import { Program } from '@coral-xyz/anchor';
|
|
3
|
-
import bs58 from 'bs58';
|
|
4
3
|
import { Context, MemcmpFilter, PublicKey } from '@solana/web3.js';
|
|
5
4
|
import * as Buffer from 'buffer';
|
|
6
5
|
import { WebSocketProgramAccountSubscriber } from './webSocketProgramAccountSubscriber';
|
|
7
6
|
import {
|
|
8
7
|
Client,
|
|
9
|
-
ClientDuplexStream,
|
|
10
8
|
CommitmentLevel,
|
|
11
9
|
createClient,
|
|
12
10
|
SubscribeRequest,
|
|
@@ -17,7 +15,7 @@ export class grpcProgramAccountSubscriber<
|
|
|
17
15
|
T,
|
|
18
16
|
> extends WebSocketProgramAccountSubscriber<T> {
|
|
19
17
|
private client: Client;
|
|
20
|
-
private stream:
|
|
18
|
+
private stream: Awaited<ReturnType<Client['subscribe']>>;
|
|
21
19
|
private commitmentLevel: CommitmentLevel;
|
|
22
20
|
public listenerId?: number;
|
|
23
21
|
|
|
@@ -92,17 +90,18 @@ export class grpcProgramAccountSubscriber<
|
|
|
92
90
|
this.onChange = onChange;
|
|
93
91
|
|
|
94
92
|
// Subscribe with grpc
|
|
95
|
-
this.stream =
|
|
96
|
-
|
|
93
|
+
this.stream = await this.client.subscribe();
|
|
94
|
+
|
|
97
95
|
const filters = this.options.filters.map((filter) => {
|
|
98
96
|
return {
|
|
99
97
|
memcmp: {
|
|
100
|
-
offset: filter.memcmp.offset
|
|
101
|
-
|
|
98
|
+
offset: filter.memcmp.offset,
|
|
99
|
+
base58: filter.memcmp.bytes,
|
|
102
100
|
},
|
|
103
101
|
};
|
|
104
102
|
});
|
|
105
|
-
|
|
103
|
+
|
|
104
|
+
const request = {
|
|
106
105
|
slots: {},
|
|
107
106
|
accounts: {
|
|
108
107
|
drift: {
|
|
@@ -119,6 +118,7 @@ export class grpcProgramAccountSubscriber<
|
|
|
119
118
|
entry: {},
|
|
120
119
|
transactionsStatus: {},
|
|
121
120
|
};
|
|
121
|
+
|
|
122
122
|
this.stream.on('data', (chunk: SubscribeUpdate) => {
|
|
123
123
|
if (!chunk.account) {
|
|
124
124
|
return;
|
|
@@ -121,5 +121,7 @@ export async function createClient(
|
|
|
121
121
|
...args: ConstructorParameters<typeof Client>
|
|
122
122
|
): Promise<Client> {
|
|
123
123
|
const { default: Client_ } = await import('@triton-one/yellowstone-grpc');
|
|
124
|
-
|
|
124
|
+
const client = new Client_(...args);
|
|
125
|
+
await client.connect();
|
|
126
|
+
return client;
|
|
125
127
|
}
|