Skip to content

disconnect

Action for disconnecting connections.

Import

ts
import { disconnect } from '@wagmi/core'
import { disconnect } from '@wagmi/core'

Usage

ts
import { disconnect } from '@wagmi/core'
import { config } from './config'

await disconnect(config)
import { disconnect } from '@wagmi/core'
import { config } from './config'

await disconnect(config)
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

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

Parameters

ts
import { type DisconnectParameters } from '@wagmi/core'
import { type DisconnectParameters } from '@wagmi/core'

connector

Connector | undefined

Connector to disconnect with.

ts
import { disconnect, getAccount } from '@wagmi/core'
import { config } from './config'

const { connector } = getAccount(config)
const result = await disconnect(config, {
  connector, 
})
import { disconnect, getAccount } from '@wagmi/core'
import { config } from './config'

const { connector } = getAccount(config)
const result = await disconnect(config, {
  connector, 
})
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

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

Error

ts
import { type DisconnectErrorType } from '@wagmi/core'
import { type DisconnectErrorType } from '@wagmi/core'

TanStack Query

ts
import {
  type DisconnectData,
  type DisconnectVariables,
  type DisconnectMutate,
  type DisconnectMutateAsync,
  disconnectMutationOptions,
} from '@wagmi/core/query'
import {
  type DisconnectData,
  type DisconnectVariables,
  type DisconnectMutate,
  type DisconnectMutateAsync,
  disconnectMutationOptions,
} from '@wagmi/core/query'

Released under the MIT License.