AngularWeb3

Angular Web3 DApp

A modern decentralized application (DApp) built with Angular and ethers.js for Ethereum blockchain integration.

Features

Technologies Used

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd angularweb3
    
  2. Install dependencies:

    npm install
    
  3. Start the development server:

    npm start
    
  4. Open your browser and navigate to http://localhost:4200

Prerequisites

Project Structure

src/
├── app/
│   ├── components/
│   │   ├── wallet/
│   │   │   └── wallet.component.ts          # Wallet connection & info
│   │   ├── transaction/
│   │   │   └── transaction.component.ts     # ETH transaction sending
│   │   └── contract/
│   │       └── contract.component.ts        # Smart contract interaction
│   ├── services/
│   │   └── ethereum.service.ts              # Core Ethereum functionality
│   └── app.ts                              # Main application component
├── styles.scss                             # Global styles
└── main.ts                                 # Application entry point

Core Components

1. Ethereum Service (ethereum.service.ts)

The core service that handles all Ethereum blockchain interactions:

2. Wallet Component (wallet.component.ts)

Displays wallet information and provides connection functionality:

3. Transaction Component (transaction.component.ts)

Allows users to send ETH transactions:

4. Contract Component (contract.component.ts)

Interact with ERC-20 tokens and smart contracts:

Usage Examples

Connecting to Wallet

import { EthereumService } from './services/ethereum.service';

constructor(private ethereumService: EthereumService) {}

async connectWallet() {
  const success = await this.ethereumService.connectWallet();
  if (success) {
    console.log('Wallet connected successfully!');
  }
}

Sending ETH Transaction

async sendTransaction() {
  try {
    const hash = await this.ethereumService.sendTransaction(
      '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
      '0.01'
    );
    console.log('Transaction hash:', hash);
  } catch (error) {
    console.error('Transaction failed:', error);
  }
}

Interacting with Smart Contracts

async interactWithContract() {
  const contract = await this.ethereumService.getContract(
    '0x1234567890123456789012345678901234567890',
    ERC20_ABI
  );

  const balance = await contract['balanceOf'](walletAddress);
  console.log('Token balance:', ethers.formatUnits(balance, 18));
}

Supported Networks

Security Features

UI/UX Features

Deployment

Build for Production

npm run build

Deploy to Netlify

  1. Build the project: npm run build
  2. Deploy the dist/angularweb3/browser folder to Netlify

Deploy to Vercel

  1. Connect your repository to Vercel
  2. Vercel will automatically detect Angular and deploy

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -am 'Add feature'
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Support

If you have any questions or need help, please:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Contact the maintainers

Happy Web3 Development!