-
Notifications
You must be signed in to change notification settings - Fork 196
feat: add createAlchemyConfig and AlchemyProvider #2125
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
base: moldy/v5-base
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🌿 Documentation Preview
|
...(apiKey ? [alchemyAuth({ apiKey })] : []), | ||
]; | ||
|
||
const wagmiConfig = createConfig({ |
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.
I ended up not implementing the wagmiOverrides
option in this PR. I wanted to get some opinions on it. I struggled getting the types to work for some reason, I kept getting a type error when doing a shallow copy into the params.
It got me thinking, I wonder if we should just try to expose options that we see fit (rather than a full wagmiOverrides
option. And if anyone needs a bunch of wagmi overrides, we just recommend they build the wagmi config themselves.
@@ -77,6 +77,64 @@ | |||
resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz#42cc67c5baa407ac25059fcd7d405cc5ecdb0c33" | |||
integrity sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg== | |||
|
|||
"@alchemy/aa-accounts@3.14.1": |
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.
do you need this many lockfile changes?
apiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY, | ||
}), | ||
], | ||
export const config = createAlchemyConfig({ |
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.
beautiful
export function AlchemyProvider({ config, children }: AlchemyProviderProps) { | ||
return ( | ||
<WagmiProvider config={config.wagmi}> | ||
{children as any} |
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.
curious why you have to cast to any
here. i think i've maybe seen this before when there were conflicts w/ different library versions?
return perChain; | ||
})(); | ||
|
||
// Note: Currently using alchemyAuth; swap to alchemySmartWallet when ready. |
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.
nit so we can more easily find this.
// Note: Currently using alchemyAuth; swap to alchemySmartWallet when ready. | |
// TODO(v5): Currently using alchemyAuth; swap to alchemySmartWallet when ready. |
|
||
const wagmiConfig = createConfig({ | ||
chains, | ||
transports: transports!, |
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.
nit: does typing transports
as NonNullable<CreateConfigParameters["transports"]>
above avoid this non-null assertion?
Pull Request Checklist
yarn test
)site
folder, and guidelines for updating/adding docs can be found in the contribution guide)feat!: breaking change
)yarn lint:check
) and fix any issues? (yarn lint:write
)PR-Codex overview
This PR introduces the
@alchemy/react
package, enhancing the Alchemy integration with React applications by providing a simplified configuration and a newAlchemyProvider
.Detailed summary
@alchemy/connectors-web
as a dependency.createAlchemyConfig
function for simplified configuration.AlchemyProvider
component to wrap necessary providers.WagmiProvider
withAlchemyProvider
.createAlchemyConfig
andAlchemyProvider
.