@injectivelabs/sdk-ts 1.15.15 → 1.15.16
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/dist/cjs/client/indexer/grpc_stream/IndexerGrpcTradingStream.d.ts +17 -0
- package/dist/cjs/client/indexer/grpc_stream/IndexerGrpcTradingStream.js +46 -0
- package/dist/cjs/client/indexer/grpc_stream/index.d.ts +1 -0
- package/dist/cjs/client/indexer/grpc_stream/index.js +1 -0
- package/dist/cjs/client/indexer/types/trading.d.ts +1 -0
- package/dist/esm/client/indexer/grpc_stream/IndexerGrpcTradingStream.d.ts +17 -0
- package/dist/esm/client/indexer/grpc_stream/IndexerGrpcTradingStream.js +42 -0
- package/dist/esm/client/indexer/grpc_stream/index.d.ts +1 -0
- package/dist/esm/client/indexer/grpc_stream/index.js +1 -0
- package/dist/esm/client/indexer/types/trading.d.ts +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Subscription } from 'rxjs';
|
|
2
|
+
import { InjectiveTradingRpc } from '@injectivelabs/indexer-proto-ts';
|
|
3
|
+
import { StreamStatusResponse } from '../types/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* @category Indexer Grid Strategy Grpc Stream
|
|
6
|
+
*/
|
|
7
|
+
export declare class IndexerGrpcTradingStream {
|
|
8
|
+
protected client: InjectiveTradingRpc.InjectiveTradingRPCClientImpl;
|
|
9
|
+
constructor(endpoint: string);
|
|
10
|
+
streamGridStrategies({ marketId, callback, onEndCallback, accountAddresses, onStatusCallback, }: {
|
|
11
|
+
marketId?: string;
|
|
12
|
+
accountAddresses?: string[];
|
|
13
|
+
onEndCallback?: (status?: StreamStatusResponse) => void;
|
|
14
|
+
onStatusCallback?: (status: StreamStatusResponse) => void;
|
|
15
|
+
callback: (response: InjectiveTradingRpc.StreamStrategyResponse) => void;
|
|
16
|
+
}): Subscription;
|
|
17
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndexerGrpcTradingStream = void 0;
|
|
4
|
+
const indexer_proto_ts_1 = require("@injectivelabs/indexer-proto-ts");
|
|
5
|
+
const BaseIndexerGrpcWebConsumer_js_1 = require("../../base/BaseIndexerGrpcWebConsumer.js");
|
|
6
|
+
/**
|
|
7
|
+
* @category Indexer Grid Strategy Grpc Stream
|
|
8
|
+
*/
|
|
9
|
+
class IndexerGrpcTradingStream {
|
|
10
|
+
client;
|
|
11
|
+
constructor(endpoint) {
|
|
12
|
+
this.client = new indexer_proto_ts_1.InjectiveTradingRpc.InjectiveTradingRPCClientImpl((0, BaseIndexerGrpcWebConsumer_js_1.getGrpcIndexerWebImpl)(endpoint));
|
|
13
|
+
}
|
|
14
|
+
streamGridStrategies({ marketId, callback, onEndCallback, accountAddresses, onStatusCallback, }) {
|
|
15
|
+
const request = indexer_proto_ts_1.InjectiveTradingRpc.StreamStrategyRequest.create();
|
|
16
|
+
if ((!accountAddresses || accountAddresses.length === 0) && !marketId) {
|
|
17
|
+
throw new Error('accountAddresses or marketId is required');
|
|
18
|
+
}
|
|
19
|
+
if (typeof callback !== 'function') {
|
|
20
|
+
throw new Error('callback must be a function');
|
|
21
|
+
}
|
|
22
|
+
if (accountAddresses) {
|
|
23
|
+
request.accountAddresses = accountAddresses;
|
|
24
|
+
}
|
|
25
|
+
if (marketId) {
|
|
26
|
+
request.marketId = marketId;
|
|
27
|
+
}
|
|
28
|
+
const subscription = this.client.StreamStrategy(request).subscribe({
|
|
29
|
+
next(response) {
|
|
30
|
+
callback(response);
|
|
31
|
+
},
|
|
32
|
+
error(err) {
|
|
33
|
+
if (onStatusCallback) {
|
|
34
|
+
onStatusCallback(err);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
complete() {
|
|
38
|
+
if (onEndCallback) {
|
|
39
|
+
onEndCallback();
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
return subscription;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.IndexerGrpcTradingStream = IndexerGrpcTradingStream;
|
|
@@ -3,6 +3,7 @@ export * from './IndexerGrpcMitoStream.js';
|
|
|
3
3
|
export * from './IndexerGrpcOracleStream.js';
|
|
4
4
|
export * from './IndexerGrpcAccountStream.js';
|
|
5
5
|
export * from './IndexerGrpcAuctionStream.js';
|
|
6
|
+
export * from './IndexerGrpcTradingStream.js';
|
|
6
7
|
export * from './IndexerGrpcExplorerStream.js';
|
|
7
8
|
export * from './IndexerGrpcDerivativesStream.js';
|
|
8
9
|
export * from './IndexerGrpcAccountPortfolioStream.js';
|
|
@@ -19,6 +19,7 @@ __exportStar(require("./IndexerGrpcMitoStream.js"), exports);
|
|
|
19
19
|
__exportStar(require("./IndexerGrpcOracleStream.js"), exports);
|
|
20
20
|
__exportStar(require("./IndexerGrpcAccountStream.js"), exports);
|
|
21
21
|
__exportStar(require("./IndexerGrpcAuctionStream.js"), exports);
|
|
22
|
+
__exportStar(require("./IndexerGrpcTradingStream.js"), exports);
|
|
22
23
|
__exportStar(require("./IndexerGrpcExplorerStream.js"), exports);
|
|
23
24
|
__exportStar(require("./IndexerGrpcDerivativesStream.js"), exports);
|
|
24
25
|
__exportStar(require("./IndexerGrpcAccountPortfolioStream.js"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Subscription } from 'rxjs';
|
|
2
|
+
import { InjectiveTradingRpc } from '@injectivelabs/indexer-proto-ts';
|
|
3
|
+
import { StreamStatusResponse } from '../types/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* @category Indexer Grid Strategy Grpc Stream
|
|
6
|
+
*/
|
|
7
|
+
export declare class IndexerGrpcTradingStream {
|
|
8
|
+
protected client: InjectiveTradingRpc.InjectiveTradingRPCClientImpl;
|
|
9
|
+
constructor(endpoint: string);
|
|
10
|
+
streamGridStrategies({ marketId, callback, onEndCallback, accountAddresses, onStatusCallback, }: {
|
|
11
|
+
marketId?: string;
|
|
12
|
+
accountAddresses?: string[];
|
|
13
|
+
onEndCallback?: (status?: StreamStatusResponse) => void;
|
|
14
|
+
onStatusCallback?: (status: StreamStatusResponse) => void;
|
|
15
|
+
callback: (response: InjectiveTradingRpc.StreamStrategyResponse) => void;
|
|
16
|
+
}): Subscription;
|
|
17
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { InjectiveTradingRpc } from '@injectivelabs/indexer-proto-ts';
|
|
2
|
+
import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer.js';
|
|
3
|
+
/**
|
|
4
|
+
* @category Indexer Grid Strategy Grpc Stream
|
|
5
|
+
*/
|
|
6
|
+
export class IndexerGrpcTradingStream {
|
|
7
|
+
client;
|
|
8
|
+
constructor(endpoint) {
|
|
9
|
+
this.client = new InjectiveTradingRpc.InjectiveTradingRPCClientImpl(getGrpcIndexerWebImpl(endpoint));
|
|
10
|
+
}
|
|
11
|
+
streamGridStrategies({ marketId, callback, onEndCallback, accountAddresses, onStatusCallback, }) {
|
|
12
|
+
const request = InjectiveTradingRpc.StreamStrategyRequest.create();
|
|
13
|
+
if ((!accountAddresses || accountAddresses.length === 0) && !marketId) {
|
|
14
|
+
throw new Error('accountAddresses or marketId is required');
|
|
15
|
+
}
|
|
16
|
+
if (typeof callback !== 'function') {
|
|
17
|
+
throw new Error('callback must be a function');
|
|
18
|
+
}
|
|
19
|
+
if (accountAddresses) {
|
|
20
|
+
request.accountAddresses = accountAddresses;
|
|
21
|
+
}
|
|
22
|
+
if (marketId) {
|
|
23
|
+
request.marketId = marketId;
|
|
24
|
+
}
|
|
25
|
+
const subscription = this.client.StreamStrategy(request).subscribe({
|
|
26
|
+
next(response) {
|
|
27
|
+
callback(response);
|
|
28
|
+
},
|
|
29
|
+
error(err) {
|
|
30
|
+
if (onStatusCallback) {
|
|
31
|
+
onStatusCallback(err);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
complete() {
|
|
35
|
+
if (onEndCallback) {
|
|
36
|
+
onEndCallback();
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
return subscription;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -3,6 +3,7 @@ export * from './IndexerGrpcMitoStream.js';
|
|
|
3
3
|
export * from './IndexerGrpcOracleStream.js';
|
|
4
4
|
export * from './IndexerGrpcAccountStream.js';
|
|
5
5
|
export * from './IndexerGrpcAuctionStream.js';
|
|
6
|
+
export * from './IndexerGrpcTradingStream.js';
|
|
6
7
|
export * from './IndexerGrpcExplorerStream.js';
|
|
7
8
|
export * from './IndexerGrpcDerivativesStream.js';
|
|
8
9
|
export * from './IndexerGrpcAccountPortfolioStream.js';
|
|
@@ -3,6 +3,7 @@ export * from './IndexerGrpcMitoStream.js';
|
|
|
3
3
|
export * from './IndexerGrpcOracleStream.js';
|
|
4
4
|
export * from './IndexerGrpcAccountStream.js';
|
|
5
5
|
export * from './IndexerGrpcAuctionStream.js';
|
|
6
|
+
export * from './IndexerGrpcTradingStream.js';
|
|
6
7
|
export * from './IndexerGrpcExplorerStream.js';
|
|
7
8
|
export * from './IndexerGrpcDerivativesStream.js';
|
|
8
9
|
export * from './IndexerGrpcAccountPortfolioStream.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/sdk-ts",
|
|
3
3
|
"description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.",
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.16",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": {
|
|
@@ -124,16 +124,16 @@
|
|
|
124
124
|
"@ethersproject/bytes": "^5.8.0",
|
|
125
125
|
"@injectivelabs/abacus-proto-ts": "1.14.0",
|
|
126
126
|
"@injectivelabs/core-proto-ts": "1.14.3",
|
|
127
|
-
"@injectivelabs/exceptions": "^1.15.
|
|
127
|
+
"@injectivelabs/exceptions": "^1.15.13",
|
|
128
128
|
"@injectivelabs/grpc-web": "^0.0.1",
|
|
129
129
|
"@injectivelabs/grpc-web-node-http-transport": "^0.0.2",
|
|
130
130
|
"@injectivelabs/grpc-web-react-native-transport": "^0.0.2",
|
|
131
|
-
"@injectivelabs/indexer-proto-ts": "1.13.
|
|
131
|
+
"@injectivelabs/indexer-proto-ts": "1.13.12",
|
|
132
132
|
"@injectivelabs/mito-proto-ts": "1.13.2",
|
|
133
|
-
"@injectivelabs/networks": "^1.15.
|
|
133
|
+
"@injectivelabs/networks": "^1.15.14",
|
|
134
134
|
"@injectivelabs/olp-proto-ts": "1.13.4",
|
|
135
|
-
"@injectivelabs/ts-types": "^1.15.
|
|
136
|
-
"@injectivelabs/utils": "^1.15.
|
|
135
|
+
"@injectivelabs/ts-types": "^1.15.14",
|
|
136
|
+
"@injectivelabs/utils": "^1.15.14",
|
|
137
137
|
"@metamask/eth-sig-util": "^8.2.0",
|
|
138
138
|
"@noble/curves": "^1.8.1",
|
|
139
139
|
"@noble/hashes": "^1.7.1",
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"shx": "^0.3.4",
|
|
153
153
|
"snakecase-keys": "^5.4.1"
|
|
154
154
|
},
|
|
155
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "4031bd72faad58d400f08a3ab1132c58b4edabca",
|
|
156
156
|
"typedoc": {
|
|
157
157
|
"entryPoint": "./src/index.ts",
|
|
158
158
|
"readmeFile": "./README.md",
|