@injectivelabs/sdk-ts 1.17.2-alpha.8 → 1.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/cjs/{AbacusGrpcApi-vcp-9fNL.cjs → AbacusGrpcApi-DXSuhb6R.cjs} +1 -1
  2. package/dist/cjs/{BaseGrpcConsumer-DUwCngI6.cjs → BaseGrpcConsumer-EtEQfhmo.cjs} +47 -6
  3. package/dist/{esm/BaseGrpcConsumer-BbvNzhrS.d.ts → cjs/BaseGrpcConsumer-Vvj4lzyS.d.cts} +14 -2
  4. package/dist/cjs/{BaseIndexerGrpcConsumer-BGLVnJtw.cjs → BaseIndexerGrpcConsumer-CW1kTn-_.cjs} +1 -1
  5. package/dist/cjs/{ChainGrpcExchangeApi-VVmtAGW5.cjs → ChainGrpcExchangeApi-CF9ATYqN.cjs} +3 -3
  6. package/dist/cjs/{ChainRestTendermintApi-CW49Mtmx.cjs → ChainRestTendermintApi-vL0g-BF-.cjs} +2 -2
  7. package/dist/cjs/{DirectEthSecp256k1Wallet-Chd5kOwo.cjs → DirectEthSecp256k1Wallet-CIdxvYjL.cjs} +2 -2
  8. package/dist/cjs/{ExecArgNeptuneWithdraw-BqrKFTTp.cjs → ExecArgNeptuneWithdraw-C-NQ72VM.cjs} +6 -6
  9. package/dist/cjs/{IndexerGrpcWeb3GwApi-RL0sxzNw.cjs → IndexerGrpcWeb3GwApi-C7kkr4Il.cjs} +7 -7
  10. package/dist/cjs/{MsgBase-BJ1-Qh5c.cjs → MsgBase-DqOmzCyS.cjs} +1 -0
  11. package/dist/cjs/{MsgSetDenomMetadata-BzFtwh7v.cjs → MsgSetDenomMetadata-CKvxIq_t.cjs} +26 -15
  12. package/dist/cjs/{OLPGrpcApi-B9O9HcGv.cjs → OLPGrpcApi-BCCb6fBZ.cjs} +1 -1
  13. package/dist/cjs/{QueryTradingStrategyContractTotalStrategies-t-5fuyN_.cjs → QueryTradingStrategyContractTotalStrategies-Ayot_18R.cjs} +3 -3
  14. package/dist/cjs/{IndexerGrpcAccountPortfolioStream-CGaNa5R7.cjs → StreamManagerV2-igv0mn2I.cjs} +1375 -378
  15. package/dist/cjs/{accounts-DC6uKJZm.cjs → accounts-CHKUxDIf.cjs} +6 -6
  16. package/dist/{esm/any_pb-B1YYUSUf.d.ts → cjs/any_pb-CutLnOUR.d.cts} +2 -2
  17. package/dist/cjs/{chain-CdI97AzZ.cjs → chain-CGHrf7gg.cjs} +4 -4
  18. package/dist/cjs/client/abacus.cjs +2 -2
  19. package/dist/cjs/client/abacus.d.cts +2 -2
  20. package/dist/cjs/client/chain.cjs +5 -5
  21. package/dist/cjs/client/chain.d.cts +9 -9
  22. package/dist/cjs/client/indexer.cjs +74 -60
  23. package/dist/cjs/client/indexer.d.cts +10 -10
  24. package/dist/cjs/client/olp.cjs +3 -3
  25. package/dist/cjs/client/olp.d.cts +2 -2
  26. package/dist/cjs/client/wasm.cjs +8 -8
  27. package/dist/cjs/client/wasm.d.cts +2 -2
  28. package/dist/cjs/core/accounts.cjs +3 -3
  29. package/dist/cjs/core/accounts.d.cts +9 -9
  30. package/dist/cjs/core/modules.cjs +11 -11
  31. package/dist/cjs/core/modules.d.cts +9 -9
  32. package/dist/cjs/core/tx.cjs +8 -8
  33. package/dist/cjs/core/tx.d.cts +9 -9
  34. package/dist/cjs/cosmjs.cjs +9 -9
  35. package/dist/cjs/cosmjs.d.cts +3 -3
  36. package/dist/cjs/exports.cjs +9 -9
  37. package/dist/cjs/exports.d.cts +3 -3
  38. package/dist/cjs/{index-Cc5Q73-y.d.cts → index-CGvISJoE.d.cts} +1 -1
  39. package/dist/cjs/{index-CKBod1ba.d.cts → index-CO3Y9drx.d.cts} +4 -3
  40. package/dist/cjs/{index-Cc4mqAsR.d.cts → index-D6ubyMlR.d.cts} +1 -1
  41. package/dist/{esm/index-DdGVE3_u.d.ts → cjs/index-DWbxb1AB.d.cts} +7 -13
  42. package/dist/cjs/{index-9KV6P3U_.d.cts → index-DemZnO3c.d.cts} +986 -292
  43. package/dist/cjs/{index-Cqfc1ppG.d.cts → index-DjRtDAy5.d.cts} +241 -19
  44. package/dist/cjs/{index-B19YRG03.d.cts → index-lRWP4rKg.d.cts} +1 -1
  45. package/dist/cjs/index.cjs +96 -72
  46. package/dist/cjs/index.d.cts +10 -10
  47. package/dist/cjs/{service-Do5zpuEu.cjs → service-BCLvTVy_.cjs} +2 -2
  48. package/dist/cjs/service.cjs +3 -3
  49. package/dist/cjs/service.d.cts +4 -4
  50. package/dist/cjs/{tx-D51SCHxX.cjs → tx-VwbP3UdI.cjs} +6 -6
  51. package/dist/cjs/{tx_pb-tECSPcSB.d.cts → tx_pb-D-cNmrlO.d.cts} +4 -3
  52. package/dist/cjs/{types-NFV4P_J_.cjs → types-BTuy007B.cjs} +135 -7
  53. package/dist/cjs/types.cjs +7 -1
  54. package/dist/cjs/types.d.cts +4 -4
  55. package/dist/cjs/{utils-CaAHoOvO.cjs → utils-CDl812vv.cjs} +158 -88
  56. package/dist/cjs/utils.cjs +5 -1
  57. package/dist/cjs/utils.d.cts +10 -10
  58. package/dist/esm/{AbacusGrpcApi-CXaVHTrN.js → AbacusGrpcApi-Ce1hRKuD.js} +1 -1
  59. package/dist/{cjs/BaseGrpcConsumer-PDufF0fz.d.cts → esm/BaseGrpcConsumer-6x4RlZ16.d.ts} +14 -2
  60. package/dist/esm/{BaseGrpcConsumer-DptVGP0n.js → BaseGrpcConsumer-BTWyD665.js} +48 -7
  61. package/dist/esm/{BaseIndexerGrpcConsumer-CjpUoGXy.js → BaseIndexerGrpcConsumer-BTZzA_Eg.js} +1 -1
  62. package/dist/esm/{ChainGrpcExchangeApi-CDMDxAJf.js → ChainGrpcExchangeApi-DqdCst2Z.js} +3 -3
  63. package/dist/esm/{ChainRestTendermintApi-Cy7hYJYp.js → ChainRestTendermintApi-BT_yOkAV.js} +2 -2
  64. package/dist/esm/{DirectEthSecp256k1Wallet-VC6TDitT.js → DirectEthSecp256k1Wallet-BqxC1b40.js} +2 -2
  65. package/dist/esm/{ExecArgNeptuneWithdraw-yQxlQZWQ.js → ExecArgNeptuneWithdraw-uLf3HttI.js} +6 -6
  66. package/dist/esm/{IndexerGrpcWeb3GwApi-BngLjriD.js → IndexerGrpcWeb3GwApi-B2mgt9tE.js} +7 -7
  67. package/dist/esm/{MsgBase-aKq3ln6R.js → MsgBase-BkRgVbdY.js} +1 -0
  68. package/dist/esm/{MsgSetDenomMetadata-CTc1ec1M.js → MsgSetDenomMetadata-CXgkQ3LF.js} +26 -15
  69. package/dist/esm/{OLPGrpcApi-CMwW7LXZ.js → OLPGrpcApi-DUCfcca_.js} +1 -1
  70. package/dist/esm/{QueryTradingStrategyContractTotalStrategies-DnsH6JLf.js → QueryTradingStrategyContractTotalStrategies-CZWdw3BE.js} +3 -3
  71. package/dist/esm/{IndexerGrpcAccountPortfolioStream-BOLdMeVd.js → StreamManagerV2-B9xiJYLj.js} +1116 -203
  72. package/dist/esm/{accounts-DXee44Zk.js → accounts-C5HEaz0B.js} +6 -6
  73. package/dist/{cjs/any_pb-CP-3DVyl.d.cts → esm/any_pb-DBt7qvTr.d.ts} +2 -2
  74. package/dist/esm/{chain-BquCFi0h.js → chain-CHX5uSpc.js} +4 -4
  75. package/dist/esm/client/abacus.d.ts +2 -2
  76. package/dist/esm/client/abacus.js +2 -2
  77. package/dist/esm/client/chain.d.ts +9 -9
  78. package/dist/esm/client/chain.js +5 -5
  79. package/dist/esm/client/indexer.d.ts +10 -10
  80. package/dist/esm/client/indexer.js +7 -7
  81. package/dist/esm/client/olp.d.ts +2 -2
  82. package/dist/esm/client/olp.js +3 -3
  83. package/dist/esm/client/wasm.d.ts +2 -2
  84. package/dist/esm/client/wasm.js +8 -8
  85. package/dist/esm/core/accounts.d.ts +9 -9
  86. package/dist/esm/core/accounts.js +3 -3
  87. package/dist/esm/core/modules.d.ts +9 -9
  88. package/dist/esm/core/modules.js +11 -11
  89. package/dist/esm/core/tx.d.ts +9 -9
  90. package/dist/esm/core/tx.js +8 -8
  91. package/dist/esm/cosmjs.d.ts +3 -3
  92. package/dist/esm/cosmjs.js +9 -9
  93. package/dist/esm/exports.d.ts +3 -3
  94. package/dist/esm/exports.js +9 -9
  95. package/dist/esm/{index-BOKuUpVZ.d.ts → index--sg5xbEP.d.ts} +1 -1
  96. package/dist/esm/{index-B1R417vW.d.ts → index-B-SD0p02.d.ts} +241 -19
  97. package/dist/esm/{index-qFCOVI7n.d.ts → index-BJQt8IpY.d.ts} +1 -1
  98. package/dist/esm/{index-DS6aJrL5.d.ts → index-C_3bL-y4.d.ts} +1 -1
  99. package/dist/esm/{index-CIU3qLo9.d.ts → index-Ch477yfL.d.ts} +1001 -307
  100. package/dist/esm/{index-aNMYd-s0.d.ts → index-DOyiZiUK.d.ts} +4 -3
  101. package/dist/{cjs/index-D4uWOVE5.d.cts → esm/index-Dn4OxoMy.d.ts} +7 -13
  102. package/dist/esm/index.d.ts +10 -10
  103. package/dist/esm/index.js +19 -19
  104. package/dist/esm/{service-DYSaTvVz.js → service-CnqMmybI.js} +2 -2
  105. package/dist/esm/service.d.ts +4 -4
  106. package/dist/esm/service.js +3 -3
  107. package/dist/esm/{tx-B9VusHOP.js → tx-DsGG15fH.js} +6 -6
  108. package/dist/esm/{tx_pb-TiSRD5ay.d.ts → tx_pb-zz4o4hHG.d.ts} +4 -3
  109. package/dist/esm/types-68OuBiEQ.js +162 -0
  110. package/dist/esm/types.d.ts +4 -4
  111. package/dist/esm/types.js +2 -2
  112. package/dist/esm/{utils-DlnuXIe8.js → utils-BFBu_LnJ.js} +135 -89
  113. package/dist/esm/utils.d.ts +10 -10
  114. package/dist/esm/utils.js +2 -2
  115. package/package.json +11 -13
  116. package/dist/esm/types-Cq0sRR6y.js +0 -70
@@ -1,14 +1,13 @@
1
1
  const require_chunk = require('./chunk-CbDLau6x.cjs');
2
- const require_utils = require('./utils-CaAHoOvO.cjs');
2
+ const require_utils = require('./utils-CDl812vv.cjs');
3
3
  const require_defineProperty = require('./defineProperty-dyr5BsvG.cjs');
4
- const require_BaseGrpcConsumer = require('./BaseGrpcConsumer-DUwCngI6.cjs');
5
- const require_BaseIndexerGrpcConsumer = require('./BaseIndexerGrpcConsumer-BGLVnJtw.cjs');
4
+ const require_BaseGrpcConsumer = require('./BaseGrpcConsumer-EtEQfhmo.cjs');
5
+ const require_BaseIndexerGrpcConsumer = require('./BaseIndexerGrpcConsumer-CW1kTn-_.cjs');
6
6
  const require_BaseRestConsumer = require('./BaseRestConsumer-uSzCOit7.cjs');
7
- const require_IndexerGrpcWeb3GwApi = require('./IndexerGrpcWeb3GwApi-RL0sxzNw.cjs');
8
- const require_types = require('./types-NFV4P_J_.cjs');
7
+ const require_IndexerGrpcWeb3GwApi = require('./IndexerGrpcWeb3GwApi-C7kkr4Il.cjs');
8
+ const require_types = require('./types-BTuy007B.cjs');
9
9
  let __injectivelabs_utils = require("@injectivelabs/utils");
10
10
  let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
11
- let __injectivelabs_ts_types = require("@injectivelabs/ts-types");
12
11
  let __injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb_client = require("@injectivelabs/mito-proto-ts-v2/generated/goadesign_goagen_mito_api_pb.client");
13
12
  let __injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb = require("@injectivelabs/mito-proto-ts-v2/generated/goadesign_goagen_mito_api_pb");
14
13
  __injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb = require_chunk.__toESM(__injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb);
@@ -54,6 +53,7 @@ let __injectivelabs_indexer_proto_ts_v2_generated_injective_portfolio_rpc_pb_cli
54
53
  let __injectivelabs_indexer_proto_ts_v2_generated_injective_insurance_rpc_pb = require("@injectivelabs/indexer-proto-ts-v2/generated/injective_insurance_rpc_pb");
55
54
  __injectivelabs_indexer_proto_ts_v2_generated_injective_insurance_rpc_pb = require_chunk.__toESM(__injectivelabs_indexer_proto_ts_v2_generated_injective_insurance_rpc_pb);
56
55
  let __injectivelabs_indexer_proto_ts_v2_generated_injective_insurance_rpc_pb_client = require("@injectivelabs/indexer-proto-ts-v2/generated/injective_insurance_rpc_pb.client");
56
+ let eventemitter3 = require("eventemitter3");
57
57
 
58
58
  //#region src/client/indexer/transformers/IndexerCommonTransformer.ts
