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: add support for wallet_sendTransaction fallback #2875

Merged
merged 8 commits into from
Oct 17, 2024
Merged

Conversation

jxom
Copy link
Member

@jxom jxom commented Oct 16, 2024

Adds support for falling back to wallet_sendTransaction if eth_sendTransaction fails.


PR-Codex overview

This PR introduces support for the wallet_sendTransaction method, allowing transactions to be sent through wallets. It also updates type definitions to accommodate null accounts and adjusts related tests to ensure compatibility.

Detailed summary

  • Added support for wallet_sendTransaction in various functions.
  • Updated type definitions to allow account to be null.
  • Modified transaction methods to handle null accounts.
  • Enhanced tests for sending transactions with null accounts.
  • Adjusted error handling for unsupported methods.

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

Copy link

changeset-bot bot commented Oct 16, 2024

🦋 Changeset detected

Latest commit: 2d4ea49

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 Oct 16, 2024

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

Name Status Preview Updated (UTC)
viem ✅ Ready (Inspect) Visit Preview Oct 17, 2024 0:07am

@jxom jxom changed the title feat: add support for wallet_sendTransaction feat: add support for wallet_sendTransaction fallback Oct 16, 2024
Copy link
Contributor

github-actions bot commented Oct 16, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
import * from 'viem' (esm) 61.73 KB (-0.02% 🔽) 1.3 s (-0.02% 🔽) 9.5 s (-44.36% 🔽) 10.7 s
const viem = require('viem') (cjs) 72.03 KB (+0.12% 🔺) 1.5 s (+0.12% 🔺) 23.3 s (+39.14% 🔺) 24.7 s
import { createClient, http } from 'viem' 6.31 KB (0%) 127 ms (0%) 521 ms (-71.37% 🔽) 647 ms
import * from 'viem/account-abstraction' 45.04 KB (0%) 901 ms (0%) 5.1 s (-69.06% 🔽) 6 s
import { toCoinbaseSmartAccount } from 'viem/account-abstraction' 35.03 KB (0%) 701 ms (0%) 7.7 s (+15.65% 🔺) 8.4 s
import * from 'viem/accounts' 80.81 KB (0%) 1.7 s (0%) 5.3 s (-8.64% 🔽) 6.9 s
import { privateKeyToAccount } from 'viem/accounts' 20.18 KB (0%) 404 ms (0%) 4.1 s (+13.23% 🔺) 4.5 s
import { mnemonicToAccount } from 'viem/accounts' 25.79 KB (0%) 516 ms (0%) 5.9 s (-29.14% 🔽) 6.4 s
import * from 'viem/actions' 46.96 KB (+0.22% 🔺) 940 ms (+0.22% 🔺) 16.4 s (-13.9% 🔽) 17.3 s
import { getBlockNumber } from 'viem/actions' 318 B (0%) 10 ms (0%) 87 ms (-13.05% 🔽) 97 ms
import * from 'viem/chains' 39.97 KB (0%) 800 ms (0%) 10 s (-43.16% 🔽) 10.8 s
import { mainnet } from 'viem/chains' 324 B (0%) 10 ms (0%) 44 ms (-84.99% 🔽) 54 ms
import * from 'viem/chains/utils' 1.08 KB (0%) 22 ms (0%) 67 ms (-60.49% 🔽) 89 ms
import * from 'viem/ens' 45.88 KB (0%) 918 ms (0%) 10.1 s (+18.34% 🔺) 11.1 s
import { getEnsAvatar } from 'viem/ens' 22.17 KB (0%) 444 ms (0%) 4.8 s (-42.2% 🔽) 5.3 s
import * from 'viem/siwe' 31.09 KB (-0.12% 🔽) 622 ms (-0.12% 🔽) 7.5 s (+12.87% 🔺) 8.1 s
import { verifySiweMessage } from 'viem/siwe' 30.1 KB (0%) 603 ms (0%) 9.8 s (+35.26% 🔺) 10.4 s

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.63%. Comparing base (5c9ed2f) to head (2d4ea49).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2875      +/-   ##
==========================================
- Coverage   99.65%   99.63%   -0.02%     
==========================================
  Files         855      858       +3     
  Lines       72760    72853      +93     
  Branches     3231     3238       +7     
==========================================
+ Hits        72507    72587      +80     
- Misses        237      248      +11     
- Partials       16       18       +2     

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

@jxom jxom merged commit fc9b81c into main Oct 17, 2024
26 of 37 checks passed
@jxom jxom deleted the jxom/wallet-send-tx branch October 17, 2024 00:04
@github-actions github-actions bot mentioned this pull request Oct 17, 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