-
Notifications
You must be signed in to change notification settings - Fork 134
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
initial smart wallet example setup #39
base: main
Are you sure you want to change the base?
Conversation
@hone1er is attempting to deploy a commit to the useWeb3 Team on Vercel. A member of the Team first needs to authorize it. |
🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎ To accept the risk, merge this PR and you will not be notified again.
Next stepsWhat is an install script?Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts. Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead. Take a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with
|
import { useState } from 'react' | ||
|
||
export function useSWWriteContracts() { | ||
const { data: walletClient } = useEIP5792WalletClient() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { data: walletClient } = useEIP5792WalletClient() | |
const { data: walletClient } = useWalletClient() |
walletClient | ||
.writeContracts({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
walletClient | |
.writeContracts({ | |
writeContracts(walletClient, { |
Can use tree-shakable actions instead. Needs an import { writeContracts } from 'viem/experimental'
.
walletClient | ||
.getCapabilities() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same suggestion as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yoo thank you so much for taking a look! Implementing your suggestions now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do this in wagmi from 2.8.0
(it's building now): https://wagmi.sh/react/api/hooks/useCapabilities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was fast! lol I will update to use the wagmi hook 😊
This is great! Love it I wonder a little bit if we should add it as an example page or as a more detailed, full example implementation. More detailed examples like this, which require different packages/configuration/etc. might be easier to maintain as fork or branch. There are a couple of other branches as examples (e.g. ethers instead of viem, using signature-recovery,etc.). We should probably keep a list of active examples on the readme so its easier to find tho. In this case, I think you could replace the default connect/sign in flow, include a simple contract, NFT minting and provide the full E2E example and functionalities of smart wallets. What do you think? |
Sounds good to me! I'll get working on this soon. I was actually thinking the smart contract example should have a lot more documentation to it so i think breaking it out into it's own branch and getting more detailed is a great idea. |
Opening as a draft to get feedback
but this should be a working example of coinbase smart wallet integration
Screen.Recording.2024-05-01.at.12.45.57.PM.mov
Screen.Recording.2024-05-01.at.12.49.31.PM.mov
Screen.Recording.2024-05-01.at.1.09.27.PM.mov
Removed the Coinbase connector specific connect and disconnect buttons in favor of telling the user to use the coinbase wallet in web3Modal and added links to smart wallet repo and docs