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: OnchainKitProvider default dependencies #1589

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

feat: OnchainKitProvider default dependencies #1589

wants to merge 10 commits into from

Conversation

0xAlec
Copy link
Contributor

@0xAlec 0xAlec commented Nov 6, 2024

What changed? Why?

  • add default WagmiProvider and QueryClientProvider if not provided in the React context

Notes to reviewers
please review the default WagmiProvider configuration settings 🙏

How has it been tested?
playground and unit test

Copy link

vercel bot commented Nov 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 Nov 19, 2024 7:59pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 7:59pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 7:59pm

coinbaseWallet({
appName,
appLogoUrl,
preference: 'smartWalletOnly',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we set this to all?

Copy link
Contributor

Choose a reason for hiding this comment

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

seems like it'd be a more flexible implementation, unless we just really want to push to smart wallet.

Copy link
Contributor

Choose a reason for hiding this comment

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

we need to add a second connector for EOA
coinbaseWallet({ appName: 'OnchainKit', preference: 'eoaOnly', }),

Comment on lines +27 to +34
[base.id]: apiKey
? http(`https://api.developer.coinbase.com/rpc/v1/base/${apiKey}`)
: http(),
[baseSepolia.id]: apiKey
? http(
`https://api.developer.coinbase.com/rpc/v1/base-sepolia/${apiKey}`,
)
: http(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

uses Base networks by default and sets the RPC as the CDP Node

</OnchainKitContext.Provider>
</QueryClientProvider>
</WagmiProvider>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

since Wagmi requires QueryClient, the only time 1 dep is missing should be when there is a QueryClient, but no Wagmi? Seems like an edge case, but would be possible to support this usecase, no? or, should we adjust the console.errors at least to only state using default if both don't exist and otherwise prompt the user to fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if 1 dep is missing, we shouldn't modify the default behavior and allow the app to display the typical error message instead

image

Copy link
Contributor Author

@0xAlec 0xAlec Nov 6, 2024

Choose a reason for hiding this comment

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

in my mind, if you provide 1 of the 2 deps then it should default to the same logic/behavior as before this PR which is Unhandled Runtime Error

expect(coinbaseWallet).toHaveBeenCalledWith({
appName: undefined,
appLogoUrl: undefined,
preference: 'smartWalletOnly',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this going to force the components to use smart wallet ? thinking this might be related to the issue i'm having where i'm unable to connect to EOA

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.

4 participants