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: narrow sign transaction return type based on the transaction type #2853

Merged
merged 7 commits into from
Oct 13, 2024

Conversation

marthendalnunes
Copy link
Contributor

@marthendalnunes marthendalnunes commented Oct 13, 2024

PR-Codex overview

This PR focuses on narrowing the return type of the signTransaction function in the wallet client, enhancing type safety and ensuring more precise types for transaction requests.

Detailed summary

  • Updated the return type of signTransaction to be more specific based on the request type.
  • Modified signTransaction parameters to include a default request type.
  • Added tests for various transaction types (legacy, eip1559, eip2930, eip4844, eip7702) to validate type expectations.
  • Updated pnpm-lock.yaml to reflect the new version of viem.

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

Copy link

vercel bot commented Oct 13, 2024

@marthendalnunes is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

changeset-bot bot commented Oct 13, 2024

🦋 Changeset detected

Latest commit: a5bc63b

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

This PR includes changesets to release 1 package
Name Type
viem 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

@jxom
Copy link
Member

jxom commented Oct 13, 2024

Can we add a type test for this under signTransaction.test-d.ts?

@marthendalnunes
Copy link
Contributor Author

sure, I'll add it

@marthendalnunes
Copy link
Contributor Author

Added the type tests and refactored the return type narrowing to infer the transaction type based on the whole request object rather than only the type key.

@jxom jxom force-pushed the fix/sign-transaction-return-type branch from a8d7cb4 to a5bc63b Compare October 13, 2024 22:35
@jxom jxom merged commit 840531e into wevm:main Oct 13, 2024
12 of 25 checks passed
@github-actions github-actions bot mentioned this pull request Oct 13, 2024
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.

2 participants