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

FR: Dont wrap wagmi viem, integrate underneath like @coinbase/onchain-kit #1142

Open
polus-arcticus opened this issue Nov 11, 2024 · 2 comments

Comments

@polus-arcticus
Copy link

polus-arcticus commented Nov 11, 2024

Integrating this package into an existing react app is quite burdensome, as now i have to import the exact same function names but with alchemy's sdk, it'd be far nicer if there i didnt have to make a separate config and stick if statements in every compontent if alchemy or if not.

thanks!

@moldy530
Copy link
Collaborator

Can you explain a bit more? What are some expected APIs you'd expect here?

@polus-arcticus
Copy link
Author

Hi @moldy530 thanks for taking a look at this issue, sure thing.

Let one consider an existing dapp who built upon the viem/wagmi stack.
https://accountkit.alchemy.com/react/quickstart#existing-project
under
https://accountkit.alchemy.com/react/quickstart#3b-customize-authentication-methods

one finds

import { createConfig, cookieStorage } from "@account-kit/react";

in fact one realizes that the aa-sdk mirrors nearly 1-to-1 with the wagmi api

https://wagmi.sh/react/getting-started#create-config

import { http, createConfig } from 'wagmi'

It is not immediately apparent, or desirable for code liability to change all wagmi imports to aa-sdk imports.

Now one finds they have to duplicate all methods, such as

https://wagmi.sh/react/api/hooks/useAccount
https://accountkit.alchemy.com/reference/account-kit/react/hooks/useAccount

import { useAccount } from 'wagmi'
import { useAccount as useAlchemyAAAcount} from '@account-kit/react'
function App() {
 const acount = useAccount()
 const alchemyAccount = useAlchemyAAAcount()
}

and than write a bunch of conditional logic based on how the user injected thier web3 with the dapp

now, what one finds that, with the coinbase onchain kit
https://onchainkit.xyz/installation/vite

that they dont wrap around wagmi, but integrate within it.
This is much more desirable for maintainability and future compatibility

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

No branches or pull requests

2 participants