Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xslipk committed Sep 28, 2022
1 parent 144a25d commit bc08919
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 84 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: Pulll Request App Build

# Controls when the action will run.
on:
# Triggers the workflow pull request events but only for the main and develop branch
# Triggers the workflow pull request events
pull_request:
branches: [main, develop, staging]
branches: ['**']
# Triggers the workflow push events but only for the main
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -59,4 +62,9 @@ jobs:
# run: pnpm test:e2e

- name: Build source code.
run: pnpm build
run: pnpm build

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0
Published by **[blockcoders](https://github.com/blockcoders)** on **2022/09/28**
- [#1](https://github.com/blockcoders/ink-substrate-explorer-api/pull/1) Release v1.0.0 - Milestone 1 Ink Explorer API
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing

1. [Fork it](https://help.github.com/articles/fork-a-repo/)
2. Install dependencies (`pnpm i --frozen-lockfile`)
3. Create your feature branch (`git checkout -b my-new-feature`)
4. Commit your changes (`git commit -am 'Added some feature'`)
5. Test your changes (`pnpm test`)
6. Push to the branch (`git push origin my-new-feature`)
7. [Create new Pull Request](https://help.github.com/articles/creating-a-pull-request/)

## Testing

We use [Jest](https://github.com/facebook/jest) to write tests. Run our test suite with this command:

```
pnpm test
```

## Code Style

We use [Prettier](https://prettier.io/) and tslint to maintain code style and best practices.
Please make sure your PR adheres to the guides by running:

```
pnpm format
```

and
```
pnpm lint
```
161 changes: 82 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# **Ink! Explorer**
Ink! Explorer API
=================

[![App Build](https://github.com/blockcoders/ink-substrate-explorer-api/actions/workflows/pr.yaml/badge.svg)](https://github.com/blockcoders/ink-substrate-explorer-api/actions/workflows/pr.yaml)
[![Coverage Status](https://coveralls.io/repos/github/blockcoders/ink-substrate-explorer-api/badge.svg?branch=main)](https://coveralls.io/github/blockcoders/ink-substrate-explorer-api?branch=main)
[![Known Vulnerabilities](https://snyk.io/test/github/blockcoders/ink-substrate-explorer-api/badge.svg)](https://snyk.io/test/github/blockcoders/ink-substrate-explorer-api)

## **About the explorer**

Expand All @@ -8,47 +13,6 @@ The idea of this project is to provide a tool that allows developers of Ink! exp

This project serves useful information that is not available anywhere else. Since the back end is in charge of obtaining information related to the balances, transactions and more, of the contracts that use Ink modules. Ink Explorer uses polkadot.js to communicate with the Substrate / Polkadot networks. It is safe to say that this project is a must.

Blockcoders is a team that is always contributing to blockchain projects to help the growth of the ecosystem.

## **About us**

### Team members

- Jose Ramirez
- Fernando Sirni
- Ruben Gutierrez

### Contact

- **Contact Name:** Jose Ramirez
- **Contact Email:** jose@blockcoders.io
- **Website:** http://blockcoders.io/

### Team's experience

Our team has been contributing with different projects in blockchain for a few years, building APIs, SDKs and developer tools. Our goal is to continue to drive the crypto space forward by investing intellectual capital into projects, participating actively to help shape the ecosystems we believe in.

### Team Code Repos

- https://github.com/blockcoders
- https://github.com/blockcoders/nestjs-ethers
- https://github.com/blockcoders/harmony-marketplace-sdk
- https://github.com/blockcoders/near-rpc-providers
- https://github.com/athenafarm/athena-vault-contracts
- https://github.com/athenafarm/athena-sdk

### Team personal Githubs

- https://github.com/0xslipk
- https://github.com/fersirni
- https://github.com/RubenGutierrezC

### Team LinkedIn Profiles

- https://www.linkedin.com/in/jarcodallo/
- https://www.linkedin.com/in/fernando-sirni-1931ba122/
- https://www.linkedin.com/in/rubengutierrezc/

## **Get Started**

## Running the service locally
Expand All @@ -62,56 +26,65 @@ Our team has been contributing with different projects in blockchain for a few y

### Install all the dependencies

```
```sh
pnpm i --frozen-lockfile
```

### Configure the environment variables

**Note**: The .env file has the configuration for GraphQL, the PostgreSQL database, Node and the RPC url of the Substrate Blockchain.

```
```sh
cp .env.sample .env
```

<span style="color:#2a98db"> **Service configurations** </span>

- **NODE_ENV**=development
- **PORT**=8080
- **LOG_NAME**=ink-substrate-explorer-api
- **LOG_LEVEL**=debug
#### Service configurations

<span style="color:#2a98db"> **GraphQL configurations** </span>

- **GRAPHQL_DEBUG**=true
- **GRAPHQL_PLAYGROUND**=true
- **GRAPHQL_SORT_SCHEMA**=true
- **GRAPHQL_INTROSPECTION**=true
```sh
NODE_ENV=development
PORT=8080
LOG_NAME=ink-substrate-explorer-api
LOG_LEVEL=debug
```

<span style="color:#2a98db"> **Database configurations** </span>
#### GraphQL configurations

- **DATABASE_HOST**=postgres
- **DATABASE_NAME**=ink
- **DATABASE_USERNAME**=root
- **DATABASE_PASSWORD**=password
- **DATABASE_RETRY_ATTEMPTS**=5
- **DATABASE_RETRY_DELAY**=3000
```sh
GRAPHQL_DEBUG=true
GRAPHQL_PLAYGROUND=true
GRAPHQL_SORT_SCHEMA=true
GRAPHQL_INTROSPECTION=true
```

<span style="color:#2a98db"> **Blockchain and Sync configurations** </span>
#### Database configurations

- **WS_PROVIDER**=wss://rococo-contracts-rpc.polkadot.io
- **LOAD_ALL_BLOCKS**=false - <span style="color:#2a98db"> Set to _true_ to process every block from FIRST_BLOCK_TO_LOAD to the current block. Set to _false_ to only start processing blocks from the last existing block in the database.</span>
```sh
DATABASE_HOST=postgres
DATABASE_NAME=ink
DATABASE_USERNAME=root
DATABASE_PASSWORD=password
DATABASE_RETRY_ATTEMPTS=5
DATABASE_RETRY_DELAY=3000
```

- **FIRST_BLOCK_TO_LOAD**=0 - <span style="color:#2a98db"> Block number from which the service will start to process blocks. (Can be genesis or some other block. For example, the first block supporting contracts) </span>
#### Blockchain and Sync configurations

- **BLOCK_CONCURRENCY**=1000 - <span style="color:#2a98db"> Number of blocks to process concurrently. This can speed up or down the syncing process.</span>
```sh
WS_PROVIDER=wss://rococo-contracts-rpc.polkadot.io
# Set to true to process every block from FIRST_BLOCK_TO_LOAD to the current block. Set to false to only start processing blocks from the last existing block in the database.
LOAD_ALL_BLOCKS=false
# Block number from which the service will start to process blocks. (Can be genesis or some other block. For example, the first block supporting contracts)
FIRST_BLOCK_TO_LOAD=0
# Number of blocks to process concurrently. This can speed up or down the syncing process.
BLOCK_CONCURRENCY=1000
```

### Start a Postgres DB using docker (optional)

To start the project a **PostgreSQL DB** is needed. For that, the **dev-docker-compose.yaml** file already has an image set up ready to use.
Running this command it will also start a container for pgAdmin:

```
```sh
docker-compose -f dev-docker-compose.yaml up -d
```

Expand All @@ -120,7 +93,7 @@ docker-compose -f dev-docker-compose.yaml up -d
The service needs to connect to a Substrate Blockchain. For that, the **dev-docker-compose.yaml** file already has an image set up ready to use.
Run this command:

```
```sh
docker-compose -f dev-docker-compose.yaml up -d
```

Expand All @@ -130,7 +103,9 @@ Another way to run a local node is with [this paritytech guide](https://github.c

### Starting the project (DEV)

- ### `pnpm start:dev`
```sh
pnpm start:dev
```

Runs the service in the development mode.
The service will reload if you make edits.
Expand All @@ -141,39 +116,51 @@ The service will reload if you make edits.

To start both the Back-end service container and the DB container run:

- ### `docker-compose up -d`
```sh
docker-compose up -d
```

### Test

Running the unit tests.

- ### `pnpm test`
```sh
pnpm test
```

Running the test coverage.

- ### `pnpm test:cov`
```sh
pnpm test:cov
```

## Running the Back-end service Docker image

### Download the image from DockerHub

```
```sh
docker pull blockcoders/ink-substrate-explorer-api:latest
```

### Run

- ### `docker run -it -p 5000:5000 --network ink-explorer-network --env-file {pathToEnvFile} blockcoders/ink-substrate-explorer-api:latest`

Verify the image started running
```sh
# Create a docker network
docker network create ink-explorer-network

# Run the service
docker run -it -p 5000:5000 --network ink-explorer-network --env-file {pathToEnvFile} blockcoders/ink-substrate-explorer-api:latest
```

#### Verify the image started running

```sh
docker ps
```

The result should look like this:

```
```sh
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f31a7d0fd6c8 blockcoders/ink-substrate-explorer-api "docker-entrypoint.s…" 15 seconds ago Up 14 seconds 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp funny_lumiere
```
Expand Down Expand Up @@ -620,4 +607,20 @@ In case of a downtime of the node, the subscriptions will be reconnected automat
- 10000 blocks ~ 3 minutes
- 100000 blocks ~ 24 minutes

## Change Log

See [Changelog](CHANGELOG.md) for more information.

## Contributing

Contributions welcome! See [Contributing](CONTRIBUTING.md).

## Collaborators

* [__Jose Ramirez__](https://github.com/0xslipk)
* [__Fernando Sirni__](https://github.com/fersirni)
* [__Ruben Gutierrez__](https://github.com/RubenGutierrezC)

## License

Licensed under the Apache 2.0 - see the [LICENSE](LICENSE) file for details.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ink-substrate-explorer-api",
"version": "1.0.0-alpha.1",
"version": "1.0.0",
"description": "Ink Explorer is an application that provides Ink contracts related information on Substrate based blockchains.",
"author": "Blockcoders <engineering@blockcoders.io>",
"license": "MIT",
Expand All @@ -19,7 +19,7 @@
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/src/main",
"start:prod": "NODE_ENV=production node dist/src/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"lint:ci": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"test": "jest",
Expand Down

0 comments on commit bc08919

Please sign in to comment.