Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions docs/base-account/framework-integrations/wagmi/other-use-cases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,26 @@ The key to accessing advanced Base Account functionality is getting the provider
<CodeGroup>
```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<any>(null)
const connections = useConnections()
const [provider, setProvider] = useState<EIP1193Provider | null>(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
}
Expand Down Expand Up @@ -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)