59
59
  var IndexerCommonTransformer = class {
@@ -145,7 +145,7 @@ var IndexerGrpcMitoTransformer = class IndexerGrpcMitoTransformer {
145
145
  static portfolioResponseToPortfolio(portfolio) {
146
146
  return {
147
147
  pnl: portfolio.pnl,
148
- totalValue: typeof portfolio.totalValue === "bigint" ? Number(portfolio.totalValue) : portfolio.totalValue,
148
+ totalValue: require_utils.bigIntToNumber(portfolio.totalValue),
149
149
  updatedAt: Number(portfolio.pnlUpdatedAt),
150
150
  totalValueChartList: portfolio.totalValueChart.map(IndexerGrpcMitoTransformer.mitoPriceSnapshotToPriceSnapshot),
151
151
  pnlChartList: portfolio.pnlChart.map(IndexerGrpcMitoTransformer.mitoPriceSnapshotToPriceSnapshot)
@@ -154,7 +154,7 @@ var IndexerGrpcMitoTransformer = class IndexerGrpcMitoTransformer {
154
154
  static leaderboardResponseToLeaderboard(leaderboard) {
155
155
  return {
156
156
  epochId: leaderboard.epochId,
157
- snapshotBlock: typeof leaderboard.snapshotBlock === "bigint" ? leaderboard.snapshotBlock.toString() : leaderboard.snapshotBlock,
157
+ snapshotBlock: require_utils.bigIntToString(leaderboard.snapshotBlock),
158
158
  updatedAt: Number(leaderboard.updatedAt),
159
159
  entriesList: leaderboard.entries.map((entry) => ({
160
160
  address: entry.address,
@@ -245,25 +245,25 @@ var IndexerGrpcMitoTransformer = class IndexerGrpcMitoTransformer {
245
245
  stakedAmount: holder.stakedAmount,
246
246
  holderAddress: holder.holderAddress,
247
247
  lpAmountPercentage: holder.lpAmountPercentage,
248
- redemptionLockTime: typeof holder.redemptionLockTime === "bigint" ? holder.redemptionLockTime.toString() : holder.redemptionLockTime,
248
+ redemptionLockTime: require_utils.bigIntToString(holder.redemptionLockTime),
249
249
  updatedAt: Number(holder.updatedAt)
250
250
  };
251
251
  }
252
252
  static mitoMissionToMission(mission) {
253
253
  return {
254
254
  id: mission.id,
255
- points: typeof mission.points === "bigint" ? mission.points.toString() : mission.points,
255
+ points: require_utils.bigIntToString(mission.points),
256
256
  progress: mission.progress,
257
257
  expected: mission.expected,
258
258
  completed: mission.completed,
259
- accruedPoints: typeof mission.accruedPoints === "bigint" ? mission.accruedPoints.toString() : mission.accruedPoints,
259
+ accruedPoints: require_utils.bigIntToString(mission.accruedPoints),
260
260
  updatedAt: Number(mission.updatedAt)
261
261
  };
262
262
  }
263
263
  static mitoMissionLeaderboardEntryToMissionLeaderboardEntry(entry) {
264
264
  return {
265
265
  address: entry.address,
266
- accruedPoints: typeof entry.accruedPoints === "bigint" ? entry.accruedPoints.toString() : entry.accruedPoints
266
+ accruedPoints: require_utils.bigIntToString(entry.accruedPoints)
267
267
  };
268
268
  }
269
269
  static mitoIDOProgressToIDOProgress(progress) {
@@ -1312,15 +1312,15 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1312
1312
  tokens: data.tokens,
1313
1313
  delegatorShares: data.delegatorShares,
1314
1314
  description: IndexerGrpcExplorerTransformer.grpcValidatorDescriptionToValidatorDescription(data.description),
1315
- unbondingHeight: typeof data.unbondingHeight === "bigint" ? Number(data.unbondingHeight) : parseInt(data.unbondingHeight, 10),
1315
+ unbondingHeight: require_utils.bigIntToNumber(data.unbondingHeight),
1316
1316
  unbondingTime: data.unbondingTime,
1317
1317
  commissionRate: data.commissionRate,
1318
1318
  commissionMaxRate: data.commissionMaxRate,
1319
1319
  commissionMaxChangeRate: data.commissionMaxChangeRate,
1320
1320
  commissionUpdateTime: data.commissionUpdateTime,
1321
- proposed: typeof data.proposed === "bigint" ? Number(data.proposed) : parseInt(data.proposed, 10),
1322
- signed: typeof data.signed === "bigint" ? Number(data.signed) : parseInt(data.signed, 10),
1323
- missed: typeof data.missed === "bigint" ? Number(data.missed) : parseInt(data.missed, 10),
1321
+ signed: require_utils.bigIntToNumber(data.signed),
1322
+ missed: require_utils.bigIntToNumber(data.missed),
1323
+ proposed: require_utils.bigIntToNumber(data.proposed),
1324
1324
  uptimePercentage: data.uptimePercentage,
1325
1325
  imageUrl: data.imageUrl,
1326
1326
  timestamp: data.timestamp,
@@ -1331,14 +1331,14 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1331
1331
  static streamTxResponseToTxs(response) {
1332
1332
  return {
1333
1333
  id: response.id,
1334
- blockNumber: typeof response.blockNumber === "bigint" ? Number(response.blockNumber) : parseInt(response.blockNumber, 10),
1335
- blockTimestamp: response.blockTimestamp,
1336
1334
  hash: response.hash,
1337
- codespace: response.codespace,
1335
+ code: response.code,
1338
1336
  messages: response.messages,
1339
- txNumber: typeof response.txNumber === "bigint" ? Number(response.txNumber) : parseInt(response.txNumber, 10),
1340
1337
  errorLog: response.errorLog,
1341
- code: response.code
1338
+ codespace: response.codespace,
1339
+ blockTimestamp: response.blockTimestamp,
1340
+ txNumber: require_utils.bigIntToNumber(response.txNumber),
1341
+ blockNumber: require_utils.bigIntToNumber(response.blockNumber)
1342
1342
  };
1343
1343
  }
1344
1344
  static grpcGasFeeToGasFee(gasFee) {
@@ -1347,43 +1347,43 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1347
1347
  amount: amount.amount,
1348
1348
  denom: amount.denom
1349
1349
  })),
1350
- gasLimit: typeof gasFee.gasLimit === "bigint" ? Number(gasFee.gasLimit) : parseInt(gasFee.gasLimit, 10),
1351
1350
  payer: gasFee.payer,
1352
- granter: gasFee.granter
1351
+ granter: gasFee.granter,
1352
+ gasLimit: require_utils.bigIntToNumber(gasFee.gasLimit)
1353
1353
  };
1354
1354
  }
1355
1355
  static grpcTransactionToBankMsgSendTransaction(tx) {
1356
1356
  const data = tx.data;
1357
1357
  const [message] = JSON.parse(require_utils.uint8ArrayToString(data.messages));
1358
1358
  return {
1359
- blockNumber: typeof data.blockNumber === "bigint" ? Number(data.blockNumber) : parseInt(data.blockNumber, 10),
1360
- blockTimestamp: data.blockTimestamp,
1361
1359
  hash: data.hash,
1362
- amount: message.value.amount[0].amount,
1363
- denom: message.value.amount[0].denom,
1364
1360
  sender: message.value.from_address,
1365
- receiver: message.value.to_address
1361
+ receiver: message.value.to_address,
1362
+ blockTimestamp: data.blockTimestamp,
1363
+ denom: message.value.amount[0].denom,
1364
+ amount: message.value.amount[0].amount,
1365
+ blockNumber: require_utils.bigIntToNumber(data.blockNumber)
1366
1366
  };
1367
1367
  }
1368
1368
  static grpcTransactionToTransaction(tx) {
1369
1369
  const data = tx.data;
1370
1370
  return {
1371
1371
  id: data.id,
1372
- blockNumber: typeof data.blockNumber === "bigint" ? Number(data.blockNumber) : parseInt(data.blockNumber, 10),
1373
- blockTimestamp: data.blockTimestamp,
1374
1372
  hash: data.hash,
1375
1373
  code: data.code,
1376
1374
  info: data.info,
1377
- gasWanted: typeof data.gasWanted === "bigint" ? Number(data.gasWanted) : parseInt(data.gasWanted, 10),
1378
- gasUsed: typeof data.gasUsed === "bigint" ? Number(data.gasUsed) : parseInt(data.gasUsed, 10),
1379
- codespace: data.codespace,
1380
1375
  data: data.data,
1381
- gasFee: IndexerGrpcExplorerTransformer.grpcGasFeeToGasFee(data.gasFee),
1382
1376
  txType: data.txType,
1377
+ codespace: data.codespace,
1378
+ blockTimestamp: data.blockTimestamp,
1379
+ gasUsed: require_utils.bigIntToNumber(data.gasUsed),
1380
+ gasWanted: require_utils.bigIntToNumber(data.gasWanted),
1381
+ blockNumber: require_utils.bigIntToNumber(data.blockNumber),
1382
+ gasFee: IndexerGrpcExplorerTransformer.grpcGasFeeToGasFee(data.gasFee),
1383
1383
  signatures: data.signatures.map((signature) => ({
1384
1384
  pubkey: signature.pubkey,
1385
1385
  address: signature.address,
1386
- sequence: typeof signature.sequence === "bigint" ? Number(signature.sequence) : parseInt(signature.sequence, 10),
1386
+ sequence: require_utils.bigIntToNumber(signature.sequence),
1387
1387
  signature: signature.signature
1388
1388
  })),
1389
1389
  events: data.events.map((event) => ({
@@ -1400,14 +1400,14 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1400
1400
  const messages = JSON.parse(require_utils.uint8ArrayToString(tx.messages));
1401
1401
  return {
1402
1402
  ...tx,
1403
- gasWanted: typeof tx.gasWanted === "bigint" ? Number(tx.gasWanted) : parseInt(tx.gasWanted, 10),
1404
- gasUsed: typeof tx.gasUsed === "bigint" ? Number(tx.gasUsed) : parseInt(tx.gasUsed, 10),
1405
- blockNumber: typeof tx.blockNumber === "bigint" ? Number(tx.blockNumber) : parseInt(tx.blockNumber, 10),
1403
+ gasUsed: require_utils.bigIntToNumber(tx.gasUsed),
1404
+ gasWanted: require_utils.bigIntToNumber(tx.gasWanted),
1405
+ blockNumber: require_utils.bigIntToNumber(tx.blockNumber),
1406
1406
  signatures: tx.signatures.map((signature) => ({
1407
1407
  pubkey: signature.pubkey,
1408
1408
  address: signature.address,
1409
- sequence: typeof signature.sequence === "bigint" ? Number(signature.sequence) : parseInt(signature.sequence, 10),
1410
- signature: signature.signature
1409
+ signature: signature.signature,
1410
+ sequence: require_utils.bigIntToNumber(signature.sequence)
1411
1411
  })),
1412
1412
  gasFee: tx.gasFee ? IndexerGrpcExplorerTransformer.grpcGasFeeToGasFee(tx.gasFee) : {
1413
1413
  gasLimit: 0,
@@ -1427,26 +1427,26 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1427
1427
  }
1428
1428
  static grpcBlockToBlock(block) {
1429
1429
  return {
1430
- height: typeof block.height === "bigint" ? Number(block.height) : parseInt(block.height, 10),
1431
- proposer: block.proposer,
1432
1430
  moniker: block.moniker,
1431
+ proposer: block.proposer,
1433
1432
  blockHash: block.blockHash,
1433
+ timestamp: block.timestamp,
1434
1434
  parentHash: block.parentHash,
1435
- numPreCommits: typeof block.numPreCommits === "bigint" ? Number(block.numPreCommits) : parseInt(block.numPreCommits, 10),
1436
- numTxs: typeof block.numTxs === "bigint" ? Number(block.numTxs) : parseInt(block.numTxs, 10),
1437
- timestamp: block.timestamp
1435
+ height: require_utils.bigIntToNumber(block.height),
1436
+ numTxs: require_utils.bigIntToNumber(block.numTxs),
1437
+ numPreCommits: require_utils.bigIntToNumber(block.numPreCommits)
1438
1438
  };
1439
1439
  }
1440
1440
  static grpcBlockToBlockWithTxs(block) {
1441
1441
  return {
1442
- height: typeof block.height === "bigint" ? Number(block.height) : parseInt(block.height, 10),
1443
- proposer: block.proposer,
1444
1442
  moniker: block.moniker,
1443
+ proposer: block.proposer,
1445
1444
  blockHash: block.blockHash,
1445
+ timestamp: block.timestamp,
1446
1446
  parentHash: block.parentHash,
1447
- numPreCommits: typeof block.numPreCommits === "bigint" ? Number(block.numPreCommits) : parseInt(block.numPreCommits, 10),
1448
- numTxs: typeof block.numTxs === "bigint" ? Number(block.numTxs) : parseInt(block.numTxs, 10),
1449
- timestamp: block.timestamp
1447
+ height: require_utils.bigIntToNumber(block.height),
1448
+ numTxs: require_utils.bigIntToNumber(block.numTxs),
1449
+ numPreCommits: require_utils.bigIntToNumber(block.numPreCommits)
1450
1450
  };
1451
1451
  }
1452
1452
  static grpcBlocksToBlocks(blocks) {
@@ -1466,88 +1466,88 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1466
1466
  }
1467
1467
  static grpcValidatorUptimeToValidatorUptime(validatorUptime) {
1468
1468
  return {
1469
- blockNumber: typeof validatorUptime.blockNumber === "bigint" ? Number(validatorUptime.blockNumber) : parseInt(validatorUptime.blockNumber, 10),
1470
- status: validatorUptime.status
1469
+ status: validatorUptime.status,
1470
+ blockNumber: require_utils.bigIntToNumber(validatorUptime.blockNumber)
1471
1471
  };
1472
1472
  }
1473
1473
  static grpcValidatorSlashingEventToValidatorSlashingEvent(validatorUptime) {
1474
1474
  return {
1475
- blockNumber: typeof validatorUptime.blockNumber === "bigint" ? Number(validatorUptime.blockNumber) : parseInt(validatorUptime.blockNumber, 10),
1476
- blockTimestamp: validatorUptime.blockTimestamp,
1477
- address: validatorUptime.address,
1478
- power: typeof validatorUptime.power === "bigint" ? Number(validatorUptime.power) : parseInt(validatorUptime.power, 10),
1479
1475
  reason: validatorUptime.reason,
1480
1476
  jailed: validatorUptime.jailed,
1481
- missedBlocks: typeof validatorUptime.missedBlocks === "bigint" ? Number(validatorUptime.missedBlocks) : parseInt(validatorUptime.missedBlocks, 10)
1477
+ address: validatorUptime.address,
1478
+ power: require_utils.bigIntToNumber(validatorUptime.power),
1479
+ blockTimestamp: validatorUptime.blockTimestamp,
1480
+ blockNumber: require_utils.bigIntToNumber(validatorUptime.blockNumber),
1481
+ missedBlocks: require_utils.bigIntToNumber(validatorUptime.missedBlocks)
1482
1482
  };
1483
1483
  }
1484
1484
  static grpcIBCTransferTxToIBCTransferTx(grpcIBCTransferTx) {
1485
1485
  return {
1486
+ denom: grpcIBCTransferTx.denom,
1487
+ state: grpcIBCTransferTx.state,
1486
1488
  sender: grpcIBCTransferTx.sender,
1489
+ amount: grpcIBCTransferTx.amount,
1490
+ dataHex: grpcIBCTransferTx.dataHex,
1487
1491
  receiver: grpcIBCTransferTx.receiver,
1492
+ createdAt: grpcIBCTransferTx.createdAt,
1493
+ updatedAt: grpcIBCTransferTx.updatedAt,
1488
1494
  sourcePort: grpcIBCTransferTx.sourcePort,
1495
+ txHashesList: grpcIBCTransferTx.txHashes,
1489
1496
  sourceChannel: grpcIBCTransferTx.sourceChannel,
1497
+ timeoutHeight: grpcIBCTransferTx.timeoutHeight,
1490
1498
  destinationPort: grpcIBCTransferTx.destinationPort,
1491
1499
  destinationChannel: grpcIBCTransferTx.destinationChannel,
1492
- amount: grpcIBCTransferTx.amount,
1493
- denom: grpcIBCTransferTx.denom,
1494
- timeoutHeight: grpcIBCTransferTx.timeoutHeight,
1495
- timeoutTimestamp: typeof grpcIBCTransferTx.timeoutTimestamp === "bigint" ? Number(grpcIBCTransferTx.timeoutTimestamp) : parseInt(grpcIBCTransferTx.timeoutTimestamp, 10),
1496
- packetSequence: typeof grpcIBCTransferTx.packetSequence === "bigint" ? Number(grpcIBCTransferTx.packetSequence) : parseInt(grpcIBCTransferTx.packetSequence, 10),
1497
- dataHex: grpcIBCTransferTx.dataHex,
1498
- state: grpcIBCTransferTx.state,
1499
- txHashesList: grpcIBCTransferTx.txHashes,
1500
- createdAt: grpcIBCTransferTx.createdAt,
1501
- updatedAt: grpcIBCTransferTx.updatedAt
1500
+ packetSequence: require_utils.bigIntToNumber(grpcIBCTransferTx.packetSequence),
1501
+ timeoutTimestamp: require_utils.bigIntToNumber(grpcIBCTransferTx.timeoutTimestamp)
1502
1502
  };
1503
1503
  }
1504
1504
  static grpcPeggyDepositTx(grpcPeggyDepositTx) {
1505
1505
  return {
1506
- sender: grpcPeggyDepositTx.sender,
1507
- receiver: grpcPeggyDepositTx.receiver,
1508
- eventNonce: typeof grpcPeggyDepositTx.eventNonce === "bigint" ? Number(grpcPeggyDepositTx.eventNonce) : parseInt(grpcPeggyDepositTx.eventNonce, 10),
1509
- eventHeight: typeof grpcPeggyDepositTx.eventHeight === "bigint" ? Number(grpcPeggyDepositTx.eventHeight) : parseInt(grpcPeggyDepositTx.eventHeight, 10),
1510
- amount: grpcPeggyDepositTx.amount,
1511
1506
  denom: grpcPeggyDepositTx.denom,
1512
- orchestratorAddress: grpcPeggyDepositTx.orchestratorAddress,
1513
1507
  state: grpcPeggyDepositTx.state,
1508
+ sender: grpcPeggyDepositTx.sender,
1509
+ amount: grpcPeggyDepositTx.amount,
1510
+ receiver: grpcPeggyDepositTx.receiver,
1514
1511
  claimType: grpcPeggyDepositTx.claimType,
1515
- txHashesList: grpcPeggyDepositTx.txHashes,
1516
1512
  createdAt: grpcPeggyDepositTx.createdAt,
1517
- updatedAt: grpcPeggyDepositTx.updatedAt
1513
+ updatedAt: grpcPeggyDepositTx.updatedAt,
1514
+ txHashesList: grpcPeggyDepositTx.txHashes,
1515
+ eventNonce: require_utils.bigIntToNumber(grpcPeggyDepositTx.eventNonce),
1516
+ eventHeight: require_utils.bigIntToNumber(grpcPeggyDepositTx.eventHeight),
1517
+ orchestratorAddress: grpcPeggyDepositTx.orchestratorAddress
1518
1518
  };
1519
1519
  }
1520
1520
  static grpcPeggyWithdrawalTx(grpcPeggyWithdrawalTx) {
1521
1521
  return {
1522
+ denom: grpcPeggyWithdrawalTx.denom,
1523
+ state: grpcPeggyWithdrawalTx.state,
1522
1524
  sender: grpcPeggyWithdrawalTx.sender,
1523
- receiver: grpcPeggyWithdrawalTx.receiver,
1524
1525
  amount: grpcPeggyWithdrawalTx.amount,
1525
- denom: grpcPeggyWithdrawalTx.denom,
1526
+ receiver: grpcPeggyWithdrawalTx.receiver,
1526
1527
  bridgeFee: grpcPeggyWithdrawalTx.bridgeFee,
1527
- outgoingTxId: typeof grpcPeggyWithdrawalTx.outgoingTxId === "bigint" ? Number(grpcPeggyWithdrawalTx.outgoingTxId) : parseInt(grpcPeggyWithdrawalTx.outgoingTxId, 10),
1528
- batchTimeout: typeof grpcPeggyWithdrawalTx.batchTimeout === "bigint" ? Number(grpcPeggyWithdrawalTx.batchTimeout) : parseInt(grpcPeggyWithdrawalTx.batchTimeout, 10),
1529
- batchNonce: typeof grpcPeggyWithdrawalTx.batchNonce === "bigint" ? Number(grpcPeggyWithdrawalTx.batchNonce) : parseInt(grpcPeggyWithdrawalTx.batchNonce, 10),
1530
- eventNonce: typeof grpcPeggyWithdrawalTx.eventNonce === "bigint" ? Number(grpcPeggyWithdrawalTx.eventNonce) : parseInt(grpcPeggyWithdrawalTx.eventNonce, 10),
1531
- eventHeight: typeof grpcPeggyWithdrawalTx.eventHeight === "bigint" ? Number(grpcPeggyWithdrawalTx.eventHeight) : parseInt(grpcPeggyWithdrawalTx.eventHeight, 10),
1532
- orchestratorAddress: grpcPeggyWithdrawalTx.orchestratorAddress,
1533
- state: grpcPeggyWithdrawalTx.state,
1534
1528
  claimType: grpcPeggyWithdrawalTx.claimType,
1535
- txHashesList: grpcPeggyWithdrawalTx.txHashes,
1536
1529
  createdAt: grpcPeggyWithdrawalTx.createdAt,
1537
- updatedAt: grpcPeggyWithdrawalTx.updatedAt
1530
+ updatedAt: grpcPeggyWithdrawalTx.updatedAt,
1531
+ txHashesList: grpcPeggyWithdrawalTx.txHashes,
1532
+ batchNonce: require_utils.bigIntToNumber(grpcPeggyWithdrawalTx.batchNonce),
1533
+ eventNonce: require_utils.bigIntToNumber(grpcPeggyWithdrawalTx.eventNonce),
1534
+ eventHeight: require_utils.bigIntToNumber(grpcPeggyWithdrawalTx.eventHeight),
1535
+ orchestratorAddress: grpcPeggyWithdrawalTx.orchestratorAddress,
1536
+ outgoingTxId: require_utils.bigIntToNumber(grpcPeggyWithdrawalTx.outgoingTxId),
1537
+ batchTimeout: require_utils.bigIntToNumber(grpcPeggyWithdrawalTx.batchTimeout)
1538
1538
  };
1539
1539
  }
1540
1540
  static getExplorerStatsResponseToExplorerStats(response) {
1541
1541
  return {
1542
- assets: typeof response.assets === "bigint" ? response.assets.toString() : response.assets,
1543
- txsTotal: typeof response.txsTotal === "bigint" ? response.txsTotal.toString() : response.txsTotal,
1544
- addresses: typeof response.addresses === "bigint" ? response.addresses.toString() : response.addresses,
1545
- injSupply: typeof response.injSupply === "bigint" ? response.injSupply.toString() : response.injSupply,
1546
- txsInPast24Hours: typeof response.txs24H === "bigint" ? response.txs24H.toString() : response.txs24H,
1547
- txsInPast30Days: typeof response.txs30D === "bigint" ? response.txs30D.toString() : response.txs30D,
1548
- blockCountInPast24Hours: typeof response.blockCount24H === "bigint" ? response.blockCount24H.toString() : response.blockCount24H,
1549
- txsPerSecondInPast24Hours: typeof response.txsPs24H === "bigint" ? response.txsPs24H.toString() : response.txsPs24H,
1550
- txsPerSecondInPast100Blocks: typeof response.txsPs100B === "bigint" ? response.txsPs100B.toString() : response.txsPs100B
1542
+ assets: require_utils.bigIntToString(response.assets),
1543
+ txsTotal: require_utils.bigIntToString(response.txsTotal),
1544
+ addresses: require_utils.bigIntToString(response.addresses),
1545
+ injSupply: require_utils.bigIntToString(response.injSupply),
1546
+ txsInPast30Days: require_utils.bigIntToString(response.txs30D),
1547
+ txsInPast24Hours: require_utils.bigIntToString(response.txs24H),
1548
+ txsPerSecondInPast24Hours: require_utils.bigIntToString(response.txsPs24H),
1549
+ blockCountInPast24Hours: require_utils.bigIntToString(response.blockCount24H),
1550
+ txsPerSecondInPast100Blocks: require_utils.bigIntToString(response.txsPs100B)
1551
1551
  };
1552
1552
  }
1553
1553
  static getTxsV2ResponseToTxs(response) {
@@ -1566,7 +1566,7 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1566
1566
  signature: signature.signature,
1567
1567
  sequence: (() => {
1568
1568
  try {
1569
- return typeof signature.sequence === "bigint" ? Number(signature.sequence) : parseInt(signature.sequence, 10);
1569
+ return require_utils.bigIntToNumber(signature.sequence);
1570
1570
  } catch (_unused3) {
1571
1571
  return 0;
1572
1572
  }
@@ -1574,12 +1574,12 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1574
1574
  }));
1575
1575
  const claimIds = tx.claimIds.map((claimId) => {
1576
1576
  try {
1577
- return typeof claimId === "bigint" ? Number(claimId) : parseInt(claimId, 10);
1577
+ return require_utils.bigIntToNumber(claimId);
1578
1578
  } catch (_unused4) {
1579
1579
  return 0;
1580
1580
  }
1581
1581
  });
1582
- const blockNumber = typeof tx.blockNumber === "bigint" ? Number(tx.blockNumber) : parseInt(tx.blockNumber);
1582
+ const blockNumber = require_utils.bigIntToNumber(tx.blockNumber);
1583
1583
  return {
1584
1584
  logs,
1585
1585
  info: "",
@@ -1612,7 +1612,7 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1612
1612
  };
1613
1613
  }
1614
1614
  static grpcAccountTxV2ToTransaction(tx) {
1615
- var _tx$gasFee, _tx$gasFee2, _tx$gasFee3, _tx$gasFee$gasLimit, _tx$gasFee4, _tx$gasFee$granter, _tx$gasFee5, _tx$gasFee$payer, _tx$gasFee6;
1615
+ var _tx$gasFee, _tx$gasFee2, _tx$gasFee$granter, _tx$gasFee3, _tx$gasFee$payer, _tx$gasFee4;
1616
1616
  return {
1617
1617
  id: tx.id,
1618
1618
  hash: tx.hash,
@@ -1625,27 +1625,27 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1625
1625
  amount: amount.amount,
1626
1626
  denom: amount.denom
1627
1627
  })),
1628
- gasLimit: typeof ((_tx$gasFee2 = tx.gasFee) === null || _tx$gasFee2 === void 0 ? void 0 : _tx$gasFee2.gasLimit) === "bigint" ? Number((_tx$gasFee3 = tx.gasFee) === null || _tx$gasFee3 === void 0 ? void 0 : _tx$gasFee3.gasLimit) : parseInt((_tx$gasFee$gasLimit = (_tx$gasFee4 = tx.gasFee) === null || _tx$gasFee4 === void 0 ? void 0 : _tx$gasFee4.gasLimit) !== null && _tx$gasFee$gasLimit !== void 0 ? _tx$gasFee$gasLimit : "0", 10),
1629
- granter: (_tx$gasFee$granter = (_tx$gasFee5 = tx.gasFee) === null || _tx$gasFee5 === void 0 ? void 0 : _tx$gasFee5.granter) !== null && _tx$gasFee$granter !== void 0 ? _tx$gasFee$granter : "",
1630
- payer: (_tx$gasFee$payer = (_tx$gasFee6 = tx.gasFee) === null || _tx$gasFee6 === void 0 ? void 0 : _tx$gasFee6.payer) !== null && _tx$gasFee$payer !== void 0 ? _tx$gasFee$payer : ""
1628
+ gasLimit: require_utils.bigIntToNumber((_tx$gasFee2 = tx.gasFee) === null || _tx$gasFee2 === void 0 ? void 0 : _tx$gasFee2.gasLimit),
1629
+ granter: (_tx$gasFee$granter = (_tx$gasFee3 = tx.gasFee) === null || _tx$gasFee3 === void 0 ? void 0 : _tx$gasFee3.granter) !== null && _tx$gasFee$granter !== void 0 ? _tx$gasFee$granter : "",
1630
+ payer: (_tx$gasFee$payer = (_tx$gasFee4 = tx.gasFee) === null || _tx$gasFee4 === void 0 ? void 0 : _tx$gasFee4.payer) !== null && _tx$gasFee$payer !== void 0 ? _tx$gasFee$payer : ""
1631
1631
  },
1632
1632
  events: tx.events,
1633
1633
  errorLog: tx.errorLog,
1634
1634
  codespace: tx.codespace,
1635
- gasUsed: typeof tx.gasUsed === "bigint" ? Number(tx.gasUsed) : parseInt(tx.gasUsed, 10),
1635
+ gasUsed: require_utils.bigIntToNumber(tx.gasUsed),
1636
1636
  blockTimestamp: tx.blockTimestamp,
1637
- gasWanted: typeof tx.gasWanted === "bigint" ? Number(tx.gasWanted) : parseInt(tx.gasWanted, 10),
1638
- blockNumber: typeof tx.blockNumber === "bigint" ? Number(tx.blockNumber) : parseInt(tx.blockNumber, 10),
1637
+ gasWanted: require_utils.bigIntToNumber(tx.gasWanted),
1638
+ blockNumber: require_utils.bigIntToNumber(tx.blockNumber),
1639
1639
  signatures: tx.signatures.map((signature) => ({
1640
1640
  address: signature.address,
1641
1641
  pubkey: signature.pubkey,
1642
1642
  signature: signature.signature,
1643
- sequence: typeof signature.sequence === "bigint" ? Number(signature.sequence) : parseInt(signature.sequence, 10)
1643
+ sequence: require_utils.bigIntToNumber(signature.sequence)
1644
1644
  })),
1645
1645
  messages: transactionV2MessagesToMessagesNoThrow(tx.messages),
1646
1646
  logs: parseStringToObjectLikeNoThrow(tx.logs),
1647
1647
  data: "/" + require_utils.uint8ArrayToString(tx.data).split("/").pop(),
1648
- claimIds: tx.claimIds.map((claimId) => typeof claimId === "bigint" ? Number(claimId) : parseInt(claimId, 10))
1648
+ claimIds: tx.claimIds.map((claimId) => require_utils.bigIntToNumber(claimId))
1649
1649
  };
1650
1650
  }
1651
1651
  static getBlocksV2ResponseToBlocks(response) {
@@ -1661,9 +1661,9 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1661
1661
  blockHash: block.blockHash,
1662
1662
  timestamp: block.timestamp,
1663
1663
  parentHash: block.parentHash,
1664
- height: typeof block.height === "bigint" ? Number(block.height) : parseInt(block.height, 10),
1665
- numTxs: typeof block.numTxs === "bigint" ? Number(block.numTxs) : parseInt(block.numTxs, 10),
1666
- numPreCommits: typeof block.numPreCommits === "bigint" ? Number(block.numPreCommits) : parseInt(block.numPreCommits, 10)
1664
+ height: require_utils.bigIntToNumber(block.height),
1665
+ numTxs: require_utils.bigIntToNumber(block.numTxs),
1666
+ numPreCommits: require_utils.bigIntToNumber(block.numPreCommits)
1667
1667
  };
1668
1668
  }
1669
1669
  static getContractTxsV2ResponseToContractTxs(response) {
@@ -1673,7 +1673,7 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1673
1673
  };
1674
1674
  }
1675
1675
  static grpcContractTxV2ToTransaction(tx) {
1676
- var _tx$gasFee7;
1676
+ var _tx$gasFee5;
1677
1677
  return {
1678
1678
  messages: transactionV2MessagesToMessagesNoThrow(tx.messages),
1679
1679
  code: tx.code,
@@ -1681,18 +1681,18 @@ var IndexerGrpcExplorerTransformer = class IndexerGrpcExplorerTransformer {
1681
1681
  type: tx.txType,
1682
1682
  txHash: tx.hash,
1683
1683
  error_log: tx.errorLog,
1684
- height: typeof tx.blockNumber === "bigint" ? Number(tx.blockNumber) : parseInt(tx.blockNumber, 10),
1685
- tx_number: typeof tx.txNumber === "bigint" ? Number(tx.txNumber) : parseInt(tx.txNumber, 10),
1686
- time: typeof tx.blockUnixTimestamp === "bigint" ? Number(tx.blockUnixTimestamp) : parseInt(tx.blockUnixTimestamp, 10),
1684
+ height: require_utils.bigIntToNumber(tx.blockNumber),
1685
+ tx_number: require_utils.bigIntToNumber(tx.txNumber),
1686
+ time: require_utils.bigIntToNumber(tx.blockUnixTimestamp),
1687
1687
  amount: getContractTransactionV2Amount(tx),
1688
1688
  logs: JSON.parse(require_utils.uint8ArrayToString(tx.logs)),
1689
1689
  data: "/" + require_utils.uint8ArrayToString(tx.data).split("/").pop(),
1690
- fee: (0, __injectivelabs_utils.toHumanReadable)(((_tx$gasFee7 = tx.gasFee) === null || _tx$gasFee7 === void 0 || (_tx$gasFee7 = _tx$gasFee7.amount[0]) === null || _tx$gasFee7 === void 0 ? void 0 : _tx$gasFee7.amount) || "0"),
1690
+ fee: (0, __injectivelabs_utils.toHumanReadable)(((_tx$gasFee5 = tx.gasFee) === null || _tx$gasFee5 === void 0 || (_tx$gasFee5 = _tx$gasFee5.amount[0]) === null || _tx$gasFee5 === void 0 ? void 0 : _tx$gasFee5.amount) || "0"),
1691
1691
  signatures: tx.signatures.map((signature) => ({
1692
1692
  address: signature.address,
1693
1693
  pubkey: signature.pubkey,
1694
1694
  signature: signature.signature,
1695
- sequence: typeof signature.sequence === "bigint" ? Number(signature.sequence) : parseInt(signature.sequence, 10)
1695
+ sequence: require_utils.bigIntToNumber(signature.sequence)
1696
1696
  }))
1697
1697
  };
1698
1698
  }
@@ -1726,8 +1726,8 @@ var IndexerGrpcReferralTransformer = class {
1726
1726
  var IndexerOracleStreamTransformer = class {};
1727
1727
  require_defineProperty._defineProperty(IndexerOracleStreamTransformer, "pricesStreamCallback", (response) => ({
1728
1728
  price: response.price,
1729
- operation: require_types.StreamOperation.Update,
1730
- timestamp: typeof response.timestamp === "bigint" ? Number(response.timestamp) : parseInt(response.timestamp, 10)
1729
+ timestamp: require_utils.bigIntToNumber(response.timestamp),
1730
+ operation: require_types.StreamOperation.Update
1731
1731
  }));
1732
1732
  require_defineProperty._defineProperty(IndexerOracleStreamTransformer, "pricesByMarketsCallback", (response) => ({ ...response }));
1733
1733
 
@@ -1980,9 +1980,9 @@ require_defineProperty._defineProperty(IndexerAuctionStreamTransformer, "bidsStr
1980
1980
  bid: {
1981
1981
  bidder: response.bidder,
1982
1982
  bidAmount: response.bidAmount,
1983
- bidTimestamp: typeof response.timestamp === "bigint" ? Number(response.timestamp) : parseInt(response.timestamp, 10)
1983
+ bidTimestamp: require_utils.bigIntToNumber(response.timestamp)
1984
1984
  },
1985
- operation: __injectivelabs_ts_types.StreamOperation.Insert
1985
+ operation: require_types.StreamOperation.Insert
1986
1986
  }));
1987
1987
 
1988
1988
  //#endregion
@@ -2202,7 +2202,7 @@ require_defineProperty._defineProperty(IndexerArchiverStreamTransformer, "spotAv
2202
2202
  return {
2203
2203
  averageEntry: averageEntry ? IndexerGrpcArchiverTransformer.grpcSpotAverageEntryToSpotAverageEntry(averageEntry) : void 0,
2204
2204
  operation: require_types.StreamOperation.Update,
2205
- timestamp: typeof response.timestamp === "bigint" ? Number(response.timestamp) : response.timestamp
2205
+ timestamp: require_utils.bigIntToNumber(response.timestamp)
2206
2206
  };
2207
2207
  });
2208
2208
 
@@ -2228,7 +2228,7 @@ require_defineProperty._defineProperty(ExplorerStreamTransformer, "transactionsS
2228
2228
  //#endregion
2229
2229
  //#region src/client/indexer/transformers/IndexerGrpcDerivativeTransformer.ts
2230
2230
  const zeroPositionDelta = () => ({
2231
- tradeDirection: __injectivelabs_ts_types.TradeDirection.Buy,
2231
+ tradeDirection: require_types.TradeDirection.Buy,
2232
2232
  executionPrice: "0",
2233
2233
  executionQuantity: "0",
2234
2234
  executionMargin: "0"
@@ -2287,13 +2287,7 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2287
2287
  const pagination = response.paging;
2288
2288
  return {
2289
2289
  orders: IndexerGrpcDerivativeTransformer.grpcOrdersToOrders(orders),
2290
- pagination: pagination ? {
2291
- to: pagination.to,
2292
- from: pagination.from,
2293
- total: Number(pagination.total),
2294
- countBySubaccount: pagination.countBySubaccount,
2295
- next: pagination.next
2296
- } : void 0
2290
+ pagination: require_utils.grpcPagingToPagingV2(pagination)
2297
2291
  };
2298
2292
  }
2299
2293
  static orderHistoryResponseToOrderHistory(response, isConditional) {
@@ -2301,13 +2295,7 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2301
2295
  const pagination = response.paging;
2302
2296
  return {
2303
2297
  orderHistory: IndexerGrpcDerivativeTransformer.grpcOrderHistoryListToOrderHistoryList(orderHistory, isConditional),
2304
- pagination: pagination ? {
2305
- to: pagination.to,
2306
- from: pagination.from,
2307
- total: Number(pagination.total),
2308
- countBySubaccount: pagination.countBySubaccount,
2309
- next: pagination.next
2310
- } : void 0
2298
+ pagination: require_utils.grpcPagingToPagingV2(pagination)
2311
2299
  };
2312
2300
  }
2313
2301
  static positionsResponseToPositions(response) {
@@ -2315,13 +2303,7 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2315
2303
  const pagination = response.paging;
2316
2304
  return {
2317
2305
  positions: IndexerGrpcDerivativeTransformer.grpcPositionsToPositions(positions),
2318
- pagination: pagination ? {
2319
- to: pagination.to,
2320
- from: pagination.from,
2321
- total: Number(pagination.total),
2322
- countBySubaccount: pagination.countBySubaccount,
2323
- next: pagination.next
2324
- } : void 0
2306
+ pagination: require_utils.grpcPagingToPagingV2(pagination)
2325
2307
  };
2326
2308
  }
2327
2309
  static positionsV2ResponseToPositionsV2(response) {
@@ -2329,13 +2311,7 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2329
2311
  const pagination = response.paging;
2330
2312
  return {
2331
2313
  positions: IndexerGrpcDerivativeTransformer.grpcPositionsV2ToPositionsV2(positions),
2332
- pagination: pagination ? {
2333
- to: pagination.to,
2334
- from: pagination.from,
2335
- total: Number(pagination.total),
2336
- countBySubaccount: pagination.countBySubaccount,
2337
- next: pagination.next
2338
- } : void 0
2314
+ pagination: require_utils.grpcPagingToPagingV2(pagination)
2339
2315
  };
2340
2316
  }
2341
2317
  static tradesResponseToTrades(response) {
@@ -2343,13 +2319,7 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2343
2319
  const pagination = response.paging;
2344
2320
  return {
2345
2321
  trades: IndexerGrpcDerivativeTransformer.grpcTradesToTrades(trades),
2346
- pagination: pagination ? {
2347
- to: pagination.to,
2348
- from: pagination.from,
2349
- total: Number(pagination.total),
2350
- countBySubaccount: pagination.countBySubaccount,
2351
- next: pagination.next
2352
- } : void 0
2322
+ pagination: require_utils.grpcPagingToPagingV2(pagination)
2353
2323
  };
2354
2324
  }
2355
2325
  static subaccountTradesListResponseToSubaccountTradesList(response) {
@@ -2361,13 +2331,7 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2361
2331
  const pagination = response.paging;
2362
2332
  return {
2363
2333
  fundingPayments: IndexerGrpcDerivativeTransformer.grpcFundingPaymentsToFundingPayments(fundingPayments),
2364
- pagination: pagination ? {
2365
- to: pagination.to,
2366
- from: pagination.from,
2367
- total: Number(pagination.total),
2368
- countBySubaccount: pagination.countBySubaccount,
2369
- next: pagination.next
2370
- } : void 0
2334
+ pagination: require_utils.grpcPagingToPagingV2(pagination)
2371
2335
  };
2372
2336
  }
2373
2337
  static fundingRatesResponseToFundingRates(response) {
@@ -2375,13 +2339,7 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2375
2339
  const pagination = response.paging;
2376
2340
  return {
2377
2341
  fundingRates: IndexerGrpcDerivativeTransformer.grpcFundingRatesToFundingRates(fundingRates),
2378
- pagination: pagination ? {
2379
- to: pagination.to,
2380
- from: pagination.from,
2381
- total: Number(pagination.total),
2382
- countBySubaccount: pagination.countBySubaccount,
2383
- next: pagination.next
2384
- } : void 0
2342
+ pagination: require_utils.grpcPagingToPagingV2(pagination)
2385
2343
  };
2386
2344
  }
2387
2345
  static orderbookV2ResponseToOrderbookV2(response) {
@@ -2414,13 +2372,7 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2414
2372
  const pagination = response.paging;
2415
2373
  return {
2416
2374
  markets: IndexerGrpcDerivativeTransformer.grpcBinaryOptionsMarketsToBinaryOptionsMarkets(markets),
2417
- pagination: {
2418
- to: (pagination === null || pagination === void 0 ? void 0 : pagination.to) || 0,
2419
- from: (pagination === null || pagination === void 0 ? void 0 : pagination.from) || 0,
2420
- total: Number((pagination === null || pagination === void 0 ? void 0 : pagination.total) || 0),
2421
- countBySubaccount: Number((pagination === null || pagination === void 0 ? void 0 : pagination.countBySubaccount) || 0),
2422
- next: (pagination === null || pagination === void 0 ? void 0 : pagination.next) || []
2423
- }
2375
+ pagination: require_utils.grpcPagingToPagingV2(pagination)
2424
2376
  };
2425
2377
  }
2426
2378
  static binaryOptionsMarketsResponseToBinaryOptionsMarkets(response) {
@@ -2572,7 +2524,7 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2572
2524
  };
2573
2525
  }
2574
2526
  static grpcOrderHistoryListToOrderHistoryList(orderHistory, isConditional) {
2575
- return (isConditional ? orderHistory : orderHistory.filter((order) => order.state !== __injectivelabs_ts_types.OrderState.Booked)).map((orderHistory$1) => IndexerGrpcDerivativeTransformer.grpcOrderHistoryToOrderHistory(orderHistory$1));
2527
+ return (isConditional ? orderHistory : orderHistory.filter((order) => order.state !== require_types.OrderState.Booked)).map((orderHistory$1) => IndexerGrpcDerivativeTransformer.grpcOrderHistoryToOrderHistory(orderHistory$1));
2576
2528
  }
2577
2529
  static grpcPositionToPosition(position) {
2578
2530
  return {
@@ -2601,7 +2553,11 @@ var IndexerGrpcDerivativeTransformer = class IndexerGrpcDerivativeTransformer {
2601
2553
  liquidationPrice: position.liquidationPrice,
2602
2554
  markPrice: position.markPrice,
2603
2555
  ticker: position.ticker,
2604
- updatedAt: Number(position.updatedAt)
2556
+ updatedAt: Number(position.updatedAt),
2557
+ fundingSum: position.fundingSum,
2558
+ fundingLast: position.fundingLast,
2559
+ cumulativeFundingEntry: position.cumulativeFundingEntry,
2560
+ effectiveCumulativeFundingEntry: position.effectiveCumulativeFundingEntry
2605
2561
  };
2606
2562
  }
2607
2563
  static grpcPositionsToPositions(positions) {
@@ -4632,7 +4588,7 @@ var IndexerRestLeaderboardChronosApi = class extends require_BaseRestConsumer.Ba
4632
4588
  };
4633
4589
 
4634
4590
  //#endregion
4635
- //#region src/client/indexer/grpc_stream/streamHelpers.ts
4591
+ //#region src/client/indexer/grpc_stream/stream/streamHelpers.ts
4636
4592
  /**
4637
4593
  * Creates a subscription wrapper for V2 streaming with proper cancellation support.
4638
4594
  *
@@ -4666,7 +4622,7 @@ function createStreamSubscription(stream, handleResponse, onEndCallback, onStatu
4666
4622
  }
4667
4623
 
4668
4624
  //#endregion
4669
- //#region src/client/indexer/grpc_stream/IndexerGrpcSpotStream.ts
4625
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcSpotStream.ts
4670
4626
  /**
4671
4627
  * @category Indexer Grpc Stream
4672
4628
  * @description Provides streaming access to spot market data from Injective Indexer
@@ -4678,9 +4634,9 @@ var IndexerGrpcSpotStream = class {
4678
4634
  this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
4679
4635
  this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb_client.InjectiveSpotExchangeRPCClient(this.transport);
4680
4636
  }
4681
- /** @deprecated - use streamSpotOrderbookV2 */
4682
- streamSpotOrderbook(_args) {
4683
- throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("deprecated - use streamDerivativeOrderbookV2"));
4637
+ /** @deprecated - use streamOrderbookV2 */
4638
+ streamOrderbook(_args) {
4639
+ throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("deprecated - use streamOrderbookV2"));
4684
4640
  }
4685
4641
  /**
4686
4642
  * Stream spot orders
@@ -4693,7 +4649,7 @@ var IndexerGrpcSpotStream = class {
4693
4649
  * @param params.onStatusCallback - Called on stream errors
4694
4650
  * @returns Subscription object with unsubscribe method
4695
4651
  */
4696
- streamSpotOrders({ marketId, subaccountId, orderSide, callback, onEndCallback, onStatusCallback }) {
4652
+ streamOrders({ marketId, subaccountId, orderSide, callback, onEndCallback, onStatusCallback }) {
4697
4653
  if (typeof callback !== "function") throw new Error("callback must be a function");
4698
4654
  const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamOrdersRequest.create();
4699
4655
  if (marketId) request.marketId = marketId;
@@ -4717,7 +4673,7 @@ var IndexerGrpcSpotStream = class {
4717
4673
  * @param params.onStatusCallback - Called on stream errors
4718
4674
  * @returns Subscription object with unsubscribe method
4719
4675
  */
4720
- streamSpotOrderHistory({ marketId, subaccountId, orderTypes, executionTypes, direction, state, callback, onEndCallback, onStatusCallback }) {
4676
+ streamOrderHistory({ marketId, subaccountId, orderTypes, executionTypes, direction, state, callback, onEndCallback, onStatusCallback }) {
4721
4677
  if (typeof callback !== "function") throw new Error("callback must be a function");
4722
4678
  const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamOrdersHistoryRequest.create();
4723
4679
  if (subaccountId) request.subaccountId = subaccountId;
@@ -4745,7 +4701,7 @@ var IndexerGrpcSpotStream = class {
4745
4701
  * @param params.onStatusCallback - Called on stream errors
4746
4702
  * @returns Subscription object with unsubscribe method
4747
4703
  */
4748
- streamSpotTrades({ marketIds, marketId, subaccountIds, subaccountId, pagination, direction, executionSide, callback, onEndCallback, onStatusCallback }) {
4704
+ streamTrades({ marketIds, marketId, subaccountIds, subaccountId, pagination, direction, executionSide, callback, onEndCallback, onStatusCallback }) {
4749
4705
  if (typeof callback !== "function") throw new Error("callback must be a function");
4750
4706
  const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamTradesRequest.create();
4751
4707
  if (marketIds) request.marketIds = marketIds;
@@ -4771,7 +4727,7 @@ var IndexerGrpcSpotStream = class {
4771
4727
  * @param params.onStatusCallback - Called on stream errors
4772
4728
  * @returns Subscription object with unsubscribe method
4773
4729
  */
4774
- streamSpotMarket({ marketIds, callback, onEndCallback, onStatusCallback }) {
4730
+ streamMarkets({ marketIds, callback, onEndCallback, onStatusCallback }) {
4775
4731
  if (typeof callback !== "function") throw new Error("callback must be a function");
4776
4732
  const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamMarketsRequest.create();
4777
4733
  if (marketIds) request.marketIds = marketIds;
@@ -4788,7 +4744,7 @@ var IndexerGrpcSpotStream = class {
4788
4744
  * @param params.onStatusCallback - Called on stream errors
4789
4745
  * @returns Subscription object with unsubscribe method
4790
4746
  */
4791
- streamSpotOrderbookV2({ marketIds, callback, onEndCallback, onStatusCallback }) {
4747
+ streamOrderbooksV2({ marketIds, callback, onEndCallback, onStatusCallback }) {
4792
4748
  if (!marketIds || marketIds.length === 0) throw new Error("marketIds is required and cannot be empty");
4793
4749
  if (typeof callback !== "function") throw new Error("callback must be a function");
4794
4750
  const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamOrderbookV2Request.create();
@@ -4806,7 +4762,7 @@ var IndexerGrpcSpotStream = class {
4806
4762
  * @param params.onStatusCallback - Called on stream errors
4807
4763
  * @returns Subscription object with unsubscribe method
4808
4764
  */
4809
- streamSpotOrderbookUpdate({ marketIds, callback, onEndCallback, onStatusCallback }) {
4765
+ streamOrderbookUpdates({ marketIds, callback, onEndCallback, onStatusCallback }) {
4810
4766
  if (!marketIds || marketIds.length === 0) throw new Error("marketIds is required and cannot be empty");
4811
4767
  if (typeof callback !== "function") throw new Error("callback must be a function");
4812
4768
  const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamOrderbookUpdateRequest.create();
@@ -4818,7 +4774,7 @@ var IndexerGrpcSpotStream = class {
4818
4774
  };
4819
4775
 
4820
4776
  //#endregion
4821
- //#region src/client/indexer/grpc_stream/IndexerGrpcMitoStream.ts
4777
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcMitoStream.ts
4822
4778
  /**
4823
4779
  * @category Indexer Grpc Stream
4824
4780
  * @description Provides streaming access to Mito vault data from Injective Indexer
@@ -4933,7 +4889,7 @@ var IndexerGrpcMitoStream = class {
4933
4889
  };
4934
4890
 
4935
4891
  //#endregion
4936
- //#region src/client/indexer/grpc_stream/IndexerGrpcOracleStream.ts
4892
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcOracleStream.ts
4937
4893
  /**
4938
4894
  * @category Indexer Grpc Stream
4939
4895
  * @description Provides streaming access to oracle price data from Injective Indexer
@@ -4987,7 +4943,7 @@ var IndexerGrpcOracleStream = class {
4987
4943
  };
4988
4944
 
4989
4945
  //#endregion
4990
- //#region src/client/indexer/grpc_stream/IndexerGrpcAccountStream.ts
4946
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcAccountStream.ts
4991
4947
  /**
4992
4948
  * @category Indexer Grpc Stream
4993
4949
  * @description Provides streaming access to account data from the Injective Indexer
@@ -5020,7 +4976,7 @@ var IndexerGrpcAccountStream = class {
5020
4976
  };
5021
4977
 
5022
4978
  //#endregion
5023
- //#region src/client/indexer/grpc_stream/IndexerGrpcAuctionStream.ts
4979
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcAuctionStream.ts
5024
4980
  /**
5025
4981
  * @category Indexer Grpc Stream
5026
4982
  * @description Provides streaming access to auction data from Injective Indexer
@@ -5050,7 +5006,7 @@ var IndexerGrpcAuctionStream = class {
5050
5006
  };
5051
5007
 
5052
5008
  //#endregion
5053
- //#region src/client/indexer/grpc_stream/IndexerGrpcTradingStream.ts
5009
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcTradingStream.ts
5054
5010
  /**
5055
5011
  * @category Indexer Grid Strategy Grpc Stream
5056
5012
  * @description Provides streaming access to grid strategy data from Injective Indexer
@@ -5085,7 +5041,7 @@ var IndexerGrpcTradingStream = class {
5085
5041
  };
5086
5042
 
5087
5043
  //#endregion
5088
- //#region src/client/indexer/grpc_stream/IndexerGrpcArchiverStream.ts
5044
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcArchiverStream.ts
5089
5045
  /**
5090
5046
  * @category Indexer Grpc Stream
5091
5047
  * @description Provides streaming access to archiver data from Injective Indexer
@@ -5118,7 +5074,7 @@ var IndexerGrpcArchiverStream = class {
5118
5074
  };
5119
5075
 
5120
5076
  //#endregion
5121
- //#region src/client/indexer/grpc_stream/IndexerGrpcExplorerStream.ts
5077
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcExplorerStream.ts
5122
5078
  /**
5123
5079
  * @category Indexer Grpc Stream
5124
5080
  * @description Provides streaming access to blockchain explorer data from Injective Indexer
@@ -5178,7 +5134,7 @@ var IndexerGrpcExplorerStream = class {
5178
5134
  };
5179
5135
 
5180
5136
  //#endregion
5181
- //#region src/client/indexer/grpc_stream/IndexerGrpcDerivativesStream.ts
5137
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcDerivativesStream.ts
5182
5138
  /**
5183
5139
  * @category Indexer Grpc Stream
5184
5140
  * @description Provides streaming access to derivatives market data from Injective Indexer
@@ -5368,7 +5324,7 @@ var IndexerGrpcDerivativesStream = class {
5368
5324
  };
5369
5325
 
5370
5326
  //#endregion
5371
- //#region src/client/indexer/grpc_stream/IndexerGrpcAccountPortfolioStream.ts
5327
+ //#region src/client/indexer/grpc_stream/stream/IndexerGrpcAccountPortfolioStream.ts
5372
5328
  /**
5373
5329
  * @category Indexer Grpc Stream
5374
5330
  * @description Provides streaming access to account portfolio data from Injective Indexer
@@ -5405,184 +5361,1177 @@ var IndexerGrpcAccountPortfolioStream = class {
5405
5361
  };
5406
5362
 
5407
5363
  //#endregion
5408
- Object.defineProperty(exports, 'ExplorerStreamTransformer', {
5409
- enumerable: true,
5410
- get: function () {
5411
- return ExplorerStreamTransformer;
5412
- }
5413
- });
5414
- Object.defineProperty(exports, 'IndexerAccountPortfolioStreamTransformer', {
5415
- enumerable: true,
5416
- get: function () {
5417
- return IndexerAccountPortfolioStreamTransformer;
5418
- }
5419
- });
5420
- Object.defineProperty(exports, 'IndexerAccountStreamTransformer', {
5421
- enumerable: true,
5422
- get: function () {
5423
- return IndexerAccountStreamTransformer;
5424
- }
5425
- });
5426
- Object.defineProperty(exports, 'IndexerArchiverStreamTransformer', {
5427
- enumerable: true,
5428
- get: function () {
5429
- return IndexerArchiverStreamTransformer;
5430
- }
5431
- });
5432
- Object.defineProperty(exports, 'IndexerAuctionStreamTransformer', {
5433
- enumerable: true,
5434
- get: function () {
5435
- return IndexerAuctionStreamTransformer;
5436
- }
5437
- });
5438
- Object.defineProperty(exports, 'IndexerCampaignTransformer', {
5439
- enumerable: true,
5440
- get: function () {
5441
- return IndexerCampaignTransformer;
5442
- }
5443
- });
5444
- Object.defineProperty(exports, 'IndexerDerivativeStreamTransformer', {
5445
- enumerable: true,
5446
- get: function () {
5447
- return IndexerDerivativeStreamTransformer;
5448
- }
5449
- });
5450
- Object.defineProperty(exports, 'IndexerGrpcAccountApi', {
5451
- enumerable: true,
5452
- get: function () {
5453
- return IndexerGrpcAccountApi;
5454
- }
5455
- });
5456
- Object.defineProperty(exports, 'IndexerGrpcAccountPortfolioApi', {
5457
- enumerable: true,
5458
- get: function () {
5459
- return IndexerGrpcAccountPortfolioApi;
5460
- }
5461
- });
5462
- Object.defineProperty(exports, 'IndexerGrpcAccountPortfolioStream', {
5463
- enumerable: true,
5464
- get: function () {
5465
- return IndexerGrpcAccountPortfolioStream;
5466
- }
5467
- });
5468
- Object.defineProperty(exports, 'IndexerGrpcAccountPortfolioTransformer', {
5469
- enumerable: true,
5470
- get: function () {
5471
- return IndexerGrpcAccountPortfolioTransformer;
5472
- }
5473
- });
5474
- Object.defineProperty(exports, 'IndexerGrpcAccountStream', {
5475
- enumerable: true,
5476
- get: function () {
5477
- return IndexerGrpcAccountStream;
5478
- }
5479
- });
5480
- Object.defineProperty(exports, 'IndexerGrpcAccountTransformer', {
5481
- enumerable: true,
5482
- get: function () {
5483
- return IndexerGrpcAccountTransformer;
5484
- }
5485
- });
5486
- Object.defineProperty(exports, 'IndexerGrpcArchiverApi', {
5487
- enumerable: true,
5488
- get: function () {
5489
- return IndexerGrpcArchiverApi;
5490
- }
5491
- });
5492
- Object.defineProperty(exports, 'IndexerGrpcArchiverStream', {
5493
- enumerable: true,
5494
- get: function () {
5495
- return IndexerGrpcArchiverStream;
5496
- }
5497
- });
5498
- Object.defineProperty(exports, 'IndexerGrpcArchiverTransformer', {
5499
- enumerable: true,
5500
- get: function () {
5501
- return IndexerGrpcArchiverTransformer;
5502
- }
5503
- });
5504
- Object.defineProperty(exports, 'IndexerGrpcAuctionApi', {
5505
- enumerable: true,
5506
- get: function () {
5507
- return IndexerGrpcAuctionApi;
5508
- }
5509
- });
5510
- Object.defineProperty(exports, 'IndexerGrpcAuctionStream', {
5511
- enumerable: true,
5512
- get: function () {
5513
- return IndexerGrpcAuctionStream;
5514
- }
5515
- });
5516
- Object.defineProperty(exports, 'IndexerGrpcAuctionTransformer', {
5517
- enumerable: true,
5518
- get: function () {
5519
- return IndexerGrpcAuctionTransformer;
5520
- }
5521
- });
5522
- Object.defineProperty(exports, 'IndexerGrpcCampaignApi', {
5523
- enumerable: true,
5524
- get: function () {
5525
- return IndexerGrpcCampaignApi;
5526
- }
5527
- });
5528
- Object.defineProperty(exports, 'IndexerGrpcDerivativeTransformer', {
5529
- enumerable: true,
5530
- get: function () {
5531
- return IndexerGrpcDerivativeTransformer;
5532
- }
5533
- });
5534
- Object.defineProperty(exports, 'IndexerGrpcDerivativesApi', {
5535
- enumerable: true,
5536
- get: function () {
5537
- return IndexerGrpcDerivativesApi;
5538
- }
5539
- });
5540
- Object.defineProperty(exports, 'IndexerGrpcDerivativesStream', {
5541
- enumerable: true,
5542
- get: function () {
5543
- return IndexerGrpcDerivativesStream;
5544
- }
5545
- });
5546
- Object.defineProperty(exports, 'IndexerGrpcExplorerApi', {
5547
- enumerable: true,
5548
- get: function () {
5549
- return IndexerGrpcExplorerApi;
5550
- }
5551
- });
5552
- Object.defineProperty(exports, 'IndexerGrpcExplorerStream', {
5553
- enumerable: true,
5554
- get: function () {
5555
- return IndexerGrpcExplorerStream;
5556
- }
5557
- });
5558
- Object.defineProperty(exports, 'IndexerGrpcExplorerTransformer', {
5559
- enumerable: true,
5560
- get: function () {
5561
- return IndexerGrpcExplorerTransformer;
5562
- }
5563
- });
5564
- Object.defineProperty(exports, 'IndexerGrpcInsuranceFundApi', {
5565
- enumerable: true,
5566
- get: function () {
5567
- return IndexerGrpcInsuranceFundApi;
5568
- }
5569
- });
5570
- Object.defineProperty(exports, 'IndexerGrpcInsuranceFundTransformer', {
5571
- enumerable: true,
5572
- get: function () {
5573
- return IndexerGrpcInsuranceFundTransformer;
5574
- }
5575
- });
5576
- Object.defineProperty(exports, 'IndexerGrpcMegaVaultApi', {
5577
- enumerable: true,
5578
- get: function () {
5579
- return IndexerGrpcMegaVaultApi;
5580
- }
5581
- });
5582
- Object.defineProperty(exports, 'IndexerGrpcMegaVaultTransformer', {
5583
- enumerable: true,
5584
- get: function () {
5585
- return IndexerGrpcMegaVaultTransformer;
5364
+ //#region src/client/indexer/grpc_stream/stream/StreamManager.ts
5365
+ /**
5366
+ * StreamManager - Simple registry for managing multiple V1 stream subscriptions by key
5367
+ *
5368
+ * This is a lightweight utility for storing and canceling multiple V1 RxJS-based streams.
5369
+ * For V2 streams with advanced lifecycle management and retry logic, use StreamManagerV2.
5370
+ */
5371
+ var StreamManager = class {
5372
+ constructor() {
5373
+ require_defineProperty._defineProperty(this, "streams", /* @__PURE__ */ new Map());
5374
+ }
5375
+ set(stream, streamKey) {
5376
+ if (this.streams.has(streamKey)) throw new Error(`Stream ${streamKey} already exists`);
5377
+ this.streams.set(streamKey, stream);
5378
+ }
5379
+ get(streamKey) {
5380
+ if (!this.streams.has(streamKey)) throw new Error(`Stream ${streamKey} is not found`);
5381
+ return this.streams.get(streamKey);
5382
+ }
5383
+ exists(streamKey) {
5384
+ return this.streams.has(streamKey);
5385
+ }
5386
+ cancelAll() {
5387
+ this.streams.forEach((stream) => {
5388
+ stream.cancel();
5389
+ });
5390
+ this.streams = /* @__PURE__ */ new Map();
5391
+ }
5392
+ cancel(streamKey) {
5393
+ if (!this.streams.has(streamKey)) throw new Error(`Stream ${streamKey} is not found`);
5394
+ this.streams.get(streamKey).cancel();
5395
+ this.streams.delete(streamKey);
5396
+ }
5397
+ cancelIfExists(streamKey) {
5398
+ if (!this.streams.has(streamKey)) return;
5399
+ this.streams.get(streamKey).cancel();
5400
+ this.streams.delete(streamKey);
5401
+ }
5402
+ };
5403
+
5404
+ //#endregion
5405
+ //#region src/client/indexer/grpc_stream/streamV2/streamHelpersV2.ts
5406
+ /**
5407
+ * Extracts detailed error information from a gRPC/RpcError object.
5408
+ *
5409
+ * gRPC-web errors typically have these properties:
5410
+ * - code: gRPC status code (number)
5411
+ * - message: Error message
5412
+ * - name: 'RpcError'
5413
+ * - methodName: The RPC method that failed
5414
+ * - serviceName: The service name
5415
+ * - metadata: Response metadata/trailers
5416
+ */
5417
+ function extractGrpcError(error) {
5418
+ let code = require_types.GrpcStatusCode.UNKNOWN;
5419
+ let details = "Unknown stream error";
5420
+ let metadata = void 0;
5421
+ if (error && typeof error === "object") {
5422
+ if ("code" in error && typeof error.code === "number") code = error.code;
5423
+ if ("message" in error && typeof error.message === "string") details = error.message;
5424
+ else if ("details" in error && typeof error.details === "string") details = error.details;
5425
+ const errorObj = error;
5426
+ metadata = {
5427
+ originalError: error,
5428
+ ..."name" in errorObj && { errorName: errorObj.name },
5429
+ ..."methodName" in errorObj && { methodName: errorObj.methodName },
5430
+ ..."serviceName" in errorObj && { serviceName: errorObj.serviceName },
5431
+ ..."metadata" in errorObj && { grpcMetadata: errorObj.metadata }
5432
+ };
5433
+ } else if (error instanceof Error) {
5434
+ details = error.message;
5435
+ metadata = {
5436
+ originalError: error,
5437
+ stack: error.stack
5438
+ };
5439
+ }
5440
+ return {
5441
+ code,
5442
+ details,
5443
+ metadata
5444
+ };
5445
+ }
5446
+ /**
5447
+ * Creates an event-based subscription for StreamManager V2.
5448
+ * This emits 'error' and 'complete' events instead of using callbacks.
5449
+ *
5450
+ * Error Handling:
5451
+ * - gRPC errors are extracted with full metadata and emitted as 'error' events
5452
+ * - User callback errors are caught and emitted separately to distinguish from stream errors
5453
+ * - Aborted streams don't emit any events (clean shutdown)
5454
+ *
5455
+ * @param stream - The ServerStreamingCall from the V2 client
5456
+ * @param handleResponse - Callback to process each stream response
5457
+ * @returns StreamSubscription with event emitters for error/complete
5458
+ */
5459
+ function createStreamSubscriptionV2(stream, handleResponse) {
5460
+ const emitter = new eventemitter3.EventEmitter();
5461
+ const abortController = new AbortController();
5462
+ let hasEmittedTerminalEvent = false;
5463
+ const subscription = {
5464
+ unsubscribe: () => {
5465
+ abortController.abort();
5466
+ emitter.removeAllListeners();
5467
+ },
5468
+ on: (event, handler) => {
5469
+ emitter.on(event, handler);
5470
+ },
5471
+ off: (event, handler) => {
5472
+ emitter.off(event, handler);
5473
+ }
5474
+ };
5475
+ (async () => {
5476
+ try {
5477
+ for await (const response of stream.responses) {
5478
+ if (abortController.signal.aborted) return;
5479
+ try {
5480
+ handleResponse(response);
5481
+ } catch (callbackError) {
5482
+ if (!abortController.signal.aborted && !hasEmittedTerminalEvent) {
5483
+ hasEmittedTerminalEvent = true;
5484
+ const streamError = {
5485
+ code: require_types.GrpcStatusCode.INTERNAL,
5486
+ details: callbackError instanceof Error ? `Callback error: ${callbackError.message}` : "Callback error: Unknown",
5487
+ metadata: {
5488
+ type: "callback-error",
5489
+ originalError: callbackError,
5490
+ stack: callbackError instanceof Error ? callbackError.stack : void 0
5491
+ }
5492
+ };
5493
+ emitter.emit("error", streamError);
5494
+ }
5495
+ return;
5496
+ }
5497
+ }
5498
+ if (!abortController.signal.aborted && !hasEmittedTerminalEvent) {
5499
+ hasEmittedTerminalEvent = true;
5500
+ emitter.emit("complete");
5501
+ }
5502
+ } catch (error) {
5503
+ if (!abortController.signal.aborted && !hasEmittedTerminalEvent) {
5504
+ hasEmittedTerminalEvent = true;
5505
+ const streamError = extractGrpcError(error);
5506
+ emitter.emit("error", streamError);
5507
+ }
5508
+ }
5509
+ })();
5510
+ return subscription;
5511
+ }
5512
+
5513
+ //#endregion
5514
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcSpotStreamV2.ts
5515
+ var IndexerGrpcSpotStreamV2 = class {
5516
+ constructor(endpoint, metadata) {
5517
+ require_defineProperty._defineProperty(this, "client", void 0);
5518
+ require_defineProperty._defineProperty(this, "transport", void 0);
5519
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
5520
+ this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb_client.InjectiveSpotExchangeRPCClient(this.transport);
5521
+ }
5522
+ /**
5523
+ * Stream spot orderbook updates
5524
+ * @param params.marketIds - Array of market IDs to stream
5525
+ * @param params.callback - Called for each orderbook update
5526
+ * @returns StreamSubscription
5527
+ */
5528
+ streamOrderbookUpdates({ marketIds, callback }) {
5529
+ if (!marketIds || marketIds.length === 0) throw new Error("marketIds is required");
5530
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5531
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamOrderbookUpdateRequest.create();
5532
+ request.marketIds = marketIds;
5533
+ return createStreamSubscriptionV2(this.client.streamOrderbookUpdate(request), (response) => {
5534
+ callback(IndexerSpotStreamTransformer.orderbookUpdateStreamCallback(response));
5535
+ });
5536
+ }
5537
+ /**
5538
+ * Stream spot orders
5539
+ * @param params.marketId - Optional market ID to filter
5540
+ * @param params.subaccountId - Optional subaccount ID to filter
5541
+ * @param params.orderSide - Optional order side to filter
5542
+ * @param params.callback - Called for each order update
5543
+ * @returns StreamSubscription
5544
+ */
5545
+ streamOrders({ marketId, subaccountId, orderSide, callback }) {
5546
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5547
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamOrdersRequest.create();
5548
+ if (marketId) request.marketId = marketId;
5549
+ if (subaccountId) request.subaccountId = subaccountId;
5550
+ if (orderSide) request.orderSide = orderSide;
5551
+ return createStreamSubscriptionV2(this.client.streamOrders(request), (response) => {
5552
+ callback(IndexerSpotStreamTransformer.ordersStreamCallback(response));
5553
+ });
5554
+ }
5555
+ /**
5556
+ * Stream spot order history
5557
+ * @param params.subaccountId - Optional subaccount ID to filter
5558
+ * @param params.marketId - Optional market ID to filter
5559
+ * @param params.orderTypes - Optional order types to filter
5560
+ * @param params.direction - Optional direction to filter
5561
+ * @param params.state - Optional state to filter
5562
+ * @param params.executionTypes - Optional execution types to filter
5563
+ * @param params.callback - Called for each order history update
5564
+ * @returns StreamSubscription
5565
+ */
5566
+ streamOrderHistory({ subaccountId, marketId, orderTypes, direction, state, executionTypes, callback }) {
5567
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5568
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamOrdersHistoryRequest.create();
5569
+ if (subaccountId) request.subaccountId = subaccountId;
5570
+ if (marketId) request.marketId = marketId;
5571
+ if (orderTypes) request.orderTypes = orderTypes;
5572
+ if (direction) request.direction = direction;
5573
+ if (state) request.state = state;
5574
+ if (executionTypes) request.executionTypes = executionTypes;
5575
+ return createStreamSubscriptionV2(this.client.streamOrdersHistory(request), (response) => {
5576
+ callback(IndexerSpotStreamTransformer.orderHistoryStreamCallback(response));
5577
+ });
5578
+ }
5579
+ /**
5580
+ * Stream spot trades
5581
+ * @param params.marketId - Optional market ID to filter
5582
+ * @param params.marketIds - Optional array of market IDs to filter
5583
+ * @param params.subaccountId - Optional subaccount ID to filter
5584
+ * @param params.subaccountIds - Optional array of subaccount IDs to filter
5585
+ * @param params.executionSide - Optional execution side to filter
5586
+ * @param params.direction - Optional direction to filter
5587
+ * @param params.executionTypes - Optional execution types to filter
5588
+ * @param params.callback - Called for each trade update
5589
+ * @returns StreamSubscription
5590
+ */
5591
+ streamTrades({ marketId, marketIds, subaccountId, subaccountIds, executionSide, direction, executionTypes, callback }) {
5592
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5593
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_spot_exchange_rpc_pb.StreamTradesRequest.create();
5594
+ if (marketId) request.marketId = marketId;
5595
+ if (marketIds) request.marketIds = marketIds;
5596
+ if (subaccountId) request.subaccountId = subaccountId;
5597
+ if (subaccountIds) request.subaccountIds = subaccountIds;
5598
+ if (executionSide) request.executionSide = executionSide;
5599
+ if (direction) request.direction = direction;
5600
+ if (executionTypes) request.executionTypes = executionTypes;
5601
+ return createStreamSubscriptionV2(this.client.streamTrades(request), (response) => {
5602
+ callback(IndexerSpotStreamTransformer.tradesStreamCallback(response));
5603
+ });
5604
+ }
5605
+ };
5606
+
5607
+ //#endregion
5608
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcMitoStreamV2.ts
5609
+ var IndexerGrpcMitoStreamV2 = class {
5610
+ constructor(endpoint, metadata) {
5611
+ require_defineProperty._defineProperty(this, "client", void 0);
5612
+ require_defineProperty._defineProperty(this, "transport", void 0);
5613
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
5614
+ this.client = new __injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb_client.MitoAPIClient(this.transport);
5615
+ }
5616
+ /**
5617
+ * Stream vault transfers
5618
+ * @param params.vault - Optional vault address to filter
5619
+ * @param params.account - Optional account address to filter
5620
+ * @param params.callback - Called for each transfer update
5621
+ * @returns StreamSubscription
5622
+ */
5623
+ streamTransfers({ vault, account, callback }) {
5624
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5625
+ const request = __injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb.StreamTransfersRequest.create();
5626
+ if (vault) request.vault = vault;
5627
+ if (account) request.account = account;
5628
+ return createStreamSubscriptionV2(this.client.streamTransfers(request), (response) => {
5629
+ callback(IndexerGrpcMitoStreamTransformer.transfersStreamCallback(response));
5630
+ });
5631
+ }
5632
+ /**
5633
+ * Stream vault information
5634
+ * @param params.vault - Optional vault address to filter
5635
+ * @param params.callback - Called for each vault update
5636
+ * @returns StreamSubscription
5637
+ */
5638
+ streamVault({ vault, callback }) {
5639
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5640
+ const request = __injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb.StreamVaultRequest.create();
5641
+ if (vault) request.vault = vault;
5642
+ return createStreamSubscriptionV2(this.client.streamVault(request), (response) => {
5643
+ callback(IndexerGrpcMitoStreamTransformer.vaultStreamCallback(response));
5644
+ });
5645
+ }
5646
+ /**
5647
+ * Stream vault holder subscriptions
5648
+ * @param params.holderAddress - The holder address to stream subscriptions for
5649
+ * @param params.vaultAddress - Optional vault address to filter
5650
+ * @param params.stakingContractAddress - Optional staking contract address to filter
5651
+ * @param params.callback - Called for each subscription update
5652
+ * @returns StreamSubscription
5653
+ */
5654
+ streamVaultHolderSubscriptions({ holderAddress, vaultAddress, stakingContractAddress, callback }) {
5655
+ if (!holderAddress) throw new Error("holderAddress is required");
5656
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5657
+ const request = __injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb.StreamHolderSubscriptionRequest.create();
5658
+ request.holderAddress = holderAddress;
5659
+ if (vaultAddress) request.vaultAddress = vaultAddress;
5660
+ if (stakingContractAddress) request.stakingContractAddress = stakingContractAddress;
5661
+ return createStreamSubscriptionV2(this.client.streamHolderSubscription(request), (response) => {
5662
+ callback(IndexerGrpcMitoStreamTransformer.vaultHolderSubscriptionStreamCallback(response));
5663
+ });
5664
+ }
5665
+ /**
5666
+ * Stream staking rewards by account
5667
+ * @param params.staker - The staker address to stream rewards for
5668
+ * @param params.stakingContractAddress - The staking contract address
5669
+ * @param params.callback - Called for each reward update
5670
+ * @returns StreamSubscription
5671
+ */
5672
+ streamStakingRewardsByAccount({ staker, stakingContractAddress, callback }) {
5673
+ if (!staker) throw new Error("staker is required");
5674
+ if (!stakingContractAddress) throw new Error("stakingContractAddress is required");
5675
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5676
+ const request = __injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb.StreamStakingRewardByAccountRequest.create();
5677
+ request.staker = staker;
5678
+ request.stakingContractAddress = stakingContractAddress;
5679
+ return createStreamSubscriptionV2(this.client.streamStakingRewardByAccount(request), (response) => {
5680
+ callback(IndexerGrpcMitoStreamTransformer.stakingRewardByAccountStreamCallback(response));
5681
+ });
5682
+ }
5683
+ /**
5684
+ * Stream historical staking data
5685
+ * @param params.staker - The staker address to stream data for
5686
+ * @param params.stakingContractAddress - The staking contract address
5687
+ * @param params.callback - Called for each historical staking update
5688
+ * @returns StreamSubscription
5689
+ */
5690
+ streamHistoricalStaking({ staker, stakingContractAddress, callback }) {
5691
+ if (!staker) throw new Error("staker is required");
5692
+ if (!stakingContractAddress) throw new Error("stakingContractAddress is required");
5693
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5694
+ const request = __injectivelabs_mito_proto_ts_v2_generated_goadesign_goagen_mito_api_pb.StreamHistoricalStakingRequest.create();
5695
+ request.staker = staker;
5696
+ request.stakingContractAddress = stakingContractAddress;
5697
+ return createStreamSubscriptionV2(this.client.streamHistoricalStaking(request), (response) => {
5698
+ callback(IndexerGrpcMitoStreamTransformer.historicalStakingStreamCallback(response));
5699
+ });
5700
+ }
5701
+ };
5702
+
5703
+ //#endregion
5704
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcOracleStreamV2.ts
5705
+ var IndexerGrpcOracleStreamV2 = class {
5706
+ constructor(endpoint, metadata) {
5707
+ require_defineProperty._defineProperty(this, "client", void 0);
5708
+ require_defineProperty._defineProperty(this, "transport", void 0);
5709
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
5710
+ this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_oracle_rpc_pb_client.InjectiveOracleRPCClient(this.transport);
5711
+ }
5712
+ /**
5713
+ * Stream oracle price updates
5714
+ * @param params.oracleType - The oracle type to stream prices for
5715
+ * @param params.baseSymbol - Optional base symbol filter
5716
+ * @param params.quoteSymbol - Optional quote symbol filter
5717
+ * @param params.callback - Called for each price update
5718
+ * @returns StreamSubscription
5719
+ */
5720
+ streamOraclePrices({ oracleType, baseSymbol, quoteSymbol, callback }) {
5721
+ if (!oracleType) throw new Error("oracleType is required");
5722
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5723
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_oracle_rpc_pb.StreamPricesRequest.create();
5724
+ if (baseSymbol) request.baseSymbol = baseSymbol;
5725
+ if (quoteSymbol) request.quoteSymbol = quoteSymbol;
5726
+ request.oracleType = oracleType;
5727
+ return createStreamSubscriptionV2(this.client.streamPrices(request), (response) => {
5728
+ callback(IndexerOracleStreamTransformer.pricesStreamCallback(response));
5729
+ });
5730
+ }
5731
+ /**
5732
+ * Stream oracle prices by markets
5733
+ * @param params.marketIds - Optional array of market IDs to filter
5734
+ * @param params.callback - Called for each price update
5735
+ * @returns StreamSubscription
5736
+ */
5737
+ streamOraclePricesByMarkets({ marketIds, callback }) {
5738
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5739
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_oracle_rpc_pb.StreamPricesByMarketsRequest.create();
5740
+ if (marketIds) request.marketIds = marketIds;
5741
+ return createStreamSubscriptionV2(this.client.streamPricesByMarkets(request), (response) => {
5742
+ callback(IndexerOracleStreamTransformer.pricesByMarketsCallback(response));
5743
+ });
5744
+ }
5745
+ };
5746
+
5747
+ //#endregion
5748
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcAccountStreamV2.ts
5749
+ var IndexerGrpcAccountStreamV2 = class {
5750
+ constructor(endpoint, metadata) {
5751
+ require_defineProperty._defineProperty(this, "client", void 0);
5752
+ require_defineProperty._defineProperty(this, "transport", void 0);
5753
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
5754
+ this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_accounts_rpc_pb_client.InjectiveAccountsRPCClient(this.transport);
5755
+ }
5756
+ /**
5757
+ * Stream subaccount balance updates
5758
+ * @param params.subaccountId - The subaccount ID to stream balance for
5759
+ * @param params.callback - Called for each balance update
5760
+ * @returns StreamSubscription
5761
+ */
5762
+ streamSubaccountBalance({ subaccountId, callback }) {
5763
+ if (!subaccountId) throw new Error("subaccountId is required");
5764
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5765
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_accounts_rpc_pb.StreamSubaccountBalanceRequest.create();
5766
+ request.subaccountId = subaccountId;
5767
+ return createStreamSubscriptionV2(this.client.streamSubaccountBalance(request), (response) => {
5768
+ callback(IndexerAccountStreamTransformer.balanceStreamCallback(response));
5769
+ });
5770
+ }
5771
+ };
5772
+
5773
+ //#endregion
5774
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcAuctionStreamV2.ts
5775
+ var IndexerGrpcAuctionStreamV2 = class {
5776
+ constructor(endpoint, metadata) {
5777
+ require_defineProperty._defineProperty(this, "client", void 0);
5778
+ require_defineProperty._defineProperty(this, "transport", void 0);
5779
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
5780
+ this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_auction_rpc_pb_client.InjectiveAuctionRPCClient(this.transport);
5781
+ }
5782
+ /**
5783
+ * Stream auction bids
5784
+ * @param params.callback - Called for each bid update
5785
+ * @returns StreamSubscription
5786
+ */
5787
+ streamBids({ callback }) {
5788
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5789
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_auction_rpc_pb.StreamBidsRequest.create();
5790
+ return createStreamSubscriptionV2(this.client.streamBids(request), (response) => {
5791
+ callback(IndexerAuctionStreamTransformer.bidsStreamCallback(response));
5792
+ });
5793
+ }
5794
+ };
5795
+
5796
+ //#endregion
5797
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcTradingStreamV2.ts
5798
+ var IndexerGrpcTradingStreamV2 = class {
5799
+ constructor(endpoint, metadata) {
5800
+ require_defineProperty._defineProperty(this, "client", void 0);
5801
+ require_defineProperty._defineProperty(this, "transport", void 0);
5802
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
5803
+ this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_trading_rpc_pb_client.InjectiveTradingRPCClient(this.transport);
5804
+ }
5805
+ /**
5806
+ * Stream grid strategies
5807
+ * @param params.marketId - Optional market ID to filter strategies
5808
+ * @param params.accountAddresses - Optional array of account addresses to filter
5809
+ * @param params.callback - Called for each strategy update
5810
+ * @returns StreamSubscription
5811
+ */
5812
+ streamGridStrategies({ marketId, accountAddresses, callback }) {
5813
+ if ((!accountAddresses || accountAddresses.length === 0) && !marketId) throw new Error("accountAddresses or marketId is required");
5814
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5815
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_trading_rpc_pb.StreamStrategyRequest.create();
5816
+ if (accountAddresses) request.accountAddresses = accountAddresses;
5817
+ if (marketId) request.marketId = marketId;
5818
+ return createStreamSubscriptionV2(this.client.streamStrategy(request), (response) => {
5819
+ callback(response);
5820
+ });
5821
+ }
5822
+ };
5823
+
5824
+ //#endregion
5825
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcArchiverStreamV2.ts
5826
+ var IndexerGrpcArchiverStreamV2 = class {
5827
+ constructor(endpoint, metadata) {
5828
+ require_defineProperty._defineProperty(this, "client", void 0);
5829
+ require_defineProperty._defineProperty(this, "transport", void 0);
5830
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
5831
+ this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_archiver_rpc_pb_client.InjectiveArchiverRPCClient(this.transport);
5832
+ }
5833
+ /**
5834
+ * Stream spot average entries
5835
+ * @param params.account - The account address to stream entries for
5836
+ * @param params.callback - Called for each average entry update
5837
+ * @returns StreamSubscription
5838
+ */
5839
+ streamSpotAverageEntries({ account, callback }) {
5840
+ if (!account) throw new Error("account is required");
5841
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5842
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_archiver_rpc_pb.StreamSpotAverageEntriesRequest.create();
5843
+ request.account = account;
5844
+ return createStreamSubscriptionV2(this.client.streamSpotAverageEntries(request), (response) => {
5845
+ callback(IndexerArchiverStreamTransformer.spotAverageEntriesStreamCallback(response));
5846
+ });
5847
+ }
5848
+ };
5849
+
5850
+ //#endregion
5851
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcExplorerStreamV2.ts
5852
+ var IndexerGrpcExplorerStreamV2 = class {
5853
+ constructor(endpoint, metadata) {
5854
+ require_defineProperty._defineProperty(this, "client", void 0);
5855
+ require_defineProperty._defineProperty(this, "transport", void 0);
5856
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
5857
+ this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_explorer_rpc_pb_client.InjectiveExplorerRPCClient(this.transport);
5858
+ }
5859
+ /**
5860
+ * Stream block updates
5861
+ * @param params.callback - Called for each block update
5862
+ * @returns StreamSubscription
5863
+ */
5864
+ streamBlocks({ callback }) {
5865
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5866
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_explorer_rpc_pb.StreamBlocksRequest.create();
5867
+ return createStreamSubscriptionV2(this.client.streamBlocks(request), (response) => {
5868
+ callback(ExplorerStreamTransformer.blocksStreamCallback(response));
5869
+ });
5870
+ }
5871
+ /**
5872
+ * Stream blocks with transactions
5873
+ * @param params.callback - Called for each block with transactions update
5874
+ * @returns StreamSubscription
5875
+ */
5876
+ streamBlocksWithTxs({ callback }) {
5877
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5878
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_explorer_rpc_pb.StreamBlocksRequest.create();
5879
+ return createStreamSubscriptionV2(this.client.streamBlocks(request), (response) => {
5880
+ callback(ExplorerStreamTransformer.blocksWithTxsStreamCallback(response));
5881
+ });
5882
+ }
5883
+ /**
5884
+ * Stream transaction updates
5885
+ * @param params.callback - Called for each transaction update
5886
+ * @returns StreamSubscription
5887
+ */
5888
+ streamTransactions({ callback }) {
5889
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5890
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_explorer_rpc_pb.StreamTxsRequest.create();
5891
+ return createStreamSubscriptionV2(this.client.streamTxs(request), (response) => {
5892
+ callback(ExplorerStreamTransformer.transactionsStreamCallback(response));
5893
+ });
5894
+ }
5895
+ };
5896
+
5897
+ //#endregion
5898
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcDerivativesStreamV2.ts
5899
+ var IndexerGrpcDerivativesStreamV2 = class {
5900
+ constructor(endpoint, metadata) {
5901
+ require_defineProperty._defineProperty(this, "client", void 0);
5902
+ require_defineProperty._defineProperty(this, "transport", void 0);
5903
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
5904
+ this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_derivative_exchange_rpc_pb_client.InjectiveDerivativeExchangeRPCClient(this.transport);
5905
+ }
5906
+ /**
5907
+ * Stream derivative orders
5908
+ * @param params.marketId - Optional market ID to filter
5909
+ * @param params.subaccountId - Optional subaccount ID to filter
5910
+ * @param params.orderSide - Optional order side to filter
5911
+ * @param params.callback - Called for each order update
5912
+ * @returns StreamSubscription
5913
+ */
5914
+ streamOrders({ marketId, subaccountId, orderSide, callback }) {
5915
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5916
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_derivative_exchange_rpc_pb.StreamOrdersRequest.create();
5917
+ if (marketId) request.marketId = marketId;
5918
+ if (subaccountId) request.subaccountId = subaccountId;
5919
+ if (orderSide) request.orderSide = orderSide;
5920
+ return createStreamSubscriptionV2(this.client.streamOrders(request), (response) => {
5921
+ callback(IndexerDerivativeStreamTransformer.ordersStreamCallback(response));
5922
+ });
5923
+ }
5924
+ /**
5925
+ * Stream derivative order history
5926
+ * @param params.subaccountId - Optional subaccount ID to filter
5927
+ * @param params.marketId - Optional market ID to filter
5928
+ * @param params.orderTypes - Optional order types to filter
5929
+ * @param params.direction - Optional direction to filter
5930
+ * @param params.state - Optional state to filter
5931
+ * @param params.executionTypes - Optional execution types to filter
5932
+ * @param params.callback - Called for each order history update
5933
+ * @returns StreamSubscription
5934
+ */
5935
+ streamOrdersHistory({ subaccountId, marketId, orderTypes, direction, state, executionTypes, callback }) {
5936
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5937
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_derivative_exchange_rpc_pb.StreamOrdersHistoryRequest.create();
5938
+ if (subaccountId) request.subaccountId = subaccountId;
5939
+ if (marketId) request.marketId = marketId;
5940
+ if (orderTypes) request.orderTypes = orderTypes;
5941
+ if (direction) request.direction = direction;
5942
+ if (state) request.state = state;
5943
+ if (executionTypes) request.executionTypes = executionTypes;
5944
+ return createStreamSubscriptionV2(this.client.streamOrdersHistory(request), (response) => {
5945
+ callback(IndexerDerivativeStreamTransformer.orderHistoryStreamCallback(response));
5946
+ });
5947
+ }
5948
+ /**
5949
+ * Stream derivative trades
5950
+ * @param params.marketId - Optional market ID to filter
5951
+ * @param params.marketIds - Optional array of market IDs to filter
5952
+ * @param params.subaccountId - Optional subaccount ID to filter
5953
+ * @param params.subaccountIds - Optional array of subaccount IDs to filter
5954
+ * @param params.executionSide - Optional execution side to filter
5955
+ * @param params.direction - Optional direction to filter
5956
+ * @param params.pagination - Optional pagination options
5957
+ * @param params.callback - Called for each trade update
5958
+ * @returns StreamSubscription
5959
+ */
5960
+ streamTrades({ marketIds, marketId, subaccountIds, subaccountId, executionSide, direction, pagination, callback }) {
5961
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5962
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_derivative_exchange_rpc_pb.StreamTradesRequest.create();
5963
+ if (marketIds) request.marketIds = marketIds;
5964
+ if (marketId) request.marketId = marketId;
5965
+ if (subaccountIds) request.subaccountIds = subaccountIds;
5966
+ if (subaccountId) request.subaccountId = subaccountId;
5967
+ if (executionSide) request.executionSide = executionSide;
5968
+ if (direction) request.direction = direction;
5969
+ if (pagination) {
5970
+ if (pagination.skip !== void 0) request.skip = BigInt(pagination.skip);
5971
+ if (pagination.limit !== void 0) request.limit = pagination.limit;
5972
+ }
5973
+ return createStreamSubscriptionV2(this.client.streamTrades(request), (response) => {
5974
+ callback(IndexerDerivativeStreamTransformer.tradesStreamCallback(response));
5975
+ });
5976
+ }
5977
+ /**
5978
+ * Stream derivative positions
5979
+ * @param params.marketId - Optional market ID to filter
5980
+ * @param params.address - Optional address to filter
5981
+ * @param params.subaccountId - Optional subaccount ID to filter
5982
+ * @param params.callback - Called for each position update
5983
+ * @returns StreamSubscription
5984
+ */
5985
+ streamPositions({ marketId, address, subaccountId, callback }) {
5986
+ if (typeof callback !== "function") throw new Error("callback must be a function");
5987
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_derivative_exchange_rpc_pb.StreamPositionsRequest.create();
5988
+ if (marketId) request.marketId = marketId;
5989
+ if (address) request.accountAddress = address;
5990
+ if (subaccountId) request.subaccountId = subaccountId;
5991
+ return createStreamSubscriptionV2(this.client.streamPositions(request), (response) => {
5992
+ callback(IndexerDerivativeStreamTransformer.positionStreamCallback(response));
5993
+ });
5994
+ }
5995
+ /**
5996
+ * Stream derivative markets
5997
+ * @param params.marketIds - Optional array of market IDs to filter
5998
+ * @param params.callback - Called for each market update
5999
+ * @returns StreamSubscription
6000
+ */
6001
+ streamMarkets({ marketIds, callback }) {
6002
+ if (typeof callback !== "function") throw new Error("callback must be a function");
6003
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_derivative_exchange_rpc_pb.StreamMarketRequest.create();
6004
+ if (marketIds && marketIds.length) request.marketIds = marketIds;
6005
+ return createStreamSubscriptionV2(this.client.streamMarket(request), (response) => {
6006
+ callback(response);
6007
+ });
6008
+ }
6009
+ /**
6010
+ * Stream derivative orderbooks V2
6011
+ * @param params.marketIds - Array of market IDs to stream
6012
+ * @param params.callback - Called for each orderbook update
6013
+ * @returns StreamSubscription
6014
+ */
6015
+ streamOrderbooksV2({ marketIds, callback }) {
6016
+ if (!marketIds || marketIds.length === 0) throw new Error("marketIds is required and cannot be empty");
6017
+ if (typeof callback !== "function") throw new Error("callback must be a function");
6018
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_derivative_exchange_rpc_pb.StreamOrderbookV2Request.create();
6019
+ request.marketIds = marketIds;
6020
+ return createStreamSubscriptionV2(this.client.streamOrderbookV2(request), (response) => {
6021
+ callback(IndexerDerivativeStreamTransformer.orderbookV2StreamCallback(response));
6022
+ });
6023
+ }
6024
+ /**
6025
+ * Stream derivative orderbook updates
6026
+ * @param params.marketIds - Array of market IDs to stream
6027
+ * @param params.callback - Called for each orderbook update
6028
+ * @returns StreamSubscription
6029
+ */
6030
+ streamOrderbookUpdates({ marketIds, callback }) {
6031
+ if (!marketIds || marketIds.length === 0) throw new Error("marketIds is required and cannot be empty");
6032
+ if (typeof callback !== "function") throw new Error("callback must be a function");
6033
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_derivative_exchange_rpc_pb.StreamOrderbookUpdateRequest.create();
6034
+ request.marketIds = marketIds;
6035
+ return createStreamSubscriptionV2(this.client.streamOrderbookUpdate(request), (response) => {
6036
+ callback(IndexerDerivativeStreamTransformer.orderbookUpdateStreamCallback(response));
6037
+ });
6038
+ }
6039
+ /**
6040
+ * Stream derivative positions V2
6041
+ * @param params.marketId - Optional market ID to filter
6042
+ * @param params.address - Optional address to filter
6043
+ * @param params.subaccountId - Optional subaccount ID to filter
6044
+ * @param params.callback - Called for each position update
6045
+ * @returns StreamSubscription
6046
+ */
6047
+ streamPositionsV2({ marketId, address, subaccountId, callback }) {
6048
+ if (typeof callback !== "function") throw new Error("callback must be a function");
6049
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_derivative_exchange_rpc_pb.StreamPositionsV2Request.create();
6050
+ if (marketId) request.marketId = marketId;
6051
+ if (address) request.accountAddress = address;
6052
+ if (subaccountId) request.subaccountId = subaccountId;
6053
+ return createStreamSubscriptionV2(this.client.streamPositionsV2(request), (response) => {
6054
+ callback(IndexerDerivativeStreamTransformer.positionV2StreamCallback(response));
6055
+ });
6056
+ }
6057
+ };
6058
+
6059
+ //#endregion
6060
+ //#region src/client/indexer/grpc_stream/streamV2/IndexerGrpcAccountPortfolioStreamV2.ts
6061
+ var IndexerGrpcAccountPortfolioStreamV2 = class {
6062
+ constructor(endpoint, metadata) {
6063
+ require_defineProperty._defineProperty(this, "client", void 0);
6064
+ require_defineProperty._defineProperty(this, "transport", void 0);
6065
+ this.transport = new require_BaseGrpcConsumer.GrpcWebRpcTransport(endpoint, metadata);
6066
+ this.client = new __injectivelabs_indexer_proto_ts_v2_generated_injective_portfolio_rpc_pb_client.InjectivePortfolioRPCClient(this.transport);
6067
+ }
6068
+ /**
6069
+ * Stream account portfolio updates
6070
+ * @param params.accountAddress - The account address to stream portfolio for
6071
+ * @param params.subaccountId - Optional subaccount ID to filter
6072
+ * @param params.type - Optional portfolio type to filter
6073
+ * @param params.callback - Called for each portfolio update
6074
+ * @returns StreamSubscription
6075
+ */
6076
+ streamAccountPortfolio({ accountAddress, subaccountId, type, callback }) {
6077
+ if (!accountAddress) throw new Error("accountAddress is required");
6078
+ if (typeof callback !== "function") throw new Error("callback must be a function");
6079
+ const request = __injectivelabs_indexer_proto_ts_v2_generated_injective_portfolio_rpc_pb.StreamAccountPortfolioRequest.create();
6080
+ request.accountAddress = accountAddress;
6081
+ if (subaccountId) request.subaccountId = subaccountId;
6082
+ if (type) request.type = type;
6083
+ return createStreamSubscriptionV2(this.client.streamAccountPortfolio(request), (response) => {
6084
+ callback(IndexerAccountPortfolioStreamTransformer.accountPortfolioStreamCallback(response));
6085
+ });
6086
+ }
6087
+ };
6088
+
6089
+ //#endregion
6090
+ //#region src/client/indexer/grpc_stream/streamV2/StreamManagerV2.ts
6091
+ /**
6092
+ * Default retry configuration
6093
+ */
6094
+ const DEFAULT_RETRY_CONFIG = {
6095
+ enabled: true,
6096
+ maxAttempts: 5,
6097
+ initialDelayMs: 1e3,
6098
+ maxDelayMs: 3e4,
6099
+ backoffMultiplier: 2,
6100
+ persistent: true
6101
+ };
6102
+ /**
6103
+ * Maps gRPC status code to disconnect reason
6104
+ */
6105
+ function mapGrpcCodeToReason(code) {
6106
+ switch (code) {
6107
+ case require_types.GrpcStatusCode.CANCELLED: return require_types.StreamDisconnectReason.UserStopped;
6108
+ case require_types.GrpcStatusCode.UNAVAILABLE: return require_types.StreamDisconnectReason.NetworkError;
6109
+ case require_types.GrpcStatusCode.DEADLINE_EXCEEDED: return require_types.StreamDisconnectReason.Timeout;
6110
+ case require_types.GrpcStatusCode.UNAUTHENTICATED:
6111
+ case require_types.GrpcStatusCode.PERMISSION_DENIED: return require_types.StreamDisconnectReason.AuthenticationError;
6112
+ case require_types.GrpcStatusCode.RESOURCE_EXHAUSTED: return require_types.StreamDisconnectReason.RateLimited;
6113
+ case require_types.GrpcStatusCode.INVALID_ARGUMENT:
6114
+ case require_types.GrpcStatusCode.NOT_FOUND:
6115
+ case require_types.GrpcStatusCode.ALREADY_EXISTS:
6116
+ case require_types.GrpcStatusCode.OUT_OF_RANGE:
6117
+ case require_types.GrpcStatusCode.UNIMPLEMENTED:
6118
+ case require_types.GrpcStatusCode.FAILED_PRECONDITION: return require_types.StreamDisconnectReason.InvalidRequest;
6119
+ case require_types.GrpcStatusCode.UNKNOWN:
6120
+ case require_types.GrpcStatusCode.INTERNAL:
6121
+ case require_types.GrpcStatusCode.DATA_LOSS:
6122
+ case require_types.GrpcStatusCode.ABORTED:
6123
+ default: return require_types.StreamDisconnectReason.StreamError;
6124
+ }
6125
+ }
6126
+ /**
6127
+ * Determines if a disconnect reason should trigger a retry
6128
+ */
6129
+ function isRetryableReason(reason) {
6130
+ switch (reason) {
6131
+ case require_types.StreamDisconnectReason.NetworkError:
6132
+ case require_types.StreamDisconnectReason.Timeout:
6133
+ case require_types.StreamDisconnectReason.RateLimited:
6134
+ case require_types.StreamDisconnectReason.StreamError:
6135
+ case require_types.StreamDisconnectReason.StreamEnded: return true;
6136
+ case require_types.StreamDisconnectReason.UserStopped:
6137
+ case require_types.StreamDisconnectReason.MaxRetries:
6138
+ case require_types.StreamDisconnectReason.AuthenticationError:
6139
+ case require_types.StreamDisconnectReason.InvalidRequest: return false;
6140
+ default: return false;
6141
+ }
6142
+ }
6143
+ /**
6144
+ * StreamManagerV2 - Manages gRPC stream connections with automatic retry
6145
+ *
6146
+ * V2 Features:
6147
+ * - Event-based lifecycle (on/off methods)
6148
+ * - Automatic retry with exponential backoff
6149
+ * - Persistent retry mode
6150
+ * - Comprehensive gRPC error code mapping
6151
+ * - Distinguishes retryable vs non-retryable errors
6152
+ *
6153
+ */
6154
+ var StreamManagerV2 = class extends eventemitter3.EventEmitter {
6155
+ constructor(config) {
6156
+ super();
6157
+ require_defineProperty._defineProperty(this, "config", void 0);
6158
+ require_defineProperty._defineProperty(this, "state", require_types.StreamState.Idle);
6159
+ require_defineProperty._defineProperty(this, "subscription", null);
6160
+ require_defineProperty._defineProperty(this, "retryTimeoutId", null);
6161
+ require_defineProperty._defineProperty(this, "retryAttempt", 0);
6162
+ this.config = {
6163
+ id: config.id,
6164
+ streamFactory: config.streamFactory,
6165
+ onData: config.onData,
6166
+ retryConfig: {
6167
+ ...DEFAULT_RETRY_CONFIG,
6168
+ ...config.retryConfig
6169
+ }
6170
+ };
6171
+ const originalEmit = this.emit.bind(this);
6172
+ this.emit = ((event, ...args) => {
6173
+ if (event === require_types.StreamEvent.Data && args.length > 0) this.handleData(args[0]);
6174
+ return originalEmit(event, ...args);
6175
+ });
6176
+ }
6177
+ start() {
6178
+ if (this.state !== require_types.StreamState.Idle && this.state !== require_types.StreamState.Stopped) {
6179
+ this.emit(require_types.StreamEvent.Warn, { message: `Stream already started (state: ${this.state})` });
6180
+ return;
6181
+ }
6182
+ this.connect();
6183
+ }
6184
+ stop() {
6185
+ this.handleDisconnect(require_types.StreamDisconnectReason.UserStopped);
6186
+ }
6187
+ getId() {
6188
+ return this.config.id;
6189
+ }
6190
+ /**
6191
+ * Destroy the stream manager and clean up all resources
6192
+ * Call this when the stream manager is no longer needed
6193
+ */
6194
+ destroy() {
6195
+ this.stop();
6196
+ this.removeAllListeners();
6197
+ }
6198
+ getState() {
6199
+ return this.state;
6200
+ }
6201
+ updateState(newState) {
6202
+ const oldState = this.state;
6203
+ this.state = newState;
6204
+ this.emit(require_types.StreamEvent.StateChange, {
6205
+ from: oldState,
6206
+ to: newState
6207
+ });
6208
+ }
6209
+ clearSubscription() {
6210
+ if (!this.subscription) return;
6211
+ this.subscription.unsubscribe();
6212
+ this.subscription = null;
6213
+ }
6214
+ clearRetryTimeout() {
6215
+ if (!this.retryTimeoutId) return;
6216
+ clearTimeout(this.retryTimeoutId);
6217
+ this.retryTimeoutId = null;
6218
+ }
6219
+ calculateNextBackoff(reason) {
6220
+ const baseDelay = reason === require_types.StreamDisconnectReason.RateLimited ? Math.max(this.config.retryConfig.initialDelayMs, 5e3) : this.config.retryConfig.initialDelayMs;
6221
+ if (this.config.retryConfig.maxAttempts > 0 && this.retryAttempt >= this.config.retryConfig.maxAttempts) return this.config.retryConfig.persistent ? this.config.retryConfig.maxDelayMs : null;
6222
+ const nextBackoffDelay = baseDelay * Math.pow(this.config.retryConfig.backoffMultiplier, this.retryAttempt);
6223
+ return Math.min(nextBackoffDelay, this.config.retryConfig.maxDelayMs);
6224
+ }
6225
+ scheduleRetry(reason) {
6226
+ if (!this.config.retryConfig.enabled) return;
6227
+ const nextBackoff = this.calculateNextBackoff(reason);
6228
+ if (nextBackoff === null) {
6229
+ this.handleMaxRetriesReached();
6230
+ return;
6231
+ }
6232
+ this.retryTimeoutId = setTimeout(() => {
6233
+ this.retryAttempt++;
6234
+ this.emit(require_types.StreamEvent.Retry, {
6235
+ attempt: this.retryAttempt,
6236
+ delayMs: nextBackoff,
6237
+ nextBackoff: this.calculateNextBackoff(reason)
6238
+ });
6239
+ this.connect();
6240
+ }, nextBackoff);
6241
+ }
6242
+ handleMaxRetriesReached() {
6243
+ this.emit(require_types.StreamEvent.Error, { message: `Max retries (${this.config.retryConfig.maxAttempts}) reached` });
6244
+ this.handleDisconnect(require_types.StreamDisconnectReason.MaxRetries);
6245
+ }
6246
+ handleError(error) {
6247
+ const errorInfo = this.extractErrorInfo(error);
6248
+ this.emit(require_types.StreamEvent.Error, errorInfo);
6249
+ const reason = mapGrpcCodeToReason(error && typeof error === "object" && "code" in error ? error.code : require_types.GrpcStatusCode.UNKNOWN);
6250
+ this.handleDisconnect(reason);
6251
+ }
6252
+ /**
6253
+ * Handles incoming data - calls user callback
6254
+ * Called automatically when user emits 'data' event from streamFactory callback
6255
+ */
6256
+ handleData(response) {
6257
+ try {
6258
+ this.config.onData(response);
6259
+ } catch (error) {
6260
+ this.handleError(error);
6261
+ }
6262
+ }
6263
+ handleConnected(isReconnect) {
6264
+ this.updateState(require_types.StreamState.Connected);
6265
+ this.retryAttempt = 0;
6266
+ this.emit(require_types.StreamEvent.Connect, {
6267
+ isReconnect,
6268
+ attempt: 0
6269
+ });
6270
+ }
6271
+ handleDisconnect(reason) {
6272
+ this.clearSubscription();
6273
+ this.clearRetryTimeout();
6274
+ const willRetry = isRetryableReason(reason) && this.config.retryConfig.enabled;
6275
+ this.emit(require_types.StreamEvent.Disconnect, {
6276
+ reason,
6277
+ willRetry,
6278
+ attempt: this.retryAttempt
6279
+ });
6280
+ if (willRetry) {
6281
+ this.updateState(require_types.StreamState.Reconnecting);
6282
+ this.scheduleRetry(reason);
6283
+ } else this.updateState(require_types.StreamState.Stopped);
6284
+ }
6285
+ connect() {
6286
+ this.clearSubscription();
6287
+ const isReconnect = this.state === require_types.StreamState.Reconnecting;
6288
+ this.updateState(isReconnect ? require_types.StreamState.Reconnecting : require_types.StreamState.Connecting);
6289
+ try {
6290
+ this.subscription = this.config.streamFactory();
6291
+ this.subscription.on("error", (error) => {
6292
+ this.handleError(error);
6293
+ });
6294
+ this.subscription.on("complete", () => {
6295
+ this.handleDisconnect(require_types.StreamDisconnectReason.StreamEnded);
6296
+ });
6297
+ this.handleConnected(isReconnect);
6298
+ } catch (error) {
6299
+ this.handleError(error);
6300
+ }
6301
+ }
6302
+ /**
6303
+ * Extracts error message, code, and details from an error object
6304
+ */
6305
+ extractErrorInfo(error) {
6306
+ if (error && typeof error === "object" && "details" in error) return {
6307
+ message: error.details,
6308
+ code: error.code,
6309
+ details: error
6310
+ };
6311
+ const code = error && typeof error === "object" && "code" in error ? error.code : void 0;
6312
+ return {
6313
+ message: error instanceof Error ? error.message : "Unknown error",
6314
+ code,
6315
+ details: error instanceof Error ? error.stack : error
6316
+ };
6317
+ }
6318
+ };
6319
+
6320
+ //#endregion
6321
+ Object.defineProperty(exports, 'ExplorerStreamTransformer', {
6322
+ enumerable: true,
6323
+ get: function () {
6324
+ return ExplorerStreamTransformer;
6325
+ }
6326
+ });
6327
+ Object.defineProperty(exports, 'IndexerAccountPortfolioStreamTransformer', {
6328
+ enumerable: true,
6329
+ get: function () {
6330
+ return IndexerAccountPortfolioStreamTransformer;
6331
+ }
6332
+ });
6333
+ Object.defineProperty(exports, 'IndexerAccountStreamTransformer', {
6334
+ enumerable: true,
6335
+ get: function () {
6336
+ return IndexerAccountStreamTransformer;
6337
+ }
6338
+ });
6339
+ Object.defineProperty(exports, 'IndexerArchiverStreamTransformer', {
6340
+ enumerable: true,
6341
+ get: function () {
6342
+ return IndexerArchiverStreamTransformer;
6343
+ }
6344
+ });
6345
+ Object.defineProperty(exports, 'IndexerAuctionStreamTransformer', {
6346
+ enumerable: true,
6347
+ get: function () {
6348
+ return IndexerAuctionStreamTransformer;
6349
+ }
6350
+ });
6351
+ Object.defineProperty(exports, 'IndexerCampaignTransformer', {
6352
+ enumerable: true,
6353
+ get: function () {
6354
+ return IndexerCampaignTransformer;
6355
+ }
6356
+ });
6357
+ Object.defineProperty(exports, 'IndexerDerivativeStreamTransformer', {
6358
+ enumerable: true,
6359
+ get: function () {
6360
+ return IndexerDerivativeStreamTransformer;
6361
+ }
6362
+ });
6363
+ Object.defineProperty(exports, 'IndexerGrpcAccountApi', {
6364
+ enumerable: true,
6365
+ get: function () {
6366
+ return IndexerGrpcAccountApi;
6367
+ }
6368
+ });
6369
+ Object.defineProperty(exports, 'IndexerGrpcAccountPortfolioApi', {
6370
+ enumerable: true,
6371
+ get: function () {
6372
+ return IndexerGrpcAccountPortfolioApi;
6373
+ }
6374
+ });
6375
+ Object.defineProperty(exports, 'IndexerGrpcAccountPortfolioStream', {
6376
+ enumerable: true,
6377
+ get: function () {
6378
+ return IndexerGrpcAccountPortfolioStream;
6379
+ }
6380
+ });
6381
+ Object.defineProperty(exports, 'IndexerGrpcAccountPortfolioStreamV2', {
6382
+ enumerable: true,
6383
+ get: function () {
6384
+ return IndexerGrpcAccountPortfolioStreamV2;
6385
+ }
6386
+ });
6387
+ Object.defineProperty(exports, 'IndexerGrpcAccountPortfolioTransformer', {
6388
+ enumerable: true,
6389
+ get: function () {
6390
+ return IndexerGrpcAccountPortfolioTransformer;
6391
+ }
6392
+ });
6393
+ Object.defineProperty(exports, 'IndexerGrpcAccountStream', {
6394
+ enumerable: true,
6395
+ get: function () {
6396
+ return IndexerGrpcAccountStream;
6397
+ }
6398
+ });
6399
+ Object.defineProperty(exports, 'IndexerGrpcAccountStreamV2', {
6400
+ enumerable: true,
6401
+ get: function () {
6402
+ return IndexerGrpcAccountStreamV2;
6403
+ }
6404
+ });
6405
+ Object.defineProperty(exports, 'IndexerGrpcAccountTransformer', {
6406
+ enumerable: true,
6407
+ get: function () {
6408
+ return IndexerGrpcAccountTransformer;
6409
+ }
6410
+ });
6411
+ Object.defineProperty(exports, 'IndexerGrpcArchiverApi', {
6412
+ enumerable: true,
6413
+ get: function () {
6414
+ return IndexerGrpcArchiverApi;
6415
+ }
6416
+ });
6417
+ Object.defineProperty(exports, 'IndexerGrpcArchiverStream', {
6418
+ enumerable: true,
6419
+ get: function () {
6420
+ return IndexerGrpcArchiverStream;
6421
+ }
6422
+ });
6423
+ Object.defineProperty(exports, 'IndexerGrpcArchiverStreamV2', {
6424
+ enumerable: true,
6425
+ get: function () {
6426
+ return IndexerGrpcArchiverStreamV2;
6427
+ }
6428
+ });
6429
+ Object.defineProperty(exports, 'IndexerGrpcArchiverTransformer', {
6430
+ enumerable: true,
6431
+ get: function () {
6432
+ return IndexerGrpcArchiverTransformer;
6433
+ }
6434
+ });
6435
+ Object.defineProperty(exports, 'IndexerGrpcAuctionApi', {
6436
+ enumerable: true,
6437
+ get: function () {
6438
+ return IndexerGrpcAuctionApi;
6439
+ }
6440
+ });
6441
+ Object.defineProperty(exports, 'IndexerGrpcAuctionStream', {
6442
+ enumerable: true,
6443
+ get: function () {
6444
+ return IndexerGrpcAuctionStream;
6445
+ }
6446
+ });
6447
+ Object.defineProperty(exports, 'IndexerGrpcAuctionStreamV2', {
6448
+ enumerable: true,
6449
+ get: function () {
6450
+ return IndexerGrpcAuctionStreamV2;
6451
+ }
6452
+ });
6453
+ Object.defineProperty(exports, 'IndexerGrpcAuctionTransformer', {
6454
+ enumerable: true,
6455
+ get: function () {
6456
+ return IndexerGrpcAuctionTransformer;
6457
+ }
6458
+ });
6459
+ Object.defineProperty(exports, 'IndexerGrpcCampaignApi', {
6460
+ enumerable: true,
6461
+ get: function () {
6462
+ return IndexerGrpcCampaignApi;
6463
+ }
6464
+ });
6465
+ Object.defineProperty(exports, 'IndexerGrpcDerivativeTransformer', {
6466
+ enumerable: true,
6467
+ get: function () {
6468
+ return IndexerGrpcDerivativeTransformer;
6469
+ }
6470
+ });
6471
+ Object.defineProperty(exports, 'IndexerGrpcDerivativesApi', {
6472
+ enumerable: true,
6473
+ get: function () {
6474
+ return IndexerGrpcDerivativesApi;
6475
+ }
6476
+ });
6477
+ Object.defineProperty(exports, 'IndexerGrpcDerivativesStream', {
6478
+ enumerable: true,
6479
+ get: function () {
6480
+ return IndexerGrpcDerivativesStream;
6481
+ }
6482
+ });
6483
+ Object.defineProperty(exports, 'IndexerGrpcDerivativesStreamV2', {
6484
+ enumerable: true,
6485
+ get: function () {
6486
+ return IndexerGrpcDerivativesStreamV2;
6487
+ }
6488
+ });
6489
+ Object.defineProperty(exports, 'IndexerGrpcExplorerApi', {
6490
+ enumerable: true,
6491
+ get: function () {
6492
+ return IndexerGrpcExplorerApi;
6493
+ }
6494
+ });
6495
+ Object.defineProperty(exports, 'IndexerGrpcExplorerStream', {
6496
+ enumerable: true,
6497
+ get: function () {
6498
+ return IndexerGrpcExplorerStream;
6499
+ }
6500
+ });
6501
+ Object.defineProperty(exports, 'IndexerGrpcExplorerStreamV2', {
6502
+ enumerable: true,
6503
+ get: function () {
6504
+ return IndexerGrpcExplorerStreamV2;
6505
+ }
6506
+ });
6507
+ Object.defineProperty(exports, 'IndexerGrpcExplorerTransformer', {
6508
+ enumerable: true,
6509
+ get: function () {
6510
+ return IndexerGrpcExplorerTransformer;
6511
+ }
6512
+ });
6513
+ Object.defineProperty(exports, 'IndexerGrpcInsuranceFundApi', {
6514
+ enumerable: true,
6515
+ get: function () {
6516
+ return IndexerGrpcInsuranceFundApi;
6517
+ }
6518
+ });
6519
+ Object.defineProperty(exports, 'IndexerGrpcInsuranceFundTransformer', {
6520
+ enumerable: true,
6521
+ get: function () {
6522
+ return IndexerGrpcInsuranceFundTransformer;
6523
+ }
6524
+ });
6525
+ Object.defineProperty(exports, 'IndexerGrpcMegaVaultApi', {
6526
+ enumerable: true,
6527
+ get: function () {
6528
+ return IndexerGrpcMegaVaultApi;
6529
+ }
6530
+ });
6531
+ Object.defineProperty(exports, 'IndexerGrpcMegaVaultTransformer', {
6532
+ enumerable: true,
6533
+ get: function () {
6534
+ return IndexerGrpcMegaVaultTransformer;
5586
6535
  }
5587
6536
  });
5588
6537
  Object.defineProperty(exports, 'IndexerGrpcMetaApi', {
@@ -5609,6 +6558,12 @@ Object.defineProperty(exports, 'IndexerGrpcMitoStreamTransformer', {
5609
6558
  return IndexerGrpcMitoStreamTransformer;
5610
6559
  }
5611
6560
  });
6561
+ Object.defineProperty(exports, 'IndexerGrpcMitoStreamV2', {
6562
+ enumerable: true,
6563
+ get: function () {
6564
+ return IndexerGrpcMitoStreamV2;
6565
+ }
6566
+ });
5612
6567
  Object.defineProperty(exports, 'IndexerGrpcMitoTransformer', {
5613
6568
  enumerable: true,
5614
6569
  get: function () {
@@ -5627,6 +6582,12 @@ Object.defineProperty(exports, 'IndexerGrpcOracleStream', {
5627
6582
  return IndexerGrpcOracleStream;
5628
6583
  }
5629
6584
  });
6585
+ Object.defineProperty(exports, 'IndexerGrpcOracleStreamV2', {
6586
+ enumerable: true,
6587
+ get: function () {
6588
+ return IndexerGrpcOracleStreamV2;
6589
+ }
6590
+ });
5630
6591
  Object.defineProperty(exports, 'IndexerGrpcOracleTransformer', {
5631
6592
  enumerable: true,
5632
6593
  get: function () {
@@ -5657,6 +6618,12 @@ Object.defineProperty(exports, 'IndexerGrpcSpotStream', {
5657
6618
  return IndexerGrpcSpotStream;
5658
6619
  }
5659
6620
  });
6621
+ Object.defineProperty(exports, 'IndexerGrpcSpotStreamV2', {
6622
+ enumerable: true,
6623
+ get: function () {
6624
+ return IndexerGrpcSpotStreamV2;
6625
+ }
6626
+ });
5660
6627
  Object.defineProperty(exports, 'IndexerGrpcSpotTransformer', {
5661
6628
  enumerable: true,
5662
6629
  get: function () {
@@ -5675,6 +6642,12 @@ Object.defineProperty(exports, 'IndexerGrpcTradingStream', {
5675
6642
  return IndexerGrpcTradingStream;
5676
6643
  }
5677
6644
  });
6645
+ Object.defineProperty(exports, 'IndexerGrpcTradingStreamV2', {
6646
+ enumerable: true,
6647
+ get: function () {
6648
+ return IndexerGrpcTradingStreamV2;
6649
+ }
6650
+ });
5678
6651
  Object.defineProperty(exports, 'IndexerOracleStreamTransformer', {
5679
6652
  enumerable: true,
5680
6653
  get: function () {
@@ -5722,4 +6695,28 @@ Object.defineProperty(exports, 'IndexerSpotStreamTransformer', {
5722
6695
  get: function () {
5723
6696
  return IndexerSpotStreamTransformer;
5724
6697
  }
6698
+ });
6699
+ Object.defineProperty(exports, 'StreamManager', {
6700
+ enumerable: true,
6701
+ get: function () {
6702
+ return StreamManager;
6703
+ }
6704
+ });
6705
+ Object.defineProperty(exports, 'StreamManagerV2', {
6706
+ enumerable: true,
6707
+ get: function () {
6708
+ return StreamManagerV2;
6709
+ }
6710
+ });
6711
+ Object.defineProperty(exports, 'createStreamSubscription', {
6712
+ enumerable: true,
6713
+ get: function () {
6714
+ return createStreamSubscription;
6715
+ }
6716
+ });
6717
+ Object.defineProperty(exports, 'createStreamSubscriptionV2', {
6718
+ enumerable: true,
6719
+ get: function () {
6720
+ return createStreamSubscriptionV2;
6721
+ }
5725
6722
  });