Skip to content

Fix invokeContract's return type leaking raw stellar-sdk objects instead of ContractCallResult #132

Description

@meshackyaro

Description

src/types/contract.ts defines ContractCallResult (success, returnValue?, txHash?, errorCode?, gasUsed?) as the apparent intended shape for a contract invocation's outcome. But invokeContract (src/contract/invoke.ts) is typed to return Promise<unknown> and actually resolves { operation, account, server } — the raw, internal Contract.call(...) operation object, the Account returned by server.getAccount(caller), and the SorobanRpc.Server instance itself — none of which is a ContractCallResult. ContractCallResult currently has zero producers anywhere in src/ (grepping for it shows only its own declaration and its re-export via contract/index.ts), meaning the type that looks like the contract module's primary output type is entirely unused in practice, while the function that should produce it leaks unrelated internal SDK objects to its caller instead.

Component

SDK

Difficulty

🟡 Medium

Tasks

  • Change invokeContract's return type to Promise<ContractCallResult>
  • Complete the simulate→sign→submit flow inside invokeContract (or clearly split it into prepareInvocation/submitInvocation steps) so it can actually populate success, txHash, returnValue, errorCode, gasUsed instead of returning intermediate SDK objects
  • Update any dependent code once real callers exist (tracked in the companion "replace placeholder implementation" issues, which will want to call this)

Acceptance Criteria

  • invokeContract returns a ContractCallResult, not raw internal SDK objects
  • ContractCallResult has at least one real producer in the codebase

Estimated Time

1-2 days

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions