Skip to content

injected

Connector for EIP-1193 Ethereum Providers.

Import

ts
import { injected } from '@wagmi/vue/connectors'

Usage

ts
import { createConfig, http } from '@wagmi/vue'
import { mainnet, sepolia } from '@wagmi/vue/chains'
import { injected } from '@wagmi/vue/connectors'

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

Parameters

ts
import { type InjectedParameters } from '@wagmi/vue/connectors'

shimDisconnect

boolean | undefined

  • MetaMask and other injected providers do not support programmatic disconnect.
  • This flag simulates the disconnect behavior by keeping track of connection status in storage. See GitHub issue for more info.
  • Defaults to true.
ts
import { injected } from '@wagmi/vue/connectors'

const connector = injected({
  shimDisconnect: false, 
})

target

TargetId | (TargetMap[TargetId] & { id: string }) | (() => (TargetMap[TargetId] & { id: string }) | undefined) | undefined

ts
import { injected } from '@wagmi/vue/connectors'

const connector = injected({
  target() { 
    return { 
      id: 'windowProvider', 
      name: 'Window Provider', 
      provider: window.ethereum, 
    } 
  }, 
})

unstable_shimAsyncInject

boolean | number | undefined

Watches for async provider injection via the ethereum#initialized event. When true, defaults to 1_000 milliseconds. Otherwise, uses a provided value of milliseconds.

ts
import { injected } from '@wagmi/vue/connectors'

const connector = injected({
  unstable_shimAsyncInject: 2_000, 
})

Released under the MIT License.