Skip to content

Conversation

@kstroobants
Copy link
Contributor

@kstroobants kstroobants commented Sep 18, 2025

Fixes #DXP-678

What

  • Added getStudioTransactionByHash method to transactionActions to fetch transactions by hash for the studionet and localnet chain.
  • Introduced getTransactionStatus method to transactionActions to retrieve the status of a transaction.
  • Updated GenLayerMethod type to include sim_getTransactionByHash and gen_getTransactionStatus methods.
  • Updated GenLayerClient type to include getStudioTransactionByHash and getTransactionStatus methods.

Why

To support fetching transaction details and status.

Testing done

Tested both method by calling them on all chains.

Decisions made

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR
  • I have set a descriptive PR title compliant with conventional commits

Reviewing tips

This PR depends on this studio PR genlayerlabs/genlayer-studio#1319

User facing release notes

Added support for fetching transaction details and statuses for the studionet and localnet chain.

Summary by CodeRabbit

  • New Features
    • Retrieve transactions by hash with optional full details, including automatic decoding on Studio/localnet.
    • Check transaction status by hash for clearer visibility into pending, successful, or failed transactions.
    • Enhanced handling for Studio/localnet environments to streamline local development and debugging.

@coderabbitai
Copy link

coderabbitai bot commented Sep 18, 2025

Walkthrough

Adds two transaction-related API methods and corresponding client types. Implements sim_getTransactionByHash with optional full flag and conditional localnet/studionet decoding, and gen_getTransactionStatus for status retrieval. Updates transactionActions to import studionet and expose getStudioTransactionByHash and getTransactionStatus.

Changes

Cohort / File(s) Summary
Transaction actions API additions
src/transactions/actions.ts
Imports studionet; adds getStudioTransactionByHash calling sim_getTransactionByHash with [hash, full?] and decoding for localnet/studionet; adds getTransactionStatus calling gen_getTransactionStatus; leaves existing getTransaction logic unchanged.
Client types extensions
src/types/clients.ts
Extends GenLayerMethod with sim_getTransactionByHash and gen_getTransactionStatus; adds corresponding GenLayerClient methods getStudioTransactionByHash and getTransactionStatus with typed params/returns.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor App
  participant Client as GenLayerClient
  participant Actions as transactionActions
  participant RPC as RPC Provider
  participant Decoder as decodeLocalnetTransaction

  App->>Client: getStudioTransactionByHash({hash, full?})
  Client->>Actions: getStudioTransactionByHash({hash, full?})
  Actions->>RPC: sim_getTransactionByHash([hash, full?])

  alt Chain is localnet/studionet
    RPC-->>Actions: tx (raw)
    Actions->>Decoder: decodeLocalnetTransaction(tx)
    Decoder-->>Actions: tx (decoded)
    Actions-->>Client: GenLayerTransaction (decoded)
  else Other chains
    RPC-->>Actions: tx (raw)
    Actions-->>Client: GenLayerTransaction (raw)
  end
  Client-->>App: Promise<GenLayerTransaction>
Loading
sequenceDiagram
  autonumber
  actor App
  participant Client as GenLayerClient
  participant Actions as transactionActions
  participant RPC as RPC Provider

  App->>Client: getTransactionStatus({hash})
  Client->>Actions: getTransactionStatus({hash})
  Actions->>RPC: gen_getTransactionStatus([hash])
  RPC-->>Actions: TransactionStatus
  Actions-->>Client: TransactionStatus
  Client-->>App: Promise<TransactionStatus>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • danielrc888

Poem

Thump-thump, I hop through hashes and logs,
Nose to the wire where the status jogs.
Studio or local, I nibble, decode—
A carrot-orange trace on the chainy road.
Two fresh calls in my basket I stash—
Peek at the status, fetch by the hash!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "feat: expose rpc endpoints" accurately reflects the main intent of the changeset (exposing RPC endpoints and adding client/action wrappers) and follows conventional commit style, but it is somewhat generic rather than specifying which endpoints were added.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed The pull request description largely follows the repository template: it includes "Fixes #DXP-678" and the required sections ("What", "Why", "Testing done", "Checks", "Reviewing tips", and "User facing release notes") and clearly describes the added methods and type updates; the author also reports testing across chains. The "Decisions made" section is empty and the "Testing done" section is brief and lacks concrete steps or links to test artifacts, but these omissions are non-critical and do not make the description off-topic. Overall the description is sufficiently complete for review.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dxp-678-expose-sim_gettransactionbyhash-and-gen_gettransactionstatus

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.

coderabbitai[bot]

This comment was marked as resolved.

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