@burningflames/inj-exchange-sdk 0.1.1 → 0.2.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 CHANGED
@@ -6,13 +6,21 @@ the SDK hands you the bytes.
6
6
 
7
7
  ## Why this exists
8
8
 
9
- `@injectivelabs/sdk-ts` talks to the chain and the indexer over **gRPC-web**. In a
10
- browser that is the only option; in a backend it is the wrong one — gRPC-web needs
11
- a proxy hop in front of the node, and it is meaningfully slower than the native
12
- protocol for the number of calls a trading service makes.
13
-
14
- This SDK speaks native gRPC over `@grpc/grpc-js` to the same endpoints, so a
15
- backend calls the chain and the indexer directly with no proxy in the path.
9
+ `@injectivelabs/sdk-ts` reaches the chain and the indexer over **gRPC-web**. That is
10
+ the right choice in a browser and a detour in a backend: every call crosses an
11
+ Envoy hop in front of the node, and the client carries a wallet-and-cosmos platform
12
+ this service never touches — 68 packages, 181 MB installed, 705 ms to import.
13
+
14
+ This SDK speaks native gRPC over `@grpc/grpc-js` to the same endpoints, so nothing
15
+ sits between the backend and the node. It installs 35 packages, 105 MB, and imports
16
+ in 67 ms.
17
+
18
+ The hop is not the bottleneck. Measured against the public endpoints, p50 is within
19
+ 5% and throughput at 64 calls in flight is within 3%, because a call spends its time
20
+ inside the endpoint rather than in the proxy. What native gRPC does buy is the tail:
21
+ on an orderbook read gRPC-web reached 871 ms at p95 where native stayed at 259 ms.
22
+ It also lets the client point at a node's own port 9090 with no proxy to stand up,
23
+ which is the lever that matters.
16
24
 
17
25
  ## Scope
18
26
 
@@ -203,6 +211,30 @@ and need a trigger price.
203
211
 
204
212
  **Deposits cannot target the default subaccount.** Use nonce ≥ 1.
