Skip to content

chore/tc-updates#631

Merged
Frederick-88 merged 5 commits intodevfrom
chore/tc-updates
Apr 6, 2026
Merged

chore/tc-updates#631
Frederick-88 merged 5 commits intodevfrom
chore/tc-updates

Conversation

@Frederick-88
Copy link
Copy Markdown
Collaborator

@Frederick-88 Frederick-88 commented Apr 1, 2026

This pull request introduces several improvements and new features to the tcAbacus client in sdk-ts, focusing on supporting new gRPC methods for referrer code management and eligibility checks. It also includes a dependency update and a minor bugfix in the indexer stream transformer. The most important changes are grouped below.

New gRPC Methods for Referrer Codes and Eligibility:

  • Added three new API methods to TcAbacusGrpcApi:

    • fetchReferrerEligibility(address) to check if an address is eligible to be a referrer.
    • createReferrerCode(address, code) to create a new referrer code.
    • fetchReferrerCodes(address, cursor?, limit?) to list referrer codes for an address.
  • Implemented corresponding transformation logic in TcAbacusGrpcTransformer:

    • grpcReferrerEligibilityToReferrerEligibility
    • grpcReferrerCodeToReferrerCode
    • grpcListReferrerCodesToListReferrerCodes
  • Extended type definitions in tcAbacus.ts:

    • Added ReferrerEligibilityResponse, ReferrerCode, and ListReferrerCodesResponse interfaces.
    • Updated imports in transformer index for new types. [1] [2]

Dependency Update:

  • Bumped @injectivelabs/tc-abacus-proto-ts-v2 dependency from 1.18.2 to 1.18.3 in package.json to support new proto definitions.

Bugfixes and Minor Improvements:

  • Fixed IndexerTcDerivativesStreamTransformer to skip orders with OrderState.Booked when transforming stream responses, improving filtering logic. [1] [2]

Documentation:

  • Added a comprehensive .claude/skills/align-proto/SKILL.md describing the workflow, templates, and best practices for aligning proto packages and implementing new gRPC services in the SDK.

Summary by CodeRabbit

  • New Features

    • Added referrer eligibility check, referrer code creation, and paginated referrer codes listing APIs.
    • Added new epoch timestamp field to current epoch responses and related types.
  • Bug Fixes

    • Filtered out booked orders from derivative order streams.
  • Documentation

    • Added a user-invocable workflow for aligning generated proto artifacts and implementation templates.
  • Chores

    • Bumped a proto-related dependency to a newer patch version.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 43a63a94-f190-40ac-88ca-b3df7cc513b2

📥 Commits

Reviewing files that changed from the base of the PR and between b44d920 and 3e01f82.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • packages/sdk-ts/package.json

📝 Walkthrough

Walkthrough

Adds a new align-proto skill doc, updates a proto dependency in packages/sdk-ts, adds three TcAbacus gRPC API methods plus transformers/types for referrer-code functionality, and filters out OrderState.Booked in the derivatives order-history stream callback.

Changes

Cohort / File(s) Summary
Skill Documentation
​.claude/skills/align-proto/SKILL.md
Added a new user-invocable skill describing an end-to-end "align-proto" workflow, TypeScript templates, and implementation constraints for keeping packages/sdk-ts gRPC implementations in sync with upstream proto releases.
Dependency Update
packages/sdk-ts/package.json
Bumped @injectivelabs/tc-abacus-proto-ts-v2 from 1.18.21.18.4.
TC Abacus API Expansion
packages/sdk-ts/src/client/tcAbacus/grpc/TcAbacusGrpcApi.ts, packages/sdk-ts/src/client/tcAbacus/grpc/transformers/index.ts, packages/sdk-ts/src/client/tcAbacus/types/tcAbacus.ts
Added fetchReferrerEligibility, createReferrerCode, and fetchReferrerCodes methods to TcAbacusGrpcApi; added transformers mapping referrer-related proto responses to SDK shapes; added ReferrerEligibilityResponse, ReferrerCode, ListReferrerCodesResponse types and extended CurrentEpochResponse with epochPointsDistributedAt.
Order Stream Filtering
packages/sdk-ts/src/client/indexer/transformers/IndexerTcDerivativesStreamTransformer.ts
Imported OrderState and updated orderHistoryStreamCallback to return undefined when response.order?.state === OrderState.Booked, filtering out Booked orders from the transformed stream payloads.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nibbled protos, templates snug in paw,
New referrer calls now open the door,
Booked orders slip quiet from the stream,
A skill to align — precise as a dream,
Rabbit cheers — code hopped on with a scoot.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'chore/tc-updates' is vague and generic, using non-descriptive terminology that does not convey meaningful information about the changeset. Replace with a more specific title like 'Add tcAbacus referrer methods and types' or 'feat: add referrer eligibility and code management gRPC methods' to clearly communicate the main changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/tc-updates

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

