Skip to content

Commit

Permalink
Merge pull request #17 from protofire/fix-node-connection-issues
Browse files Browse the repository at this point in the history
Update polkadot dependencies an fix node connection issue.
  • Loading branch information
cmalfesi authored Feb 11, 2021
2 parents e0e42e3 + c92ca1b commit e59bab6
Show file tree
Hide file tree
Showing 13 changed files with 547 additions and 531 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.1.0
Published by **[jarcodallo](https://github.com/jarcodallo)** on **2021/02/11**
- [#17](https://github.com/protofire/polkadot-mempool-explorer/pull/17) Update polkadot dependencies an fix node connection issue.

## 1.0.3
Published by **[jarcodallo](https://github.com/jarcodallo)** on **2021/01/28**
- [#16](https://github.com/protofire/polkadot-mempool-explorer/pull/16) UI Fixes, API Definition and CODE_OF_CONDUCT
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ Displays log output from custom `polkadot-westend` service.

Displays log output from custom `polkadot-main` service.

## Mempool Explorer API Definition

<p align="center"><img src="./assets/swagger.png"/></p>

You can read more about the API Definition [here](https://mempool.dot.protofire.io/api/v1/api-docs).

## Contributing

### Code of Conduct
Expand Down
45 changes: 45 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Polkadot Mempool Explorer API

Mempool Explorer API Definition [api-docs](https://mempool.dot.protofire.io/api/v1/api-docs).

## Environment setup

- Install [Node.js](https://nodejs.org/)
- Recommended method is by using [NVM](https://github.com/creationix/nvm)
- Recommended Node.js version is v12

## Demo

[mempool.dot.protofire.io](https://mempool.dot.protofire.io)

## Custom Polkadot Node

In order to track extrinsics lifecycle. We added a new RPC method ([author_trackExtrinsic](https://github.com/protofire/polkadot-mempool-explorer/blob/develop/api/services/polkadot/custom-rpc-methods.js)) on [Substrate core](https://github.com/jarcodallo/substrate/blob/master/client/rpc-api/src/author/mod.rs).

This basically allows someone to subscribe and track status changes in the extrinsics lifecycle, for example movements getting in or out of queues, and everything that matters for us before including those extrinsics in blocks.

- Substrate change: [github.com/paritytech/substrate](https://github.com/jarcodallo/substrate/commits/master)
- Polkadot dependencies update: [github.com/paritytech/polkadot](https://github.com/jarcodallo/polkadot/commits/master)
- Docker image of the polkadot binary: [hub.docker.com/polkadot](https://hub.docker.com/repository/docker/jarcodallo/polkadot)

## Get Started

In the project directory, you can run:

### `npm start`

Runs the NodeJs service in the development mode.\
Open [localhost:8081/api/v1/api-docs](http://localhost:8084/api/v1/api-docs) to view it in the browser or Postman.

The service will reload if you make edits.

## Mempool Explorer API Definition

<p align="center"><img src="../assets/swagger.png"/></p>


## Endpoints

- `/networks`: Get networks [specs](https://github.com/protofire/polkadot-mempool-explorer/blob/main/api/routes/explorerApiDocumentation.js#L32-L65).
- `/networks/:networkId/reset`: Reset the listener for a network id. [specs](https://github.com/protofire/polkadot-mempool-explorer/blob/main/api/routes/explorerApiDocumentation.js#L66-L95).
- `/transactions/:networkId`: Get transactions by network id. [specs](https://github.com/protofire/polkadot-mempool-explorer/blob/main/api/routes/explorerApiDocumentation.js#L96-L133).
19 changes: 7 additions & 12 deletions api/constants/networks.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
const DEFAULT_NETWORK = {
id: 'polkadot',
name: 'Polkadot',
url: 'wss://cc1-1.polkadot.network',
url: 'wss://rpc.polkadot.io',
};

const LIVE_NETWORKS = [
DEFAULT_NETWORK,
{
id: 'kusama',
name: 'Kusama',
url: 'wss://cc3-5.kusama.network',
url: 'wss://kusama-rpc.polkadot.io',
},
];

const TEST_NETWORKS = [
{
id: 'amber',
name: 'Amber',
url: 'wss://fullnode.amber.centrifuge.io',
},
{
id: 'westend2',
name: 'Westend',
url: 'wss://westend-rpc.polkadot.io',
},
// {
// id: 'rococo',
// name: 'Rococo',
// url: 'wss://rococo-rpc.polkadot.io',
// },
{
id: 'rococo',
name: 'Rococo',
url: 'wss://rococo-rpc.polkadot.io',
},
// {
// id: 'rococo-tick',
// name: 'Rococo Tick',
Expand Down
3 changes: 3 additions & 0 deletions api/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ module.exports = Object.assign({}, variables, {
CACHE_MAX_AGE: variables.CACHE_MAX_AGE || 3600000 * 24, // Default 24 hours
NETWORK_MAX_ITEMS: variables.NETWORK_MAX_ITEMS || 50, // Default 50
DATE_FORMAT: variables.DATE_FORMAT || 'MMM D, YYYY, h:mm:ss A',
WS_PROVIDER_RETRIES: variables.WS_PROVIDER_RETRIES || 5, // Default 10 times
WS_PROVIDER_RETRY_DELAY: variables.WS_PROVIDER_RETRY_DELAY || 5000, // Default 5 seconds
FETCH_PENDING_EXTRINSICS_DELAY: variables.FETCH_PENDING_EXTRINSICS_DELAY || 5000, // Default 5 seconds
});
Loading

0 comments on commit e59bab6

Please sign in to comment.