GithubHelp home page GithubHelp logo

goodvibesohmly / dapp-boilerplate-angular-bootstrap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from primedao/dapp-boilerplate-angular-bootstrap

0.0 0.0 0.0 37 KB

Boilerplate template for creating a dapp using Angular and Bootstrap

JavaScript 6.59% TypeScript 63.80% HTML 29.33% CSS 0.28%

dapp-boilerplate-angular-bootstrap's Introduction

Dapp Boilerplate Using Angular and Bootstrap

This project was generated with Angular CLI version 10.1.1.

Features

  • Gets web3 provider from Metamask
  • Shows ETH and ERC20 token balances using ethers library
  • Dynamically changes addresses when user changes them in Metamask
  • Dynamically changes and displays network when user changes them in Metamask
  • Allows user to disconnect dapp from wallet

Bootstrap Dependency

This project uses Bootstrap version 4.1.1 loaded from the Bootstrap CDN (see the index.html file). There are alternate ways to add the Bootstrap dependencies to an Angular project directly if you don't want to take a dependency on the CDN.

UI Architecture

All HTML was taken from stock bootstrap examples found at https://getbootstrap.com/docs/4.1/examples/.

The project adds a header and footer to the app.component.html which are always rendered as components.

The project adds a default homepage in homepage.component.ts which can be easily modified.

The project adds a dashboard for logged in users which displays their balances. This page was based on the dashboard template from the bootstrap examples.

JSON Module Import

In order to deserialize JSON files to objects, the ts.config has been altered as follows:

    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,

Web3 Integration

The project uses best practices as of October 2020 for connecting to a web3 provider using Metamask. It uses an Observable architecture to listen for both account changed events and network changed events to have the UI automatically update when the user changes things in Metamask.

Future work could support other wallets which could be added in the login component.

It uses the ethers library for connecting to smart contracts and shows how to displays erc20 balances. Future work could support more sophisticated smart contract interaction.

Development server

Run npm or yarn to install dependencies and then run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

dapp-boilerplate-angular-bootstrap's People

Contributors

emoon-dev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.