Skip to content

useConnections ​

Composable for getting active connections.

Import ​

ts
import { useConnections } from 'wagmi'

Usage ​

vue
<script setup lang="ts">
import { useConnections } from 'wagmi'

const connections = useConnections()
</script>
ts
import { http, createConfig } from '@wagmi/vue'
import { mainnet, sepolia } from '@wagmi/vue/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})

Parameters ​

ts
import { type UseConnectionsParameters } from 'wagmi'

config ​

Config | undefined

Config to use instead of retrieving from the WagmiPlugin.

vue
<script setup lang="ts">
import { useConnections } from 'wagmi'
import { config } from './config'

const connections = useConnections({
  config, 
})
</script>
ts
import { http, createConfig } from '@wagmi/vue'
import { mainnet, sepolia } from '@wagmi/vue/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})

Return Type ​

ts
import { type UseConnectionsReturnType } from 'wagmi'

Action ​

Released under the MIT License.