Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add validation for getContract params #5780

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Dec 17, 2024

Problem solved

Fixes TOOL-2768


PR-Codex overview

This PR focuses on adding validation to the getContract function in the thirdweb package, ensuring that the provided client, address, and chain are valid before proceeding.

Detailed summary

  • Added validation checks in the getContract function:
    • Validates if options.client is provided.
    • Validates if options.address is a valid address using isAddress.
    • Validates if options.chain and options.chain.id are provided.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Dec 17, 2024

🦋 Changeset detected

Latest commit: 4be5192

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
thirdweb Patch
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Dec 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2024 9:31pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2024 9:31pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2024 9:31pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2024 9:31pm

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Dec 17, 2024
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@joaquim-verges joaquim-verges marked this pull request as ready for review December 17, 2024 21:13
if (!isAddress(options.address)) {
throw new Error("getContract validation error: Invalid address");
}
if (!options.chain || !options.chain.id) {
Copy link

Choose a reason for hiding this comment

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

The check !options.chain.id will evaluate to true when chain.id is 0, which is a valid chain ID. Consider using typeof options.chain.id !== 'number' to properly validate the type while allowing zero values.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link

linear bot commented Dec 17, 2024

Copy link
Contributor

github-actions bot commented Dec 17, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 45.02 KB (+0.2% 🔺) 901 ms (+0.2% 🔺) 2.8 s (+3.03% 🔺) 3.7 s
thirdweb (cjs) 110.76 KB (-0.08% 🔽) 2.3 s (-0.08% 🔽) 7.5 s (+0.41% 🔺) 9.7 s
thirdweb (minimal + tree-shaking) 5.58 KB (0%) 112 ms (0%) 492 ms (+130.7% 🔺) 603 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 43 ms (-52.49% 🔽) 53 ms
thirdweb/react (minimal + tree-shaking) 19.1 KB (+0.19% 🔺) 383 ms (+0.19% 🔺) 863 ms (-12.47% 🔽) 1.3 s

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.

Project coverage is 53.01%. Comparing base (07ad025) to head (4be5192).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/contract/contract.ts 0.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5780      +/-   ##
==========================================
- Coverage   53.02%   53.01%   -0.02%     
==========================================
  Files        1101     1101              
  Lines       59080    59096      +16     
  Branches     4809     4813       +4     
==========================================
+ Hits        31328    31329       +1     
- Misses      27034    27049      +15     
  Partials      718      718              
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 07ad025
packages 50.15% <0.00%> (-0.02%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
packages/thirdweb/src/contract/contract.ts 28.57% <0.00%> (-71.43%) ⬇️

Copy link
Member Author

Merge activity

  • Dec 18, 4:01 PM EST: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..

DASH-540

* on the chat page -> move the container 1 level down - so the chat can be scrolled from the corner of the page as well
* reduce container max-width for the history page to 800px to match it with landing page
* stop the auto scroll if user interacts with chat UI
* custom 404 page for the nebula subdomain
* remove the announcement banner from the 404 pages ( this affects entire dashboard)
* fix empty title in chat history page
* fix overflow in chat history page on mobile when there's a long text without a whitespace

<!-- start pr-codex -->

---

This PR focuses on enhancing the chat functionality and user experience in the `Nebula` application. It introduces auto-scrolling features, improves layout styling, and adds a new `404 Not Found` page.

- Added auto-scrolling feature to `Chats` component.
- Introduced `setEnableAutoScroll` function to manage scrolling behavior.
- Enhanced styling in `ChatHistoryPage` and `SessionCard`.
- Implemented a new `NebulaNotFound` component with a user-friendly 404 message.
- Updated `ChatPageContent` to utilize the new auto-scroll functionality.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants