Repository navigation
perf: validate Stellar addresses without eager SDK import - #1486
Open
digofavour-hub wants to merge 1 commit into
Open
digofavour-hub wants to merge 1 commit into
digofavour-hub wants to merge 1 commit into
Conversation
|
@digofavour-hub 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1412
Summary
Removes eager
@stellar/stellar-sdkimports from the entry bundle by introducing lightweight SEP-0023 StrKey validators and dynamically loading SDK-dependent vault services at their call sites.Changes
src/utils/stellarAddress.tsimplementingisValidEd25519PublicKeyandisValidContractId(56-char uppercase RFC 4648 base32, version byte check, CRC16-XModem checksum) without importing@stellar/stellar-sdk.StrKeyimports insrc/config/constants.ts,src/services/vaultConfig.ts,src/config/runtimeConfig.ts, andsrc/app/deposit.tswith the lightweight helpers.src/hooks/useVaultBalances.tsandsrc/hooks/useDepositHistory.tsto dynamicallyimport()vaultReads.tsandvaultEvents.tsat call sites so the SDK is only loaded when needed.src/utils/stellarAddress.test.tsverifying parity withStrKeyacross valid, invalid, and edge-case inputs (lowercase, 55/57 chars, bad checksums, muxedM...addresses, secret seeds, empty/non-base32 strings) plus static source checks ensuring entry modules do not statically import@stellar/stellar-sdk.Testing
npm test -- --run src/utils/stellarAddress.test.ts src/config/constants.test.ts src/services/vaultConfig.test.ts src/App.deposit.test.tsx—stellarAddress.test.ts(11/11),constants.test.ts(4/4),vaultConfig.test.ts(4/4) all pass;App.deposit.test.tsx47/48 pass (1 pre-existing unrelated focus-order failure).npm test -- --run src/pages/BillingHistory.test.tsx src/config/runtimeConfig.test.ts— 92/92 passed.npx tsc --noEmit— 0 errors in all modified/added files.npm run build:origin/maincurrently has pre-existing unrelated syntax/type errors (e.g., duplicateepdeclaration insrc/components/CollectionsMenu.tsx) that preventvite buildfrom completing before and after this change; those unrelated files were intentionally left untouched.