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

[SDK] Refactor: More Viem to Ox migration #5790

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented Dec 18, 2024

TOOL-0000


PR-Codex overview

This PR focuses on migrating the maxUint256 functionality from viem to ox/Solidity across multiple files, enhancing the codebase's consistency and reliance on the ox library. It also updates workflows and introduces new tests for verifying smart account signatures.

Detailed summary

  • Migrated maxUint256 imports from viem to ox/Solidity in several files.
  • Updated GitHub Actions workflow to include ready_for_review and draft in pull request triggers.
  • Modified isErc6492Signature to use ox__Hex.slice.
  • Enhanced smart wallet signature verification tests.
  • Refactored various functions to utilize ox library components.

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

Copy link

vercel bot commented Dec 18, 2024

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

Name Status Preview Comments Updated (UTC)
docs-v2 ❌ Failed (Inspect) Jan 9, 2025 3:20am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 3:20am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 3:20am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 3:20am

Copy link

graphite-app bot commented Dec 18, 2024

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.

Copy link

changeset-bot bot commented Dec 18, 2024

🦋 Changeset detected

Latest commit: 505a026

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
Contributor

github-actions bot commented Dec 18, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 46.68 KB (+2.26% 🔺) 934 ms (+2.26% 🔺) 598 ms (+57.63% 🔺) 1.6 s
thirdweb (cjs) 116.72 KB (+1.12% 🔺) 2.4 s (+1.12% 🔺) 1.4 s (+11.34% 🔺) 3.8 s
thirdweb (minimal + tree-shaking) 5.59 KB (0%) 112 ms (0%) 232 ms (+178.98% 🔺) 344 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 13 ms (+32.4% 🔺) 23 ms
thirdweb/react (minimal + tree-shaking) 19.24 KB (+0.16% 🔺) 385 ms (+0.16% 🔺) 187 ms (+81.49% 🔺) 572 ms

@gregfromstl gregfromstl marked this pull request as ready for review December 18, 2024 10:37
@gregfromstl gregfromstl requested review from a team as code owners December 18, 2024 10:37
@gregfromstl gregfromstl changed the title [SDK] Refactor: Viem to Ox migration [SDK] Refactor: More Viem to Ox migration Dec 18, 2024
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 91.78082% with 6 lines in your changes missing coverage. Please review.

Project coverage is 54.83%. Comparing base (bfc4778) to head (505a026).

Files with missing lines Patch % Lines
packages/thirdweb/src/auth/verify-hash.ts 54.54% 5 Missing ⚠️
...ages/thirdweb/src/utils/abi/encodeAbiParameters.ts 92.85% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5790   +/-   ##
=======================================
  Coverage   54.82%   54.83%           
=======================================
  Files        1141     1141           
  Lines       60877    60901   +24     
  Branches     5124     5121    -3     
=======================================
+ Hits        33376    33393   +17     
- Misses      26775    26782    +7     
  Partials      726      726           
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from bfc4778
packages 52.47% <91.78%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
packages/thirdweb/src/auth/is-erc6492-signature.ts 100.00% <100.00%> (ø)
...kages/thirdweb/src/auth/parse-erc6492-signature.ts 100.00% <100.00%> (ø)
packages/thirdweb/src/auth/verify-signature.ts 95.71% <100.00%> (+0.40%) ⬆️
packages/thirdweb/src/auth/verify-typed-data.ts 100.00% <100.00%> (ø)
.../src/contract/deployment/utils/create-2-factory.ts 88.57% <100.00%> (ø)
...ges/thirdweb/src/extensions/ens/resolve-l2-name.ts 90.90% <100.00%> (+2.02%) ⬆️
...es/thirdweb/src/extensions/erc1155/read/getNFTs.ts 100.00% <100.00%> (ø)
...es/thirdweb/src/extensions/erc1155/write/mintTo.ts 100.00% <100.00%> (ø)
...irdweb/src/extensions/erc1155/write/mintToBatch.ts 93.10% <100.00%> (ø)
...s/thirdweb/src/extensions/erc1155/write/sigMint.ts 95.19% <ø> (ø)
... and 7 more

... and 2 files with indirect coverage changes

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground December 18, 2024 21:13 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 18, 2024 21:13 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui December 18, 2024 21:13 Inactive
@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Dec 18, 2024
@@ -304,7 +308,7 @@
dynamic,
encoded: dynamic
? encodeParams(preparedParams)
: concat(preparedParams.map(({ encoded }) => encoded)),
: ox__Hex.concat(...preparedParams.map(({ encoded }) => encoded)),
Copy link
Member

Choose a reason for hiding this comment

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

weird choice from ox to not accept an array for concat

@@ -134,6 +134,7 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
account: smartAccount,
});
expect(tx.transactionHash).toHaveLength(66);
await sleep(1000);
Copy link
Member

Choose a reason for hiding this comment

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

you can use 'confirmContractDeployment' here i think

Copy link
Member Author

gregfromstl commented Jan 9, 2025

Merge activity

  • Jan 8, 10:09 PM EST: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 8, 10:09 PM EST: A user added this pull request to the Graphite merge queue.
  • Jan 8, 10:16 PM EST: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'Vercel – docs-v2').

TOOL-0000

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on migrating functionality in the `thirdweb` package from `viem` to `ox`, improving consistency and possibly performance. It updates various files to utilize `ox` components, enhancing the codebase's integration with the `ox` library.

### Detailed summary
- Migrated `maxUint256` imports from `viem` to `ox/Solidity` in multiple files.
- Updated the `isErc6492Signature` function to use `ox__Hex.slice`.
- Changed `decodeAbiParameters` to `ox__AbiParameters.decode`.
- Replaced various utility functions with their `ox` equivalents across different modules.
- Enhanced the `verifyHash` function to utilize `ox__Signature`.
- Added new tests for `verifyContractWalletSignature` using `smartWallet`.
- Updated the workflow file to include new pull request types.

> ✨ 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
Dashboard Involves changes to the Dashboard. packages SDK Involves changes to the thirdweb SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants