一键导入
aztec-wallet-sdk
// Use this skill when integrating Aztec wallet connectivity with @aztec/wallet-sdk, including discovery/session flows, secure-channel key exchange, extension handlers, encrypted messaging, and BaseWallet implementations.
// Use this skill when integrating Aztec wallet connectivity with @aztec/wallet-sdk, including discovery/session flows, secure-channel key exchange, extension handlers, encrypted messaging, and BaseWallet implementations.
| name | aztec-wallet-sdk |
| description | Use this skill when integrating Aztec wallet connectivity with @aztec/wallet-sdk, including discovery/session flows, secure-channel key exchange, extension handlers, encrypted messaging, and BaseWallet implementations. |
| license | Proprietary. LICENSE.txt has complete terms |
| compatibility | Pinned to aztec-packages v4.2.0 (commit f8c89cf4345df6c4ca9e66ea9b738e96070abc5a). |
| metadata | {"version_label":"v4.2.0","commit_sha":"f8c89cf4345df6c4ca9e66ea9b738e96070abc5a","source_map":"aztec-packages/yarn-project/wallet-sdk"} |
Use this skill for wallet connectivity and wallet-provider implementation work with @aztec/wallet-sdk.
Primary scope:
WalletManagerPendingConnection, key exchange, verification hash)ExtensionProvider, ExtensionWallet)BackgroundConnectionHandler, ContentScriptConnectionHandler)BaseWalletOut of scope:
aztec-contracts)aztec-deployment)aztec-js)Use the upstream repository and pin:
https://github.com/AztecProtocol/aztec-packagesv4.2.0f8c89cf4345df6c4ca9e66ea9b738e96070abc5ayarn-project/wallet-sdkCheckout example:
git clone https://github.com/AztecProtocol/aztec-packages.git
cd aztec-packages
git checkout v4.2.0
git status
Expected status includes HEAD detached at v4.2.0.
PendingConnection.confirm() succeeds.WalletMessageType.DISCONNECT) and cleanup all in-flight requests.chainInfo and appId on discovery and message flows.BaseWallet and implement account lookup and capability behavior explicitly.# Install core SDK deps (choose one package manager)
scripts/install_wallet_sdk_deps.sh npm
import { Fr } from '@aztec/aztec.js/fields';
import { WalletManager } from '@aztec/wallet-sdk/manager';
import { hashToEmoji } from '@aztec/wallet-sdk/crypto';
const discovery = WalletManager.configure({
extensions: { enabled: true },
}).getAvailableWallets({
chainInfo: { chainId: new Fr(31337), version: new Fr(1) },
appId: 'my-dapp',
timeout: 60000,
});
for await (const provider of discovery.wallets) {
const pending = await provider.establishSecureChannel('my-dapp');
console.log('Verify:', hashToEmoji(pending.verificationHash));
const wallet = await pending.confirm();
const accounts = await wallet.getAccounts();
console.log(accounts);
}
WalletManager.configure({ extensions: { enabled: true } }).getAvailableWallets({ chainInfo, appId, timeout, onWalletDiscovered? }).discovery.walletsonWalletDiscovereddiscovery.cancel().provider.establishSecureChannel(appId).pending.verificationHash using hashToEmoji(...).pending.confirm() only after user confirmation.pending.cancel() if verification fails.ExtensionProvider.discoverWallets(chainInfo, options) when bypassing manager abstractions.DiscoveredWallet entries through onWalletDiscovered callback.discovered.establishSecureChannel().Background script:
BackgroundConnectionHandler(config, transport, callbacks).initialize() once.BackgroundConnectionCallbacks fields are optional:
onPendingDiscovery — queues approval UI for incoming discovery requests.onSessionEstablished — notified when key exchange completes and a session is live.onSessionTerminated — notified when a session ends (disconnect or tab close).onWalletMessage — receives decrypted wallet calls; call sendResponse with result.approveDiscovery(requestId) or rejectDiscovery(requestId).onWalletMessage to wallet backend.sendResponse(sessionId, walletResponse).handler with let before defining callbacks that reference it (avoids temporal deadzone).Content script:
ContentScriptConnectionHandler(transport).start() once.WalletMessageType:DISCOVERYDISCOVERY_RESPONSEKEY_EXCHANGE_REQUESTKEY_EXCHANGE_RESPONSEDISCONNECTgenerateKeyPair, exportPublicKey, importPublicKey, deriveSessionKeys for key exchange.encrypt/decrypt for all post-handshake payloads.requestId/messageId and validate walletId on responses.BaseWalletBaseWallet for wallet implementations backed by PXE + Aztec node.getAccountFromAddress(address)getAccounts()simulateTx, profileTx, sendTxregisterContract, registerSendercreateAuthWit, getPrivateEventsgetContractMetadata, getContractClassMetadatarequestCapabilities(...) for external wallets.BaseWallet.sendTx returns { receipt?, txHash?, offchainEffects, offchainMessages }. Custom Wallet / BaseWallet implementations must call extractOffchainOutput(provenTx.getOffchainEffects(), provenTx.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp) (the anchor-block timestamp argument is mandatory in v4.2.0) and spread the result into the returned object — the OffchainMessage.anchorBlockTimestamp field added in this release is set from that argument.provider.onDisconnect(callback) — returns an unsubscribe function.provider.isDisconnected() to test current session state without polling.provider.disconnect() on app shutdown or wallet switch.terminateSession(...)/terminateForTab(...)/clearAll().yarn-project/wallet-sdk/src/**/*.test.ts as behavior references.base_wallet.test.ts.2s in DiscoveredWallet)# preflight checks (node + package manager + optional node URL + optional source path)
scripts/preflight_wallet_sdk.sh [node-url] [wallet-sdk-dir]
# install wallet-sdk dependencies
scripts/install_wallet_sdk_deps.sh <npm|yarn|pnpm> [version]
# run a TS wallet-sdk example with tsx (tsx must be installed: npm install -D tsx)
scripts/run_wallet_sdk_example.sh <entry-file.ts> [-- <extra-args...>]
# summarize package entrypoints/exports from aztec-packages checkout
scripts/summarize_wallet_sdk_exports.sh <aztec-packages-dir>
# run wallet-sdk package tests from aztec-packages checkout
scripts/run_wallet_sdk_tests.sh <aztec-packages-dir> [test-name-pattern]
60000ms).DiscoveredWallet.establishSecureChannel() enforces a 2000ms timeout; retry from approved discovery state.confirm().walletId, messageId, and per-session routing state.ExtensionWallet rejects in-flight and future calls once disconnected.allowList/blockList filtering in manager config.PendingDiscovery.appName is always undefined at this pin:
DiscoveryRequest does not carry an appName field, so BackgroundConnectionHandler never populates it. Do not rely on it for UI labelling; use appId and origin instead.reference.md for pinned source corpus and API/file map.patterns.md for reusable dApp and extension integration snippets.scripts/ for repeatable setup, inspection, and test workflows.Use this skill when working with Aztec account implementations and lifecycle flows, including Schnorr/ECDSA account flavors, account abstraction entrypoints, transaction routing, key-store integration, deployment, and wallet reconstruction.
Use this skill when creating, editing, testing, debugging, or upgrading Aztec smart contracts in Noir/Aztec.nr, including storage modeling, private/public/utility functions, note delivery, authwit authorization, TestEnvironment tests, and artifact/codegen workflows.
Use this skill when deploying Aztec smart contracts (not authoring them), including local-network and devnet deployment via aztec-wallet/Aztec.js, fee-payment setup, deterministic addresses, deployment verification, and contract registration workflows.
Use this skill when building TypeScript applications with Aztec.js, including node/PXE connectivity, account lifecycle, contract deployment and interaction, transaction/fee handling, authwit authorization, event reads, and test automation.
Use this skill when implementing or debugging direct PXE workflows in TypeScript, including private execution lifecycle, note discovery/synchronization, sender/recipient tagging, private events, scopes, and oracle/debug checks.
Use this skill when testing Aztec smart contracts, including Noir tests with TestEnvironment and TypeScript integration tests with Aztec.js on local-network/devnet-like setups.