205
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`.
229
+
230
+ Retrying is on by default — five attempts, 1 s doubling to a 30 s cap, and a
231
+ connection that stays up for 5 s resets the counter. Only `UNAVAILABLE`,
232
+ `DEADLINE_EXCEEDED`, `RESOURCE_EXHAUSTED`, `UNKNOWN`, `INTERNAL`, `DATA_LOSS` and
233
+ `ABORTED` are retried; anything else ends the stream and reports it. The policy is
234
+ readable as `DEFAULT_RETRY_CONFIG`, and the stream client's fourth argument
235
+ replaces any part of it — `enabled: false` makes a dropped feed loud instead of
236
+ silent.
237
+
206
238
  ## Markets used for the proofs
207
239
 
208
240
  - INJ/USDC PERP `0x790aee464fbbd02cf4476444554c71d1225f7edfe15e6dc7f874c455fd883d31` — quote USDC `erc20:0xa00C59fF5a080D2b954d0c75e46E22a0c371235a`, initial margin ratio 0.0333 (30x), minimum quantity 0.01 INJ
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_indexer = require("../indexer-DI7-gHOA.cjs");
2
+ const require_indexer = require("../indexer-BryK87hi.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 IndexerPortfolioApiClient, d as IndexerArchiverApiClient, f as IndexerAccountsApiClient, i as IndexerDerivativesStreamClient, l as IndexerOracleApiClient, n as IndexerPortfolioStreamClient, o as StreamManager, r as IndexerOracleStreamClient, s as IndexerSpotApiClient, t as IndexerSpotStreamClient, u as IndexerDerivativesApiClient } from "../index-B3bDzB4S.cjs";
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-CWbL8bgV.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 IndexerPortfolioApiClient, d as IndexerArchiverApiClient, f as IndexerAccountsApiClient, i as IndexerDerivativesStreamClient, l as IndexerOracleApiClient, n as IndexerPortfolioStreamClient, o as StreamManager, r as IndexerOracleStreamClient, s as IndexerSpotApiClient, t as IndexerSpotStreamClient, u as IndexerDerivativesApiClient } from "../index-DcQT-y4U.js";
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-BOvbtaH9.js";
2
+ export { DEFAULT_RETRY_CONFIG, IndexerAccountsApiClient, IndexerAccountsStreamClient, IndexerArchiverApiClient, IndexerDerivativesApiClient, IndexerDerivativesStreamClient, IndexerOracleApiClient, IndexerOracleStreamClient, IndexerPortfolioApiClient, IndexerPortfolioStreamClient, IndexerSpotApiClient, IndexerSpotStreamClient, StreamManager };
@@ -1 +1 @@
1
- export { f as IndexerAccountsApiClient, a as IndexerAccountsStreamClient, d as IndexerArchiverApiClient, u as IndexerDerivativesApiClient, i as IndexerDerivativesStreamClient, l as IndexerOracleApiClient, r as IndexerOracleStreamClient, c as IndexerPortfolioApiClient, n as IndexerPortfolioStreamClient, s as IndexerSpotApiClient, t as IndexerSpotStreamClient, o as StreamManager } from "../indexer-D7XfYsAZ.js";
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-CJOiN_jd.js";
@@ -2106,6 +2106,12 @@ 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;
@@ -2131,13 +2137,15 @@ declare class StreamManager<StreamResponse> extends EventEmitter<EventTypes<Stre
2131
2137
  private calculateBackoff;
2132
2138
  }
2133
2139
  declare class IndexerAccountsStreamClient {
2140
+ private retryConfig?;
2134
2141
  private client;
2135
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2142
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2136
2143
  streamSubaccountBalance(params: Pick<StreamSubaccountBalanceRequest, "subaccountId"> & Partial<StreamSubaccountBalanceRequest>): StreamManager<StreamSubaccountBalanceResponse>;
2137
2144
  }
2138
2145
  declare class IndexerDerivativesStreamClient {
2146
+ private retryConfig?;
2139
2147
  private client;
2140
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2148
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2141
2149
  streamMarket(params?: Partial<StreamMarketRequest>): StreamManager<StreamMarketResponse>;
2142
2150
  streamOrderbookV2(params?: Partial<StreamOrderbookV2Request$1>): StreamManager<StreamOrderbookV2Response$1>;
2143
2151
  streamOrderbookUpdate(params?: Partial<StreamOrderbookUpdateRequest$1>): StreamManager<StreamOrderbookUpdateResponse$1>;
@@ -2147,18 +2155,21 @@ declare class IndexerDerivativesStreamClient {
2147
2155
  streamOrdersHistory(params?: Partial<StreamOrdersHistoryRequest$1>): StreamManager<StreamOrdersHistoryResponse$1>;
2148
2156
  }
2149
2157
  declare class IndexerOracleStreamClient {
2158
+ private retryConfig?;
2150
2159
  private client;
2151
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2160
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2152
2161
  streamPricesByMarkets(params?: Partial<StreamPricesByMarketsRequest>): StreamManager<StreamPricesByMarketsResponse>;
2153
2162
  }
2154
2163
  declare class IndexerPortfolioStreamClient {
2164
+ private retryConfig?;
2155
2165
  private client;
2156
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2166
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2157
2167
  streamAccountPortfolio(params: Partial<StreamAccountPortfolioRequest> & Pick<StreamAccountPortfolioRequest, "accountAddress">): StreamManager<StreamAccountPortfolioResponse>;
2158
2168
  }
2159
2169
  declare class IndexerSpotStreamClient {
2170
+ private retryConfig?;
2160
2171
  private client;
2161
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2172
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2162
2173
  streamMarkets(params?: Partial<StreamMarketsRequest>): StreamManager<StreamMarketsResponse>;
2163
2174
  streamOrderbookV2(params?: Partial<StreamOrderbookV2Request>): StreamManager<StreamOrderbookV2Response>;
2164
2175
  streamOrderbookUpdates(params?: Partial<StreamOrderbookUpdateRequest>): StreamManager<StreamOrderbookUpdateResponse>;
@@ -2166,4 +2177,4 @@ declare class IndexerSpotStreamClient {
2166
2177
  streamTradesV2(params?: Partial<StreamTradesV2Request>): StreamManager<StreamTradesV2Response>;
2167
2178
  streamOrdersHistory(params?: Partial<StreamOrdersHistoryRequest>): StreamManager<StreamOrdersHistoryResponse>;
2168
2179
  }
2169
- export { IndexerAccountsStreamClient as a, IndexerPortfolioApiClient as c, IndexerArchiverApiClient as d, IndexerAccountsApiClient as f, IndexerDerivativesStreamClient as i, IndexerOracleApiClient as l, IndexerPortfolioStreamClient as n, StreamManager as o, IndexerOracleStreamClient as r, IndexerSpotApiClient as s, IndexerSpotStreamClient as t, IndexerDerivativesApiClient as u };
2180
+ 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 };
@@ -2106,6 +2106,12 @@ 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;
@@ -2131,13 +2137,15 @@ declare class StreamManager<StreamResponse> extends EventEmitter<EventTypes<Stre
2131
2137
  private calculateBackoff;
2132
2138
  }
2133
2139
  declare class IndexerAccountsStreamClient {
2140
+ private retryConfig?;
2134
2141
  private client;
2135
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2142
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2136
2143
  streamSubaccountBalance(params: Pick<StreamSubaccountBalanceRequest, "subaccountId"> & Partial<StreamSubaccountBalanceRequest>): StreamManager<StreamSubaccountBalanceResponse>;
2137
2144
  }
2138
2145
  declare class IndexerDerivativesStreamClient {
2146
+ private retryConfig?;
2139
2147
  private client;
2140
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2148
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2141
2149
  streamMarket(params?: Partial<StreamMarketRequest>): StreamManager<StreamMarketResponse>;
2142
2150
  streamOrderbookV2(params?: Partial<StreamOrderbookV2Request$1>): StreamManager<StreamOrderbookV2Response$1>;
2143
2151
  streamOrderbookUpdate(params?: Partial<StreamOrderbookUpdateRequest$1>): StreamManager<StreamOrderbookUpdateResponse$1>;
@@ -2147,18 +2155,21 @@ declare class IndexerDerivativesStreamClient {
2147
2155
  streamOrdersHistory(params?: Partial<StreamOrdersHistoryRequest$1>): StreamManager<StreamOrdersHistoryResponse$1>;
2148
2156
  }
2149
2157
  declare class IndexerOracleStreamClient {
2158
+ private retryConfig?;
2150
2159
  private client;
2151
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2160
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2152
2161
  streamPricesByMarkets(params?: Partial<StreamPricesByMarketsRequest>): StreamManager<StreamPricesByMarketsResponse>;
2153
2162
  }
2154
2163
  declare class IndexerPortfolioStreamClient {
2164
+ private retryConfig?;
2155
2165
  private client;
2156
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2166
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2157
2167
  streamAccountPortfolio(params: Partial<StreamAccountPortfolioRequest> & Pick<StreamAccountPortfolioRequest, "accountAddress">): StreamManager<StreamAccountPortfolioResponse>;
2158
2168
  }
2159
2169
  declare class IndexerSpotStreamClient {
2170
+ private retryConfig?;
2160
2171
  private client;
2161
- constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions);
2172
+ constructor(address: string, serverCredentials?: ChannelCredentials, options?: ChannelOptions, retryConfig?: Partial<StreamManagerRetryConfig>);
2162
2173
  streamMarkets(params?: Partial<StreamMarketsRequest>): StreamManager<StreamMarketsResponse>;
2163
2174
  streamOrderbookV2(params?: Partial<StreamOrderbookV2Request>): StreamManager<StreamOrderbookV2Response>;
2164
2175
  streamOrderbookUpdates(params?: Partial<StreamOrderbookUpdateRequest>): StreamManager<StreamOrderbookUpdateResponse>;
@@ -2166,4 +2177,4 @@ declare class IndexerSpotStreamClient {
2166
2177
  streamTradesV2(params?: Partial<StreamTradesV2Request>): StreamManager<StreamTradesV2Response>;
2167
2178
  streamOrdersHistory(params?: Partial<StreamOrdersHistoryRequest>): StreamManager<StreamOrdersHistoryResponse>;
2168
2179
  }
2169
- export { IndexerAccountsStreamClient as a, IndexerPortfolioApiClient as c, IndexerArchiverApiClient as d, IndexerAccountsApiClient as f, IndexerDerivativesStreamClient as i, IndexerOracleApiClient as l, IndexerPortfolioStreamClient as n, StreamManager as o, IndexerOracleStreamClient as r, IndexerSpotApiClient as s, IndexerSpotStreamClient as t, IndexerDerivativesApiClient as u };
2180
+ 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
@@ -9,7 +9,7 @@ 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-DI7-gHOA.cjs");
12
+ const require_indexer = require("./indexer-BryK87hi.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
@@ -6,6 +6,6 @@ import { ApiError } from "./types.cjs";
6
6
  import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-BgKRWG60.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 IndexerPortfolioApiClient, d as IndexerArchiverApiClient, f as IndexerAccountsApiClient, i as IndexerDerivativesStreamClient, l as IndexerOracleApiClient, n as IndexerPortfolioStreamClient, o as StreamManager, r as IndexerOracleStreamClient, s as IndexerSpotApiClient, t as IndexerSpotStreamClient, u as IndexerDerivativesApiClient } from "./index-B3bDzB4S.cjs";
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-CWbL8bgV.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
@@ -6,6 +6,6 @@ import "./msgs.js";
6
6
  import { i as StreamState, n as StreamDisconnectReason, r as StreamManagerRetryConfig, t as EventTypes } from "./stream-BgKRWG60.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 IndexerPortfolioApiClient, d as IndexerArchiverApiClient, f as IndexerAccountsApiClient, i as IndexerDerivativesStreamClient, l as IndexerOracleApiClient, n as IndexerPortfolioStreamClient, o as StreamManager, r as IndexerOracleStreamClient, s as IndexerSpotApiClient, t as IndexerSpotStreamClient, u as IndexerDerivativesApiClient } from "./index-DcQT-y4U.js";
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-BOvbtaH9.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
@@ -8,6 +8,6 @@ import { a as MsgDeposit, c as MsgCreateDerivativeMarketOrder, d as MsgCancelDer
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 IndexerPortfolioApiClient, d as IndexerArchiverApiClient, f as IndexerAccountsApiClient, i as IndexerDerivativesStreamClient, l as IndexerOracleApiClient, n as IndexerPortfolioStreamClient, o as StreamManager, r as IndexerOracleStreamClient, s as IndexerSpotApiClient, t as IndexerSpotStreamClient, u as IndexerDerivativesApiClient } from "./indexer-D7XfYsAZ.js";
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-CJOiN_jd.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 };
@@ -21422,14 +21422,19 @@ var IndexerSpotApiClient = class {
21422
21422
  }
21423
21423
  };
21424
21424
  // managers/StreamManager.ts
21425
- const DEFAULT_RETRY_CONFIG = {
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:
@@ -21594,108 +21599,124 @@ var StreamManager = class extends eventemitter3.EventEmitter {
21594
21599
  };
21595
21600
  // clients/indexer/streamClient/IndexerAccountsStreamClient.ts
21596
21601
  var IndexerAccountsStreamClient = class {
21602
+ retryConfig;
21597
21603
  client;
21598
- constructor(address, serverCredentials, options) {
21604
+ constructor(address, serverCredentials, options, retryConfig) {
21605
+ this.retryConfig = retryConfig;
21599
21606
  if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
21600
21607
  this.client = new InjectiveAccountsRPCClient(address, serverCredentials, options);
21601
21608
  }
21602
21609
  streamSubaccountBalance(params) {
21603
21610
  const streamFactory = () => this.client.streamSubaccountBalance(StreamSubaccountBalanceRequest.create(params));
21604
- return new StreamManager(streamFactory, InjectiveAccountsRPCService.streamSubaccountBalance.path);
21611
+ return new StreamManager(streamFactory, InjectiveAccountsRPCService.streamSubaccountBalance.path, this.retryConfig);
21605
21612
  }
21606
21613
  };
21607
21614
  // clients/indexer/streamClient/IndexerDerivativesStreamClient.ts
21608
21615
  var IndexerDerivativesStreamClient = class {
21616
+ retryConfig;
21609
21617
  client;
21610
- constructor(address, serverCredentials, options) {
21618
+ constructor(address, serverCredentials, options, retryConfig) {
21619
+ this.retryConfig = retryConfig;
21611
21620
  if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
21612
21621
  this.client = new InjectiveDerivativeExchangeRPCClient(address, serverCredentials, options);
21613
21622
  }
21614
21623
  streamMarket(params) {
21615
21624
  const streamFactory = () => this.client.streamMarket(StreamMarketRequest.create(params));
21616
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamMarket.path);
21625
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamMarket.path, this.retryConfig);
21617
21626
  }
21618
21627
  streamOrderbookV2(params) {
21619
21628
  const streamFactory = () => this.client.streamOrderbookV2(StreamOrderbookV2Request$1.create(params));
21620
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookV2.path);
21629
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookV2.path, this.retryConfig);
21621
21630
  }
21622
21631
  streamOrderbookUpdate(params) {
21623
21632
  const streamFactory = () => this.client.streamOrderbookUpdate(StreamOrderbookUpdateRequest$1.create(params));
21624
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookUpdate.path);
21633
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookUpdate.path, this.retryConfig);
21625
21634
  }
21626
21635
  streamPositionsV2(params) {
21627
21636
  const streamFactory = () => this.client.streamPositionsV2(StreamPositionsV2Request.create(params));
21628
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamPositionsV2.path);
21637
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamPositionsV2.path, this.retryConfig);
21629
21638
  }
21630
21639
  streamTradesV2(params) {
21631
21640
  const streamFactory = () => this.client.streamTradesV2(StreamTradesV2Request$1.create(params));
21632
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamTradesV2.path);
21641
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamTradesV2.path, this.retryConfig);
21633
21642
  }
21634
21643
  streamOrders(params) {
21635
21644
  const streamFactory = () => this.client.streamOrders(StreamOrdersRequest$1.create(params));
21636
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrders.path);
21645
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrders.path, this.retryConfig);
21637
21646
  }
21638
21647
  streamOrdersHistory(params) {
21639
21648
  const streamFactory = () => this.client.streamOrdersHistory(StreamOrdersHistoryRequest$1.create(params));
21640
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrdersHistory.path);
21649
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrdersHistory.path, this.retryConfig);
21641
21650
  }
21642
21651
  };
21643
21652
  // clients/indexer/streamClient/IndexerOracleStreamClient.ts
21644
21653
  var IndexerOracleStreamClient = class {
21654
+ retryConfig;
21645
21655
  client;
21646
- constructor(address, serverCredentials, options) {
21656
+ constructor(address, serverCredentials, options, retryConfig) {
21657
+ this.retryConfig = retryConfig;
21647
21658
  if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
21648
21659
  this.client = new InjectiveOracleRPCClient(address, serverCredentials, options);
21649
21660
  }
21650
21661
  streamPricesByMarkets(params) {
21651
21662
  const streamFactory = () => this.client.streamPricesByMarkets(StreamPricesByMarketsRequest.create(params));
21652
- return new StreamManager(streamFactory, InjectiveOracleRPCService.streamPricesByMarkets.path);
21663
+ return new StreamManager(streamFactory, InjectiveOracleRPCService.streamPricesByMarkets.path, this.retryConfig);
21653
21664
  }
21654
21665
  };
21655
21666
  // clients/indexer/streamClient/IndexerPortfolioStreamClient.ts
21656
21667
  var IndexerPortfolioStreamClient = class {
21668
+ retryConfig;
21657
21669
  client;
21658
- constructor(address, serverCredentials, options) {
21670
+ constructor(address, serverCredentials, options, retryConfig) {
21671
+ this.retryConfig = retryConfig;
21659
21672
  if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
21660
21673
  this.client = new InjectivePortfolioRPCClient(address, serverCredentials, options);
21661
21674
  }
21662
21675
  streamAccountPortfolio(params) {
21663
21676
  const streamFactory = () => this.client.streamAccountPortfolio(StreamAccountPortfolioRequest.create(params));
21664
- return new StreamManager(streamFactory, InjectivePortfolioRPCService.streamAccountPortfolio.path);
21677
+ return new StreamManager(streamFactory, InjectivePortfolioRPCService.streamAccountPortfolio.path, this.retryConfig);
21665
21678
  }
21666
21679
  };
21667
21680
  // clients/indexer/streamClient/IndexerSpotStreamClient.ts
21668
21681
  var IndexerSpotStreamClient = class {
21682
+ retryConfig;
21669
21683
  client;
21670
- constructor(address, serverCredentials, options) {
21684
+ constructor(address, serverCredentials, options, retryConfig) {
21685
+ this.retryConfig = retryConfig;
21671
21686
  if (!serverCredentials) serverCredentials = _grpc_grpc_js.credentials.createSsl();
21672
21687
  this.client = new InjectiveSpotExchangeRPCClient(address, serverCredentials, options);
21673
21688
  }
21674
21689
  streamMarkets(params) {
21675
21690
  const streamFactory = () => this.client.streamMarkets(StreamMarketsRequest.create(params));
21676
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamMarkets.path);
21691
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamMarkets.path, this.retryConfig);
21677
21692
  }
21678
21693
  streamOrderbookV2(params) {
21679
21694
  const streamFactory = () => this.client.streamOrderbookV2(StreamOrderbookV2Request.create(params));
21680
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookV2.path);
21695
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookV2.path, this.retryConfig);
21681
21696
  }
21682
21697
  streamOrderbookUpdates(params) {
21683
21698
  const streamFactory = () => this.client.streamOrderbookUpdate(StreamOrderbookUpdateRequest.create(params));
21684
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookUpdate.path);
21699
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookUpdate.path, this.retryConfig);
21685
21700
  }
21686
21701
  streamOrders(params) {
21687
21702
  const streamFactory = () => this.client.streamOrders(StreamOrdersRequest.create(params));
21688
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrders.path);
21703
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrders.path, this.retryConfig);
21689
21704
  }
21690
21705
  streamTradesV2(params) {
21691
21706
  const streamFactory = () => this.client.streamTradesV2(StreamTradesV2Request.create(params));
21692
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamTradesV2.path);
21707
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamTradesV2.path, this.retryConfig);
21693
21708
  }
21694
21709
  streamOrdersHistory(params) {
21695
21710
  const streamFactory = () => this.client.streamOrdersHistory(StreamOrdersHistoryRequest.create(params));
21696
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrdersHistory.path);
21711
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrdersHistory.path, this.retryConfig);
21697
21712
  }
21698
21713
  };
21714
+ Object.defineProperty(exports, "DEFAULT_RETRY_CONFIG", {
21715
+ enumerable: true,
21716
+ get: function() {
21717
+ return DEFAULT_RETRY_CONFIG;
21718
+ }
21719
+ });
21699
21720
  Object.defineProperty(exports, "IndexerAccountsApiClient", {
21700
21721
  enumerable: true,
21701
21722
  get: function() {
@@ -21422,14 +21422,19 @@ var IndexerSpotApiClient = class {
21422
21422
  }
21423
21423
  };
21424
21424
  // managers/StreamManager.ts
21425
- const DEFAULT_RETRY_CONFIG = {
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:
@@ -21594,106 +21599,116 @@ var StreamManager = class extends EventEmitter {
21594
21599
  };
21595
21600
  // clients/indexer/streamClient/IndexerAccountsStreamClient.ts
21596
21601
  var IndexerAccountsStreamClient = class {
21602
+ retryConfig;
21597
21603
  client;
21598
- constructor(address, serverCredentials, options) {
21604
+ constructor(address, serverCredentials, options, retryConfig) {
21605
+ this.retryConfig = retryConfig;
21599
21606
  if (!serverCredentials) serverCredentials = credentials.createSsl();
21600
21607
  this.client = new InjectiveAccountsRPCClient(address, serverCredentials, options);
21601
21608
  }
21602
21609
  streamSubaccountBalance(params) {
21603
21610
  const streamFactory = () => this.client.streamSubaccountBalance(StreamSubaccountBalanceRequest.create(params));
21604
- return new StreamManager(streamFactory, InjectiveAccountsRPCService.streamSubaccountBalance.path);
21611
+ return new StreamManager(streamFactory, InjectiveAccountsRPCService.streamSubaccountBalance.path, this.retryConfig);
21605
21612
  }
21606
21613
  };
21607
21614
  // clients/indexer/streamClient/IndexerDerivativesStreamClient.ts
21608
21615
  var IndexerDerivativesStreamClient = class {
21616
+ retryConfig;
21609
21617
  client;
21610
- constructor(address, serverCredentials, options) {
21618
+ constructor(address, serverCredentials, options, retryConfig) {
21619
+ this.retryConfig = retryConfig;
21611
21620
  if (!serverCredentials) serverCredentials = credentials.createSsl();
21612
21621
  this.client = new InjectiveDerivativeExchangeRPCClient(address, serverCredentials, options);
21613
21622
  }
21614
21623
  streamMarket(params) {
21615
21624
  const streamFactory = () => this.client.streamMarket(StreamMarketRequest.create(params));
21616
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamMarket.path);
21625
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamMarket.path, this.retryConfig);
21617
21626
  }
21618
21627
  streamOrderbookV2(params) {
21619
21628
  const streamFactory = () => this.client.streamOrderbookV2(StreamOrderbookV2Request$1.create(params));
21620
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookV2.path);
21629
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookV2.path, this.retryConfig);
21621
21630
  }
21622
21631
  streamOrderbookUpdate(params) {
21623
21632
  const streamFactory = () => this.client.streamOrderbookUpdate(StreamOrderbookUpdateRequest$1.create(params));
21624
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookUpdate.path);
21633
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrderbookUpdate.path, this.retryConfig);
21625
21634
  }
21626
21635
  streamPositionsV2(params) {
21627
21636
  const streamFactory = () => this.client.streamPositionsV2(StreamPositionsV2Request.create(params));
21628
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamPositionsV2.path);
21637
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamPositionsV2.path, this.retryConfig);
21629
21638
  }
21630
21639
  streamTradesV2(params) {
21631
21640
  const streamFactory = () => this.client.streamTradesV2(StreamTradesV2Request$1.create(params));
21632
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamTradesV2.path);
21641
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamTradesV2.path, this.retryConfig);
21633
21642
  }
21634
21643
  streamOrders(params) {
21635
21644
  const streamFactory = () => this.client.streamOrders(StreamOrdersRequest$1.create(params));
21636
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrders.path);
21645
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrders.path, this.retryConfig);
21637
21646
  }
21638
21647
  streamOrdersHistory(params) {
21639
21648
  const streamFactory = () => this.client.streamOrdersHistory(StreamOrdersHistoryRequest$1.create(params));
21640
- return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrdersHistory.path);
21649
+ return new StreamManager(streamFactory, InjectiveDerivativeExchangeRPCService.streamOrdersHistory.path, this.retryConfig);
21641
21650
  }
21642
21651
  };
21643
21652
  // clients/indexer/streamClient/IndexerOracleStreamClient.ts
21644
21653
  var IndexerOracleStreamClient = class {
21654
+ retryConfig;
21645
21655
  client;
21646
- constructor(address, serverCredentials, options) {
21656
+ constructor(address, serverCredentials, options, retryConfig) {
21657
+ this.retryConfig = retryConfig;
21647
21658
  if (!serverCredentials) serverCredentials = credentials.createSsl();
21648
21659
  this.client = new InjectiveOracleRPCClient(address, serverCredentials, options);
21649
21660
  }
21650
21661
  streamPricesByMarkets(params) {
21651
21662
  const streamFactory = () => this.client.streamPricesByMarkets(StreamPricesByMarketsRequest.create(params));
21652
- return new StreamManager(streamFactory, InjectiveOracleRPCService.streamPricesByMarkets.path);
21663
+ return new StreamManager(streamFactory, InjectiveOracleRPCService.streamPricesByMarkets.path, this.retryConfig);
21653
21664
  }
21654
21665
  };
21655
21666
  // clients/indexer/streamClient/IndexerPortfolioStreamClient.ts
21656
21667
  var IndexerPortfolioStreamClient = class {
21668
+ retryConfig;
21657
21669
  client;
21658
- constructor(address, serverCredentials, options) {
21670
+ constructor(address, serverCredentials, options, retryConfig) {
21671
+ this.retryConfig = retryConfig;
21659
21672
  if (!serverCredentials) serverCredentials = credentials.createSsl();
21660
21673
  this.client = new InjectivePortfolioRPCClient(address, serverCredentials, options);
21661
21674
  }
21662
21675
  streamAccountPortfolio(params) {
21663
21676
  const streamFactory = () => this.client.streamAccountPortfolio(StreamAccountPortfolioRequest.create(params));
21664
- return new StreamManager(streamFactory, InjectivePortfolioRPCService.streamAccountPortfolio.path);
21677
+ return new StreamManager(streamFactory, InjectivePortfolioRPCService.streamAccountPortfolio.path, this.retryConfig);
21665
21678
  }
21666
21679
  };
21667
21680
  // clients/indexer/streamClient/IndexerSpotStreamClient.ts
21668
21681
  var IndexerSpotStreamClient = class {
21682
+ retryConfig;
21669
21683
  client;
21670
- constructor(address, serverCredentials, options) {
21684
+ constructor(address, serverCredentials, options, retryConfig) {
21685
+ this.retryConfig = retryConfig;
21671
21686
  if (!serverCredentials) serverCredentials = credentials.createSsl();
21672
21687
  this.client = new InjectiveSpotExchangeRPCClient(address, serverCredentials, options);
21673
21688
  }
21674
21689
  streamMarkets(params) {
21675
21690
  const streamFactory = () => this.client.streamMarkets(StreamMarketsRequest.create(params));
21676
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamMarkets.path);
21691
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamMarkets.path, this.retryConfig);
21677
21692
  }
21678
21693
  streamOrderbookV2(params) {
21679
21694
  const streamFactory = () => this.client.streamOrderbookV2(StreamOrderbookV2Request.create(params));
21680
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookV2.path);
21695
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookV2.path, this.retryConfig);
21681
21696
  }
21682
21697
  streamOrderbookUpdates(params) {
21683
21698
  const streamFactory = () => this.client.streamOrderbookUpdate(StreamOrderbookUpdateRequest.create(params));
21684
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookUpdate.path);
21699
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrderbookUpdate.path, this.retryConfig);
21685
21700
  }
21686
21701
  streamOrders(params) {
21687
21702
  const streamFactory = () => this.client.streamOrders(StreamOrdersRequest.create(params));
21688
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrders.path);
21703
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrders.path, this.retryConfig);
21689
21704
  }
21690
21705
  streamTradesV2(params) {
21691
21706
  const streamFactory = () => this.client.streamTradesV2(StreamTradesV2Request.create(params));
21692
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamTradesV2.path);
21707
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamTradesV2.path, this.retryConfig);
21693
21708
  }
21694
21709
  streamOrdersHistory(params) {
21695
21710
  const streamFactory = () => this.client.streamOrdersHistory(StreamOrdersHistoryRequest.create(params));
21696
- return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrdersHistory.path);
21711
+ return new StreamManager(streamFactory, InjectiveSpotExchangeRPCService.streamOrdersHistory.path, this.retryConfig);
21697
21712
  }
21698
21713
  };
21699
- export { IndexerAccountsStreamClient as a, IndexerPortfolioApiClient as c, IndexerArchiverApiClient as d, IndexerAccountsApiClient as f, IndexerDerivativesStreamClient as i, IndexerOracleApiClient as l, IndexerPortfolioStreamClient as n, StreamManager as o, IndexerOracleStreamClient as r, IndexerSpotApiClient as s, IndexerSpotStreamClient as t, IndexerDerivativesApiClient as u };
21714
+ 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burningflames/inj-exchange-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Trading messages, query clients and EIP-712 transaction building for the Injective exchange module",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",