Skip to content

Conversation

@ElasticBottle
Copy link
Contributor

@ElasticBottle ElasticBottle commented Nov 12, 2024

Problem solved

https://linear.app/thirdweb/issue/CNCT-2311/pro-cannot-sign-transaction-with-in-app-wallet


PR-Codex overview

This PR focuses on improving the transaction signing process in the thirdweb wallet by ensuring that the types of transaction parameters are properly checked before processing them.

Detailed summary

  • Updated handling of tx.value, tx.gas, tx.nonce, tx.maxPriorityFeePerGas, and tx.gasPrice to check their types before conversion to hex.
  • Ensured tx.maxFeePerGas and tx.gasPrice are set based on type checks.
  • Maintained logic for adding a 10% buffer to tx.gas.

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

@linear
Copy link

linear bot commented Nov 12, 2024

@vercel
Copy link

vercel bot commented Nov 12, 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 Nov 12, 2024 10:26pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 12, 2024 10:26pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 12, 2024 10:26pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 12, 2024 10:26pm

@changeset-bot
Copy link

changeset-bot bot commented Nov 12, 2024

🦋 Changeset detected

Latest commit: 6771cfe

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

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

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 12, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 44.15 KB (0%) 883 ms (0%) 775 ms (+43.31% 🔺) 1.7 s
thirdweb (cjs) 104.69 KB (0%) 2.1 s (0%) 1.4 s (+27.95% 🔺) 3.4 s
thirdweb (minimal + tree-shaking) 5.72 KB (0%) 115 ms (0%) 202 ms (+290.05% 🔺) 316 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 120 ms (+1463.64% 🔺) 130 ms
thirdweb/react (minimal + tree-shaking) 18.78 KB (0%) 376 ms (0%) 395 ms (+258.7% 🔺) 770 ms

@codecov
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.30%. Comparing base (ff188fd) to head (6771cfe).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5390      +/-   ##
==========================================
- Coverage   45.32%   45.30%   -0.03%     
==========================================
  Files        1067     1068       +1     
  Lines       55405    55433      +28     
  Branches     3999     4000       +1     
==========================================
+ Hits        25111    25112       +1     
- Misses      29607    29634      +27     
  Partials      687      687              
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from ff188fd
packages 40.32% <ø> (-0.03%) ⬇️

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

see 1 file with indirect coverage changes

@ElasticBottle ElasticBottle added the merge-queue Adds the pull request to Graphite's merge queue. label Nov 12, 2024
@ElasticBottle ElasticBottle enabled auto-merge (squash) November 12, 2024 14:38
Copy link
Contributor Author

ElasticBottle commented Nov 12, 2024

Merge activity

  • Nov 12, 9:38 AM EST: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Nov 12, 3:17 PM EST: A user added this pull request to the Graphite merge queue.
  • Nov 12, 3:39 PM EST: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'Vercel – thirdweb-www').
  • Nov 12, 5:11 PM EST: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Nov 12, 5:11 PM EST: A user added this pull request to the Graphite merge queue.
  • Nov 12, 5:27 PM EST: A user merged this pull request with the Graphite merge queue.

chainId: toHex(tx.chainId),
};

if (tx.maxFeePerGas) {
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we check the type here too?

nitpick: in general i prefer checking if value !== undefined rather than typeof bigint

## Problem solved

https://linear.app/thirdweb/issue/CNCT-2311/pro-cannot-sign-transaction-with-in-app-wallet

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving the transaction signing process in the `enclave-wallet` by ensuring proper type checks for various transaction properties, specifically handling cases for `bigint` and `number` types.

### Detailed summary
- Updated the handling of `tx.value`, `tx.gas`, `tx.nonce`, `tx.maxPriorityFeePerGas`, and `tx.gasPrice` to check their types before processing.
- Ensured that `tx.value`, `tx.gas`, and `tx.maxPriorityFeePerGas` are only processed if they are of type `bigint`.
- Adjusted the handling of `tx.nonce` to support both `number` and fallback to `eth_getTransactionCount`.
- Maintained a 10% buffer for `tx.gas` calculations.
- Updated the assignment of `transaction.maxFeePerGas` and `transaction.type` based on the presence of `tx.maxFeePerGas`.

> ✨ 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

merge-queue Adds the pull request to Graphite's merge queue. packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants