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 currently published wallet from the Chrome Web Store, or obtain a V2 beta through the V2 release workflow:

  1. Download and unzip the V2 extension ZIP.
  2. Open chrome://extensions, enable Developer mode, and choose Load unpacked.
  3. Select the extracted extension directory.

V2 uses one extension with a global Mainnet/Testnet Mode in Developer Settings. Changing mode locks and reloads the wallet. The SDK's switchNetwork() method is deprecated and always throws; users select the mode in the wallet.

Install the SDK

pnpm add @noir-wallet/sdk@2.0.0 --save-exact

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)

available excludes pending funds but does not account for destination-specific fees. Use getMaxTransfer() after the recipient, memo, funding source, and fee tier are known; a different fee tier during approval can change the final maximum.

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. Keystone cannot send from transparent funds or shield them; Ledger supports both through hardware signing.

Next steps