Skip to content

Conversation

@Frederick-88
Copy link
Collaborator

@Frederick-88 Frederick-88 commented Jan 14, 2026

note - additions:

Summary by CodeRabbit

  • New Features

    • Expanded market & epoch data returned (more reward, score, eligibility and volume fields)
    • Improved timestamp handling using native JavaScript Date objects
  • Bug Fixes

    • Fixed market rewards range retrieval reference
  • Chores

    • Bumped protobuf library dependency
    • Consolidated/updated client export surface and internal client implementation

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

Consolidates generated OLP proto outputs into a unified goagen_olp_injective_dmm_v2 module, updates client imports/exports, adjusts transformer mappings to use Date objects, and makes several proto-derived fields optional; also broadens proto generation source path.

Changes

Cohort / File(s) Summary
Dependency version bump
packages/sdk-ts/package.json
Updated @injectivelabs/olp-proto-ts-v2 from 1.17.3 to 1.17.5.
SDK client code updates
packages/sdk-ts/src/client/olp/grpc/OLPGrpcApi.ts, packages/sdk-ts/src/client/olp/grpc/types/index.ts
Switched proto import to goagen_olp_injective_dmm_v2_pb, replaced client type/initialization with InjectiveDmmV2Client, corrected fetchMarketRewardsRange binding, and made some proto-derived fields optional (RewardsEligibility.averageDailyMakerVolumePercentage, EpochConfigV2 thresholds).
Transformer field mappings
packages/sdk-ts/src/client/olp/grpc/transformers/index.ts
Repointed imports to new generated pb module and updated many mappers to expose additional fields and convert protobuf timestamps into native Date objects with undefined fallbacks.
Proto generation script
protoV2/olp/gen.sh
Broadened proto file collection path from $ROOT_DIR/gen/api/proto to $ROOT_DIR/gen.
Proto package public API / generated index files
protoV2/olp/src/index.*, protoV2/olp/src/index.template.*, protoV2/olp/src/index.d.ts
Replaced previous per-file RPC client exports with a single InjectiveDmmV2Client; removed InjectiveVolatilityRPCClient; consolidated type namespace exports into DmmPb sourced from goagen_olp_injective_dmm_v2_pb and removed separate TimestampPb/VolatilityPb exports.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hopped through generated trees so grand,

unified protos now close at hand.
Dates replaced the old timestamp song,
clients renamed and fields made strong—
a tiny hop, a cleaner land. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'chore/indexer-olp-schema-update' is clear and specific, directly reflecting the main objective of updating the OLP indexer schema through dependency and protobuf client/type changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 13f61a0 and f23deec.

📒 Files selected for processing (2)
  • protoV2/olp/src/index.js
  • protoV2/olp/src/index.template.js
🔇 Additional comments (4)
protoV2/olp/src/index.template.js (2)

59-73: Previous issue resolved: Orphaned export removed.

The InjectiveVolatilityRPCClient has been correctly removed from the export chain. The exports now properly declare only DmmPb and InjectiveDmmV2Client, which are both properly assigned. The client is correctly sourced from the new consolidated module path ./generated/goagen_olp_injective_dmm_v2_pb.client.js.


3-58: Standard TypeScript helper implementations.

These helper functions (__createBinding, __setModuleDefault, __importStar) follow the standard TypeScript compiler output patterns and are correctly implemented for module interoperability.

protoV2/olp/src/index.js (2)

59-73: Previous issues resolved: Export chain cleaned up.

The orphaned InjectiveVolatilityRPCClient export has been removed as flagged in past reviews. The export declarations now correctly include only InjectiveDmmV2Client and DmmPb, both of which are properly assigned from the consolidated goagen_olp_injective_dmm_v2_pb module.


3-58: Helpers correctly synchronized with template.

The helper function implementations are consistent with the template file and follow standard TypeScript compilation patterns.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@socket-security
Copy link

socket-security bot commented Jan 14, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​injectivelabs/​olp-proto-ts-v2@​1.17.3 ⏵ 1.17.573 -510073 +196 +4100

View full report

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/sdk-ts/src/client/olp/grpc/OLPGrpcApi.ts (1)

259-262: Guard the optional marketId parameter before assignment.

