Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

iWallet Connector

iwallet() uses window.IWalletJS by default and is compatible with iost-iwallet-pro request methods:

  • connect
  • disconnect
  • accounts
  • chainId (preferred)
  • network (fallback)
  • signMessage
  • sendTransaction
  • callContract

The extension injects window.IWalletJS asynchronously. After the provider is attached it dispatches IWalletJS#initialized on window. The connector waits for that event (with a short polling fallback) during setup(), connect(), and reconnect().

import {
  IWALLET_INITIALIZED_EVENT,
  getIWalletProvider,
  watchIWalletProvider,
  waitForIWalletProvider,
} from '@ivem/kit'
 
getIWalletProvider()
await waitForIWalletProvider()
watchIWalletProvider((provider) => {
  console.log(Boolean(provider))
})
 
window.addEventListener(IWALLET_INITIALIZED_EVENT, () => {
  console.log('iWallet Pro is ready')
})

Custom Provider Injection

import { iwallet } from '@ivem/kit'
 
const connector = iwallet({
  getProvider: () => window.IWalletJS,
})

This is useful for tests or multi-provider injection environments.