iWallet Connector
iwallet() uses window.IWalletJS by default and is compatible with iost-iwallet-pro request methods:
connectdisconnectaccountschainId(preferred)network(fallback)signMessagesendTransactioncallContract
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.