The marketId parameter is optional but assigned directly to request.marketId without checking if it exists. The established pattern in this file guards optional parameters before assignment (see fetchEpochs, fetchRewardsEligibility), and the test confirms this method is called without marketId. Add the guard to maintain consistency:

Suggested fix
    request.epochId = epochId
-   request.marketId = marketId
+   if (marketId) {
+     request.marketId = marketId
+   }
🤖 Fix all issues with AI agents
In `@protoV2/olp/src/index.js`:
- Around line 60-63: The export chain in index.js lists
InjectiveVolatilityRPCClient but that symbol is not assigned anywhere; remove
InjectiveVolatilityRPCClient from the export declaration so the chain only
declares actual exported identifiers (e.g., change the chain to export DmmPb and
InjectiveDmmV2Client only) and search for any leftover references to
InjectiveVolatilityRPCClient in this module to delete or replace them; update
the exports line where exports.DmmPb = exports.InjectiveVolatilityRPCClient =
exports.InjectiveDmmV2Client = void 0 to exclude InjectiveVolatilityRPCClient
(use exports.DmmPb = exports.InjectiveDmmV2Client = void 0) so consumers no
longer receive an undefined export.
- Around line 65-76: Remove the orphaned export for
InjectiveVolatilityRPCClient: delete the export assignment that leaves
InjectiveVolatilityRPCClient undefined (the pattern like exports.DmmPb =
exports.InjectiveDmmV2Client = void 0) and ensure only InjectiveDmmV2Client and
DmmPb remain exported; keep the existing require and Object.defineProperty for
InjectiveDmmV2Client and the __importStar export of DmmPb, but do not declare or
export InjectiveVolatilityRPCClient anywhere in this file.

In `@protoV2/olp/src/index.template.js`:
- Around line 60-63: Remove the leftover undefined export by deleting the
`exports.InjectiveVolatilityRPCClient` entry from the export initialization;
update the export assignment so only `exports.DmmPb` and
`exports.InjectiveDmmV2Client` are initialized (e.g., `exports.DmmPb =
exports.InjectiveDmmV2Client = void 0`) and ensure no other code references
`InjectiveVolatilityRPCClient`.
🧹 Nitpick comments (1)
packages/sdk-ts/src/client/olp/grpc/transformers/index.ts (1)

282-310: Parameter naming inconsistency.

The parameter is named reward but it represents a volume object of type GrpcAccountVolume. Consider renaming to volume for clarity and consistency with the method name grpcAccountVolumesToAccountVolumes.

Suggested fix
 static grpcAccountVolumesToAccountVolumes(
-  reward: GrpcAccountVolume,
+  volume: GrpcAccountVolume,
 ): AccountVolume {
   return {
-    date: reward.date,
-    volume: reward.volume,
-    epochId: reward.epochId,
+    date: volume.date,
+    volume: volume.volume,
+    epochId: volume.epochId,
     // ... rest of fields updated similarly
   }
 }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d7429e and 13f61a0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • packages/sdk-ts/package.json
  • packages/sdk-ts/src/client/olp/grpc/OLPGrpcApi.ts
  • packages/sdk-ts/src/client/olp/grpc/transformers/index.ts
  • packages/sdk-ts/src/client/olp/grpc/types/index.ts
  • protoV2/olp/gen.sh
  • protoV2/olp/src/index.d.ts
  • protoV2/olp/src/index.js
  • protoV2/olp/src/index.template.d.ts
  • protoV2/olp/src/index.template.js
  • protoV2/olp/src/index.template.ts
  • protoV2/olp/src/index.ts
🔇 Additional comments (17)
protoV2/olp/gen.sh (1)

41-41: Verify the broader proto collection scope is intentional.

The path changed from $ROOT_DIR/gen/api/proto to $ROOT_DIR/gen, which now collects all *.proto files from the entire gen directory tree instead of just the api/proto subdirectory. This may include additional proto files that weren't previously part of the generation.

Confirm this broader scope is intentional and doesn't inadvertently include unwanted proto files (e.g., test protos, internal protos, deprecated definitions).

packages/sdk-ts/src/client/olp/grpc/OLPGrpcApi.ts (3)

2-3: LGTM - imports updated to new proto module.

The import paths correctly reference the new consolidated goagen_olp_injective_dmm_v2_pb module and InjectiveDmmV2Client, aligning with the proto schema migration.


