Skip to content

Add SDK unit tests for PaymentStreamClient and DistributorClient #25

@pragmaticAweds

Description

@pragmaticAweds

Context

The SDK package (packages/sdk/) contains PaymentStreamClient and DistributorClient — the TypeScript wrappers around the generated Soroban contract bindings. These clients are the critical interface between the frontend and the smart contracts, yet they have zero test files. If a contract ABI changes or a method signature is updated, there is no automated way to catch regressions before they hit the UI.

What Success Looks Like

  • Test files exist for both PaymentStreamClient and DistributorClient
  • Tests cover: method signatures, parameter validation, error handling, and return type shapes
  • Contract calls are mocked at the RPC level (no live network dependency)
  • Tests run with Vitest and are integrated into the project's test pipeline
  • Coverage includes: createStream, deposit, withdraw, cancelStream, pauseStream, resumeStream, setDelegate, revokeDelegate for streams; distributeEqual, distributeWeighted for distributor

Implementation Guidance

  • packages/sdk/src/PaymentStreamClient.ts — stream client with ~15 public methods
  • packages/sdk/src/DistributorClient.ts — distributor client
  • packages/sdk/src/generated/ — generated bindings that the clients wrap
  • Follow the testing patterns from apps/web/src/services/stellar.service.test.ts for mocking RPC calls
  • Mock SorobanRpc.Server and Contract at the module level
  • Test both success and error paths (network failure, invalid params, contract revert)
  • The SDK package may need its own vitest.config.ts if it doesn't have one

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: mediumStandard features across multiple codebase sections

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions