Skip to content

feat: extract shared core package for web and mobile (#1006) - #1129

Merged
Nanle-code merged 1 commit into
Nanle-code:masterfrom
VeronicDev:feat/core-shared-package
Oct 5, 2026
Merged

Nanle-code merged 1 commit into
Nanle-code:masterfrom
VeronicDev:feat/core-shared-package

Conversation

@VeronicDev

Copy link
Copy Markdown
Contributor

Closes #1006

Summary

Extract platform-agnostic Stellar logic into a shared @stellar-dev-dashboard/core\ workspace package to eliminate duplicated code between the web app (\src/lib/stellar/) and mobile app (\mobile/src/services/stellar.ts).

Changes

New Package: \packages/core/\

  • Network config (
    etworks.ts): \NETWORKS, \getServer, \getSorobanServer, \updateCustomNetworkConfig\
  • Validation (\�alidation.ts): Address, amount, memo, contract, URL, network validators with \ValidationResult\ type
  • Formatters (\ ormatters.ts): XLM, address, stroop, instruction, byte, date, relative time formatting
  • Addresses (\�ddresses.ts): Validation, parsing, SEP-29 memo check, federation resolution, universal resolver
  • Reserves (
    eserves.ts): Account reserve calculations with \AccountReserves\ type
  • Operation Labels (\operationLabels.ts): Human-readable labels for all Stellar operation types
  • Services (\services.ts): High-level data fetching (\ etchAccount, \ etchTransactions, \ etchNetworkStats, \ etchXLMPrice) with in-memory caching
  • Types (\ ypes/index.ts): Shared TypeScript interfaces

Test Suite (_tests_/)

  • 7 test files covering all modules
  • Tests cover primary flow, boundary cases (e.g., 7 decimal places, 28-byte memo), and failure cases (invalid inputs, network errors)

Lint Enforcement

  • ESLint config with
    o-restricted-imports\ blocking React, React Native, browser globals (\window, \document, \localStorage, etc.)

Consumer Updates

  • Mobile app: \mobile/src/services/stellar.ts\ now imports from core, keeps only AsyncStorage caching wrappers and \ etchOperations\
  • Mobile formatters: \mobile/src/utils/formatters.ts\ now re-exports from core
  • Mobile types: \mobile/src/types/index.ts\ now re-exports from core
  • Web app: \src/lib/stellar/networks.ts, \ ormatters.ts, \�ddresses.ts,
    eserves.ts, \�alidation.ts\ now delegate to core

Workspace Config

  • Added \packages/core\ to \pnpm-workspace.yaml\
  • Added @stellar-dev-dashboard/core\ as workspace dependency in both \package.json\ files

Documentation

Acceptance Criteria Met

  • \packages/core\ workspace package holds platform-agnostic modules
  • Both web and mobile import from @stellar-dev-dashboard/core\
  • Duplicated mobile code removed
  • Core has no DOM or React Native imports (enforced by lint)
  • Core has its own test suite running in CI
  • Automated tests cover primary flow, boundary case, failure case
  • User-facing documentation updated with compatibility/migration notes

- Create packages/core workspace package with platform-agnostic Stellar logic
- Network config, validation, formatters, addresses, reserves, operation labels, services
- Comprehensive test suite covering primary flow, boundary cases, failure cases
- ESLint rules enforcing no DOM/React Native imports in core
- Update mobile app to import from @stellar-dev-dashboard/core
- Update web app to delegate to core package
- Remove duplicated code from mobile/services/stellar.ts
- Add core package to pnpm-workspace.yaml
- Update documentation: packages/core/README.md, root README.md, CHANGELOG.md
@vercel

vercel Bot commented Oct 1, 2026

Copy link
Copy Markdown

@VeronicDev is attempting to deploy a commit to the nanle-code's projects Team on Vercel.

A member of the Team first needs to authorize it.

@VeronicDev

Copy link
Copy Markdown
Contributor Author

Kindly merge.

@Nanle-code
Nanle-code merged commit 75fa918 into Nanle-code:master Oct 5, 2026
1 check failed
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.

[2026 Mobile] Extract a shared core package used by both the web app and the mobile app

2 participants