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: Transaction component - add calls support #1220

Merged
merged 39 commits into from
Sep 10, 2024
Merged

Conversation

0xAlec
Copy link
Contributor

@0xAlec 0xAlec commented Sep 6, 2024

What changed? Why?

  • add calls prop to Transaction
  • add calls vs contracts option to Transaction component in Playground
  • replace contracts with a transactions state in TransactionProvider that is set based on the provided props

New hooks

useSendWalletTransactions

  • This hook will return the correct Wagmi hook for sending a transaction to the wallet based on the appropriate wallet capabilities and provided arguments (useWriteContract, useWriteContracts, useSendCall, and useSendCalls)

useTransactionType

  • This hook will return a single transaction status based on the wallet capabilities and provided arguments (calls or contracts)

Notes to reviewers

How has it been tested?
In Playground with calls and contracts options

example userop with batched calls - https://base.blockscout.com/op/0xa1a33c1f8466a40350ee8558da4f3cfbd0762bbd77f56cd85c91c81669cacdb7

Copy link

vercel bot commented Sep 6, 2024

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

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 9, 2024 3:36pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 9, 2024 3:36pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 9, 2024 3:36pm

if (!transactions) {
return;
}
if (walletCapabilities.hasAtomicBatch) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this use batchedTransactions even only one transaction?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep - batch of 1 is valid as well

Copy link
Contributor

@Zizzamia Zizzamia left a comment

Choose a reason for hiding this comment

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

Masterpiece!

Love the way you are growing into a Michelin Star chef.

Copy link
Contributor

@abcrane123 abcrane123 left a comment

Choose a reason for hiding this comment

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

amazing

@0xAlec 0xAlec merged commit 8c6b4e3 into main Sep 10, 2024
16 checks passed
@0xAlec 0xAlec deleted the alec/calls-support branch September 10, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants