MetaMask / MetaMask/metamask-extension

transaction-utils determineTransactionType does not handle missing `to` parameter

Open
#23,385 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

### What is this about?

The `readAddressAsContract` function accepts an input parameter address as `string`.
The `determineTransactionTypes` function calls this with potentially undefined `to`.

### Scenario

_No response_

### Design

_No response_

### Technical Details

Either:
- Handle the case explicitly
- Perform input validation and throw explicit error

### Threat Modeling Framework

_No response_

### Acceptance Criteria

_No response_

### Stakeholder review needed before the work gets merged

- [X] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)

### References

https://github.com/MetaMask/metamask-extension/pull/23276/files#diff-04988d119dcfa22dc14a7fef5eeb754d471a03dfe927809c2e1b15c3e8fa2d5aR145

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the referenced pull request diff, then trace determineTransactionTypes and readAddressAsContract to understand how an undefined to value reaches the string parameter. Review the relevant transaction utility tests, if present, and verify that the chosen handling is covered without breaking existing transaction-type behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.