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
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
RpcClientinterface extracted with methods:simulateTransaction,sendTransaction,getTransaction,getEvents,getLatestLedgerStellarSplitSDK({ rpcClient: customClient })constructor option accepts a customRpcClientimplementationSorobanRpcClientcreated internally whenrpcClientnot supplied (backward-compatible)MockRpcClientexported from@stellar-split/sdk/testing— implementsRpcClientwith configurable responsesRpcClientcalls (not the Soroban SDK directly)RpcClientinterface exported from the package rootMockRpcClient— no real network calls in unit test suite after this change