### React: Use Account Hook for Aztec Wallet SDK Source: https://github.com/nemi-fi/wallet-sdk/blob/main/README.md Provides a React hook example for retrieving the connected account using the Aztec Wallet SDK. The 'useAccount' hook takes the SDK instance as an argument and returns the account object, which can then be used to access properties like the account's address. ```tsx import { useAccount } from "@nemi-fi/wallet-sdk/react"; function App() { const account = useAccount(sdk); return
{account.address.toString()}
; } ``` -------------------------------- ### Update Aztec.js RPC Usage with AztecWalletSdk Source: https://github.com/nemi-fi/wallet-sdk/blob/main/README.md Demonstrates the transition from the older aztec.js Wallet to the new AztecWalletSdk for contract interaction. It highlights changes in import paths and initialization, requiring the SDK to be configured with an Aztec node URL and connectors. The 'Contract.fromAztec' method is used for compatibility. ```typescript // before import { Wallet } from "@aztec/aztec.js"; const account: Wallet; const token = await TokenContract.at(address, account); // after import { AztecWalletSdk, obsidion } from "@nemi-fi/wallet-sdk"; import { Contract } from "@nemi-fi/wallet-sdk/eip1193"; class Token extends Contract.fromAztec(TokenContract) {} const sdk = new AztecWalletSdk({ aztecNode: "http://localhost:8080", connectors: [obsidion()], }); await sdk.connect("obsidion"); const account = await sdk.getAccount(); const token = await Token.at(address, account); ``` -------------------------------- ### Convert aztec.js Wallet to EIP1193 Account Source: https://github.com/nemi-fi/wallet-sdk/blob/main/README.md Illustrates how to convert an existing aztec.js Wallet instance into an EIP1193-compatible Account object for use with the Aztec Wallet SDK. This involves importing necessary classes from both aztec.js and the wallet-sdk, and then utilizing the 'Eip1193Account.fromAztec' static method with the wallet, Aztec node client, and PXE client. ```typescript import { getDeployedTestAccountsWallets } from "@aztec/accounts/testing"; import { createAztecNodeClient, createPXEClient } from "@aztec.js"; import { type Account, Eip1193Account } from "@nemi-fi/wallet-sdk/eip1193"; const sandboxUrl = "http://localhost:8080"; const aztecNode = createAztecNodeClient(sandboxUrl); const pxe = createPXEClient(sandboxUrl); const [wallet] = await getDeployedTestAccountsWallets(pxe); const account: Account = await Eip1193Account.fromAztec(wallet, aztecNode, pxe); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.