Skip to content

feat(stellar): replace public Stellar name-resolution stubs with core resolver - #261

Open
carelessdept wants to merge 1 commit into
wraith-protocol:developfrom
carelessdept:feat/stellar-name-resolver
Open

carelessdept wants to merge 1 commit into
wraith-protocol:developfrom
carelessdept:feat/stellar-name-resolver

Conversation

@carelessdept

Copy link
Copy Markdown
Contributor

Summary

Replaces the 500 ms timer stubs in @wraith-protocol/sdk-react and @wraith-protocol/sdk-svelte with a typed core Soroban wraith-names contract resolver in @wraith-protocol/sdk/chains/stellar.

Changes

  • Core Stellar Resolver (src/chains/stellar/names.ts, exported from @wraith-protocol/sdk/chains/stellar):
    • normalizeStellarName(name) strips trailing .wraith and validates 3..=32 characters, lowercase ASCII alphanumeric labels, and single-level subdomains (sub.parent), rejecting malformed inputs before any RPC request with InvalidNameError.
    • resolveStellarName(name, chain, options) simulates resolve(name) against the configured wraith-names Soroban contract (DEPLOYMENTS.stellar.contracts.names), decodes and validates 64-byte (spendingPubKey || viewingPubKey) payloads into st:xlm:... stealth meta-addresses via encodeStealthMetaAddress / decodeStealthMetaAddress, and rejects malformed contract payloads with InvalidMetaAddressError.
    • Unregistered names (NameNotFound / contract error #6 / scvVoid) return null by default (or throw NameNotFoundError when throwOnNotFound: true) and are never cached.
    • Positive resolutions are cached in memory for DEFAULT_STELLAR_NAME_TTL_MS (5 minutes) with bypassCache, ttlMs, clearStellarNameCache(), getStellarNameDefaultTtl(), and setStellarNameDefaultTtl() controls.
    • Unconfigured chains or network passphrase mismatches reject with WalletWrongNetworkError.
    • Pre-aborted or mid-flight aborted AbortSignal instances reject immediately with RPCAbortedError.
  • React & Svelte Wrappers (packages/sdk-react/src/hooks.ts, packages/sdk-svelte/src/primitives/useStellarName.ts):
    • Both useStellarName wrappers now call resolveStellarName with AbortController cancellation on unmount/abort()/superseding lookups, loading state transitions, and typed WraithError propagation.
  • Tests & Documentation:
    • Added unit tests in test/chains/stellar/names.test.ts, packages/sdk-react/test/hooks.test.tsx, and packages/sdk-svelte/test/stellarParity.test.ts covering found, missing, malformed, wrong-network, and aborted requests plus cache TTL/bypass semantics.
    • Documented network and cache semantics in README.md and packages/sdk-svelte/README.md, and updated etc/sdk-stellar.api.md.

Closes #242

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@carelessdept 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

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Core Stellar name resolution and React integration pass the focused resolver and hook tests after a clean SDK build. Approved.

@carelessdept
carelessdept force-pushed the feat/stellar-name-resolver branch from bb43a6b to ee98a71 Compare October 18, 2026 15:25
@carelessdept

Copy link
Copy Markdown
Contributor Author

Rebased/resolved the conflict in packages/sdk-react/src/hooks.ts after #256 landed on develop — all 21 CI checks are green and the branch is clean to merge whenever convenient. Thank you @truthixify!

@truthixify truthixify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resolver works for the common path, but normalizeStellarName rejects names the configured on-chain contract can register. In src/chains/stellar/names.ts:79-85 every label is required to be at least 3 characters; the contract only applies the 3-character minimum to the full name and permits a single-level subdomain such as a.alice. That record can exist on chain but this public resolver fails before RPC, so its owner cannot resolve it. Please align client validation with the contract's actual accepted name set (and add a short-subdomain regression), or tighten the contract first. The focused core/React tests and build passed locally.

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.

[Wave 10] Replace public Stellar name-resolution stubs with one core implementation

2 participants