Skip to content

chore: expose decode function for public use#153

Merged
MicBun merged 1 commit intomainfrom
exposedecode
Feb 20, 2026
Merged

chore: expose decode function for public use#153
MicBun merged 1 commit intomainfrom
exposedecode

Conversation

@MicBun
Copy link
Member

@MicBun MicBun commented Feb 20, 2026

resolves: https://github.com/truflation/website/issues/3347

Summary by CodeRabbit

  • New Features
    • NodeTNClient now includes a method to dynamically retrieve chainId from an endpoint
    • NodeTNClient constructor now accepts an optional chainId parameter for programmatic configuration
    • Expanded public API with new utilities for decoding market data and attestation components

@MicBun MicBun self-assigned this Feb 20, 2026
@MicBun MicBun added the chore label Feb 20, 2026
@holdex
Copy link

holdex bot commented Feb 20, 2026

Time Submission Status

Member Status Time Action Last Update
MicBun ✅ Submitted 1h Update time Feb 20, 2026, 12:58 AM

You can submit time with the command. Example:

@holdex pr submit-time 15m

See available commands to help comply with our Guidelines.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

The changes introduce dynamic chainId retrieval via a new public static method in NodeTNClient and make it configurable through the constructor. Additionally, utility functions for decoding market data and attestation components are exposed through the public API exports.

Changes

Cohort / File(s) Summary
NodeTNClient API
examples/decode_market_example/index.ts
Updated example to consolidate imports and demonstrate dynamic chainId retrieval via NodeTNClient.getDefaultChainId(endpoint) before client initialization.
Public API Exports
src/internal.ts
Added exports for decodeActionArgs and decodeQueryComponents from AttestationEncoding, and decodeMarketData function with MarketData type from orderbookHelpers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A chainId dances through the digital night,
Retrieved with grace, configured just right,
Exports bloom forth like carrots in spring,
Market data decoded—what joy it will bring! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective: exposing decode functions for public use, which aligns with the changes to export decoding utilities in src/internal.ts and the new public API additions in NodeTNClient.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch exposedecode

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@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.

🧹 Nitpick comments (1)
examples/decode_market_example/index.ts (1)

13-20: No error handling if getDefaultChainId fails before client initialization.

If the endpoint is unreachable or returns an unexpected response, getDefaultChainId will throw and the error message from the top-level .catch(console.error) on Line 60 may not be very informative. For an example file this is acceptable, but consider adding a brief log or a more descriptive catch if this example is intended as a reference for users.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/decode_market_example/index.ts` around lines 13 - 20, Wrap the await
NodeTNClient.getDefaultChainId(endpoint) call in a try/catch to handle
network/response errors before constructing the NodeTNClient; in the catch log a
descriptive error (including the endpoint and the caught error) and either
rethrow or exit (e.g., process.exit(1)) so the example fails with a clear
message rather than an opaque top-level .catch; update the code around
getDefaultChainId and the NodeTNClient initialization to use this guarded value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@examples/decode_market_example/index.ts`:
- Around line 13-20: Wrap the await NodeTNClient.getDefaultChainId(endpoint)
call in a try/catch to handle network/response errors before constructing the
NodeTNClient; in the catch log a descriptive error (including the endpoint and
the caught error) and either rethrow or exit (e.g., process.exit(1)) so the
example fails with a clear message rather than an opaque top-level .catch;
update the code around getDefaultChainId and the NodeTNClient initialization to
use this guarded value.

@MicBun MicBun merged commit 287b443 into main Feb 20, 2026
5 checks passed
@MicBun MicBun deleted the exposedecode branch February 20, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant