Noir Wallet SDK integration

Install the TypeScript SDK, detect Noir Wallet, request account access, read balances, and send ZEC.

The SDK is a typed wrapper around the Noir Wallet provider injected into web pages. This guide reflects the current package exports and request types.

Install the extension

Install the production extension from the official Chrome Web Store. Use this build only with real ZEC.

Use only official testnet packages

Do not install ZIP files shared through messages or third-party mirrors. A mainnet asset does not contain -testnet in its filename.

Mainnet and testnet use different extension IDs and isolated wallet data. switchNetwork() is deprecated and always throws; install the appropriate extension build instead.

Install the SDK

pnpm add @noir-wallet/sdk

Connect from a user action

Call getNoirWallet() in the browser. wallet.zcash.connect() opens the wallet authorization flow, so invoke it from a deliberate button click.

sdk-quick-start.ts
import { getNoirWallet } from '@noir-wallet/sdk'

export async function connectNoirWallet() {
  const wallet = getNoirWallet()
  if (!wallet) {
    throw new Error('Install Noir Wallet to continue')
  }

  const connection = await wallet.zcash.connect()

  return {
    wallet,
    primaryShieldedAddress: connection.shielded,
    authorizedAccounts: connection.accounts
  }
}

connect() returns the primary account's top-level transparent and shielded addresses. Its accounts array contains every account the user authorized for read access.

Check an existing connection silently

Use getAccounts() during application startup. It does not open the wallet and returns null when the origin is not connected.

silent-connection.ts
import { getNoirWallet } from '@noir-wallet/sdk'

export async function getExistingConnection() {
  const wallet = getNoirWallet()
  if (!wallet) return null

  const connection = await wallet.zcash.getAccounts()
  if (!connection) return null

  return {
    primaryAccount: {
      transparent: connection.transparent,
      shielded: connection.shielded
    },
    accounts: connection.accounts
  }
}

Read balances

const balance = await wallet.zcash.getBalance()

console.log(balance.available)
console.log(balance.shielded)
console.log(balance.accounts)

total includes pending funds. available and spendable exclude pending funds but do not account for destination-specific fees. Use getMaxTransfer() for the exact send limit after the recipient, memo, funding source, and fee tier are known.

Send a transaction

Call wallet.zcash.sendTransaction(). The destination property is to, and amounts are decimal ZEC strings.

send-transaction.ts
import { getNoirWallet } from '@noir-wallet/sdk'

const wallet = getNoirWallet()
if (!wallet) {
  throw new Error('Install Noir Wallet to continue')
}

const txid = await wallet.zcash.sendTransaction({
  to: 'u1...',
  amount: '0.25',
  fundingSource: 'shielded'
})

console.log(txid)

fundingSource: "transparent" exposes and may link the selected transparent UTXOs. Prefer shielded funding when the workflow supports it.

Next steps