MetaMask / MetaMask/metamask-design-system

Improve error handling of `generateSeedEthereum` in design system shared

Open
#821 0 comments 0 reactions 0 assignees View on GitHub
team-design-system
Dominant language
TypeScript
Stars
37
Forks
14
Avg merge
1d 9h
Merged PRs (30d)
60

Description

https://github.com/MetaMask/metamask-design-system/pull/817/files#r2294831748

### Bug: Ethereum Seed Generation Fails With Invalid Inputs

The `generateSeedEthereum` function can return `NaN` because `parseInt` receives an empty string (for short addresses like '0x') or invalid hexadecimal characters from the sliced address. This may cause issues for downstream icon generation expecting a numeric seed.

Fix in Cursor Fix in Web

Contributor guide

Open the contributing guide

Research direction

Read packages/design-system-shared/src/utils/caip-address.ts#L51-L56 and trace generateSeedEthereum from there. Reproduce the short "0x" and invalid-hex cases described in the issue; done means these inputs no longer produce NaN for downstream icon generation, with relevant regression coverage passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.