Skip to main content

Connecting wallet

Passport is a valid EIP-1193 provider with support for all major RPC methods.

To create an EIP-1193 Passport provider:

const passportProvider = passport.connectEvm();

Once a provider is created, you can call various methods on it via the request function (which is protocol-agnostic), for example:

const accounts = await provider.request({ method: "eth_requestAccounts" });

Provider Events

As per the EIP-1193 specification, the zkEVM provider exposes an on and removeListener function, which can be used to subscribe to and unsubscribe from events emitted by the zkEVM provider:

export type Provider = {
on: (event: string, listener: (...args: any[]) => void) => void;
removeListener: (event: string, listener: (...args: any[]) => void) => void;

Supported Events

Accounts Changed

The zkEVM provider will emit an accountsChanged event when the accounts available to the provider changes (for example, when eth_requestAccounts is called and the users wallet is initialised):

provider.on(ProviderEvent.ACCOUNTS_CHANGED, (accounts: string[]) => {
console.log(accounts); // ['0x...']

IMX Whitepaper IMX Tokenomics Block Explorer Careers Contact Us