10-12: LGTM - client initialization updated.

The client accessor correctly uses the new InjectiveDmmV2Client type.


267-267: LGTM - method binding updated correctly.

The method binding to getMarketRewardsRange is consistent with the new client interface.

packages/sdk-ts/src/client/olp/grpc/types/index.ts (3)

1-1: LGTM - import updated to new proto module.

The import path correctly references the new consolidated goagen_olp_injective_dmm_v2_pb module.


52-60: Field is properly declared as optional - no consumer code currently accesses it.

The averageDailyMakerVolumePercentage field is correctly marked as optional (?: string) in the RewardsEligibility interface. A comprehensive search found no consumer code accessing this field, so there are no existing violations to address. TypeScript's type system will enforce proper null-safety for any future code that accesses this field.


81-93: Optional fields in EpochConfigV2 are handled correctly — transformer preserves the optional nature through direct assignment and type definitions ensure type safety.

The transformer code (grpcEpochToEpoch) correctly passes through permanenceVolumeThreshold and qualifyingVolumeThreshold as optional values without requiring explicit undefined checks. The return type EpochV2 properly references EpochConfigV2 with these fields marked as optional, maintaining type safety throughout the transform pipeline. No consumer code in the repository directly accesses these fields in a way that would cause unsafe undefined dereferences.

packages/sdk-ts/package.json (1)

334-334: LGTM - dependency bump aligns with schema migration.

The version bump from 1.17.3 to 1.17.5 aligns with the related changes migrating to the new goagen_olp_injective_dmm_v2_pb module and InjectiveDmmV2Client, which are actively used in the OLP gRPC API implementation.

protoV2/olp/src/index.template.d.ts (1)

1-2: No breaking changes detected.

The current exports (InjectiveDmmV2Client and DmmPb) are correct and already in use throughout the codebase in packages/sdk-ts/src/client/olp/. Claims of removed exports (InjectiveDmmV2RPCClient, InjectiveVolatilityRPCClient, TimestampPb, VolatilityPb) are not supported—these were either never properly exported or have no internal usage. The consolidated single-client API is functioning as intended.

Likely an incorrect or invalid review comment.

protoV2/olp/src/index.template.ts (1)

1-7: LGTM!

Template file is consistent with the generated index.ts output.

packages/sdk-ts/src/client/olp/grpc/transformers/index.ts (3)

1-1: LGTM!

Import updated to use the new consolidated protobuf module.


312-329: LGTM!

The rewardsEligibilityResponseToRewardsEligibility transformer correctly adds new fields and maintains consistent Date handling patterns.


34-71: Confirm the date field format from the protobuf schema.

The transformer correctly assumes startDate, endDate, createdAt, and updatedAt are strings and uses new Date() directly. However, this cannot be definitively confirmed from the repository alone since the OLP proto definitions are in the external dependency @injectivelabs/olp-proto-ts-v2 v1.17.5. Verify that the generated DmmPb.EpochV2 type defines these fields as strings (not protobuf Timestamp objects with seconds/nanos fields), as the current pattern would fail silently if those fields were Timestamp message types.

protoV2/olp/src/index.d.ts (1)

1-2: LGTM!

Declaration file is consistent with the TypeScript implementation.

protoV2/olp/src/index.template.js (1)

65-76: LGTM!

The client and namespace exports are correctly wired to the new unified protobuf module.

protoV2/olp/src/index.ts (1)

1-7: Clean consolidation of exports to the new unified protobuf module.

The index file now properly re-exports from the consolidated goagen_olp_injective_dmm_v2_pb module. Note that downstream consumers in the codebase (OLPGrpcApi.ts, transformers, types) are already importing directly from the generated modules rather than through these re-exports, so there is no breaking change impact. However, the template files (index.template.js and index.template.ts) should be updated to match this consolidated structure if they're used to regenerate the index file.

protoV2/olp/src/index.js (1)

3-58: Auto-generated module helpers are standard.

These TypeScript-compiled helper functions follow the expected pattern and require no changes.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@ThomasRalee ThomasRalee merged commit 712323e into dev Jan 14, 2026
5 checks passed
@ThomasRalee ThomasRalee deleted the chore/indexer-olp-schema-update branch January 14, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants