@burningflames/inj-exchange-sdk 0.1.2 → 0.3.0
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/README.md +34 -1
- package/dist/clients/indexer.cjs +2 -1
- package/dist/clients/indexer.d.cts +2 -2
- package/dist/clients/indexer.d.ts +2 -2
- package/dist/clients/indexer.js +1 -1
- package/dist/{index-B3bDzB4S.d.cts → index-D9iUJ2dU.d.cts} +21 -8
- package/dist/{index-DcQT-y4U.d.ts → index-Zb1MmK7L.d.ts} +21 -8
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{indexer-D7XfYsAZ.js → indexer-D_9xZbW-.js} +57 -36
- package/dist/{indexer-DI7-gHOA.cjs → indexer-pTkAEtBo.cjs} +62 -35
- package/dist/{stream-D8ZvUQFy.cjs → stream-B2Mi9XL8.cjs} +2 -0
- package/dist/{stream-RhVNTED5.js → stream-CbXgyx26.js} +2 -0
- package/dist/{stream-BgKRWG60.d.cts → stream-ChRmJm8w.d.cts} +3 -1
- package/dist/{stream-BgKRWG60.d.ts → stream-ChRmJm8w.d.ts} +3 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -211,6 +211,39 @@ and need a trigger price.
|
|
|
211
211
|
|
|
212
212
|
**Deposits cannot target the default subaccount.** Use nonce ≥ 1.
|
|
213
213
|
|
|
214
|
+
## Streams
|
|
215
|
+
|
|
216
|
+
The stream clients return a `StreamManager` rather than a raw gRPC stream, because
|
|
217
|
+
a market feed drops and an orderbook has to come back without the caller noticing:
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
const feed = client.streamOrderbookV2({ marketId });
|
|
221
|
+
feed.on("data", (orderbook) => { /* ... */ });
|
|
222
|
+
feed.on("disconnect", ({ reason, willRetry, attempt }) => { /* ... */ });
|
|
223
|
+
feed.start();
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Events are `data`, `connect` (`isReconnect`, `attempt`), `retry` (the `delayMs` it
|
|
227
|
+
will wait and the `nextBackoff`), `disconnect` (`reason`, `willRetry`, `attempt`)
|
|
228
|
+
and `error`. `feed.state` reads the lifecycle, and `StreamState.Failed` is the end
|
|
229
|
+
of it.
|
|
230
|
+
|
|
231
|
+
Retrying is on by default — five attempts, 1 s doubling to a 30 s cap. Only
|
|
232
|
+
`UNAVAILABLE`, `DEADLINE_EXCEEDED`, `RESOURCE_EXHAUSTED`, `UNKNOWN`, `INTERNAL`,
|
|
233
|
+
`DATA_LOSS` and `ABORTED` are retried; anything else ends the stream and reports
|
|
234
|
+
it. The policy is readable as `DEFAULT_RETRY_CONFIG`, and the stream client's
|
|
235
|
+
fourth argument replaces any part of it — `enabled: false` makes a dropped feed
|
|
236
|
+
loud instead of silent.
|
|
237
|
+
|
|
238
|
+
One message, or a connection that holds for `stableConnectionMs` (five seconds by
|
|
239
|
+
default), proves the subscription works and gives the whole budget back. So a feed
|
|
240
|
+
that delivers and then drops keeps coming back; `MAX_RETRIES` is for a stream that
|
|
241
|
+
cannot get a message at all. When the attempts are spent the stream is finished: it
|
|
242
|
+
emits `disconnect` with reason `max-retries` and an `error` named `MAX_RETRIES`,
|
|
243
|
+
moves to `Failed`, and `start()` throws from then on. Recover by building a new
|
|
244
|
+
stream from the same client — the client keeps its gRPC channel open, so that costs
|
|
245
|
+
an RPC, not a handshake.
|
|
246
|
+
|
|
214
247
|
## Markets used for the proofs
|
|
215
248
|
|
|
216
249
|
- INJ/USDC PERP `0x790aee464fbbd02cf4476444554c71d1225f7edfe15e6dc7f874c455fd883d31` — quote USDC `erc20:0xa00C59fF5a080D2b954d0c75e46E22a0c371235a`, initial margin ratio 0.0333 (30x), minimum quantity 0.01 INJ
|
|
@@ -220,7 +253,7 @@ and need a trigger price.
|
|
|
220
253
|
|
|
221
254
|
```sh
|
|
222
255
|
bun run check # oxlint, oxfmt --check, tsc --noEmit, bun test
|
|
223
|
-
bun test #
|
|
256
|
+
bun test # 68 tests: encodings, EIP-712 payload, decimal scaling, pagination, retry policy
|
|
224
257
|
bun run build # tsdown → dist/, ESM and CJS with declarations
|
|
225
258
|
bun run check:pack # the file list a publish would carry; refuses an unexpected one
|
|
226
259
|
bun pm pack # the publishable tarball
|
package/dist/clients/indexer.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_indexer = require("../indexer-
|
|
2
|
+
const require_indexer = require("../indexer-pTkAEtBo.cjs");
|
|
3
|
+
exports.DEFAULT_RETRY_CONFIG = require_indexer.DEFAULT_RETRY_CONFIG;
|
|
3
4
|
exports.IndexerAccountsApiClient = require_indexer.IndexerAccountsApiClient;
|
|
4
5
|
exports.IndexerAccountsStreamClient = require_indexer.IndexerAccountsStreamClient;
|
|
5
6
|
exports.IndexerArchiverApiClient = require_indexer.IndexerArchiverApiClient;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as IndexerAccountsStreamClient, c as
|
|
2
|
-
export { IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, StreamManager };
|
|
1
|
+
import { a as IndexerAccountsStreamClient, c as IndexerSpotApiClient, d as IndexerDerivativesApiClient, f as IndexerArchiverApiClient, i as IndexerDerivativesStreamClient, l as IndexerPortfolioApiClient, n as IndexerPortfolioStreamClient, o as DEFAULT_RETRY_CONFIG, p as IndexerAccountsApiClient, r as IndexerOracleStreamClient, s as StreamManager, t as IndexerSpotStreamClient, u as IndexerOracleApiClient } from "../index-D9iUJ2dU.cjs";
|
|
2
|
+
export { DEFAULT_RETRY_CONFIG, IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, StreamManager };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as IndexerAccountsStreamClient, c as
|
|
2
|
-
export { IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, StreamManager };
|
|
1
|
+
import { a as IndexerAccountsStreamClient, c as IndexerSpotApiClient, d as IndexerDerivativesApiClient, f as IndexerArchiverApiClient, i as IndexerDerivativesStreamClient, l as IndexerPortfolioApiClient, n as IndexerPortfolioStreamClient, o as DEFAULT_RETRY_CONFIG, p as IndexerAccountsApiClient, r as IndexerOracleStreamClient, s as StreamManager, t as IndexerSpotStreamClient, u as IndexerOracleApiClient } from "../index-Zb1MmK7L.js";
|
|
2
|
+
export { DEFAULT_RETRY_CONFIG, IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, StreamManager };
|
package/dist/clients/indexer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { o as DEFAULT_RETRY_CONFIG, p as IndexerAccountsApiClient, a as IndexerAccountsStreamClient, f as IndexerArchiverApiClient, d as IndexerDerivativesApiClient, i as IndexerDerivativesStreamClient, u as IndexerOracleApiClient, r as IndexerOracleStreamClient, l as IndexerPortfolioApiClient, n as IndexerPortfolioStreamClient, c as IndexerSpotApiClient, t as IndexerSpotStreamClient, s as StreamManager } from "../indexer-D_9xZbW-.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChannelCredentials, ChannelOptions, ClientReadableStream } from "@grpc/grpc-js";
|
|
2
2
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
3
3
|
import { EventEmitter } from "eventemitter3";
|
|
4
|
-
import { r as StreamManagerRetryConfig, t as EventTypes } from "./stream-
|
|
4
|
+
import { i as StreamState, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-ChRmJm8w.cjs";
|
|
5
5
|
interface OrderStatesRequest {
|
|
6
6
|
spotOrderHashes: string[];
|
|
7
7
|
derivativeOrderHashes: string[];
|
|
@@ -2106,10 +2106,16 @@ declare class IndexerSpotApiClient {
|
|
|
2106
2106
|
fetchSubaccountTradesList(params: Partial<SubaccountTradesListRequest> & Pick<SubaccountTradesListRequest, "subaccountId">): Promise<SubaccountTradesListResponse["trades"]>;
|
|
2107
2107
|
fetchOrdersHistory(params?: Partial<OrdersHistoryRequest>): Promise<OrdersHistoryResponse>;
|
|
2108
2108
|
}
|
|
2109
|
+
/**
|
|
2110
|
+
* What a stream client applies when the caller passes no retryConfig, exported
|
|
2111
|
+
* so a caller can read the policy instead of inferring it from the docs. Frozen
|
|
2112
|
+
* because a spread of it should never be able to change it for everyone else.
|
|
2113
|
+
*/
|
|
2114
|
+
declare const DEFAULT_RETRY_CONFIG: Readonly<StreamManagerRetryConfig>;
|
|
2109
2115
|
declare class StreamManager<StreamResponse> extends EventEmitter<EventTypes<StreamResponse>> {
|
|
2110
2116
|
private streamFactory;
|
|
2111
2117
|
private subscription;
|
|
2112
|
-
private
|
|
2118
|
+
private currentState;
|
|
2113
2119
|
private retryConfig;
|
|
2114
2120
|
private streamError;
|
|
2115
2121
|
private retryAttempts;
|
|
@@ -2117,6 +2123,8 @@ declare class StreamManager<StreamResponse> extends EventEmitter<EventTypes<Stre
|
|
|
2117
2123
|
private stableConnectionTimeout;
|
|
2118
2124
|
private path;
|
|
2119
2125
|
constructor(streamFactory: () => ClientReadableStream<StreamResponse>, path: string, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2126
|
+
/** Where the stream is in its lifecycle; `Failed` is terminal. */
|
|
2127
|
+
get state(): StreamState;
|
|
2120
2128
|
start(): void;
|
|
2121
2129
|
stop(): void;
|
|
2122
2130
|
destroy(): void;
|
|
@@ -2131,13 +2139,15 @@ declare class StreamManager<StreamResponse> extends EventEmitter<EventTypes<Stre
|
|
|
2131
2139
|
private calculateBackoff;
|
|
2132
2140
|
}
|
|
2133
2141
|
declare class IndexerAccountsStreamClient {
|
|
2142
|
+
private retryConfig?;
|
|
2134
2143
|
private client;
|
|
2135
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2144
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2136
2145
|
streamSubaccountBalance(params: Pick<StreamSubaccountBalanceRequest, "subaccountId"> & Partial<StreamSubaccountBalanceRequest>): StreamManager<StreamSubaccountBalanceResponse>;
|
|
2137
2146
|
}
|
|
2138
2147
|
declare class IndexerDerivativesStreamClient {
|
|
2148
|
+
private retryConfig?;
|
|
2139
2149
|
private client;
|
|
2140
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2150
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2141
2151
|
streamMarket(params?: Partial<StreamMarketRequest>): StreamManager<StreamMarketResponse>;
|
|
2142
2152
|
streamOrderbookV2(params?: Partial<StreamOrderbookV2Request$1>): StreamManager<StreamOrderbookV2Response$1>;
|
|
2143
2153
|
streamOrderbookUpdate(params?: Partial<StreamOrderbookUpdateRequest$1>): StreamManager<StreamOrderbookUpdateResponse$1>;
|
|
@@ -2147,18 +2157,21 @@ declare class IndexerDerivativesStreamClient {
|
|
|
2147
2157
|
streamOrdersHistory(params?: Partial<StreamOrdersHistoryRequest$1>): StreamManager<StreamOrdersHistoryResponse$1>;
|
|
2148
2158
|
}
|
|
2149
2159
|
declare class IndexerOracleStreamClient {
|
|
2160
|
+
private retryConfig?;
|
|
2150
2161
|
private client;
|
|
2151
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2162
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2152
2163
|
streamPricesByMarkets(params?: Partial<StreamPricesByMarketsRequest>): StreamManager<StreamPricesByMarketsResponse>;
|
|
2153
2164
|
}
|
|
2154
2165
|
declare class IndexerPortfolioStreamClient {
|
|
2166
|
+
private retryConfig?;
|
|
2155
2167
|
private client;
|
|
2156
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2168
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2157
2169
|
streamAccountPortfolio(params: Partial<StreamAccountPortfolioRequest> & Pick<StreamAccountPortfolioRequest, "accountAddress">): StreamManager<StreamAccountPortfolioResponse>;
|
|
2158
2170
|
}
|
|
2159
2171
|
declare class IndexerSpotStreamClient {
|
|
2172
|
+
private retryConfig?;
|
|
2160
2173
|
private client;
|
|
2161
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2174
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2162
2175
|
streamMarkets(params?: Partial<StreamMarketsRequest>): StreamManager<StreamMarketsResponse>;
|
|
2163
2176
|
streamOrderbookV2(params?: Partial<StreamOrderbookV2Request>): StreamManager<StreamOrderbookV2Response>;
|
|
2164
2177
|
streamOrderbookUpdates(params?: Partial<StreamOrderbookUpdateRequest>): StreamManager<StreamOrderbookUpdateResponse>;
|
|
@@ -2166,4 +2179,4 @@ declare class IndexerSpotStreamClient {
|
|
|
2166
2179
|
streamTradesV2(params?: Partial<StreamTradesV2Request>): StreamManager<StreamTradesV2Response>;
|
|
2167
2180
|
streamOrdersHistory(params?: Partial<StreamOrdersHistoryRequest>): StreamManager<StreamOrdersHistoryResponse>;
|
|
2168
2181
|
}
|
|
2169
|
-
export { IndexerAccountsStreamClient as a,
|
|
2182
|
+
export { IndexerAccountsStreamClient as a, IndexerSpotApiClient as c, IndexerDerivativesApiClient as d, IndexerArchiverApiClient as f, IndexerDerivativesStreamClient as i, IndexerPortfolioApiClient as l, IndexerPortfolioStreamClient as n, DEFAULT_RETRY_CONFIG as o, IndexerAccountsApiClient as p, IndexerOracleStreamClient as r, StreamManager as s, IndexerSpotStreamClient as t, IndexerOracleApiClient as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChannelCredentials, ChannelOptions, ClientReadableStream } from "@grpc/grpc-js";
|
|
2
2
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
3
3
|
import { EventEmitter } from "eventemitter3";
|
|
4
|
-
import { r as StreamManagerRetryConfig, t as EventTypes } from "./stream-
|
|
4
|
+
import { i as StreamState, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-ChRmJm8w.js";
|
|
5
5
|
interface OrderStatesRequest {
|
|
6
6
|
spotOrderHashes: string[];
|
|
7
7
|
derivativeOrderHashes: string[];
|
|
@@ -2106,10 +2106,16 @@ declare class IndexerSpotApiClient {
|
|
|
2106
2106
|
fetchSubaccountTradesList(params: Partial<SubaccountTradesListRequest> & Pick<SubaccountTradesListRequest, "subaccountId">): Promise<SubaccountTradesListResponse["trades"]>;
|
|
2107
2107
|
fetchOrdersHistory(params?: Partial<OrdersHistoryRequest>): Promise<OrdersHistoryResponse>;
|
|
2108
2108
|
}
|
|
2109
|
+
/**
|
|
2110
|
+
* What a stream client applies when the caller passes no retryConfig, exported
|
|
2111
|
+
* so a caller can read the policy instead of inferring it from the docs. Frozen
|
|
2112
|
+
* because a spread of it should never be able to change it for everyone else.
|
|
2113
|
+
*/
|
|
2114
|
+
declare const DEFAULT_RETRY_CONFIG: Readonly<StreamManagerRetryConfig>;
|
|
2109
2115
|
declare class StreamManager<StreamResponse> extends EventEmitter<EventTypes<StreamResponse>> {
|
|
2110
2116
|
private streamFactory;
|
|
2111
2117
|
private subscription;
|
|
2112
|
-
private
|
|
2118
|
+
private currentState;
|
|
2113
2119
|
private retryConfig;
|
|
2114
2120
|
private streamError;
|
|
2115
2121
|
private retryAttempts;
|
|
@@ -2117,6 +2123,8 @@ declare class StreamManager<StreamResponse> extends EventEmitter<EventTypes<Stre
|
|
|
2117
2123
|
private stableConnectionTimeout;
|
|
2118
2124
|
private path;
|
|
2119
2125
|
constructor(streamFactory: () => ClientReadableStream<StreamResponse>, path: string, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2126
|
+
/** Where the stream is in its lifecycle; `Failed` is terminal. */
|
|
2127
|
+
get state(): StreamState;
|
|
2120
2128
|
start(): void;
|
|
2121
2129
|
stop(): void;
|
|
2122
2130
|
destroy(): void;
|
|
@@ -2131,13 +2139,15 @@ declare class StreamManager<StreamResponse> extends EventEmitter<EventTypes<Stre
|
|
|
2131
2139
|
private calculateBackoff;
|
|
2132
2140
|
}
|
|
2133
2141
|
declare class IndexerAccountsStreamClient {
|
|
2142
|
+
private retryConfig?;
|
|
2134
2143
|
private client;
|
|
2135
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2144
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2136
2145
|
streamSubaccountBalance(params: Pick<StreamSubaccountBalanceRequest, "subaccountId"> & Partial<StreamSubaccountBalanceRequest>): StreamManager<StreamSubaccountBalanceResponse>;
|
|
2137
2146
|
}
|
|
2138
2147
|
declare class IndexerDerivativesStreamClient {
|
|
2148
|
+
private retryConfig?;
|
|
2139
2149
|
private client;
|
|
2140
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2150
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2141
2151
|
streamMarket(params?: Partial<StreamMarketRequest>): StreamManager<StreamMarketResponse>;
|
|
2142
2152
|
streamOrderbookV2(params?: Partial<StreamOrderbookV2Request$1>): StreamManager<StreamOrderbookV2Response$1>;
|
|
2143
2153
|
streamOrderbookUpdate(params?: Partial<StreamOrderbookUpdateRequest$1>): StreamManager<StreamOrderbookUpdateResponse$1>;
|
|
@@ -2147,18 +2157,21 @@ declare class IndexerDerivativesStreamClient {
|
|
|
2147
2157
|
streamOrdersHistory(params?: Partial<StreamOrdersHistoryRequest$1>): StreamManager<StreamOrdersHistoryResponse$1>;
|
|
2148
2158
|
}
|
|
2149
2159
|
declare class IndexerOracleStreamClient {
|
|
2160
|
+
private retryConfig?;
|
|
2150
2161
|
private client;
|
|
2151
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2162
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2152
2163
|
streamPricesByMarkets(params?: Partial<StreamPricesByMarketsRequest>): StreamManager<StreamPricesByMarketsResponse>;
|
|
2153
2164
|
}
|
|
2154
2165
|
declare class IndexerPortfolioStreamClient {
|
|
2166
|
+
private retryConfig?;
|
|
2155
2167
|
private client;
|
|
2156
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2168
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2157
2169
|
streamAccountPortfolio(params: Partial<StreamAccountPortfolioRequest> & Pick<StreamAccountPortfolioRequest, "accountAddress">): StreamManager<StreamAccountPortfolioResponse>;
|
|
2158
2170
|
}
|
|
2159
2171
|
declare class IndexerSpotStreamClient {
|
|
2172
|
+
private retryConfig?;
|
|
2160
2173
|
private client;
|
|
2161
|
-
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
|
|
2174
|
+
constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
|
|
2162
2175
|
streamMarkets(params?: Partial<StreamMarketsRequest>): StreamManager<StreamMarketsResponse>;
|
|
2163
2176
|
streamOrderbookV2(params?: Partial<StreamOrderbookV2Request>): StreamManager<StreamOrderbookV2Response>;
|
|
2164
2177
|
streamOrderbookUpdates(params?: Partial<StreamOrderbookUpdateRequest>): StreamManager<StreamOrderbookUpdateResponse>;
|
|
@@ -2166,4 +2179,4 @@ declare class IndexerSpotStreamClient {
|
|
|
2166
2179
|
streamTradesV2(params?: Partial<StreamTradesV2Request>): StreamManager<StreamTradesV2Response>;
|
|
2167
2180
|
streamOrdersHistory(params?: Partial<StreamOrdersHistoryRequest>): StreamManager<StreamOrdersHistoryResponse>;
|
|
2168
2181
|
}
|
|
2169
|
-
export { IndexerAccountsStreamClient as a,
|
|
2182
|
+
export { IndexerAccountsStreamClient as a, IndexerSpotApiClient as c, IndexerDerivativesApiClient as d, IndexerArchiverApiClient as f, IndexerDerivativesStreamClient as i, IndexerPortfolioApiClient as l, IndexerPortfolioStreamClient as n, DEFAULT_RETRY_CONFIG as o, IndexerAccountsApiClient as p, IndexerOracleStreamClient as r, StreamManager as s, IndexerSpotStreamClient as t, IndexerOracleApiClient as u };
|
package/dist/index.cjs
CHANGED
|
@@ -4,12 +4,12 @@ const require_tx = require("./tx-DIg8nbnn.cjs");
|
|
|
4
4
|
const require_exchange = require("./exchange-CTLbPuA7.cjs");
|
|
5
5
|
const require_types = require("./types.cjs");
|
|
6
6
|
const require_errors = require("./errors-CKG7zTvs.cjs");
|
|
7
|
-
const require_stream = require("./stream-
|
|
7
|
+
const require_stream = require("./stream-B2Mi9XL8.cjs");
|
|
8
8
|
const require_msgs = require("./msgs-DNyc0UtV.cjs");
|
|
9
9
|
const require_decimal = require("./decimal-DJMaLHQO.cjs");
|
|
10
10
|
const require_chain = require("./chain-LTb0TjXc.cjs");
|
|
11
11
|
const require_tx$1 = require("./tx-BgpasOOk.cjs");
|
|
12
|
-
const require_indexer = require("./indexer-
|
|
12
|
+
const require_indexer = require("./indexer-pTkAEtBo.cjs");
|
|
13
13
|
const require_utils = require("./utils.cjs");
|
|
14
14
|
exports.ApiError = require_errors.ApiError;
|
|
15
15
|
exports.BroadcastMode = require_query.BroadcastMode;
|
|
@@ -20,6 +20,7 @@ exports.ChainExchangeApiClient = require_chain.ChainExchangeApiClient;
|
|
|
20
20
|
exports.ChainId = require_types.ChainId;
|
|
21
21
|
exports.ChainTendermintApiClient = require_chain.ChainTendermintApiClient;
|
|
22
22
|
exports.ChainTxApiClient = require_chain.ChainTxApiClient;
|
|
23
|
+
exports.DEFAULT_RETRY_CONFIG = require_indexer.DEFAULT_RETRY_CONFIG;
|
|
23
24
|
exports.EvmChainId = require_types.EvmChainId;
|
|
24
25
|
exports.ExecutionType = require_exchange.ExecutionType;
|
|
25
26
|
exports.IndexerAccountsApiClient = require_indexer.IndexerAccountsApiClient;
|
package/dist/index.d.cts
CHANGED
|
@@ -3,9 +3,9 @@ import { D as OrderType, E as OrderMask, I as SignDoc, L as SignMode, O as Marke
|
|
|
3
3
|
import { n as Eip712TypedDataField, t as Eip712TypedData } from "./eip712-88KVCEnw.cjs";
|
|
4
4
|
import { a as TxRaw, c as PaginationOption, i as StdFee, n as CreateTransactionResult, o as Msg, r as SignerDetails, s as Pagination, t as CreateTransactionParams } from "./tx-CCt0zqng.cjs";
|
|
5
5
|
import { ApiError } from "./types.cjs";
|
|
6
|
-
import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-
|
|
6
|
+
import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-ChRmJm8w.cjs";
|
|
7
7
|
import "./msgs.cjs";
|
|
8
8
|
import { a as ChainAuthZApiClient, i as ChainBankApiClient, n as ChainTendermintApiClient, o as ChainAuthApiClient, r as ChainExchangeApiClient, t as ChainTxApiClient } from "./index-BT_zyZW9.cjs";
|
|
9
|
-
import { a as IndexerAccountsStreamClient, c as
|
|
9
|
+
import { a as IndexerAccountsStreamClient, c as IndexerSpotApiClient, d as IndexerDerivativesApiClient, f as IndexerArchiverApiClient, i as IndexerDerivativesStreamClient, l as IndexerPortfolioApiClient, n as IndexerPortfolioStreamClient, o as DEFAULT_RETRY_CONFIG, p as IndexerAccountsApiClient, r as IndexerOracleStreamClient, s as StreamManager, t as IndexerSpotStreamClient, u as IndexerOracleApiClient } from "./index-D9iUJ2dU.cjs";
|
|
10
10
|
import { a as sanitizeBlock, c as toPagination, d as hexToBytes, f as getEip712TypedDataV2, g as getInjectiveAddress, h as getEthereumAddress, i as createWeb3Extension, l as bytesToHex, m as toCosmosSdkDecString, n as createTxBytes, o as sanitizeLatestBlock, p as toChainFormat, r as createTxRawEIP712, s as toPageRequest, t as createTransaction, u as hexToBase64 } from "./index-BPpDV6JA.cjs";
|
|
11
|
-
export { ApiError, BroadcastMode, ChainAuthApiClient, ChainAuthZApiClient, ChainBankApiClient, ChainExchangeApiClient, ChainId, ChainTendermintApiClient, ChainTxApiClient, CreateTransactionParams, CreateTransactionResult, Eip712TypedData, Eip712TypedDataField, EventTypes, EvmChainId, ExecutionType, IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, MarketStatus, Msg, MsgBatchCancelDerivativeOrders, MsgBatchCancelSpotOrders, MsgCancelDerivativeOrder, MsgCancelSpotOrder, MsgCreateDerivativeLimitOrder, MsgCreateDerivativeMarketOrder, MsgCreateSpotLimitOrder, MsgCreateSpotMarketOrder, MsgDeposit, MsgExternalTransfer, MsgIncreasePositionMargin, MsgSend, MsgSubaccountTransfer, MsgWithdraw, OrderMask, OrderSide, OrderType, Pagination, PaginationOption, type SignDoc, SignMode, SignerDetails, StdFee, StreamDisconnectReason, StreamManager, StreamManagerRetryConfig, StreamState, TxRaw, bytesToHex, createTransaction, createTxBytes, createTxRawEIP712, createWeb3Extension, getEip712TypedDataV2, getEthereumAddress, getInjectiveAddress, hexToBase64, hexToBytes, sanitizeBlock, sanitizeLatestBlock, toChainFormat, toCosmosSdkDecString, toPageRequest, toPagination };
|
|
11
|
+
export { ApiError, BroadcastMode, ChainAuthApiClient, ChainAuthZApiClient, ChainBankApiClient, ChainExchangeApiClient, ChainId, ChainTendermintApiClient, ChainTxApiClient, CreateTransactionParams, CreateTransactionResult, DEFAULT_RETRY_CONFIG, Eip712TypedData, Eip712TypedDataField, EventTypes, EvmChainId, ExecutionType, IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, MarketStatus, Msg, MsgBatchCancelDerivativeOrders, MsgBatchCancelSpotOrders, MsgCancelDerivativeOrder, MsgCancelSpotOrder, MsgCreateDerivativeLimitOrder, MsgCreateDerivativeMarketOrder, MsgCreateSpotLimitOrder, MsgCreateSpotMarketOrder, MsgDeposit, MsgExternalTransfer, MsgIncreasePositionMargin, MsgSend, MsgSubaccountTransfer, MsgWithdraw, OrderMask, OrderSide, OrderType, Pagination, PaginationOption, type SignDoc, SignMode, SignerDetails, StdFee, StreamDisconnectReason, StreamManager, StreamManagerRetryConfig, StreamState, TxRaw, bytesToHex, createTransaction, createTxBytes, createTxRawEIP712, createWeb3Extension, getEip712TypedDataV2, getEthereumAddress, getInjectiveAddress, hexToBase64, hexToBytes, sanitizeBlock, sanitizeLatestBlock, toChainFormat, toCosmosSdkDecString, toPageRequest, toPagination };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { B as OrderMask, H as MarketStatus, M as OrderSide, T as SignMode, V as
|
|
|
3
3
|
import { ApiError } from "./types.js";
|
|
4
4
|
import { a as TxRaw, c as PaginationOption, i as StdFee, n as CreateTransactionResult, o as Msg, r as SignerDetails, s as Pagination, t as CreateTransactionParams } from "./tx-BRaw1C6e.js";
|
|
5
5
|
import "./msgs.js";
|
|
6
|
-
import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-
|
|
6
|
+
import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-ChRmJm8w.js";
|
|
7
7
|
import { n as Eip712TypedDataField, t as Eip712TypedData } from "./eip712-88KVCEnw.js";
|
|
8
8
|
import { a as ChainAuthZApiClient, i as ChainBankApiClient, n as ChainTendermintApiClient, o as ChainAuthApiClient, r as ChainExchangeApiClient, t as ChainTxApiClient } from "./index-BHLUinQA.js";
|
|
9
|
-
import { a as IndexerAccountsStreamClient, c as
|
|
9
|
+
import { a as IndexerAccountsStreamClient, c as IndexerSpotApiClient, d as IndexerDerivativesApiClient, f as IndexerArchiverApiClient, i as IndexerDerivativesStreamClient, l as IndexerPortfolioApiClient, n as IndexerPortfolioStreamClient, o as DEFAULT_RETRY_CONFIG, p as IndexerAccountsApiClient, r as IndexerOracleStreamClient, s as StreamManager, t as IndexerSpotStreamClient, u as IndexerOracleApiClient } from "./index-Zb1MmK7L.js";
|
|
10
10
|
import { a as sanitizeBlock, c as toPagination, d as hexToBytes, f as getEip712TypedDataV2, g as getInjectiveAddress, h as getEthereumAddress, i as createWeb3Extension, l as bytesToHex, m as toCosmosSdkDecString, n as createTxBytes, o as sanitizeLatestBlock, p as toChainFormat, r as createTxRawEIP712, s as toPageRequest, t as createTransaction, u as hexToBase64 } from "./index-DfoLUPEo.js";
|
|
11
|
-
export { ApiError, BroadcastMode, ChainAuthApiClient, ChainAuthZApiClient, ChainBankApiClient, ChainExchangeApiClient, ChainId, ChainTendermintApiClient, ChainTxApiClient, CreateTransactionParams, CreateTransactionResult, Eip712TypedData, Eip712TypedDataField, EventTypes, EvmChainId, ExecutionType, IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, MarketStatus, Msg, MsgBatchCancelDerivativeOrders, MsgBatchCancelSpotOrders, MsgCancelDerivativeOrder, MsgCancelSpotOrder, MsgCreateDerivativeLimitOrder, MsgCreateDerivativeMarketOrder, MsgCreateSpotLimitOrder, MsgCreateSpotMarketOrder, MsgDeposit, MsgExternalTransfer, MsgIncreasePositionMargin, MsgSend, MsgSubaccountTransfer, MsgWithdraw, OrderMask, OrderSide, OrderType, Pagination, PaginationOption, type SignDoc, SignMode, SignerDetails, StdFee, StreamDisconnectReason, StreamManager, StreamManagerRetryConfig, StreamState, TxRaw, bytesToHex, createTransaction, createTxBytes, createTxRawEIP712, createWeb3Extension, getEip712TypedDataV2, getEthereumAddress, getInjectiveAddress, hexToBase64, hexToBytes, sanitizeBlock, sanitizeLatestBlock, toChainFormat, toCosmosSdkDecString, toPageRequest, toPagination };
|
|
11
|
+
export { ApiError, BroadcastMode, ChainAuthApiClient, ChainAuthZApiClient, ChainBankApiClient, ChainExchangeApiClient, ChainId, ChainTendermintApiClient, ChainTxApiClient, CreateTransactionParams, CreateTransactionResult, DEFAULT_RETRY_CONFIG, Eip712TypedData, Eip712TypedDataField, EventTypes, EvmChainId, ExecutionType, IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, MarketStatus, Msg, MsgBatchCancelDerivativeOrders, MsgBatchCancelSpotOrders, MsgCancelDerivativeOrder, MsgCancelSpotOrder, MsgCreateDerivativeLimitOrder, MsgCreateDerivativeMarketOrder, MsgCreateSpotLimitOrder, MsgCreateSpotMarketOrder, MsgDeposit, MsgExternalTransfer, MsgIncreasePositionMargin, MsgSend, MsgSubaccountTransfer, MsgWithdraw, OrderMask, OrderSide, OrderType, Pagination, PaginationOption, type SignDoc, SignMode, SignerDetails, StdFee, StreamDisconnectReason, StreamManager, StreamManagerRetryConfig, StreamState, TxRaw, bytesToHex, createTransaction, createTxBytes, createTxRawEIP712, createWeb3Extension, getEip712TypedDataV2, getEthereumAddress, getInjectiveAddress, hexToBase64, hexToBytes, sanitizeBlock, sanitizeLatestBlock, toChainFormat, toCosmosSdkDecString, toPageRequest, toPagination };
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import { u as SignMode } from "./tx-GN0SFql2.js";
|
|
|
3
3
|
import { N as OrderMask, P as OrderType, U as MarketStatus, d as ExecutionType } from "./exchange-BPRx-kFI.js";
|
|
4
4
|
import { ChainId, EvmChainId } from "./types.js";
|
|
5
5
|
import { t as ApiError } from "./errors-MWG_E5zA.js";
|
|
6
|
-
import { n as StreamState, t as StreamDisconnectReason } from "./stream-
|
|
6
|
+
import { n as StreamState, t as StreamDisconnectReason } from "./stream-CbXgyx26.js";
|
|
7
7
|
import { a as MsgDeposit, c as MsgCreateDerivativeMarketOrder, d as MsgCancelDerivativeOrder, f as MsgBatchCancelSpotOrders, i as MsgExternalTransfer, l as MsgCreateDerivativeLimitOrder, m as MsgSend, n as MsgSubaccountTransfer, o as MsgCreateSpotMarketOrder, p as MsgBatchCancelDerivativeOrders, r as MsgIncreasePositionMargin, s as MsgCreateSpotLimitOrder, t as MsgWithdraw, u as MsgCancelSpotOrder } from "./msgs-Bi5b52-R.js";
|
|
8
8
|
import { n as toCosmosSdkDecString, t as toChainFormat } from "./decimal-CIFXn110.js";
|
|
9
9
|
import { a as ChainAuthZApiClient, i as ChainBankApiClient, n as ChainTendermintApiClient, o as ChainAuthApiClient, r as ChainExchangeApiClient, t as ChainTxApiClient } from "./chain-CgjV0b1c.js";
|
|
10
10
|
import { a as sanitizeBlock, c as toPagination, i as createWeb3Extension, n as createTxBytes, o as sanitizeLatestBlock, r as createTxRawEIP712, s as toPageRequest, t as createTransaction } from "./tx-COcDYlg3.js";
|
|
11
|
-
import { a as IndexerAccountsStreamClient, c as
|
|
11
|
+
import { a as IndexerAccountsStreamClient, c as IndexerSpotApiClient, d as IndexerDerivativesApiClient, f as IndexerArchiverApiClient, i as IndexerDerivativesStreamClient, l as IndexerPortfolioApiClient, n as IndexerPortfolioStreamClient, o as DEFAULT_RETRY_CONFIG, p as IndexerAccountsApiClient, r as IndexerOracleStreamClient, s as StreamManager, t as IndexerSpotStreamClient, u as IndexerOracleApiClient } from "./indexer-D_9xZbW-.js";
|
|
12
12
|
import { bytesToHex, getEip712TypedDataV2, getEthereumAddress, getInjectiveAddress, hexToBase64, hexToBytes } from "./utils.js";
|
|
13
|
-
export { ApiError, BroadcastMode, ChainAuthApiClient, ChainAuthZApiClient, ChainBankApiClient, ChainExchangeApiClient, ChainId, ChainTendermintApiClient, ChainTxApiClient, EvmChainId, ExecutionType, IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, MarketStatus, MsgBatchCancelDerivativeOrders, MsgBatchCancelSpotOrders, MsgCancelDerivativeOrder, MsgCancelSpotOrder, MsgCreateDerivativeLimitOrder, MsgCreateDerivativeMarketOrder, MsgCreateSpotLimitOrder, MsgCreateSpotMarketOrder, MsgDeposit, MsgExternalTransfer, MsgIncreasePositionMargin, MsgSend, MsgSubaccountTransfer, MsgWithdraw, OrderMask, OrderSide, OrderType, SignMode, StreamDisconnectReason, StreamManager, StreamState, bytesToHex, createTransaction, createTxBytes, createTxRawEIP712, createWeb3Extension, getEip712TypedDataV2, getEthereumAddress, getInjectiveAddress, hexToBase64, hexToBytes, sanitizeBlock, sanitizeLatestBlock, toChainFormat, toCosmosSdkDecString, toPageRequest, toPagination };
|
|
13
|
+
export { ApiError, BroadcastMode, ChainAuthApiClient, ChainAuthZApiClient, ChainBankApiClient, ChainExchangeApiClient, ChainId, ChainTendermintApiClient, ChainTxApiClient, DEFAULT_RETRY_CONFIG, EvmChainId, ExecutionType, IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, MarketStatus, MsgBatchCancelDerivativeOrders, MsgBatchCancelSpotOrders, MsgCancelDerivativeOrder, MsgCancelSpotOrder, MsgCreateDerivativeLimitOrder, MsgCreateDerivativeMarketOrder, MsgCreateSpotLimitOrder, MsgCreateSpotMarketOrder, MsgDeposit, MsgExternalTransfer, MsgIncreasePositionMargin, MsgSend, MsgSubaccountTransfer, MsgWithdraw, OrderMask, OrderSide, OrderType, SignMode, StreamDisconnectReason, StreamManager, StreamState, bytesToHex, createTransaction, createTxBytes, createTxRawEIP712, createWeb3Extension, getEip712TypedDataV2, getEthereumAddress, getInjectiveAddress, hexToBase64, hexToBytes, sanitizeBlock, sanitizeLatestBlock, toChainFormat, toCosmosSdkDecString, toPageRequest, toPagination };
|
|
@@ -2,7 +2,7 @@ import { credentials, makeGenericClientConstructor, status } from "@grpc/grpc-js
|
|
|
2
2
|
import { t as ApiManager } from "./ApiManager-VsZ_7GMj.js";
|
|
3
3
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
4
4
|
import { EventEmitter } from "eventemitter3";
|
|
5
|
-
import "./stream-
|
|
5
|
+
import "./stream-CbXgyx26.js";
|
|
6
6
|
import { n as getServiceAndMethodFromPath } from "./errors-MWG_E5zA.js";
|
|
7
7
|
// gen/exchange/injective_accounts_rpc.ts
|
|
8
8
|
function createBasePortfolioRequest() {
|
|
@@ -21422,14 +21422,19 @@ var IndexerSpotApiClient = class {
|
|
|
21422
21422
|
}
|
|
21423
21423
|
};
|
|
21424
21424
|
// managers/StreamManager.ts
|
|
21425
|
-
|
|
21425
|
+
/**
|
|
21426
|
+
* What a stream client applies when the caller passes no retryConfig, exported
|
|
21427
|
+
* so a caller can read the policy instead of inferring it from the docs. Frozen
|
|
21428
|
+
* because a spread of it should never be able to change it for everyone else.
|
|
21429
|
+
*/
|
|
21430
|
+
const DEFAULT_RETRY_CONFIG = Object.freeze({
|
|
21426
21431
|
enabled: true,
|
|
21427
21432
|
maxAttempts: 5,
|
|
21428
21433
|
maxDelayMs: 3e4,
|
|
21429
21434
|
backoffMultiplier: 2,
|
|
21430
21435
|
initialDelayMs: 1e3,
|
|
21431
21436
|
stableConnectionMs: 5e3
|
|
21432
|
-
};
|
|
21437
|
+
});
|
|
21433
21438
|
function ifRetryableError(code) {
|
|
21434
21439
|
switch (code) {
|
|
21435
21440
|
case status.UNAVAILABLE:
|
|
@@ -21445,7 +21450,7 @@ function ifRetryableError(code) {
|
|
|
21445
21450
|
var StreamManager = class extends EventEmitter {
|
|
21446
21451
|
streamFactory;
|
|
21447
21452
|
subscription = null;
|
|
21448
|
-
|
|
21453
|
+
currentState = 0;
|
|
21449
21454
|
retryConfig;
|
|
21450
21455
|
streamError = null;
|
|
21451
21456
|
retryAttempts = 0;
|
|
@@ -21461,15 +21466,20 @@ var StreamManager = class extends EventEmitter {
|
|
|
21461
21466
|
...retryConfig
|
|
21462
21467
|
};
|
|
21463
21468
|
}
|
|
21469
|
+
/** Where the stream is in its lifecycle; `Failed` is terminal. */
|
|
21470
|
+
get state() {
|
|
21471
|
+
return this.currentState;
|
|
21472
|
+
}
|
|
21464
21473
|
start() {
|
|
21465
21474
|
if (this.isDestroyed) throw new Error("Cannot start a destroyed stream");
|
|
21475
|
+
if (this.currentState == 6) throw new Error("Cannot start a stream that used up its retries; build a new stream from the client");
|
|
21466
21476
|
if (this.subscription) return;
|
|
21467
21477
|
this.subscription = this.streamFactory();
|
|
21468
21478
|
this.streamError = null;
|
|
21469
|
-
this.updateState(this.
|
|
21470
|
-
if (this.
|
|
21479
|
+
this.updateState(this.currentState == 0 || this.currentState == 4 ? 1 : 3);
|
|
21480
|
+
if (this.currentState == 3 || this.currentState == 1) this.scheduleConnectionStable();
|
|
21471
21481
|
this.subscription.on("data", (data) => {
|
|
21472
|
-
if (this.
|
|
21482
|
+
if (this.currentState == 3 || this.currentState == 1) this.markConnectionStable();
|
|
21473
21483
|
this.emit("data", data);
|
|
21474
21484
|
});
|
|
21475
21485
|
this.subscription.on("error", (error) => {
|
|
@@ -21479,7 +21489,7 @@ var StreamManager = class extends EventEmitter {
|
|
|
21479
21489
|
this.subscription.on("end", () => this.handleReconnection());
|
|
21480
21490
|
}
|
|
21481
21491
|
stop() {
|
|
21482
|
-
if (this.
|
|
21492
|
+
if (this.currentState == 0 || this.currentState == 5 || this.currentState == 6) return;
|
|
21483
21493
|
this.clearStableConnectionTimeout();
|
|
21484
21494
|
this.clearReconnectionTimeout();
|
|
21485
21495
|
this.clearSubscription();
|
|
@@ -21505,14 +21515,14 @@ var StreamManager = class extends EventEmitter {
|
|
|
21505
21515
|
});
|
|
21506
21516
|
}
|
|
21507
21517
|
get isDestroyed() {
|
|
21508
|
-
return this.
|
|
21518
|
+
return this.currentState == 5;
|
|
21509
21519
|
}
|
|
21510
21520
|
updateState(newState) {
|
|
21511
|
-
if (this.
|
|
21512
|
-
this.
|
|
21521
|
+
if (this.currentState === newState) return;
|
|
21522
|
+
this.currentState = newState;
|
|
21513
21523
|
}
|
|
21514
21524
|
handleReconnection() {
|
|
21515
|
-
if (this.
|
|
21525
|
+
if (this.currentState == 4 || this.currentState == 6) return;
|
|
21516
21526
|
this.clearStableConnectionTimeout();
|
|
21517
21527
|
this.clearReconnectionTimeout();
|
|
21518
21528
|
this.clearSubscription();
|
|
@@ -21525,10 +21535,10 @@ var StreamManager = class extends EventEmitter {
|
|
|
21525
21535
|
emittedError.methodName = path.methodName;
|
|
21526
21536
|
this.emit("error", emittedError);
|
|
21527
21537
|
}
|
|
21528
|
-
const reason = streamError ? "stream-error" : "stream-ended";
|
|
21529
21538
|
const retryAttemptsRemaining = this.retryAttempts < this.retryConfig.maxAttempts;
|
|
21530
21539
|
let willRetry = this.retryConfig.enabled && retryAttemptsRemaining;
|
|
21531
21540
|
if (willRetry && streamError) willRetry = ifRetryableError(streamError.code);
|
|
21541
|
+
const reason = !retryAttemptsRemaining ? "max-retries" : streamError ? "stream-error" : "stream-ended";
|
|
21532
21542
|
this.emit("disconnect", {
|
|
21533
21543
|
reason,
|
|
21534
21544
|
willRetry,
|
|
@@ -21544,7 +21554,7 @@ var StreamManager = class extends EventEmitter {
|
|
|
21544
21554
|
});
|
|
21545
21555
|
}
|
|
21546
21556
|
if (!willRetry) {
|
|
21547
|
-
this.updateState(4);
|
|
21557
|
+
this.updateState(retryAttemptsRemaining ? 4 : 6);
|
|
21548
21558
|
return;
|
|
21549
21559
|
}
|
|
21550
21560
|
this.updateState(3);
|
|
@@ -21569,6 +21579,7 @@ var StreamManager = class extends EventEmitter {
|
|
|
21569
21579
|
this.stableConnectionTimeout = null;
|
|
21570
21580
|
}
|
|
21571
21581
|
markConnectionStable() {
|
|
21582
|
+
if (this.currentState != 1 && this.currentState != 3) return;
|
|
21572
21583
|
this.updateState(2);
|
|
21573
21584
|
this.emit("connect", {
|
|
21574
21585
|
isReconnect: this.retryAttempts > 0,
|
|
@@ -21594,106 +21605,116 @@ var StreamManager = class extends EventEmitter {
|
|
|
21594
21605
|
};
|
|
21595
21606
|
// clients/indexer/streamClient/IndexerAccountsStreamClient.ts
|
|
21596
21607
|
var IndexerAccountsStreamClient = class {
|
|
21608
|
+
retryConfig;
|
|
21597
21609
|
client;
|
|
21598
|
-
constructor(address, serverCredentials, options) {
|
|
21610
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21611
|
+
this.retryConfig = retryConfig;
|
|
21599
21612
|
if (!serverCredentials) serverCredentials = credentials.createSsl();
|
|
21600
21613
|
this.client = new InjectiveAccountsRPCClient(address, serverCredentials, options);
|
|
21601
21614
|
}
|
|
21602
21615
|
streamSubaccountBalance(params) {
|
|
21603
21616
|
const streamFactory = () => this.client.streamSubaccountBalance(StreamSubaccountBalanceRequest.create(params));
|
|
21604
|
-
return new StreamManager(streamFactory, InjectiveAccountsRPCService.streamSubaccountBalance.path);
|
|
21617
|
+
return new StreamManager(streamFactory, InjectiveAccountsRPCService.streamSubaccountBalance.path, this.retryConfig);
|
|
21605
21618
|
}
|
|
21606
21619
|
};
|
|
21607
21620
|
// clients/indexer/streamClient/IndexerDerivativesStreamClient.ts
|
|
21608
21621
|
var IndexerDerivativesStreamClient = class {
|
|
21622
|
+
retryConfig;
|
|
21609
21623
|
client;
|
|
21610
|
-
constructor(address, serverCredentials, options) {
|
|
21624
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21625
|
+
this.retryConfig = retryConfig;
|
|
21611
21626
|
if (!serverCredentials) serverCredentials = credentials.createSsl();
|
|
21612
21627
|
this.client = new InjectiveDerivativeExchangeRPCClient(address, serverCredentials, options);
|
|
21613
21628
|
}
|
|
21614
21629
|
streamMarket(params) {
|
|
21615
21630
|
const streamFactory = () => this.client.streamMarket(StreamMarketRequest.create(params));
|
|
21616
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamMarket.path);
|
|
21631
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamMarket.path, this.retryConfig);
|
|
21617
21632
|
}
|
|
21618
21633
|
streamOrderbookV2(params) {
|
|
21619
21634
|
const streamFactory = () => this.client.streamOrderbookV2(StreamOrderbookV2Request$1.create(params));
|
|
21620
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookV2.path);
|
|
21635
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookV2.path, this.retryConfig);
|
|
21621
21636
|
}
|
|
21622
21637
|
streamOrderbookUpdate(params) {
|
|
21623
21638
|
const streamFactory = () => this.client.streamOrderbookUpdate(StreamOrderbookUpdateRequest$1.create(params));
|
|
21624
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookUpdate.path);
|
|
21639
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookUpdate.path, this.retryConfig);
|
|
21625
21640
|
}
|
|
21626
21641
|
streamPositionsV2(params) {
|
|
21627
21642
|
const streamFactory = () => this.client.streamPositionsV2(StreamPositionsV2Request.create(params));
|
|
21628
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamPositionsV2.path);
|
|
21643
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamPositionsV2.path, this.retryConfig);
|
|
21629
21644
|
}
|
|
21630
21645
|
streamTradesV2(params) {
|
|
21631
21646
|
const streamFactory = () => this.client.streamTradesV2(StreamTradesV2Request$1.create(params));
|
|
21632
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamTradesV2.path);
|
|
21647
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamTradesV2.path, this.retryConfig);
|
|
21633
21648
|
}
|
|
21634
21649
|
streamOrders(params) {
|
|
21635
21650
|
const streamFactory = () => this.client.streamOrders(StreamOrdersRequest$1.create(params));
|
|
21636
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrders.path);
|
|
21651
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrders.path, this.retryConfig);
|
|
21637
21652
|
}
|
|
21638
21653
|
streamOrdersHistory(params) {
|
|
21639
21654
|
const streamFactory = () => this.client.streamOrdersHistory(StreamOrdersHistoryRequest$1.create(params));
|
|
21640
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrdersHistory.path);
|
|
21655
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrdersHistory.path, this.retryConfig);
|
|
21641
21656
|
}
|
|
21642
21657
|
};
|
|
21643
21658
|
// clients/indexer/streamClient/IndexerOracleStreamClient.ts
|
|
21644
21659
|
var IndexerOracleStreamClient = class {
|
|
21660
|
+
retryConfig;
|
|
21645
21661
|
client;
|
|
21646
|
-
constructor(address, serverCredentials, options) {
|
|
21662
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21663
|
+
this.retryConfig = retryConfig;
|
|
21647
21664
|
if (!serverCredentials) serverCredentials = credentials.createSsl();
|
|
21648
21665
|
this.client = new InjectiveOracleRPCClient(address, serverCredentials, options);
|
|
21649
21666
|
}
|
|
21650
21667
|
streamPricesByMarkets(params) {
|
|
21651
21668
|
const streamFactory = () => this.client.streamPricesByMarkets(StreamPricesByMarketsRequest.create(params));
|
|
21652
|
-
return new StreamManager(streamFactory, InjectiveOracleRPCService.streamPricesByMarkets.path);
|
|
21669
|
+
return new StreamManager(streamFactory, InjectiveOracleRPCService.streamPricesByMarkets.path, this.retryConfig);
|
|
21653
21670
|
}
|
|
21654
21671
|
};
|
|
21655
21672
|
// clients/indexer/streamClient/IndexerPortfolioStreamClient.ts
|
|
21656
21673
|
var IndexerPortfolioStreamClient = class {
|
|
21674
|
+
retryConfig;
|
|
21657
21675
|
client;
|
|
21658
|
-
constructor(address, serverCredentials, options) {
|
|
21676
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21677
|
+
this.retryConfig = retryConfig;
|
|
21659
21678
|
if (!serverCredentials) serverCredentials = credentials.createSsl();
|
|
21660
21679
|
this.client = new InjectivePortfolioRPCClient(address, serverCredentials, options);
|
|
21661
21680
|
}
|
|
21662
21681
|
streamAccountPortfolio(params) {
|
|
21663
21682
|
const streamFactory = () => this.client.streamAccountPortfolio(StreamAccountPortfolioRequest.create(params));
|
|
21664
|
-
return new StreamManager(streamFactory, InjectivePortfolioRPCService.streamAccountPortfolio.path);
|
|
21683
|
+
return new StreamManager(streamFactory, InjectivePortfolioRPCService.streamAccountPortfolio.path, this.retryConfig);
|
|
21665
21684
|
}
|
|
21666
21685
|
};
|
|
21667
21686
|
// clients/indexer/streamClient/IndexerSpotStreamClient.ts
|
|
21668
21687
|
var IndexerSpotStreamClient = class {
|
|
21688
|
+
retryConfig;
|
|
21669
21689
|
client;
|
|
21670
|
-
constructor(address, serverCredentials, options) {
|
|
21690
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21691
|
+
this.retryConfig = retryConfig;
|
|
21671
21692
|
if (!serverCredentials) serverCredentials = credentials.createSsl();
|
|
21672
21693
|
this.client = new InjectiveSpotExchangeRPCClient(address, serverCredentials, options);
|
|
21673
21694
|
}
|
|
21674
21695
|
streamMarkets(params) {
|
|
21675
21696
|
const streamFactory = () => this.client.streamMarkets(StreamMarketsRequest.create(params));
|
|
21676
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamMarkets.path);
|
|
21697
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamMarkets.path, this.retryConfig);
|
|
21677
21698
|
}
|
|
21678
21699
|
streamOrderbookV2(params) {
|
|
21679
21700
|
const streamFactory = () => this.client.streamOrderbookV2(StreamOrderbookV2Request.create(params));
|
|
21680
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookV2.path);
|
|
21701
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookV2.path, this.retryConfig);
|
|
21681
21702
|
}
|
|
21682
21703
|
streamOrderbookUpdates(params) {
|
|
21683
21704
|
const streamFactory = () => this.client.streamOrderbookUpdate(StreamOrderbookUpdateRequest.create(params));
|
|
21684
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookUpdate.path);
|
|
21705
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookUpdate.path, this.retryConfig);
|
|
21685
21706
|
}
|
|
21686
21707
|
streamOrders(params) {
|
|
21687
21708
|
const streamFactory = () => this.client.streamOrders(StreamOrdersRequest.create(params));
|
|
21688
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrders.path);
|
|
21709
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrders.path, this.retryConfig);
|
|
21689
21710
|
}
|
|
21690
21711
|
streamTradesV2(params) {
|
|
21691
21712
|
const streamFactory = () => this.client.streamTradesV2(StreamTradesV2Request.create(params));
|
|
21692
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamTradesV2.path);
|
|
21713
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamTradesV2.path, this.retryConfig);
|
|
21693
21714
|
}
|
|
21694
21715
|
streamOrdersHistory(params) {
|
|
21695
21716
|
const streamFactory = () => this.client.streamOrdersHistory(StreamOrdersHistoryRequest.create(params));
|
|
21696
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrdersHistory.path);
|
|
21717
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrdersHistory.path, this.retryConfig);
|
|
21697
21718
|
}
|
|
21698
21719
|
};
|
|
21699
|
-
export { IndexerAccountsStreamClient as a,
|
|
21720
|
+
export { IndexerAccountsStreamClient as a, IndexerSpotApiClient as c, IndexerDerivativesApiClient as d, IndexerArchiverApiClient as f, IndexerDerivativesStreamClient as i, IndexerPortfolioApiClient as l, IndexerPortfolioStreamClient as n, DEFAULT_RETRY_CONFIG as o, IndexerAccountsApiClient as p, IndexerOracleStreamClient as r, StreamManager as s, IndexerSpotStreamClient as t, IndexerOracleApiClient as u };
|
|
@@ -2,7 +2,7 @@ let _grpc_grpc_js = require("@grpc/grpc-js");
|
|
|
2
2
|
const require_ApiManager = require("./ApiManager-BcwRSg4p.cjs");
|
|
3
3
|
let _bufbuild_protobuf_wire = require("@bufbuild/protobuf/wire");
|
|
4
4
|
let eventemitter3 = require("eventemitter3");
|
|
5
|
-
require("./stream-
|
|
5
|
+
require("./stream-B2Mi9XL8.cjs");
|
|
6
6
|
const require_errors = require("./errors-CKG7zTvs.cjs");
|
|
7
7
|
// gen/exchange/injective_accounts_rpc.ts
|
|
8
8
|
function createBasePortfolioRequest() {
|
|
@@ -21422,14 +21422,19 @@ var IndexerSpotApiClient = class {
|
|
|
21422
21422
|
}
|
|
21423
21423
|
};
|
|
21424
21424
|
// managers/StreamManager.ts
|
|
21425
|
-
|
|
21425
|
+
/**
|
|
21426
|
+
* What a stream client applies when the caller passes no retryConfig, exported
|
|
21427
|
+
* so a caller can read the policy instead of inferring it from the docs. Frozen
|
|
21428
|
+
* because a spread of it should never be able to change it for everyone else.
|
|
21429
|
+
*/
|
|
21430
|
+
const DEFAULT_RETRY_CONFIG = Object.freeze({
|
|
21426
21431
|
enabled: true,
|
|
21427
21432
|
maxAttempts: 5,
|
|
21428
21433
|
maxDelayMs: 3e4,
|
|
21429
21434
|
backoffMultiplier: 2,
|
|
21430
21435
|
initialDelayMs: 1e3,
|
|
21431
21436
|
stableConnectionMs: 5e3
|
|
21432
|
-
};
|
|
21437
|
+
});
|
|
21433
21438
|
function ifRetryableError(code) {
|
|
21434
21439
|
switch (code) {
|
|
21435
21440
|
case _grpc_grpc_js.status.UNAVAILABLE:
|
|
@@ -21445,7 +21450,7 @@ function ifRetryableError(code) {
|
|
|
21445
21450
|
var StreamManager = class extends eventemitter3.EventEmitter {
|
|
21446
21451
|
streamFactory;
|
|
21447
21452
|
subscription = null;
|
|
21448
|
-
|
|
21453
|
+
currentState = 0;
|
|
21449
21454
|
retryConfig;
|
|
21450
21455
|
streamError = null;
|
|
21451
21456
|
retryAttempts = 0;
|
|
@@ -21461,15 +21466,20 @@ var StreamManager = class extends eventemitter3.EventEmitter {
|
|
|
21461
21466
|
...retryConfig
|
|
21462
21467
|
};
|
|
21463
21468
|
}
|
|
21469
|
+
/** Where the stream is in its lifecycle; `Failed` is terminal. */
|
|
21470
|
+
get state() {
|
|
21471
|
+
return this.currentState;
|
|
21472
|
+
}
|
|
21464
21473
|
start() {
|
|
21465
21474
|
if (this.isDestroyed) throw new Error("Cannot start a destroyed stream");
|
|
21475
|
+
if (this.currentState == 6) throw new Error("Cannot start a stream that used up its retries; build a new stream from the client");
|
|
21466
21476
|
if (this.subscription) return;
|
|
21467
21477
|
this.subscription = this.streamFactory();
|
|
21468
21478
|
this.streamError = null;
|
|
21469
|
-
this.updateState(this.
|
|
21470
|
-
if (this.
|
|
21479
|
+
this.updateState(this.currentState == 0 || this.currentState == 4 ? 1 : 3);
|
|
21480
|
+
if (this.currentState == 3 || this.currentState == 1) this.scheduleConnectionStable();
|
|
21471
21481
|
this.subscription.on("data", (data) => {
|
|
21472
|
-
if (this.
|
|
21482
|
+
if (this.currentState == 3 || this.currentState == 1) this.markConnectionStable();
|
|
21473
21483
|
this.emit("data", data);
|
|
21474
21484
|
});
|
|
21475
21485
|
this.subscription.on("error", (error) => {
|
|
@@ -21479,7 +21489,7 @@ var StreamManager = class extends eventemitter3.EventEmitter {
|
|
|
21479
21489
|
this.subscription.on("end", () => this.handleReconnection());
|
|
21480
21490
|
}
|
|
21481
21491
|
stop() {
|
|
21482
|
-
if (this.
|
|
21492
|
+
if (this.currentState == 0 || this.currentState == 5 || this.currentState == 6) return;
|
|
21483
21493
|
this.clearStableConnectionTimeout();
|
|
21484
21494
|
this.clearReconnectionTimeout();
|
|
21485
21495
|
this.clearSubscription();
|
|
@@ -21505,14 +21515,14 @@ var StreamManager = class extends eventemitter3.EventEmitter {
|
|
|
21505
21515
|
});
|
|
21506
21516
|
}
|
|
21507
21517
|
get isDestroyed() {
|
|
21508
|
-
return this.
|
|
21518
|
+
return this.currentState == 5;
|
|
21509
21519
|
}
|
|
21510
21520
|
updateState(newState) {
|
|
21511
|
-
if (this.
|
|
21512
|
-
this.
|
|
21521
|
+
if (this.currentState === newState) return;
|
|
21522
|
+
this.currentState = newState;
|
|
21513
21523
|
}
|
|
21514
21524
|
handleReconnection() {
|
|
21515
|
-
if (this.
|
|
21525
|
+
if (this.currentState == 4 || this.currentState == 6) return;
|
|
21516
21526
|
this.clearStableConnectionTimeout();
|
|
21517
21527
|
this.clearReconnectionTimeout();
|
|
21518
21528
|
this.clearSubscription();
|
|
@@ -21525,10 +21535,10 @@ var StreamManager = class extends eventemitter3.EventEmitter {
|
|
|
21525
21535
|
emittedError.methodName = path.methodName;
|
|
21526
21536
|
this.emit("error", emittedError);
|
|
21527
21537
|
}
|
|
21528
|
-
const reason = streamError ? "stream-error" : "stream-ended";
|
|
21529
21538
|
const retryAttemptsRemaining = this.retryAttempts < this.retryConfig.maxAttempts;
|
|
21530
21539
|
let willRetry = this.retryConfig.enabled && retryAttemptsRemaining;
|
|
21531
21540
|
if (willRetry && streamError) willRetry = ifRetryableError(streamError.code);
|
|
21541
|
+
const reason = !retryAttemptsRemaining ? "max-retries" : streamError ? "stream-error" : "stream-ended";
|
|
21532
21542
|
this.emit("disconnect", {
|
|
21533
21543
|
reason,
|
|
21534
21544
|
willRetry,
|
|
@@ -21544,7 +21554,7 @@ var StreamManager = class extends eventemitter3.EventEmitter {
|
|
|
21544
21554
|
});
|
|
21545
21555
|
}
|
|
21546
21556
|
if (!willRetry) {
|
|
21547
|
-
this.updateState(4);
|
|
21557
|
+
this.updateState(retryAttemptsRemaining ? 4 : 6);
|
|
21548
21558
|
return;
|
|
21549
21559
|
}
|
|
21550
21560
|
this.updateState(3);
|
|
@@ -21569,6 +21579,7 @@ var StreamManager = class extends eventemitter3.EventEmitter {
|
|
|
21569
21579
|
this.stableConnectionTimeout = null;
|
|
21570
21580
|
}
|
|
21571
21581
|
markConnectionStable() {
|
|
21582
|
+
if (this.currentState != 1 && this.currentState != 3) return;
|
|
21572
21583
|
this.updateState(2);
|
|
21573
21584
|
this.emit("connect", {
|
|
21574
21585
|
isReconnect: this.retryAttempts > 0,
|
|
@@ -21594,108 +21605,124 @@ var StreamManager = class extends eventemitter3.EventEmitter {
|
|
|
21594
21605
|
};
|
|
21595
21606
|
// clients/indexer/streamClient/IndexerAccountsStreamClient.ts
|
|
21596
21607
|
var IndexerAccountsStreamClient = class {
|
|
21608
|
+
retryConfig;
|
|
21597
21609
|
client;
|
|
21598
|
-
constructor(address, serverCredentials, options) {
|
|
21610
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21611
|
+
this.retryConfig = retryConfig;
|
|
21599
21612
|
if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
|
|
21600
21613
|
this.client = new InjectiveAccountsRPCClient(address, serverCredentials, options);
|
|
21601
21614
|
}
|
|
21602
21615
|
streamSubaccountBalance(params) {
|
|
21603
21616
|
const streamFactory = () => this.client.streamSubaccountBalance(StreamSubaccountBalanceRequest.create(params));
|
|
21604
|
-
return new StreamManager(streamFactory, InjectiveAccountsRPCService.streamSubaccountBalance.path);
|
|
21617
|
+
return new StreamManager(streamFactory, InjectiveAccountsRPCService.streamSubaccountBalance.path, this.retryConfig);
|
|
21605
21618
|
}
|
|
21606
21619
|
};
|
|
21607
21620
|
// clients/indexer/streamClient/IndexerDerivativesStreamClient.ts
|
|
21608
21621
|
var IndexerDerivativesStreamClient = class {
|
|
21622
|
+
retryConfig;
|
|
21609
21623
|
client;
|
|
21610
|
-
constructor(address, serverCredentials, options) {
|
|
21624
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21625
|
+
this.retryConfig = retryConfig;
|
|
21611
21626
|
if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
|
|
21612
21627
|
this.client = new InjectiveDerivativeExchangeRPCClient(address, serverCredentials, options);
|
|
21613
21628
|
}
|
|
21614
21629
|
streamMarket(params) {
|
|
21615
21630
|
const streamFactory = () => this.client.streamMarket(StreamMarketRequest.create(params));
|
|
21616
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamMarket.path);
|
|
21631
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamMarket.path, this.retryConfig);
|
|
21617
21632
|
}
|
|
21618
21633
|
streamOrderbookV2(params) {
|
|
21619
21634
|
const streamFactory = () => this.client.streamOrderbookV2(StreamOrderbookV2Request$1.create(params));
|
|
21620
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookV2.path);
|
|
21635
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookV2.path, this.retryConfig);
|
|
21621
21636
|
}
|
|
21622
21637
|
streamOrderbookUpdate(params) {
|
|
21623
21638
|
const streamFactory = () => this.client.streamOrderbookUpdate(StreamOrderbookUpdateRequest$1.create(params));
|
|
21624
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookUpdate.path);
|
|
21639
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookUpdate.path, this.retryConfig);
|
|
21625
21640
|
}
|
|
21626
21641
|
streamPositionsV2(params) {
|
|
21627
21642
|
const streamFactory = () => this.client.streamPositionsV2(StreamPositionsV2Request.create(params));
|
|
21628
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamPositionsV2.path);
|
|
21643
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamPositionsV2.path, this.retryConfig);
|
|
21629
21644
|
}
|
|
21630
21645
|
streamTradesV2(params) {
|
|
21631
21646
|
const streamFactory = () => this.client.streamTradesV2(StreamTradesV2Request$1.create(params));
|
|
21632
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamTradesV2.path);
|
|
21647
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamTradesV2.path, this.retryConfig);
|
|
21633
21648
|
}
|
|
21634
21649
|
streamOrders(params) {
|
|
21635
21650
|
const streamFactory = () => this.client.streamOrders(StreamOrdersRequest$1.create(params));
|
|
21636
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrders.path);
|
|
21651
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrders.path, this.retryConfig);
|
|
21637
21652
|
}
|
|
21638
21653
|
streamOrdersHistory(params) {
|
|
21639
21654
|
const streamFactory = () => this.client.streamOrdersHistory(StreamOrdersHistoryRequest$1.create(params));
|
|
21640
|
-
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrdersHistory.path);
|
|
21655
|
+
return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrdersHistory.path, this.retryConfig);
|
|
21641
21656
|
}
|
|
21642
21657
|
};
|
|
21643
21658
|
// clients/indexer/streamClient/IndexerOracleStreamClient.ts
|
|
21644
21659
|
var IndexerOracleStreamClient = class {
|
|
21660
|
+
retryConfig;
|
|
21645
21661
|
client;
|
|
21646
|
-
constructor(address, serverCredentials, options) {
|
|
21662
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21663
|
+
this.retryConfig = retryConfig;
|
|
21647
21664
|
if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
|
|
21648
21665
|
this.client = new InjectiveOracleRPCClient(address, serverCredentials, options);
|
|
21649
21666
|
}
|
|
21650
21667
|
streamPricesByMarkets(params) {
|
|
21651
21668
|
const streamFactory = () => this.client.streamPricesByMarkets(StreamPricesByMarketsRequest.create(params));
|
|
21652
|
-
return new StreamManager(streamFactory, InjectiveOracleRPCService.streamPricesByMarkets.path);
|
|
21669
|
+
return new StreamManager(streamFactory, InjectiveOracleRPCService.streamPricesByMarkets.path, this.retryConfig);
|
|
21653
21670
|
}
|
|
21654
21671
|
};
|
|
21655
21672
|
// clients/indexer/streamClient/IndexerPortfolioStreamClient.ts
|
|
21656
21673
|
var IndexerPortfolioStreamClient = class {
|
|
21674
|
+
retryConfig;
|
|
21657
21675
|
client;
|
|
21658
|
-
constructor(address, serverCredentials, options) {
|
|
21676
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21677
|
+
this.retryConfig = retryConfig;
|
|
21659
21678
|
if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
|
|
21660
21679
|
this.client = new InjectivePortfolioRPCClient(address, serverCredentials, options);
|
|
21661
21680
|
}
|
|
21662
21681
|
streamAccountPortfolio(params) {
|
|
21663
21682
|
const streamFactory = () => this.client.streamAccountPortfolio(StreamAccountPortfolioRequest.create(params));
|
|
21664
|
-
return new StreamManager(streamFactory, InjectivePortfolioRPCService.streamAccountPortfolio.path);
|
|
21683
|
+
return new StreamManager(streamFactory, InjectivePortfolioRPCService.streamAccountPortfolio.path, this.retryConfig);
|
|
21665
21684
|
}
|
|
21666
21685
|
};
|
|
21667
21686
|
// clients/indexer/streamClient/IndexerSpotStreamClient.ts
|
|
21668
21687
|
var IndexerSpotStreamClient = class {
|
|
21688
|
+
retryConfig;
|
|
21669
21689
|
client;
|
|
21670
|
-
constructor(address, serverCredentials, options) {
|
|
21690
|
+
constructor(address, serverCredentials, options, retryConfig) {
|
|
21691
|
+
this.retryConfig = retryConfig;
|
|
21671
21692
|
if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
|
|
21672
21693
|
this.client = new InjectiveSpotExchangeRPCClient(address, serverCredentials, options);
|
|
21673
21694
|
}
|
|
21674
21695
|
streamMarkets(params) {
|
|
21675
21696
|
const streamFactory = () => this.client.streamMarkets(StreamMarketsRequest.create(params));
|
|
21676
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamMarkets.path);
|
|
21697
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamMarkets.path, this.retryConfig);
|
|
21677
21698
|
}
|
|
21678
21699
|
streamOrderbookV2(params) {
|
|
21679
21700
|
const streamFactory = () => this.client.streamOrderbookV2(StreamOrderbookV2Request.create(params));
|
|
21680
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookV2.path);
|
|
21701
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookV2.path, this.retryConfig);
|
|
21681
21702
|
}
|
|
21682
21703
|
streamOrderbookUpdates(params) {
|
|
21683
21704
|
const streamFactory = () => this.client.streamOrderbookUpdate(StreamOrderbookUpdateRequest.create(params));
|
|
21684
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookUpdate.path);
|
|
21705
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookUpdate.path, this.retryConfig);
|
|
21685
21706
|
}
|
|
21686
21707
|
streamOrders(params) {
|
|
21687
21708
|
const streamFactory = () => this.client.streamOrders(StreamOrdersRequest.create(params));
|
|
21688
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrders.path);
|
|
21709
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrders.path, this.retryConfig);
|
|
21689
21710
|
}
|
|
21690
21711
|
streamTradesV2(params) {
|
|
21691
21712
|
const streamFactory = () => this.client.streamTradesV2(StreamTradesV2Request.create(params));
|
|
21692
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamTradesV2.path);
|
|
21713
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamTradesV2.path, this.retryConfig);
|
|
21693
21714
|
}
|
|
21694
21715
|
streamOrdersHistory(params) {
|
|
21695
21716
|
const streamFactory = () => this.client.streamOrdersHistory(StreamOrdersHistoryRequest.create(params));
|
|
21696
|
-
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrdersHistory.path);
|
|
21717
|
+
return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrdersHistory.path, this.retryConfig);
|
|
21697
21718
|
}
|
|
21698
21719
|
};
|
|
21720
|
+
Object.defineProperty(exports, "DEFAULT_RETRY_CONFIG", {
|
|
21721
|
+
enumerable: true,
|
|
21722
|
+
get: function() {
|
|
21723
|
+
return DEFAULT_RETRY_CONFIG;
|
|
21724
|
+
}
|
|
21725
|
+
});
|
|
21699
21726
|
Object.defineProperty(exports, "IndexerAccountsApiClient", {
|
|
21700
21727
|
enumerable: true,
|
|
21701
21728
|
get: function() {
|
|
@@ -6,6 +6,8 @@ let StreamState = /* @__PURE__ */ function(StreamState) {
|
|
|
6
6
|
StreamState[StreamState["Reconnecting"] = 3] = "Reconnecting";
|
|
7
7
|
StreamState[StreamState["Stopped"] = 4] = "Stopped";
|
|
8
8
|
StreamState[StreamState["Destroyed"] = 5] = "Destroyed";
|
|
9
|
+
/** Retries ran out: this stream is finished and cannot be started again. */
|
|
10
|
+
StreamState[StreamState["Failed"] = 6] = "Failed";
|
|
9
11
|
return StreamState;
|
|
10
12
|
}({});
|
|
11
13
|
let StreamDisconnectReason = /* @__PURE__ */ function(StreamDisconnectReason) {
|
|
@@ -6,6 +6,8 @@ let StreamState = /* @__PURE__ */ function(StreamState) {
|
|
|
6
6
|
StreamState[StreamState["Reconnecting"] = 3] = "Reconnecting";
|
|
7
7
|
StreamState[StreamState["Stopped"] = 4] = "Stopped";
|
|
8
8
|
StreamState[StreamState["Destroyed"] = 5] = "Destroyed";
|
|
9
|
+
/** Retries ran out: this stream is finished and cannot be started again. */
|
|
10
|
+
StreamState[StreamState["Failed"] = 6] = "Failed";
|
|
9
11
|
return StreamState;
|
|
10
12
|
}({});
|
|
11
13
|
let StreamDisconnectReason = /* @__PURE__ */ function(StreamDisconnectReason) {
|
|
@@ -5,7 +5,9 @@ declare enum StreamState {
|
|
|
5
5
|
Connected = 2,
|
|
6
6
|
Reconnecting = 3,
|
|
7
7
|
Stopped = 4,
|
|
8
|
-
Destroyed = 5
|
|
8
|
+
Destroyed = 5,
|
|
9
|
+
/** Retries ran out: this stream is finished and cannot be started again. */
|
|
10
|
+
Failed = 6
|
|
9
11
|
}
|
|
10
12
|
interface StreamManagerRetryConfig {
|
|
11
13
|
enabled: boolean;
|
|
@@ -5,7 +5,9 @@ declare enum StreamState {
|
|
|
5
5
|
Connected = 2,
|
|
6
6
|
Reconnecting = 3,
|
|
7
7
|
Stopped = 4,
|
|
8
|
-
Destroyed = 5
|
|
8
|
+
Destroyed = 5,
|
|
9
|
+
/** Retries ran out: this stream is finished and cannot be started again. */
|
|
10
|
+
Failed = 6
|
|
9
11
|
}
|
|
10
12
|
interface StreamManagerRetryConfig {
|
|
11
13
|
enabled: boolean;
|
package/dist/types.cjs
CHANGED
|
@@ -3,7 +3,7 @@ const require_query = require("./query-L1m6tP9I.cjs");
|
|
|
3
3
|
const require_tx = require("./tx-DIg8nbnn.cjs");
|
|
4
4
|
const require_exchange = require("./exchange-CTLbPuA7.cjs");
|
|
5
5
|
const require_errors = require("./errors-CKG7zTvs.cjs");
|
|
6
|
-
const require_stream = require("./stream-
|
|
6
|
+
const require_stream = require("./stream-B2Mi9XL8.cjs");
|
|
7
7
|
// types/chain/enums.ts
|
|
8
8
|
const ChainId = {
|
|
9
9
|
Mainnet: "injective-1",
|
package/dist/types.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { D as OrderType, E as OrderMask, I as SignDoc, L as SignMode, O as Marke
|
|
|
2
2
|
import { n as Eip712TypedDataField, t as Eip712TypedData } from "./eip712-88KVCEnw.cjs";
|
|
3
3
|
import { a as TxRaw, c as PaginationOption, i as StdFee, n as CreateTransactionResult, o as Msg, r as SignerDetails, s as Pagination, t as CreateTransactionParams } from "./tx-CCt0zqng.cjs";
|
|
4
4
|
import { ServiceError } from "@grpc/grpc-js";
|
|
5
|
-
import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-
|
|
5
|
+
import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-ChRmJm8w.cjs";
|
|
6
6
|
export declare class ApiError extends Error {
|
|
7
7
|
private code;
|
|
8
8
|
private details;
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { B as OrderMask, H as MarketStatus, M as OrderSide, T as SignMode, V as
|
|
|
2
2
|
import { n as Eip712TypedDataField, t as Eip712TypedData } from "./eip712-88KVCEnw.js";
|
|
3
3
|
import { a as TxRaw, c as PaginationOption, i as StdFee, n as CreateTransactionResult, o as Msg, r as SignerDetails, s as Pagination, t as CreateTransactionParams } from "./tx-BRaw1C6e.js";
|
|
4
4
|
import { ServiceError } from "@grpc/grpc-js";
|
|
5
|
-
import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-
|
|
5
|
+
import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-ChRmJm8w.js";
|
|
6
6
|
export declare class ApiError extends Error {
|
|
7
7
|
private code;
|
|
8
8
|
private details;
|
package/dist/types.js
CHANGED
|
@@ -2,7 +2,7 @@ import { t as OrderSide, u as BroadcastMode } from "./query-DGTA8Lz_.js";
|
|
|
2
2
|
import { u as SignMode } from "./tx-GN0SFql2.js";
|
|
3
3
|
import { N as OrderMask, P as OrderType, U as MarketStatus, d as ExecutionType } from "./exchange-BPRx-kFI.js";
|
|
4
4
|
import { t as ApiError } from "./errors-MWG_E5zA.js";
|
|
5
|
-
import { n as StreamState, t as StreamDisconnectReason } from "./stream-
|
|
5
|
+
import { n as StreamState, t as StreamDisconnectReason } from "./stream-CbXgyx26.js";
|
|
6
6
|
// types/chain/enums.ts
|
|
7
7
|
const ChainId = {
|
|
8
8
|
Mainnet: "injective-1",
|
package/package.json
CHANGED