@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 1, 2026

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

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedglob@​11.0.3998510050100
Addedglob@​11.1.09910010050100
Addedprotoc@​32.1.0951006895100
Added@​protobuf-ts/​plugin@​2.11.11001008583100
Addedtsup@​8.5.0981009483100
Addedtsup@​8.5.1981009583100
Addedgoogle-protobuf@​4.0.010010010084100
Addedgrpc-web@​1.5.010010010085100
Addedtypescript@​5.9.21001009010090
Addedtypescript@​5.9.31001009010090

View full report

@Frederick-88 Frederick-88 marked this pull request as ready for review April 6, 2026 14:28
Copy link
Copy Markdown

@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: 1

🧹 Nitpick comments (3)
packages/sdk-ts/src/client/tcAbacus/grpc/TcAbacusGrpcApi.ts (1)

110-122: Consider returning a typed response or void for consistency.

Returning the raw proto response breaks the pattern established by other methods in this class, which always transform responses through the TcAbacusGrpcTransformer. Even if the response has no meaningful fields, consider:

  1. Returning void if the response truly carries no data
  2. Creating a minimal transformer that returns an empty typed object

This would make the API surface more consistent and decouple consumers from proto internals.

Option: Return void if response is empty
-  async createReferrerCode(address: string, code: string) {
+  async createReferrerCode(address: string, code: string): Promise<void> {
     const request = TcAbacusPb.CreateReferrerCodeRequest.create({
       code,
       address,
     })

-    const response = await this.executeGrpcCall<
+    await this.executeGrpcCall<
       TcAbacusPb.CreateReferrerCodeRequest,
       TcAbacusPb.CreateReferrerCodeResponse
     >(request, this.client.createReferrerCode.bind(this.client))
-
-    return response // has no response fields
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/sdk-ts/src/client/tcAbacus/grpc/TcAbacusGrpcApi.ts` around lines 110
- 122, The createReferrerCode method currently returns the raw proto response
which breaks the class pattern; change it to return a typed void or use the
transformer: update the method signature to async createReferrerCode(address:
string, code: string): Promise<void> and remove the returned proto object (just
await executeGrpcCall(...) and return nothing), or alternatively call a new
transformer method on TcAbacusGrpcTransformer (e.g.,
TcAbacusGrpcTransformer.transformCreateReferrerCodeResponse(response)) and
return that typed result so consumers never see proto internals; ensure the
method no longer exposes the raw TcAbacusPb.CreateReferrerCodeResponse.
.claude/skills/align-proto/SKILL.md (2)

150-156: Add blank lines around fenced code blocks.

The bash code blocks need blank lines before and after them per markdown formatting standards.

Proposed fix
 1. If `@injectivelabs/exceptions` was modified (new module added), build it first:
+
    ```bash
    cd packages/exceptions && pnpm build
    ```
+
 2. Run `pnpm type-check` in `packages/sdk-ts`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/align-proto/SKILL.md around lines 150 - 156, The markdown
contains fenced bash code blocks without blank lines before/after them; update
SKILL.md to add an empty line both immediately before and immediately after each
triple-backtick fenced code block (the blocks showing "```bash" and closing
"```") so the snippets are properly separated from surrounding text and render
correctly in Markdown; ensure all three fenced blocks in the listed steps follow
this rule.

119-126: Add language specifier to fenced code block.

The code block on line 119 lacks a language identifier, which triggers markdown linting warnings.

Proposed fix
-```
+```text
 1. types/*.ts                          (no dependencies)
 2. transformers/*Transformer.ts        (depends on types)
 3. transformers/*StreamTransformer.ts  (depends on main transformer)
 4. grpc/*Api.ts                        (depends on types + transformers)
 5. grpc_stream/streamV2/*StreamV2.ts   (depends on stream transformer)
 6. Update all index.ts exports         (depends on all above)
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @.claude/skills/align-proto/SKILL.md around lines 119 - 126, The fenced code
block containing the list starting with "1. types/*.ts (no dependencies)" in
SKILL.md is missing a language specifier which causes markdown lint warnings;
update that fenced block to include a language tag (e.g., add "text" after the
opening triple backticks) so the block becomes text ... , leaving the
content unchanged.


</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Inline comments:
In
@packages/sdk-ts/src/client/indexer/transformers/IndexerTcDerivativesStreamTransformer.ts:

  • Around line 14-16: The transformer currently returns undefined for booked
    orders (the early return in IndexerTcDerivativesStreamTransformer.ts when
    order?.state === OrderState.Booked), which violates the stream callback contract
    because IndexerGrpcTcDerivativesStreamV2.ts forwards the transformed value to
    consumers via callback(transformed). Remove the early return in the transformer
    (keep it producing the normal response object) and instead filter booked orders
    in the stream caller: update IndexerGrpcTcDerivativesStreamV2.ts where
    callback(transformed) is invoked to skip invoking the user callback when
    transformed.order?.state === OrderState.Booked (or when transformed indicates a
    booked order), following the established pattern used by
    IndexerGrpcDerivativeTransformer.grpcOrderHistoriesToOrderHistories and
    IndexerGrpcTcDerivativesTransformer.ordersHistoryResponseToOrdersHistory;
    alternatively, if you prefer to keep the transformer filtering, return a
    response object with order: undefined rather than returning undefined.

Nitpick comments:
In @.claude/skills/align-proto/SKILL.md:

  • Around line 150-156: The markdown contains fenced bash code blocks without
    blank lines before/after them; update SKILL.md to add an empty line both
    immediately before and immediately after each triple-backtick fenced code block
    (the blocks showing "bash" and closing "") so the snippets are properly
    separated from surrounding text and render correctly in Markdown; ensure all
    three fenced blocks in the listed steps follow this rule.
  • Around line 119-126: The fenced code block containing the list starting with
    "1. types/*.ts (no dependencies)" in SKILL.md is missing a language specifier
    which causes markdown lint warnings; update that fenced block to include a
    language tag (e.g., add "text" after the opening triple backticks) so the block
    becomes text ... , leaving the content unchanged.

In @packages/sdk-ts/src/client/tcAbacus/grpc/TcAbacusGrpcApi.ts:

  • Around line 110-122: The createReferrerCode method currently returns the raw
    proto response which breaks the class pattern; change it to return a typed void
    or use the transformer: update the method signature to async
    createReferrerCode(address: string, code: string): Promise and remove the
    returned proto object (just await executeGrpcCall(...) and return nothing), or
    alternatively call a new transformer method on TcAbacusGrpcTransformer (e.g.,
    TcAbacusGrpcTransformer.transformCreateReferrerCodeResponse(response)) and
    return that typed result so consumers never see proto internals; ensure the
    method no longer exposes the raw TcAbacusPb.CreateReferrerCodeResponse.

</details>

<details>
<summary>🪄 Autofix (Beta)</summary>

Fix all unresolved CodeRabbit comments on this PR:

- [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended)
- [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: defaults

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `656e36cf-1a37-43e7-a763-606f4aa5bca1`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 26c1e07e5700d642c0080e200ac262287d2fce21 and 293a3188c0d8fc1d6769ff80d523dbbc88c4a2b4.

</details>

<details>
<summary>📒 Files selected for processing (6)</summary>

* `.claude/skills/align-proto/SKILL.md`
* `packages/sdk-ts/package.json`
* `packages/sdk-ts/src/client/indexer/transformers/IndexerTcDerivativesStreamTransformer.ts`
* `packages/sdk-ts/src/client/tcAbacus/grpc/TcAbacusGrpcApi.ts`
* `packages/sdk-ts/src/client/tcAbacus/grpc/transformers/index.ts`
* `packages/sdk-ts/src/client/tcAbacus/types/tcAbacus.ts`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@Frederick-88 Frederick-88 merged commit f6d4b2e into dev Apr 6, 2026
4 of 5 checks passed
@ivan-angjelkoski ivan-angjelkoski deleted the chore/tc-updates branch April 6, 2026 15:13
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.

2 participants