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] Feature: Basic EIP7702 Support #5801

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

gregfromstl
Copy link
Member

@gregfromstl gregfromstl commented Dec 19, 2024

PR-Codex overview

This PR introduces beta support for EIP-7702 authorization lists, enhancing transaction capabilities in the thirdweb library. It includes new types, functions, and tests related to authorization signing and transaction preparation.

Detailed summary

  • Added style configuration in biome.json.
  • Introduced signAuthorization function for EIP-7702 in private-key.ts.
  • Updated prepareTransaction to accept authorizationList.
  • Implemented tests for signAuthorization and transaction serialization.
  • Modified transaction serialization to handle EIP-7702.
  • Enhanced gas estimation to support authorization signing.
  • Updated multiple files to integrate new authorization types and functions.

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

@gregfromstl gregfromstl requested review from a team as code owners December 19, 2024 01:46
Copy link

linear bot commented Dec 19, 2024

Copy link

changeset-bot bot commented Dec 19, 2024

🦋 Changeset detected

Latest commit: 429e112

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

This PR includes changesets to release 2 packages
Name Type
thirdweb Minor
@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 19, 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 7, 2025 5:27am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 7, 2025 5:27am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 7, 2025 5:27am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 7, 2025 5:27am

Copy link

graphite-app bot commented Dec 19, 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
Contributor

github-actions bot commented Dec 19, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 45.64 KB (+0.73% 🔺) 913 ms (+0.73% 🔺) 951 ms (+53.13% 🔺) 1.9 s
thirdweb (cjs) 115.44 KB (+0.56% 🔺) 2.4 s (+0.56% 🔺) 1.5 s (-0.85% 🔽) 3.8 s
thirdweb (minimal + tree-shaking) 5.58 KB (0%) 112 ms (0%) 77 ms (+32.89% 🔺) 188 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 55 ms (+247.93% 🔺) 65 ms
thirdweb/react (minimal + tree-shaking) 19.13 KB (0%) 383 ms (0%) 146 ms (-13.11% 🔽) 529 ms

from: options.from ? getAddress(options.from) : undefined,
from:
typeof options.from === "string" // Is this just an address?
? checksumAddress(options.from)
Copy link
Member

Choose a reason for hiding this comment

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

Getaddress is nice because it throws if invalid input, not sure if checksum does that

}): Promise<SignedAuthorization[]> {
const { authorizations, account } = options;

return Promise.all(
Copy link
Member

Choose a reason for hiding this comment

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

There's no way to sign multiple authorizations with one signature? Assume this will prompt multiple signatures right

resolvePromisedValue(options.transaction.to),
resolvePromisedValue(options.transaction.accessList),
resolvePromisedValue(options.transaction.value),
resolvePromisedValue(options.transaction.authorizations),
Copy link
Member

Choose a reason for hiding this comment

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

You don't need this right? Weird to have this and the one below

@@ -112,5 +128,50 @@ export async function toSerializableTransaction(
accessList,
value,
...feeData,
// For some reason authorizationList is not getting properly typed when returned from resolveAndSignAuthorizations?
Copy link
Member

Choose a reason for hiding this comment

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

Prob because of the comment above

async function resolveAndSignAuthorizations(
options: ToSerializableTransactionOptions,
): Promise<SignedAuthorization[] | undefined> {
if (typeof options.transaction.authorizations === "undefined") {
Copy link
Member

Choose a reason for hiding this comment

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

Don't you need to resolvePromise this first?

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 84.26966% with 14 lines in your changes missing coverage. Please review.

Project coverage is 55.43%. Comparing base (ddb6af1) to head (429e112).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...transaction/actions/to-serializable-transaction.ts 83.78% 6 Missing ⚠️
...b/src/transaction/actions/eip7702/authorization.ts 50.00% 5 Missing ⚠️
packages/thirdweb/src/adapters/ethers5.ts 0.00% 1 Missing ⚠️
...s/thirdweb/src/transaction/actions/estimate-gas.ts 95.23% 0 Missing and 1 partial ⚠️
.../thirdweb/src/transaction/serialize-transaction.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5801      +/-   ##
==========================================
+ Coverage   55.41%   55.43%   +0.01%     
==========================================
  Files        1123     1124       +1     
  Lines       59708    59758      +50     
  Branches     5066     5076      +10     
==========================================
+ Hits        33089    33128      +39     
- Misses      25895    25904       +9     
- Partials      724      726       +2     
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from ddb6af1
packages 53.15% <84.26%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
packages/thirdweb/src/gas/estimate-l1-fee.ts 100.00% <100.00%> (ø)
...irdweb/src/transaction/actions/send-transaction.ts 46.80% <100.00%> (ø)
...es/thirdweb/src/transaction/prepare-transaction.ts 100.00% <ø> (ø)
packages/thirdweb/src/wallets/private-key.ts 100.00% <100.00%> (ø)
packages/thirdweb/src/adapters/ethers5.ts 53.28% <0.00%> (ø)
...s/thirdweb/src/transaction/actions/estimate-gas.ts 75.64% <95.23%> (+2.91%) ⬆️
.../thirdweb/src/transaction/serialize-transaction.ts 88.78% <90.90%> (+1.28%) ⬆️
...b/src/transaction/actions/eip7702/authorization.ts 50.00% <50.00%> (ø)
...transaction/actions/to-serializable-transaction.ts 72.97% <83.78%> (-3.22%) ⬇️

... and 1 file with indirect coverage changes

Copy link
Member

@0xFirekeeper 0xFirekeeper left a comment

Choose a reason for hiding this comment

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

Beautiful

@gregfromstl gregfromstl added the merge-queue Adds the pull request to Graphite's merge queue. label Jan 7, 2025
Copy link
Member Author

gregfromstl commented Jan 7, 2025

Merge activity

  • Jan 6, 9:36 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 7, 12:18 AM EST: A user added this pull request to the Graphite merge queue.
  • Jan 7, 12:28 AM EST: A user merged this pull request with the Graphite merge queue.

<!-- start pr-codex -->

## PR-Codex overview
This PR introduces beta support for `EIP-7702` authorization lists, enhancing transaction handling and signing within the `thirdweb` library.

### Detailed summary
- Added `style` configuration in `biome.json`.
- Introduced `signAuthorization` function for EIP-7702 authorizations.
- Updated transaction preparation to include `authorizationList`.
- Added tests for `signAuthorization` and transaction serialization.
- Modified `serializeTransaction` to handle EIP-7702 transactions.
- Enhanced gas estimation and transaction preparation functions to support authorization lists.

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

Successfully merging this pull request may close these issues.

3 participants