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 currently published wallet from the Chrome Web Store, or obtain a V2 beta through the V2 release workflow:
chrome://extensions, enable Developer mode, and choose Load unpacked.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.
pnpm add @noir-wallet/sdk@2.0.0 --save-exactCall getNoirWallet() in the browser. wallet.zcash.connect() opens the wallet authorization flow, so invoke it from a deliberate button click.
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.
Use getAccounts() during application startup. It does not open the wallet and returns null when the origin is not connected.
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
}
}
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.
Call wallet.zcash.sendTransaction(). The destination property is to, and amounts are decimal
ZEC strings.
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.