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

Merged
merged 18 commits into from
Jan 14, 2025
Merged

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

merged 18 commits into from
Jan 14, 2025

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented Dec 18, 2024

TOOL-0000


PR-Codex overview

This PR focuses on migrating functionality to Ox by replacing imports from viem with ox in various files within the thirdweb package, enhancing consistency and potentially optimizing performance.

Detailed summary

  • Migrated maxUint256 import from viem to ox/Solidity in multiple files.
  • Updated isErc6492Signature function to use ox__Hex.slice.
  • Replaced decodeAbiParameters with ox__AbiParameters.decode.
  • Modified verifyEOASignature to use ox__Secp256k1.recoverAddress.
  • Adjusted signature verification functions to utilize ox__Signature.
  • Enhanced fetchConstructorParams to use ox__Abi and ox__AbiParameters.
  • Updated various utility functions to leverage ox libraries for consistency.

The following files were skipped due to too many changes: pnpm-lock.yaml

✨ 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 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:46pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:46pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:46pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 5:46pm

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: 00d6f3a

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% 🔺) 786 ms (+10.24% 🔺) 1.8 s
thirdweb (cjs) 116.72 KB (+1.12% 🔺) 2.4 s (+1.12% 🔺) 1.8 s (+17.23% 🔺) 4.2 s
thirdweb (minimal + tree-shaking) 5.59 KB (0%) 112 ms (0%) 162 ms (+166.44% 🔺) 274 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 43 ms (+61.11% 🔺) 53 ms
thirdweb/react (minimal + tree-shaking) 19.24 KB (+0.16% 🔺) 385 ms (+0.16% 🔺) 187 ms (+13.71% 🔺) 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 (23d8001) to head (00d6f3a).
Report is 1 commits behind head on main.

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.85%   54.83%   -0.03%     
==========================================
  Files        1142     1142              
  Lines       60928    60952      +24     
  Branches     5140     5138       -2     
==========================================
- Hits        33424    33422       -2     
- Misses      26777    26806      +29     
+ Partials      727      724       -3     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 23d8001
packages 52.47% <91.78%> (-0.03%) ⬇️

*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 7 files with indirect coverage changes

@@ -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 -->
@vercel vercel bot temporarily deployed to Preview – docs-v2 January 14, 2025 17:34 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www January 14, 2025 17:34 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui January 14, 2025 17:34 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground January 14, 2025 17:34 Inactive
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