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

initial smart wallet example setup #39

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

hone1er
Copy link
Contributor

@hone1er hone1er commented May 1, 2024

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

Screenshot 2024-05-01 at 8 51 06 PM

Copy link

vercel bot commented May 1, 2024

@hone1er is attempting to deploy a commit to the useWeb3 Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

socket-security bot commented May 1, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@coinbase/wallet-sdk@4.0.0-beta.12 network +4 483 kB cb-felix-z
npm/@nomicfoundation/hardhat-viem@2.0.1 filesystem +1 1.28 MB kanej
npm/eslint-config-next@14.1.4 unsafe Transitive: environment, filesystem +61 11.8 MB vercel-release-bot
npm/eslint-config-prettier@9.1.0 None 0 20.8 kB lydell
npm/eslint-plugin-prettier@5.1.3 None 0 33.9 kB jounqin

🚮 Removed packages: npm/@emotion/babel-plugin@11.11.0, npm/@emotion/cache@11.11.0, npm/@emotion/is-prop-valid@1.2.2, npm/@emotion/react@11.11.4, npm/@emotion/serialize@1.1.4, npm/@emotion/styled@11.11.5, npm/@eslint/eslintrc@3.0.2, npm/@eslint/js@9.1.1, npm/@humanwhocodes/config-array@0.13.0, npm/@metamask/object-multiplex@1.3.0, npm/@metamask/post-message-stream@6.2.0, npm/@metamask/providers@10.2.1, npm/@metamask/sdk-communication-layer@0.14.3, npm/@metamask/sdk-install-modal-web@0.14.1, npm/@metamask/sdk@0.14.3, npm/@nomicfoundation/edr-darwin-arm64@0.3.4, npm/@nomicfoundation/edr-darwin-x64@0.3.4, npm/@nomicfoundation/edr-linux-arm64-gnu@0.3.4, npm/@nomicfoundation/edr-linux-arm64-musl@0.3.4, npm/@nomicfoundation/edr-linux-x64-gnu@0.3.4, npm/@nomicfoundation/edr-linux-x64-musl@0.3.4, npm/@nomicfoundation/edr-win32-arm64-msvc@0.3.4, npm/@nomicfoundation/edr-win32-ia32-msvc@0.3.4, npm/@nomicfoundation/edr-win32-x64-msvc@0.3.4, npm/@nomicfoundation/edr@0.3.4, npm/@nomicfoundation/hardhat-viem@2.0.0, npm/@types/qs@6.9.15, npm/@wagmi/connectors@4.1.25, npm/dayjs@1.11.11

View full report↗︎

Copy link

socket-security bot commented May 1, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSource
Install scripts npm/esbuild@0.19.12

View full report↗︎

Next steps

What 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 dependency

Take 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 package

If 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 risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

  • @SocketSecurity ignore npm/esbuild@0.19.12

import { useState } from 'react'

export function useSWWriteContracts() {
const { data: walletClient } = useEIP5792WalletClient()
Copy link

Choose a reason for hiding this comment

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

Suggested change
const { data: walletClient } = useEIP5792WalletClient()
const { data: walletClient } = useWalletClient()

Comment on lines 14 to 15
walletClient
.writeContracts({
Copy link

Choose a reason for hiding this comment

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

Suggested change
walletClient
.writeContracts({
writeContracts(walletClient, {

Can use tree-shakable actions instead. Needs an import { writeContracts } from 'viem/experimental'.

Comment on lines 12 to 13
walletClient
.getCapabilities()
Copy link

Choose a reason for hiding this comment

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

Same suggestion as above.

Copy link
Contributor Author

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.

Copy link

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

Copy link
Contributor Author

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 😊

@wslyvh
Copy link
Owner

wslyvh commented May 7, 2024

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.
My thinking so far is that example/pages should demonstrate basic functionalities (send ether, transfer tokens, etc.) without requiring custom configurations, etc.

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?

@hone1er
Copy link
Contributor Author

hone1er commented May 9, 2024

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. My thinking so far is that example/pages should demonstrate basic functionalities (send ether, transfer tokens, etc.) without requiring custom configurations, etc.

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.

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.

None yet

3 participants