Giter Site home page Giter Site logo

cosmos-middleware-neos's People

Contributors

sirkitree avatar

Watchers

 avatar  avatar  avatar

cosmos-middleware-neos's Issues

Account endpoint

We should have a way to call in account information when passed an account hash

Hash examples:

  • cosmos1lsrl2uzphdzuk0lghrfe0d3rg5k2vf0km8svh6
  • cosmos1yeygh0y8rfyufdczhzytcl3pehsnxv9d3wsnlg

Endpoint should be:

  • /account/[hash]

Account info should contain:

  • account hash
  • balance
    • available
    • delegated
    • unbonding
    • rewards
    • total Atoms
    • USD equivalent based on current conversion rate (eg. ~$15.0000m @ $3.72/Atom)
  • Delegations (validator)

This should also return a list of the last 100 transaction hashes so we can see what transactions are associated with an account.

Transaction info should contain:

  • tx hash
  • tx type [transfer, staking, distribution, governance, slashing]
  • amount transferred

Convert transaction detail log value into json from string

When returning data from the /transactions/:tx endpoint created in #14, there is a value that has nested json string escaped. This causes extra parsing operations to be necessary in Neos causing undue performance and maintenance.

e.g. http://cosmos-middleware-neos.herokuapp.com/transactions/662D7DFA228C0D5BAA58B7801C4CC4A93C4E92CC500A6676FCBA79A02919D9F4

result.tx_result.log =

