The src/blockchain/ folder contains clients and utilities to interact with Stellar and Soroban. Does NOT contain smart contracts (those are on-chain).
Stellar Client - Interaction with Stellar network:
- Account management
- Fee estimation
- Transaction queries
- Balance reading
- Basic Stellar operations
Typical files:
stellar.client.ts: Main clientaccount.service.ts: Account operationsfee.service.ts: Fee estimation
Soroban Client - Interaction with Soroban (smart contracts):
- Transaction simulation
- Invocation building
- Contract state reading
- Soroban transaction sending
Typical files:
soroban.client.ts: Main clientsimulation.service.ts: Transaction simulationinvocation.builder.ts: Invocation building
Contract Clients - Wrappers/abstractions to interact with specific contracts:
These are TypeScript clients that encapsulate the logic to interact with each on-chain smart contract.
Clients to create:
reputation-contract.client.ts: Client for ReputationContractcredit-line-contract.client.ts: Client for CreditLineContractmerchant-registry-contract.client.ts: Client for MerchantRegistryContractliquidity-contract.client.ts: Client for LiquidityContract
Example structure:
// contracts/reputation-contract.client.ts
export class ReputationContractClient {
async getScore(wallet: string): Promise<number> {
// Logic to read score from contract
}
async buildUpdateScoreTx(wallet: string, score: number): Promise<string> {
// Builds unsigned XDR to update score
}
}- IO only: This layer only does I/O with blockchain, no business logic
- Unsigned XDR: Clients build unsigned XDR transactions
- App signs: Mobile app signs transactions
- API sends: API sends signed transactions
- Service calls
ContractClient.buildTx() - Client builds unsigned XDR using Soroban SDK
- API returns XDR to mobile
- Mobile signs the transaction
- Mobile sends signed XDR back
- API sends transaction to network using
soroban.client.ts