### Install Aztec CLI Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/Steps.txt Installs the Aztec command-line interface using a curl script. This is the initial step to enable further Aztec-related operations. ```bash zsh -i <(curl -s https://install.aztec.network) ``` -------------------------------- ### Start Aztec Network with Specific Configuration Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/Steps.txt Starts the Aztec network with a specified version, port, PXE node URL, prover enabled status, and L1 chain ID. This command is flexible for various deployment scenarios. ```bash VERSION=1.0.0-staging.2 aztec start --port 8081 --pxe --pxe.nodeUrl=$BOOTNODE --pxe.proverEnabled true --l1-chain-id $L1_CHAIN_ID aztec start --port 8080 --pxe --pxe.nodeUrl=https://aztec-testnet-fullnode.zkv.xyz --pxe.proverEnabled true --l1-chain-id 11155111 aztec start --port 8080 --pxe --pxe.nodeUrl=$BOOTNODE --pxe.proverEnabled true --l1-chain-id $L1_CHAIN_ID --rollup-version 1714840162 ``` -------------------------------- ### Pull Aztec Docker Image and Start Sandbox Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/Steps.txt Pulls a specific version of the Aztec Docker image and then starts the sandbox environment using that image. This is useful for reproducible deployments. ```bash docker pull aztecprotocol/aztec:1.0.0-staging.2 VERSION=1.0.0-staging.2 aztec start --sandbox ``` -------------------------------- ### Start Aztec Sandbox Environment Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/Steps.txt Launches the Aztec sandbox environment with specific configurations, including port, PXE settings, and chain ID. It may source environment variables first. ```bash source .env aztec start --sandbox --port 8081 --pxe --pxe.nodeUrl=$BOOTNODE --pxe.proverEnabled true --l1-chain-id $L1_CHAIN_ID aztec start --port 8081 --pxe --pxe.nodeUrl=$BOOTNODE --pxe.proverEnabled true --l1-chain-id $L1_CHAIN_ID ``` -------------------------------- ### Contributing Workflow using Git Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md This provides a step-by-step guide for contributing to the project using Git. It covers forking the repository, creating feature branches, committing changes, and opening a pull request. ```git 1. Fork the repository 2. Create a feature branch: `git checkout -b feature/amazing-feature` 3. Commit changes: `git commit -m 'Add amazing feature'` 4. Push to branch: `git push origin feature/amazing-feature` 5. Open a Pull Request ``` -------------------------------- ### Manual Deployment for Frontend and L1 Contracts Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md These bash commands guide the manual deployment process for the project's frontend and L1 contracts. It includes building the frontend, deploying it with Vercel, and broadcasting the L1 contract deployment using Foundry. ```bash # Build and deploy frontend cd frontend pnpm build vercel --prod # Deploy L1 contracts cd l1-contracts forge script script/Deploy.s.sol --broadcast ``` -------------------------------- ### Get Help for Foundry Tools Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/l1-contracts/README.md Displays help information for Forge, Anvil, and Cast commands. Useful for understanding available options and usage. ```shell forge --help anvil --help cast --help ``` -------------------------------- ### Run Local Ethereum Node with Anvil Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/l1-contracts/README.md Starts a local Ethereum node for development and testing using the Anvil command. This simulates a real blockchain environment. ```shell anvil ``` -------------------------------- ### Build Project with Forge Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/l1-contracts/README.md Compiles the smart contracts for the project using the Forge build command. Ensure you have Foundry installed and configured. ```shell forge build ``` -------------------------------- ### Compile Aztec Contracts (Token) Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/Steps.txt Compiles the smart contracts for the token using the 'aztec-nargo compile' command. This step also generates the required target artifacts. ```bash cd aztec-contracts/token aztec-nargo compile aztec codegen target -o src/artifacts ``` -------------------------------- ### Setup PXE Service Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Creates a local Private Execution Environment (PXE) service for interacting with the Aztec network. It requires the Aztec node URL and sets up persistent storage. This is crucial for local development and testing. ```typescript import { createPXEService, getPXEServiceConfig } from '@aztec/pxe/server'; import { createStore } from '@aztec/kv-store/lmdb'; import { createAztecNodeClient, waitForPXE } from '@aztec/aztec.js'; const NODE_URL = 'http://localhost:8080'; // Setup local PXE async function setupPXE() { const node = createAztecNodeClient(NODE_URL); try { await node.getNodeInfo(); } catch (error) { throw new Error('Aztec node is not running'); } const l1Contracts = await node.getL1ContractAddresses(); const config = getPXEServiceConfig(); const fullConfig = { ...config, l1Contracts, proverEnabled: false }; // Create persistent storage const store = await createStore('pxe', { dataDirectory: 'store', dataStoreMapSizeKB: 1e6, }); const pxe = await createPXEService(node, fullConfig, { store }); await waitForPXE(pxe); console.log('PXE service ready'); return pxe; } const pxe = await setupPXE(); ``` -------------------------------- ### Check Aztec CLI Version Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/Steps.txt Checks the currently installed version of the Aztec CLI. It can also be used with a specific version variable. ```bash aztec --version VERSION=1.0.0-staging.2 aztec --version ``` -------------------------------- ### Compile Aztec Contracts (NFT Contract) Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/Steps.txt Compiles the smart contracts for the NFT contract using the 'aztec-nargo compile' command. This includes generating target artifacts for the contract. ```bash cd aztec-contracts/nft_contract aztec-nargo compile aztec codegen target -o src/artifacts ``` -------------------------------- ### Compile Aztec Contracts (Token Bridge) Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/Steps.txt Compiles the smart contracts for the token bridge using the 'aztec-nargo compile' command. It also generates necessary artifacts for the target environment. ```bash cd aztec-contracts/token_bridge aztec-nargo compile aztec codegen target -o src/artifacts ``` -------------------------------- ### Bridge Tokens Public L1 to L2 Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Deposits tokens from Ethereum L1 to Aztec L2 with public visibility. Requires L1 clients, contract addresses, and portal manager setup. Outputs the L2 balance after claiming. ```typescript import { L1TokenPortalManager, EthAddress, Fr } from '@aztec/aztec.js'; import { createL1Clients } from '@aztec/ethereum'; import { getContract } from 'viem'; import { TokenPortalAbi } from '@aztec/l1-artifacts'; // Setup L1 clients const { walletClient, publicClient } = createL1Clients( 'http://localhost:8545', 'test test test test test test test test test test test junk' ); const MINT_AMOUNT = BigInt(1e15); // Get L1 contract addresses from node const l1ContractAddresses = (await pxe.getNodeInfo()).l1ContractAddresses; // Create portal manager const l1PortalManager = new L1TokenPortalManager( l1ContractAddresses.l1TokenPortalAddress, // Assuming this is the correct address l1ContractAddresses.l1TokenAddress, // Assuming this is the correct address EthAddress.ZERO, // Assuming a default or placeholder for feeAssetHandler l1ContractAddresses.outboxAddress, publicClient, walletClient, logger // Assuming logger is defined elsewhere ); // Bridge tokens to L2 const claim = await l1PortalManager.bridgeTokensPublic( ownerAztecAddress, // Assuming ownerAztecAddress is defined elsewhere MINT_AMOUNT, true ); // Perform unrelated actions for L2 message processing // These lines seem unrelated to the primary function of bridging tokens // await l2TokenContract.methods.mint_to_public(ownerAztecAddress, 0n).send().wait(); // await l2TokenContract.methods.mint_to_public(ownerAztecAddress, 0n).send().wait(); // Claim tokens on L2 // Assuming l2BridgeContract and ownerAztecAddress are defined elsewhere await l2BridgeContract.methods .claim_public(ownerAztecAddress, MINT_AMOUNT, claim.claimSecret, claim.messageLeafIndex) .send() .wait(); // Check balance // Assuming l2TokenContract and ownerAztecAddress are defined elsewhere const balance = await l2TokenContract.methods.balance_of_public(ownerAztecAddress).simulate(); console.log(`L2 balance: ${balance}`); ``` -------------------------------- ### Withdraw Tokens L2 to L1 Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Withdraws tokens from Aztec L2 back to Ethereum L1 using merkle proof verification. Involves authorizing burns, getting L2 to L1 message leaves, executing withdrawal on L2, and completing withdrawal on L1. Requires L1 portal manager and L2 contract instances. ```typescript import { Fr, EthAddress } from '@aztec/aztec.js'; const withdrawAmount = 9n; const nonce = Fr.random(); const recipientL1Address = EthAddress.fromString('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2'); // Assuming ownerWallet, l2BridgeContract, l2TokenContract, l1PortalManager, pxe, l1TokenManager are defined elsewhere // Step 1: Authorize bridge to burn tokens const authwit = await ownerWallet.setPublicAuthWit( { caller: l2BridgeContract.address, action: l2TokenContract.methods.burn_public(ownerAztecAddress, withdrawAmount, nonce), }, true ); await authwit.send().wait(); // Step 2: Get L2 to L1 message leaf const l2ToL1Message = await l1PortalManager.getL2ToL1MessageLeaf( withdrawAmount, recipientL1Address, l2BridgeContract.address, EthAddress.ZERO ); // Step 3: Execute withdrawal on L2 const l2TxReceipt = await l2BridgeContract.methods .exit_to_l1_public(recipientL1Address, withdrawAmount, EthAddress.ZERO, nonce) .send() .wait(); const newL2Balance = await l2TokenContract.methods.balance_of_public(ownerAztecAddress).simulate(); console.log(`New L2 balance: ${newL2Balance}`); // Step 4: Get merkle proof for L1 withdrawal const [l2ToL1MessageIndex, siblingPath] = await pxe.getL2ToL1MembershipWitness( await pxe.getBlockNumber(), l2ToL1Message ); // Step 5: Complete withdrawal on L1 await l1PortalManager.withdrawFunds( withdrawAmount, recipientL1Address, BigInt(l2TxReceipt.blockNumber!), l2ToL1MessageIndex, siblingPath ); // Verify L1 balance const newL1Balance = await l1TokenManager.getL1TokenBalance(recipientL1Address.toString()); console.log(`New L1 balance: ${newL1Balance}`); ``` -------------------------------- ### Frontend Testing Commands Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md This section provides bash commands for running frontend tests, including both unit tests and end-to-end tests. It requires navigating to the frontend directory and using the 'pnpm' package manager. ```bash cd frontend pnpm test # Run unit tests pnpm test:e2e # Run end-to-end tests ``` -------------------------------- ### Contract Testing Commands Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md These bash commands are used for testing smart contracts. They cover testing L1 contracts using Foundry and L2 contracts using the Aztec testing framework. ```bash cd l1-contracts forge test # Test L1 contracts cd aztec-contracts aztec test # Test L2 contracts ``` -------------------------------- ### Faucet API Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md Requests test ETH for gas fees. ```APIDOC ## POST /api/faucet ### Description Requests test ETH for gas fees. ### Method POST ### Endpoint /api/faucet ### Parameters #### Request Body - **address** (string) - Required - The address to send test ETH to. ### Request Example { "address": "0x..." } ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example { "message": "Test ETH sent successfully." } ``` -------------------------------- ### Automated Vercel Deployment Configuration Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md This YAML configuration defines the triggers and environments for automated deployment using GitHub Actions. It ensures secure management of environment variables for preview and production releases. ```yaml # Triggers on main branch push # Deploys to both preview and production environments # Manages environment variables securely ``` -------------------------------- ### Deploy L1 Token Portal and Bridge with Aztec Contracts Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Deploys the complete bridge infrastructure connecting L1 and L2. This includes deploying an L1 ERC20 token, an L1 token portal, and the L2 bridge contract. It also authorizes the L2 bridge as a minter and initializes the L1 portal. Dependencies include '@aztec/ethereum', '@aztec/l1-artifacts', '@aztec/noir-contracts.js/TokenBridge', and 'viem'. ```typescript import { deployL1Contract } from '@aztec/ethereum'; import { TokenPortalAbi, TokenPortalBytecode, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts'; import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge'; import { getContract } from 'viem'; // Deploy L1 ERC20 token async function deployTestERC20() { const constructorArgs = ['Test Token', 'TEST', walletClient.account.address]; const { address } = await deployL1Contract( walletClient, publicClient, TestERC20Abi, TestERC20Bytecode, constructorArgs ); return address; } // Deploy L1 portal async function deployTokenPortal() { const { address } = await deployL1Contract( walletClient, publicClient, TokenPortalAbi, TokenPortalBytecode, [] ); return address; } // Complete bridge setup async function setupBridge() { // Deploy L1 token const l1TokenContract = await deployTestERC20(); console.log('L1 token deployed:', l1TokenContract.toString()); // Deploy L1 portal const l1PortalAddress = await deployTokenPortal(); console.log('L1 portal deployed:', l1PortalAddress.toString()); // Deploy L2 bridge contract const l2BridgeContract = await TokenBridgeContract.deploy( ownerWallet, l2TokenContract.address, l1PortalAddress ).send().deployed(); console.log('L2 bridge deployed:', l2BridgeContract.address.toString()); // Authorize L2 bridge as minter await l2TokenContract.methods.set_minter(l2BridgeContract.address, true).send().wait(); // Initialize L1 portal const l1Portal = getContract({ address: l1PortalAddress.toString(), abi: TokenPortalAbi, client: walletClient, }); await l1Portal.write.initialize([ l1ContractAddresses.registryAddress.toString(), l1TokenContract.toString(), l2BridgeContract.address.toString() ]); console.log('Bridge setup complete'); return { l1Token: l1TokenContract, l1Portal: l1PortalAddress, l2Bridge: l2BridgeContract }; } const bridge = await setupBridge(); ``` -------------------------------- ### POST /api/faucet Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Sends testnet ETH to a user address to cover transaction gas fees on the L1 network. ```APIDOC ## POST /api/faucet ### Description Sends testnet ETH to a user address for transaction gas fees. ### Method POST ### Endpoint /api/faucet ### Parameters #### Request Body - **address** (string) - Required - The recipient's Ethereum address. ### Request Example ```json { "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **txHash** (string) - The transaction hash of the ETH transfer. - **message** (string) - A descriptive message about the transaction. - **balances** (object) - An object containing balance information before and after the transaction for the faucet and recipient. - **faucet** (object) - Balances for the faucet address. - **before** (string) - ETH balance before transaction. - **after** (string) - ETH balance after transaction. - **recipient** (object) - Balances for the recipient address. - **before** (string) - ETH balance before transaction. - **after** (string) - ETH balance after transaction. #### Response Example ```json { "success": true, "txHash": "0x123...", "message": "20000000000000000 ETH sent to 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2 for gas", "balances": { "faucet": { "before": "1.5", "after": "1.48" }, "recipient": { "before": "0", "after": "0.02" } } } ``` ``` -------------------------------- ### Deploy Contracts with Forge Script Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/l1-contracts/README.md Deploys smart contracts using Forge script. Requires specifying the script file, RPC URL, and private key for deployment. ```shell forge script script/Counter.s.sol:CounterScript --rpc-url --private-key ``` -------------------------------- ### Manage Environment Configuration with ConfigManager Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Manages environment-specific configurations for different deployment targets. It provides a singleton instance of ConfigManager to access settings like environment type, node URLs, and timeouts. It reads configuration from files like 'config/devnet.json'. ```typescript import { ConfigManager, getAztecNodeUrl, getL1RpcUrl } from './config/config'; // Get configuration singleton const configManager = ConfigManager.getInstance(); // Check environment if (configManager.isDevnet()) { console.log('Running on devnet'); console.log('Node URL:', getAztecNodeUrl()); console.log('L1 RPC URL:', getL1RpcUrl()); } // Get timeout configurations const timeouts = configManager.getTimeouts(); console.log('Deploy timeout:', timeouts.deployTimeout); console.log('Transaction timeout:', timeouts.txTimeout); ``` -------------------------------- ### Connect Aztec Wallet (Frontend) with Raven House Wallet SDK Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Connects to Aztec wallets from a web browser using the Raven House Wallet SDK. It initializes the Aztec node client and the wallet SDK, then attempts to connect to an Obsidian wallet and retrieves the account address. Dependencies include 'raven-house-wallet-sdk' and '@aztec/aztec.js/node'. ```typescript import { AztecWalletSdk, obsidion } from 'raven-house-wallet-sdk'; import { createAztecNodeClient } from '@aztec/aztec.js/node'; const NODE_URL = 'https://devnet.aztec-labs.com/'; // Create Aztec node client export const aztecNode = createAztecNodeClient(NODE_URL); // Create wallet SDK export const sdk = new AztecWalletSdk({ aztecNode: NODE_URL, connectors: [obsidion({})], }); // Connect to wallet async function connectAztecWallet() { try { await sdk.connect('obsidion'); const account = await sdk.getAccount(); console.log('Connected to account:', account.address.toString()); return account; } catch (error) { console.error('Failed to connect wallet:', error); throw error; } } // Usage const account = await connectAztecWallet(); ``` -------------------------------- ### Git Branching Strategy for Development Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md This describes the established Git branching strategy for the project, outlining the purpose of the 'main', 'develop', and 'feature/*' branches to maintain organized and efficient development. ```git - `main`: Production-ready code - `develop`: Integration branch - `feature/*`: Feature development ``` -------------------------------- ### Format Code with Forge Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/l1-contracts/README.md Applies standard formatting to Solidity code using the Forge fmt command. This ensures code consistency across the project. ```shell forge fmt ``` -------------------------------- ### Interact with EVM using Cast Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/l1-contracts/README.md Provides a command-line interface for interacting with the EVM using the Cast tool. Various subcommands can be used for different operations. ```shell cast ``` -------------------------------- ### Environment Variable: Attester Private Key Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/aztec - passport.md This bash snippet shows how to set the private key for the attester wallet in a local environment file. This key is crucial for signing attestations and must be kept secure. ```bash ATTESTER_PRIVATE_KEY=0x... ``` -------------------------------- ### Deploy L2 Token Contract on Aztec Network Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt This TypeScript code snippet demonstrates how to deploy a new ERC20-compatible token contract on the Aztec L2 network using the Aztec SDK. It requires setting up a PXE client connection and obtaining an owner wallet. The deployment function takes the owner's address, token name, symbol, and decimals as arguments. ```typescript import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { getInitialTestAccountsWallets } from '@aztec/accounts/testing'; import { createPXEClient, waitForPXE } from '@aztec/aztec.js'; // Setup PXE connection const pxe = await createPXEClient('http://localhost:8081'); await waitForPXE(pxe); // Get wallet const wallets = await getInitialTestAccountsWallets(pxe); const ownerWallet = wallets[0]; const ownerAddress = ownerWallet.getAddress(); // Deploy token const l2TokenContract = await TokenContract.deploy( ownerWallet, ownerAddress, 'L2 Token', // name 'L2T', // symbol 18 // decimals ).send().deployed(); console.log(`L2 token deployed at: ${l2TokenContract.address}`); ``` -------------------------------- ### Alchemy NFT API Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md Fetches a user's NFTs using the Alchemy API. ```APIDOC ## GET /api/alchemy/nfts ### Description Fetch user NFTs. ### Method GET ### Endpoint /api/alchemy/nfts ### Parameters #### Query Parameters - **userAddress** (string) - Required - The wallet address of the user. ### Response #### Success Response (200) - **nfts** (array) - A list of NFTs owned by the user. #### Response Example { "nfts": [ { "tokenId": "123", "contract": "0x...", "name": "Aztec NFT" } ] } ``` -------------------------------- ### Token Minting API Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md Mints test tokens for a given address. ```APIDOC ## POST /api/mint-tokens ### Description Mints test tokens. ### Method POST ### Endpoint /api/mint-tokens ### Parameters #### Request Body - **address** (string) - Required - The address to mint tokens to. - **amount** (string) - Required - The amount of tokens to mint. ### Request Example { "address": "0x...", "amount": "1000" } ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example { "message": "Test tokens minted successfully." } ``` -------------------------------- ### Test Contracts with Forge Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/l1-contracts/README.md Executes the unit tests for the smart contracts using the Forge test command. This is crucial for verifying contract logic and preventing regressions. ```shell forge test ``` -------------------------------- ### POST /api/mint-tokens Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Mints a specified amount of ERC20 test tokens to a given address on the L1 network. ```APIDOC ## POST /api/mint-tokens ### Description Mints ERC20 test tokens to a specified address on L1. ### Method POST ### Endpoint /api/mint-tokens ### Parameters #### Request Body - **address** (string) - Required - The recipient's Ethereum address. ### Request Example ```json { "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the minting operation was successful. - **txHash** (string) - The transaction hash of the token minting. - **message** (string) - A confirmation message detailing the minted tokens and recipient. #### Response Example ```json { "success": true, "txHash": "0xabc...", "message": "1000000000000000000000 tokens minted to 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2" } ``` ``` -------------------------------- ### Generate Gas Snapshots with Forge Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/l1-contracts/README.md Creates gas snapshots for contract functions using the Forge snapshot command. This helps in tracking gas usage over time. ```shell forge snapshot ``` -------------------------------- ### Bridge API Endpoints for Faucet and Token Minting Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md This details the API endpoints for interacting with the bridge's faucet and token minting functionalities. It specifies the HTTP methods, paths, and expected request bodies for these operations. ```json { "POST /api/faucet": "Request test ETH for gas fees", "Body": "{ \"address\": \"0x...\" }", "POST /api/mint-tokens": "Mint test tokens", "Body": "{ \"address\": \"0x...\", \"amount\": \"1000\" }" } ``` -------------------------------- ### API: Faucet ETH for Gas on Sepolia Testnet Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt This API endpoint sends testnet ETH to a specified user address on the Sepolia network to cover transaction gas fees. It takes a JSON body containing the recipient's address and returns transaction details and balance updates. ```typescript // POST /api/faucet const response = await fetch('/api/faucet', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2' }) }); const result = await response.json(); // { // success: true, // txHash: '0x123...', // message: '20000000000000000 ETH sent to 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2 for gas', // balances: { // faucet: { before: '1.5', after: '1.48' }, // recipient: { before: '0', after: '0.02' } // } // } ``` -------------------------------- ### API: Mint Test ERC20 Tokens on L1 Sepolia Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt This API endpoint mints a specified amount of test ERC20 tokens to a given address on the Sepolia L1 network. It requires a JSON body with the recipient's address and returns the transaction hash upon successful minting. ```typescript // POST /api/mint-tokens const response = await fetch('/api/mint-tokens', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2' }) }); const result = await response.json(); // { // success: true, // txHash: '0xabc...', // message: '1000000000000000000000 tokens minted to 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2' // } ``` -------------------------------- ### POST /api/alchemy/nfts Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Retrieves NFTs owned by a given Ethereum address across multiple specified chains using Alchemy's API. ```APIDOC ## POST /api/alchemy/nfts ### Description Retrieves NFTs owned by an address across multiple chains using Alchemy's API. ### Method POST ### Endpoint /api/alchemy/nfts ### Parameters #### Request Body - **address** (string) - Required - The Ethereum address to query NFTs for. - **chains** (array) - Required - An array of chain IDs to query (e.g., 1 for Mainnet, 11155111 for Sepolia). ### Request Example ```json { "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2", "chains": [1, 11155111] } ``` ### Response #### Success Response (200) - Returns an array of NFT objects owned by the specified address. Each object contains details like name, token address, chain ID, token ID, token type, description, balance, token URI, image, and collection information. #### Response Example ```json [ { "name": "Cool NFT #123", "tokenAddress": "0xdef...", "contract": {"address": "0xdef..."}, "chainId": 11155111, "tokenId": "123", "tokenType": "ERC721", "description": "A cool NFT", "balance": "1", "tokenUri": "ipfs://...", "image": "https://...", "metadata": {}, "collection": {"name": "Cool Collection"} } ] ``` ``` -------------------------------- ### Deploy L2 Token Contract Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt Deploys a new ERC20 token contract on the Aztec Layer 2 network. ```APIDOC ## Deploy L2 Token Contract ### Description Deploys a new token contract on the Aztec L2 network. ### Method Asynchronous function call using Aztec SDK. ### Endpoint N/A (This is a programmatic deployment using the Aztec SDK). ### Parameters (SDK Function Arguments) - **ownerWallet** (object) - The wallet instance of the contract owner. - **ownerAddress** (object) - The address of the contract owner. - **name** (string) - The name of the token. - **symbol** (string) - The symbol of the token. - **decimals** (number) - The number of decimal places for the token. ### Request Example (Conceptual SDK Usage) ```typescript import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { getInitialTestAccountsWallets } from '@aztec/accounts/testing'; import { createPXEClient, waitForPXE } from '@aztec/aztec.js'; // Setup PXE connection const pxe = await createPXEClient('http://localhost:8081'); await waitForPXE(pxe); // Get wallet const wallets = await getInitialTestAccountsWallets(pxe); const ownerWallet = wallets[0]; const ownerAddress = ownerWallet.getAddress(); // Deploy token const l2TokenContract = await TokenContract.deploy( ownerWallet, ownerAddress, 'L2 Token', // name 'L2T', // symbol 18 // decimals ).send().deployed(); console.log(`L2 token deployed at: ${l2TokenContract.address}`); ``` ### Response #### Success Response - **l2TokenContract** (object) - An instance of the deployed L2 Token contract. - **address** (string) - The address of the newly deployed L2 token contract. #### Response Example ``` L2 token deployed at: ``` ``` -------------------------------- ### API: Fetch User NFTs using Alchemy Source: https://context7.com/holonym-foundation/aztec-bridge/llms.txt This API endpoint retrieves NFTs owned by a specific Ethereum address across multiple specified chains (e.g., Mainnet and Sepolia) by utilizing Alchemy's NFT API. It takes an address and an array of chain IDs in the request body and returns a list of owned NFTs with their details. ```typescript // POST /api/alchemy/nfts const response = await fetch('/api/alchemy/nfts', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2', chains: [1, 11155111] // Mainnet and Sepolia }) }); const nfts = await response.json(); // [ // { // name: 'Cool NFT #123', // tokenAddress: '0xdef...', // contract: { address: '0xdef...' }, // chainId: 11155111, // tokenId: '123', // tokenType: 'ERC721', // description: 'A cool NFT', // balance: '1', // tokenUri: 'ipfs://...', // image: 'https://...', // metadata: { /* ... */ }, // collection: { name: 'Cool Collection' } // } // ] ``` -------------------------------- ### Alchemy Token Balances API Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md Retrieves token balances for a user using the Alchemy API. ```APIDOC ## GET /api/alchemy/tokens-balances ### Description Get token balances. ### Method GET ### Endpoint /api/alchemy/tokens-balances ### Parameters #### Query Parameters - **userAddress** (string) - Required - The wallet address of the user. ### Response #### Success Response (200) - **balances** (array) - A list of token balances for the user. #### Response Example { "balances": [ { "contract": "0x...", "symbol": "ETH", "balance": "1.5" } ] } ``` -------------------------------- ### Bridge API Endpoints for Alchemy Integration Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/README.md This outlines the API endpoints for integrating with Alchemy to fetch user NFTs and token balances. It specifies the HTTP methods and paths for these read operations. ```json { "GET /api/alchemy/nfts": "Fetch user NFTs", "GET /api/alchemy/tokens-balances": "Get token balances" } ``` -------------------------------- ### TypeScript: Fetch Passport Score from Holonym API Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/aztec - passport.md This TypeScript code snippet demonstrates how to replace the mock passport score retrieval with an actual API call to the Holonym service. It fetches the score for a given address and returns it as a number. ```typescript async function getPassportScore(address: string): Promise { const response = await fetch(`https://api.holonym.id/passport/score/${address}`) const data = await response.json() return data.score } ``` -------------------------------- ### API Request: Verify Attestation Signature Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/aztec - passport.md This JSON snippet represents a request payload for verifying an existing attestation signature. It includes the user's address, the signature itself, the original message, and the attester's address. ```json { "address": "0x...", "signature": "0x...", "message": "...", "attesterAddress": "0x..." } ``` -------------------------------- ### Passport Verification API Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/aztec - passport.md This section details the API endpoints for verifying passport scores and managing attestation signatures for bridge limits. ```APIDOC ## POST /api/passport/verify ### Description Verifies a user's passport score by integrating with the Holonym API and creates a signed attestation that indicates the user's bridge capacity. ### Method POST ### Endpoint `/api/passport/verify` ### Parameters #### Request Body - **address** (string) - Required - The user's blockchain address. ### Request Example ```json { "address": "0x..." } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the verification was successful. - **address** (string) - The verified user's address. - **passportScore** (integer) - The user's calculated passport score. - **tier** (string) - The trust tier assigned based on the passport score (e.g., "Proof of Clean Hand", "High Trust"). - **maxBridgeAmount** (integer | null) - The maximum amount the user can bridge. `null` for unlimited amounts. - **hasProofOfCleanHand** (boolean) - True if the user qualifies for unlimited bridging. - **attestation** (object) - An object containing the signed attestation details. - **signature** (string) - The digital signature for the attestation. - **attesterAddress** (string) - The address of the attester who signed the attestation. - **timestamp** (integer) - The Unix timestamp when the attestation was created. - **message** (string) - The message that was signed, typically including address, score, limit, and timestamp. #### Response Example ```json { "success": true, "address": "0x...", "passportScore": 95, "tier": "Proof of Clean Hand", "maxBridgeAmount": null, "hasProofOfCleanHand": true, "attestation": { "signature": "0x...", "attesterAddress": "0x...", "timestamp": 1234567890, "message": "0x...|95|unlimited|1234567890" } } ``` ## POST /api/passport/verify-signature ### Description Verifies an existing attestation signature to ensure its validity before a bridge transaction. ### Method POST ### Endpoint `/api/passport/verify-signature` ### Parameters #### Request Body - **address** (string) - Required - The user's blockchain address. - **signature** (string) - Required - The signature to verify. - **message** (string) - Required - The original message that was signed. - **attesterAddress** (string) - Required - The address of the attester who originally signed the message. ### Request Example ```json { "address": "0x...", "signature": "0x...", "message": "...", "attesterAddress": "0x..." } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the signature verification was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### API Response: Passport Verification Result Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/aztec - passport.md This JSON snippet illustrates a successful response from the passport verification API. It contains the user's address, passport score, determined bridge tier, maximum bridge amount (null for unlimited), proof of clean hand status, and a signed attestation. ```json { "success": true, "address": "0x...", "passportScore": 95, "tier": "Proof of Clean Hand", "maxBridgeAmount": null, "hasProofOfCleanHand": true, "attestation": { "signature": "0x...", "attesterAddress": "0x...", "timestamp": 1234567890, "message": "0x...|95|unlimited|1234567890" } } ``` -------------------------------- ### API Request: Verify Passport Score Source: https://github.com/holonym-foundation/aztec-bridge/blob/main/aztec - passport.md This JSON snippet represents a request payload for verifying a user's passport score. It includes the user's blockchain address as the primary input. ```json { "address": "0x..." } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.