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 7 commits into
base: main
Choose a base branch
from
Open

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 6, 2024 4:50pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 4:50pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 4:50pm

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.

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

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.

2 participants