cosmos-middleware-neos's People
cosmos-middleware-neos's Issues
Should run on port 80
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.
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.
/meantime is slightly different from big dipper's average block time
I noticed that the results we're calculating in the /meantime route are slightly different than what big dipper is calculating. Need to double check this logic.
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.
List of Transactions
This can already be done on the API here:
https://sgapiv2.certus.one/v1/transactions?limit=100
Investment data
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.
- 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 - 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
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.
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
- Will the chart in it's current state be compatible with a JSON formatted response?
- Yes, this will accept JSON and the output should be formatted as such.
- What format would be best for the JSON response?
Create block end point
Similar to the Transactions endpoint in #14 - we should have a block endpoint which gives us details about a block address.
Format should be in /blocks/[hash]
Not sure what all details we get, but it should be at least similar to what we see in big_dipper: https://cosmos.bigdipper.live/blocks/1208314
New endpoints for random validators
Bounty | 1000NCR |
---|
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.
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.
add simple-vc-validator as partner in readme
link to the simply holding hub in neos
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.
new endpoints: consensus state points
We will need data points to represent the current consensus state (as real time as possible):
/consensus/...
- height
- round
- step
- proposer
- votingpower
Discover how these are being gathered in big dipper and reverse engineer into discrete data points in our middleware.
new endpoint: total validators
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.
List of Blocks
This can already be done here:
https://sgapiv2.certus.one/v1/blocks?limit=100
I think we can use this one as it is as well for our visuals. This one gives us a list of blocks with their height in desc order. Our visual shows this in a sort of grid and 100 at a time is good enough.
Then we can call the individual block data from https://sgapiv2.certus.one/v1/block/1291669
One piece of data that would be nice to have with this is the transaction that created it...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.