Skip to content

Feat/sequence - #553

Merged
BigBen-7 merged 7 commits into
Lead-Studios:mainfrom
ummarig:feat/sequence
Aug 28, 2026
Merged

Feat/sequence#553
BigBen-7 merged 7 commits into
Lead-Studios:mainfrom
ummarig:feat/sequence

Conversation

@ummarig

@ummarig ummarig commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Changes Made

1. Added AccountInfo interface to src/types/index.ts

We added the required AccountInfo interface with all the specified properties:

export interface AccountInfo {
  address: string;
  xlmBalance: string;
  sequence: string;
  subentryCount: number;
}

2. Implemented getAccountInfo method in src/client.ts

We added the getAccountInfo method to the VeriTixClient class that:

  • Checks if the client is connected (throws ClientNotConnected if not)
  • Validates that the provided address is a valid Stellar ed25519 public key using StrKey.isValidEd25519PublicKey
  • Fetches the account from the Soroban RPC server using this.server.getAccount(address)
  • Extracts the native XLM balance, converts it from XLM to stroops (multiplying by 10,000,000)
  • Returns an object matching the AccountInfo interface
  • Throws a VeriTixError with InvalidAddress error code if the account doesn't exist or any error occurs while fetching it
  • closes feat: add VeriTixClient.getAccountInfo() — fetch Stellar account XLM balance and sequence #488

Key Features

  • Proper error handling: Follows the existing error patterns in the codebase
  • Type safety: Uses all the existing types and adds the new interface correctly
  • Stellar compatibility: Uses the official Stellar SDK's StrKey for address validation and correctly handles the account object returned from the RPC server
  • Balance conversion: Properly converts XLM balance to stroops as required by the interface
  • closes feat: add VeriTixClient.pool() — round-robin client pool for high-throughput backends #486

Changes Made

1. Created new file src/pool.ts

Added the VeriTixClientPool class that:

  • Manages a pool of VeriTixClient instances, each connected to a different RPC endpoint
  • Uses round-robin load balancing to distribute calls across healthy pool members
  • Automatically marks instances as unhealthy after 5 consecutive errors
  • Provides a healthCheck() method that checks all members and returns their status
  • Uses a proxy to forward all method calls to the next available client, so the pool acts exactly like a single VeriTixClient
  • closes #

2. Updated src/client.ts

Added the static VeriTixClient.pool() method that:

3. Updated src/index.ts

  • Added export for VeriTixClientPool
  • Added export for the AccountInfo type we created earlier

Key Features

  • Round-robin distribution: Calls are spread evenly across all healthy RPC endpoints
  • Health tracking: Unhealthy endpoints are automatically skipped
  • Transparent proxy: The pool's API is identical to VeriTixClient, so no changes are needed to existing code
  • Health check endpoint: pool.healthCheck() returns detailed status for all members
  • Error threshold: Members are marked unhealthy after 5 consecutive errors, preventing them from being used for subsequent calls
  • closes feat: add VeriTixClient.multiCall() — multiple write operations as a single atomic transaction #485

The implementation is complete and ready to use. High-throughput backends can now distribute their RPC calls across multiple endpoints to avoid bottlenecks, with automatic health management to ensure reliability.

Checklist

  • Tests added or updated
  • Docs updated (JSDoc / README)
  • npm run build passes
  • npm test passes
  • npm run lint passes

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@ummarig Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@BigBen-7
BigBen-7 merged commit b2e96ac into Lead-Studios:main Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment