Skip to content

[SPIKE] Investigate a unified Result<T, E> type across all SDK methods instead of the current mix of throwing and ok/data/error returns #810

Open

Description

@meshackyaro

Description

Some SDK methods throw on failure (e.g. createEscrow) while others return a { ok, data, error } result object (e.g. escrowClient.fund), and this inconsistency across the public API is a recurring source of confusion per integrator feedback and is visible even within the README's own examples.

Component

core

Research Questions

  • How many public methods currently throw versus return a result object, and is there any discernible pattern (e.g. by module) to the current split?
  • What would a consistent migration to one pattern (likely the Result<T,E> style, given it's already used in several places) cost in terms of breaking changes for existing integrators?
  • Could this be done as a opt-in v2 API surface alongside the existing one during a deprecation window, rather than a hard break?

Context

This inconsistency is visible in the README's own usage examples (compare createEscrow's throwing style against escrowClient.fund's result-object style) and has been flagged by integrators as confusing.

Proposed Approach

Audit the full public API for throw-vs-result-object usage, and prototype a consistent wrapper approach alongside a draft migration/deprecation plan.

Deliverables

An audit table of current method styles, a recommended consistent pattern, and a draft deprecation timeline if a breaking change is warranted.

Difficulty

🔴 Hard

Estimated Time

2-3 days

Related Issues

This is a cross-cutting API design question that touches nearly every module; likely warrants a broader maintainer discussion before implementation begins.

Activity

  1. added
    help wanted
    priority: medium
    difficulty: spike
    on Oct 29, 2026
  2. rupesh-kumar-sah commented on Oct 29, 2026

    @rupesh-kumar-sah

    Hi maintainers,

    I reviewed "[SPIKE] Investigate a unified Result<T, E> type across all SDK methods instead of the current mix of throwing and ok/data/error returns" and have a structured approach ready for implementation:

    I have reviewed the problem description and acceptance criteria for this issue. I have a clear, tested implementation ready with defensive error handling and 100% green CI proof.

    I will deliver a clean, well-tested, and production-ready PR promptly upon assignment. Kindly assign this issue to me.

    Thank you!

  3. xtep103 commented on Oct 30, 2026

    @xtep103

    Hey Maintainer, I have gone through the details of the issue and i am capable of resolving it, I would love to be assigned to work on it ASAP. Thanks in advance

  4. GangDev6707 commented on Nov 8, 2026

    @GangDev6707

    Hello @trustflow-protocol team,

    I'd like to help resolve this issue. We need to resolve 'investigate a unified result<t, e> type across all sdk methods instead of the current mix of throwing and ok/data/error returns' cleanly across the target modules. I plan to trace the current code execution path to isolate the behavior boundary and implement a focused, modular fix for 'investigate a unified result<t, e> type across all sdk methods instead of the current mix of throwing and ok/data/error returns' adhering strictly to repository architecture, followed by ensure defensive guards and backward compatibility are maintained.

    I'll reproduce the target scenario locally, add regression unit tests, and confirm all CI checks pass 100% green to verify everything passes cleanly.

    Ready to implement the patch today once assigned. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coredifficulty: spikehelp wantedpriority: mediumsdk

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions