Skip to content

feat(stellar): add Stellar network and account display helpers (closes #496) - #505

Merged
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
rupesh-kumar-sah:feat/issue-496-stellar-helpers
Sep 17, 2026
Merged

Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
rupesh-kumar-sah:feat/issue-496-stellar-helpers

Conversation

@rupesh-kumar-sah

Copy link
Copy Markdown
Contributor

Description

This PR resolves #496 by introducing lightweight, zero-dependency Stellar network and account formatting helpers to GuildPass SDK V2.

Changes

  1. src/stellar/network.ts:
    • Defined canonical StellarNetwork union type ('testnet' | 'public' | 'futurenet' | 'standalone').
    • Defined SUPPORTED_STELLAR_NETWORKS array and STELLAR_NETWORK_PASSPHRASES mapping.
    • Implemented isStellarNetwork type guard.
    • Implemented normalizeStellarNetwork (handles common aliases like "mainnet" -> "public" and "local" -> "standalone").
    • Implemented getStellarNetworkPassphrase for retrieving the standard network passphrase string.
    • Implemented isTestNetwork for predictably distinguishing development networks from public mainnet.
  2. src/stellar/accountId.ts:
    • Added truncateStellarAccountId(account, prefixLength = 4, suffixLength = 4) for safe UI display (e.g. GAAZ...CWN7).
  3. src/stellar/index.ts:
    • Exported all network helpers and types alongside account helpers.
  4. tests/stellar/network.test.ts:
    • Comprehensive Vitest test suite covering canonical network detection, alias normalization, passphrases, testnet vs mainnet classification, and account truncation.

Verification

  • pnpm typecheck (tsc --noEmit): Passed with 0 errors
  • pnpm build (tsup): ESM and DTS bundles generated successfully
  • pnpm test (vitest): 24 test files passed, 691 tests passed, 0 failures

Closes #496

Closes Adamantine-guild#496

- Define canonical StellarNetwork type ('testnet', 'public', 'futurenet', 'standalone').
- Centralize SUPPORTED_STELLAR_NETWORKS and STELLAR_NETWORK_PASSPHRASES constants.
- Implement isStellarNetwork, normalizeStellarNetwork, getStellarNetworkPassphrase,
  and isTestNetwork helpers to distinguish mainnet and development networks.
- Add truncateStellarAccountId for safe and consistent account display.
- Add comprehensive Vitest unit test suite covering valid/invalid networks and accounts.
@Lakes41
Lakes41 merged commit 55c0499 into Adamantine-guild:main Sep 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Stellar account and network helpers to GuildPass SDK V2

2 participants