[{\"msg_index\":\"0\",\"success\":false,\"log\":\"{\\\"codespace\\\":\\\"sdk\\\",\\\"code\\\":10,\\\"message\\\":\\\"insufficientaccountfunds;20453237652uatom\\u003c20453237682uatom\\\"}\"}]"

Please target this in the callback and convert it to json instead of being inside of a string.

Run on heroku

Wanna get this running on Heroku, need to do a little research into how to do that again, perhaps we don't need #1, depending on what we find.

List of Accounts

This can already be done here:
https://sgapiv2.certus.one/v1/accounts?limit=100

This is currently sorted by the amount of value associated to each account, in desc order, limit 20 by default.

I think we can pull in the top 100 for the visual from this as the orbs only change color, size, and position, based on their value, and so this will give us the top 100 richest accounts which we can then change properties on based on this value.

Investment data

The Big Dipper _ Cosmos Explorer by Forbole - Google Chrome 2019-08-10 15 52 47

Create an endpoint that gives us the following data:

  • Price
  • Market Cap
  • Inflation
  • Community Pool

This is shown on the big_dipper application at the top at all times and would be a good re-usable component to display in our worlds.

Transaction Details Endpoint

We need a way to get extra details about a transaction.

Transactions are recorded with a hash, and so the task would be to create an endpoint that would be able to receive a hash and return the details about that hash.

Since addresses are hashes as well, I'm not sure if that should be a separate endpoint or not, but will create another similar issue for addresses.

The endpoint should have the format of something like:
/transactions/[hash]
or in the case where it's easier to have one endpoint for transactions and addresses
/details/[hash]

I'm not sure what all data is available for the details of an address or transaction, so if you can find that out first, and list what details are available, then I can decide if we should just grab everything, or only certain data points to return.

Return format should be in JSON notation.

Update RPC endpoint to SGAPI

The main endpoint we've queried
http://rpc.hub.certus.one:26657
No longer is accessible.

  1. We should swap this out for any other endpoint where we can find the data. I've started by adjusting the /latest endpoint as follows: 52ca6eb
  2. If no data can be found in the other endpoints we have, we'll need to figure out where to grab this data.
  • /latest 52ca6eb
  • /meantime
  • /activevalidators
  • /onlinevotingpower
  • /consensus/height
  • /consensus/round
  • /consensus/step
  • /consensus/proposer_address
  • /consensus/proposer_name
  • /consensus/proposer_url
  • /consensus/proposer_avatar
  • /consensus/voted_power
  • /graph
  • /transactions/:tx

Bug: successful transaction errors

Failed transactions work: http://cosmos-middleware-neos.herokuapp.com/transactions/662D7DFA228C0D5BAA58B7801C4CC4A93C4E92CC500A6676FCBA79A02919D9F4

Successful transactions do not: http://cosmos-middleware-neos.herokuapp.com/transactions/8E0DD606ADFDE81F9871B99EC46C683E59EAA87E1E1EC539EAA201F07D51F153

Log shows:

2019-08-04T20:16:39.619231+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected end of JSON input
2019-08-04T20:16:39.619243+00:00 app[web.1]:     at JSON.parse (<anonymous>)
2019-08-04T20:16:39.619245+00:00 app[web.1]:     at /app/server.js:531:24
2019-08-04T20:16:39.619247+00:00 app[web.1]:     at process._tickCallback (internal/process/next_tick.js:68:7)
2019-08-04T20:16:39.619358+00:00 app[web.1]: (node:23) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
2019-08-04T20:16:39.619465+00:00 app[web.1]: (node:23) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Return JSON Data for random validators

Looks like I can get PolyLogiX to create a JSON parser for me in Neos, so converting this particular endpoint response into JSON instead of just a comma delimited string is now something we can handle! Whoohoo!

Endpoint output format (preliminary thinking)

{
 "validators": [
   {
     "name": "string",
     "image": "string",
     "power": "string",
     "uptime": "string"
   },
   {
     "name": "string",
     "image": "string",
     "power": "string",
     "uptime": "string"
   },
   {
     "name": "string",
     "image": "string",
     "power": "string",
     "uptime": "string"
   }
 ]
}

Append new data to the /transactions endpoint

https://cosmos.bigdipper.live/transactions/57573BF4BF8A86E9EA658AF9FA74688C839AF9A71157DB0E4704620E736447E2

Please find and append all data found on this screen above to the /transaction/:tx endpoint

We have:

  • hash
  • height
  • gas used/wanted
  • error code and text

We're missing:

  • fee
  • value
  • from address
  • to address
  • date

I think the additional information can be found from the block (height)?

Some additional data points:

  • transaction speed

Block endpoint gives us:
eg. http://cosmos-middleware-neos.herokuapp.com/blocks/1000

{
  "blocks": [
    {
      "height": "1000",
      "numTX": 2,
      "proposer": "B1167D0437DB9DF0D533EE2ACDE48107139BDD2E",
      "time": "2019-04-22 18:55:31.515448 +0000 UTC",
      "totalWeight": "120099917",
      "missingWeight": "0",
      "numMissing": "7"
    }
  ]
}

Block Time History endpoint

PolyLogiX is working on something to display a line chart dynamically in Neos. We'll need data for this.

The line graph data that populates this component on https://cosmos.bigdipper.live/ is what we're after here.
The Big Dipper _ Cosmos Explorer by Forbole - Google Chrome 2019-05-14 10 06 30

Tasks

  • figure out where we can get this data
  • create a new endpoint for getting the data for the block time history
  • talk with PolyLogiX to determine what format the Neos component will need the data in

Questions

must have answers before work begins

  1. Will the chart in it's current state be compatible with a JSON formatted response?
    1. Yes, this will accept JSON and the output should be formatted as such.
  2. What format would be best for the JSON response?

New endpoints for random validators

Bounty 1000NCR

image

The big_dipper application has a section on the homepage that lists random validators. I believe these are used as the pool for selecting who will be the next proposer.
The Big Dipper by Forbole - Google Chrome 2019-04-23 20 49 18

I'd like to display something similar in Neos. In order to do that, I'm going to need this data all at once in a comma delimited format, which I can then parse within Neos.

What data?

  • The validator image
  • validator name
  • voting power
  • uptime

What format?

Parsing strings in Neos is non-trivial, so the simpler the better. Return format should be as follows:

name,image,power,uptime,name,image,power,uptime,name,image,power,uptime

Endpoint

The endpoint should be the following uri:

  • /validators/random

How many?

It seems that there are 10 shown on big_dipper so this should be enough for now.

Where is this data?

I'm not sure how to retrieve this data from the REST API, that's why there's a bounty. You'll need to look through the data (please see this project's README for more info) and figure out the best way to get this data and retrieve it.

Transaction details should include the moniker if available

In the transaction details endpoint '/transactions/:tx' we should do a lookup of the address, cross referencing it with validators and turn that address hash into the an object containing the validator's name, logo, and address instead.

List endpoints

When you hit the root of the application, I'd like to list out all of the endpoints as we have them, with a description of what each one does. Sort of like swagger does, but in a simpler format that just gives the address and a description.

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.