diff --git a/docs/base-account/framework-integrations/wagmi/other-use-cases.mdx b/docs/base-account/framework-integrations/wagmi/other-use-cases.mdx index 8b846103..bf57aab2 100644 --- a/docs/base-account/framework-integrations/wagmi/other-use-cases.mdx +++ b/docs/base-account/framework-integrations/wagmi/other-use-cases.mdx @@ -16,23 +16,26 @@ The key to accessing advanced Base Account functionality is getting the provider ```tsx Hook // hooks/useBaseAccountProvider.ts -import { useConnector, useAccount } from 'wagmi' +import { useConnections } from 'wagmi' import { useEffect, useState } from 'react' +import { EIP1193Provider } from 'viem' export function useBaseAccountProvider() { - const { isConnected } = useAccount() - const connector = useConnector() - const [provider, setProvider] = useState(null) + const connections = useConnections() + const [provider, setProvider] = useState(null) useEffect(() => { - if (isConnected && connector) { - // Access the Base Account provider - const baseAccountProvider = connector.provider - setProvider(baseAccountProvider) - } else { + const connection = connections[0] + + if (!connection) { setProvider(null) + return } - }, [isConnected, connector]) + + connection.connector.getProvider().then((provider) => { + setProvider(provider as EIP1193Provider) + }) + }, [connections]) return provider } @@ -104,3 +107,8 @@ Execute multiple transactions in a single user confirmation. Sponsor gas fees for your users. **Learn more:** [Gasless Transactions Guide](/base-account/improve-ux/sponsor-gas/paymaster) | [Coinbase Developer Platform Paymaster](https://docs.cdp.coinbase.com/paymaster/introduction/welcome) + +### Full list of provider methods and capabilities +Access the full list of Base Account provider methods and capabilities. + +**Learn more:** [Provider RPC Methods](/base-account/reference/core/provider-rpc-methods/request-overview) | [Capabilities](/base-account/reference/core/capabilities/overview) \ No newline at end of file