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

feat: prepareAuthorization #3062

Merged
merged 4 commits into from
Nov 26, 2024
Merged

feat: prepareAuthorization #3062

merged 4 commits into from
Nov 26, 2024

Conversation

jxom
Copy link
Member

@jxom jxom commented Nov 26, 2024

Splits the "prepare" phase of signAuthorization into a separate Action. This will be useful for use-cases where we want to provide a consumer with a "prepared" Authorization object to sign over (similar to prepareTransactionRequest).


PR-Codex overview

This PR introduces prepareAuthorization, an experimental function for preparing EIP-7702 Authorization objects for signing. It enhances the eip7702Actions by adding this functionality, updates tests, and modifies documentation to reflect these changes.

Detailed summary

  • Added prepareAuthorization function for EIP-7702 Authorization.
  • Updated eip7702Actions to include prepareAuthorization.
  • Modified tests to cover various scenarios for prepareAuthorization.
  • Updated documentation for prepareAuthorization with examples and parameters.
  • Enhanced signAuthorization to utilize prepareAuthorization.

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

Copy link

changeset-bot bot commented Nov 26, 2024

🦋 Changeset detected

Latest commit: 5e4a2c5

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

Copy link

vercel bot commented Nov 26, 2024

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

Name Status Preview Updated (UTC)
viem ✅ Ready (Inspect) Visit Preview Nov 26, 2024 6:25am

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 99.52153% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.64%. Comparing base (2498543) to head (5e4a2c5).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/experimental/eip7702/decorators/eip7702.ts 98.11% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3062    +/-   ##
========================================
  Coverage   99.64%   99.64%            
========================================
  Files         867      869     +2     
  Lines       70806    70977   +171     
  Branches     3128     3130     +2     
========================================
+ Hits        70556    70727   +171     
+ Misses        234      233     -1     
- Partials       16       17     +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Nov 26, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
import * from 'viem' (esm) 62.21 KB (0%) 1.3 s (0%) 2 s (+57.83% 🔺) 3.2 s
const viem = require('viem') (cjs) 72.4 KB (0%) 1.5 s (0%) 2.3 s (-31.79% 🔽) 3.7 s
import { createClient, http } from 'viem' 6.3 KB (0%) 127 ms (0%) 238 ms (+180.37% 🔺) 365 ms
import * from 'viem/account-abstraction' 45.37 KB (0%) 908 ms (0%) 1.5 s (+47.55% 🔺) 2.4 s
import { toCoinbaseSmartAccount } from 'viem/account-abstraction' 35.25 KB (0%) 706 ms (0%) 1.5 s (+71.67% 🔺) 2.2 s
import * from 'viem/accounts' 81.25 KB (0%) 1.7 s (0%) 496 ms (-65.9% 🔽) 2.2 s
import { privateKeyToAccount } from 'viem/accounts' 20.35 KB (0%) 408 ms (0%) 663 ms (+26.56% 🔺) 1.1 s
import { mnemonicToAccount } from 'viem/accounts' 26.05 KB (0%) 522 ms (0%) 242 ms (-79.16% 🔽) 763 ms
import * from 'viem/actions' 47.21 KB (0%) 945 ms (0%) 2 s (+31.14% 🔺) 2.9 s
import { getBlockNumber } from 'viem/actions' 318 B (0%) 10 ms (0%) 8 ms (-51.6% 🔽) 18 ms
import * from 'viem/chains' 39.7 KB (0%) 795 ms (0%) 1.5 s (-15.55% 🔽) 2.3 s
import { mainnet } from 'viem/chains' 324 B (0%) 10 ms (0%) 125 ms (+2406.42% 🔺) 135 ms
import * from 'viem/chains/utils' 1.09 KB (0%) 22 ms (0%) 40 ms (+490.8% 🔺) 62 ms
import * from 'viem/ens' 47.12 KB (0%) 943 ms (0%) 1.3 s (+94.07% 🔺) 2.2 s
import { getEnsAvatar } from 'viem/ens' 22.2 KB (0%) 444 ms (0%) 759 ms (+82.72% 🔺) 1.3 s
import * from 'viem/siwe' 31.14 KB (0%) 623 ms (0%) 1.5 s (+3.24% 🔺) 2.1 s
import { verifySiweMessage } from 'viem/siwe' 30.13 KB (0%) 603 ms (0%) 1.4 s (+65.78% 🔺) 2 s

@jxom jxom merged commit 5ab60e3 into main Nov 26, 2024
21 of 22 checks passed
@jxom jxom deleted the prepare-authorization branch November 26, 2024 06:03
@github-actions github-actions bot mentioned this pull request Nov 26, 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.

1 participant