GithubHelp home page GithubHelp logo

shawtim / colony-event-list Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 2.42 MB

Colony Event List

Home Page: https://shawtim.github.io/colony-event-list/

JavaScript 73.53% HTML 1.88% SCSS 1.80% TypeScript 22.40% CSS 0.40%

colony-event-list's Introduction

Colony Event List

This project is to demostrate how to use colony-js to query the events and logs come from Colony Network smart contracts deployed on the Ethereum Mainnet. image

Tech Stack


CRA with Redux+Typescript

It's created with create-react-app CLI:

npx create-react-app react-demo-app --template redux-typescript

CSS Modules with SCSS

CRA comes with CSS Modules support, and we would like to use SCSS here.

npm install --save-dev node-sass

ColonyJS and ether.js

As mentioned we are going to use ColonyJS to connect Colony Network. We need to install ether.js as well.

npm install --save @colony/colony-js@2
npm install --save ethers@4

react-blockies

We would like to use an avatar library that can generated avatar by given an address, and we use react-blockies here:

npm install --save react-blockies

dayjs

We would like to format the date. While momentjs is promising, it's now a legacy project in maintenance mode. And we are going to install its alternative dayjs as suggested.

npm install --save dayjs

Dealing with Data


We refer to here on how to use ColonyJS to query the raw data and how to process them.

Detail implementation can be refered in src/features/event/api.ts.

Data Types


There are plenty of types defined to provide a human readable shapes of the converted data after processed from the raw data. Most of them are located at src/features/event/slice.ts, e.g.:

  • ColonyInitialisedEventLog
  • ColonyRoleSetEventLog
  • PayoutClaimedEventLog
  • DomainAddedEventLog

All these are the event log types for different event types. And EventLog is a superset of all of them.

React Components


The data is prepared, processed and ready in Redux store, and the data types are ready. And we need to render the data on UI.

src/App.tsx

The main container app. When it renders at the first time, event logs data will be queried, processed and then put in the Redux store. When Redux store data is available, the data will be passed into EventList component.

src/components/EventList

The react component that to render the event log list. The spec can be referred to here.

How to run


To install:

npm install

To run in development mode locally (since it needs to connect to the server API that doesnt support CORS, it doesnt work on Firefox):

npm start

To build in production mode:

npm run build

To build for github page (the build will be available on github page, but again the server API doesnt support CORS so it's not expected to work on github page):

npm run build:github

To run test (unfortunately no tests is yet available - but the framework is here):

npm test

To run test coverage report:

npm test -- --coverage

Improvement


The project is expected to be a 4 hours project so I dont expect it will be perfect. We have a list of future improvements here:

colony-event-list's People

Contributors

shawtim avatar

Watchers

 avatar  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.