Provider API

Typed reference for Noir Wallet's Zcash API and EVM network requests.

The Zcash methods below are available on wallet.zcash. Detecting the provider does not connect an account or open the wallet. EVM network requests are covered at the end of this guide.

import { getNoirWallet } from '@noir-wallet/sdk'

const wallet = getNoirWallet()
if (!wallet) throw new Error('Noir Wallet is not installed')

Call getAccounts() silently during startup. Only call connect() after a deliberate user action.

Account and balance methods

Account reads do not open approval windows. connect() is the exception: it always lets the user review the accounts shared with your site.

Transactions

Transaction methods operate on the active authorized account. Sending and shielding always require the user to approve the action in Noir Wallet.

Identity methods

The default signing mode is current. Use derived for a privacy-preserving identity that is not the main transparent address. legacy_index0 exists for integrations that require the legacy BIP-44 index 0 identity.

Identity methods are not supported for Keystone or Ledger accounts. Their Zcash flows sign supported transactions, not arbitrary messages.

Connection lifecycle

Errors and advanced usage

EVM network requests

When multiple EVM wallets are installed, users can select Ask every time, Use Noir Wallet, or Use another wallet under Settings > Default EVM Wallet. The initial preference is Ask every time. This preference controls Noir's legacy window.ethereum routing after the site reloads. Explicit EIP-6963 selections and window.noirwallet.ethereum always refer directly to Noir. Wallet choices use EIP-6963 metadata and wallet-specific namespaces; isMetaMask alone is a compatibility flag, not a wallet identity. An unidentified legacy provider is offered only when no named alternative is discoverable. If another extension has locked the legacy entry, use EIP-6963 or a separate browser profile. A wallet choice does not connect an account or approve a request; the selected wallet still handles its own permissions.

The EVM provider supports wallet_addEthereumChain and wallet_switchEthereumChain in the wallet's active Mainnet/Testnet Mode. The SDK exposes addEvmNetwork(provider, network) and switchEvmChain(provider, chainId) for these requests.

import { addEvmNetwork, detectEvmProvider, switchEvmChain } from '@noir-wallet/sdk'

const provider = await detectEvmProvider()
await addEvmNetwork(provider, {
  chainId: '0x7a69',
  chainName: 'My EVM Chain',
  nativeCurrency: { name: 'My Ether', symbol: 'METH', decimals: 18 },
  rpcUrls: ['https://rpc.my-chain.example']
})
await switchEvmChain(provider, '0x7a69')

Adding an unknown chain opens a wallet approval with its chain ID, name, native currency, selected RPC URL, and optional explorer URL. The wallet verifies that the RPC reports the requested chain ID before saving it. The first supported HTTP endpoint in rpcUrls is selected; secure WebSocket alternatives are skipped. HTTPS is required except for local development endpoints. Adding an already configured chain leaves its settings unchanged. Adding a network does not make it active; request a separate switch when needed. A switch to an unconfigured chain rejects with code 4902, and a rejected approval returns 4001. Built-in chains in the other global network mode cannot be added. EVM network selection is independent for each connected site. Switching to a network already approved for that site does not prompt again; a new network permission requires confirmation. Switching cancels that site's pending chain-specific requests and emits chainChanged to that site.

For eth_requestAccounts, closing the wallet's unlock window cancels the request with 4001. An eth_sendTransaction request with insufficient funds returns -32000 before opening transaction approval; the error identifies insufficient funds for the transaction and network fee.

For a connected Private EVM account, ordinary transfers default to a direct on-chain transfer. The user can select Send privately in wallet approval for a supported transfer. This route keeps the requested recipient amount fixed and charges route costs and gas to the sender. It returns the destination transaction hash after settlement, so the request can take longer than a direct transfer. The destination transaction is not sent from the connected Private address; do not use its sender as proof of the connected account's identity. Contract calls remain direct. After a processing timeout, check Wallet Activity before requesting another payment.

For Chainlist compatibility, wallet_addEthereumChain also accepts an optional account address as the second positional parameter. This hint is ignored and never grants account permissions. wallet_switchEthereumChain still accepts exactly one chain parameter.

Wallet token metadata

With an established wallet.multichain session, getTokenList() returns the current unlocked account's visible tokens on authorized chains. Each entry contains assetId, chainId, contractAddress (null for native assets), symbol, decimals, and enabled. The response contains no balances or private-account holdings. Re-read it after wallet_sessionChanged and after returning from Token Manager. An unauthorized current account or a context change during the request rejects with 4100.

Call wallet.multichain.openTokenManager() from a user action to open the existing wallet management page; it resolves to null. These methods are also available through request() as wallet_getTokenList and wallet_openTokenManager, without parameters. Older providers may not support them; feature-detect the convenience methods before rendering the action.