Skip to content

Refactor RPC client into a standalone injectable dependency #401

Description

@Kingsman-99

Overview

The RPC client is instantiated directly inside StellarSplitSDK, making it impossible to swap in a custom transport for testing or alternative environments without monkey-patching. Refactor it into an injectable dependency.

Acceptance Criteria

  • RpcClient interface extracted with methods: simulateTransaction, sendTransaction, getTransaction, getEvents, getLatestLedger
  • StellarSplitSDK({ rpcClient: customClient }) constructor option accepts a custom RpcClient implementation
  • Default SorobanRpcClient created internally when rpcClient not supplied (backward-compatible)
  • MockRpcClient exported from @stellar-split/sdk/testing — implements RpcClient with configurable responses
  • All existing connection-pooling, retry, and rate-limiting logic wraps RpcClient calls (not the Soroban SDK directly)
  • TypeScript: RpcClient interface exported from the package root
  • Unit tests replaced with MockRpcClient — no real network calls in unit test suite after this change

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions