Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #563

Merged
merged 2 commits into from
Apr 4, 2018
Merged

Docker #563

merged 2 commits into from
Apr 4, 2018

Conversation

NodeGuy
Copy link
Contributor

@NodeGuy NodeGuy commented Mar 20, 2018

Issue

closes: #534

@codecov
Copy link

codecov bot commented Mar 20, 2018

Codecov Report

Merging #563 into develop will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           develop    #563   +/-   ##
=======================================
  Coverage     84.4%   84.4%           
=======================================
  Files           88      88           
  Lines         1488    1488           
  Branches        67      67           
=======================================
  Hits          1256    1256           
  Misses         220     220           
  Partials        12      12

@NodeGuy NodeGuy force-pushed the Docker branch 2 times, most recently from c0b300d to 2843490 Compare March 20, 2018 05:10
@faboweb
Copy link
Collaborator

faboweb commented Mar 20, 2018

Great work, thanks a lot.
Would cd tasks/build && sh ./build.sh also work on Unix as a build command? Without sh it doesn't work on Windows.

@faboweb
Copy link
Collaborator

faboweb commented Mar 20, 2018

I get some strange issues, can someone help me with them?
image

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Mar 20, 2018

Would cd tasks/build && sh ./build.sh also work on Unix as a build command? Without sh it doesn't work on Windows.

Yes.

@faboweb
Copy link
Collaborator

faboweb commented Mar 21, 2018

It works!!! :)
Would it be possible to remove the default --binary so one can set a specific binary? This way we can easily compare build hashes.

One idea: Maybe we can make the script take a git-tag for Voyager and then it pulls the code according to the tag. This could reduce confusion about which commit are we on right now.

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Mar 21, 2018

Would it be possible to remove the default --binary so one can set a specific binary? This way we can easily compare build hashes.

One idea: Maybe we can make the script take a git-tag for Voyager and then it pulls the code according to the tag. This could reduce confusion about which commit are we on right now.

How about replacing --binary with --gaia-commit to specify a commit for Gaia and introducing --commit for specifying a Voyager commit? We shouldn't allow the use of tags because that would open a security hole until we start signing them.

@faboweb
Copy link
Collaborator

faboweb commented Mar 21, 2018

Didn't Greg push for using built binaries? I am OK with --commit for Voyager if that is securer.

Note: I put signing commits on the agenda for next Tuesday. ;)

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Mar 21, 2018

Yes but we can specify which prebuilt binary to use via the commit.

@faboweb
Copy link
Collaborator

faboweb commented Mar 21, 2018

But you would still build Gaia inside the docker?

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Mar 22, 2018

But you would still build Gaia inside the docker?

No, I'll download the prebuilt version similar to this:

wget --output-document=/usr/local/bin/gaia \
  https://tendermint-packages.interblock.io/binaries/gaia_linux_amd64/gaia_${commit}

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Mar 23, 2018

One thing I'm not thrilled about is that we're trusting Interblock and HTTPS with the integrity of Gaia:

RUN wget --output-document=/usr/local/bin/gaia \
  https://tendermint-packages.interblock.io/binaries/gaia_linux_amd64/gaia_$GAIA_COMMIT

Maybe this won't matter when it's all on the same build machine or maybe we want to do something fancy with signing the binaries.

TBD: See if we can add the build step to the CI script.

@NodeGuy NodeGuy force-pushed the Docker branch 2 times, most recently from 47f40e1 to 9f80318 Compare March 23, 2018 06:54
@faboweb
Copy link
Collaborator

faboweb commented Mar 23, 2018

I didn't knew we have Gaia builds for every commit. That is great! Let's do it like this then.

@mappum already implemented building the binaries in docker before. I am not sure if building Gaia is deterministic.

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Mar 23, 2018

Sorry, I was unclear. We don't have Gaia builds for every commit; we have exactly one provided by @greg-szabo. If he builds another one then we can specify that too. Originally I was building Gaia in the container and we could have done it for any arbitrary commit but @greg-szabo objected.

@faboweb
Copy link
Collaborator

faboweb commented Mar 23, 2018

Then I suggest we go with --binary first and migrate when we have "Gaia" (or what will follow) on every commit. What do you think?

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Mar 23, 2018

So you want the user to be able to provide their own arbitrary version of Gaia? I think that would go in the opposite direction of making the build more deterministic.

Let's get @greg-szabo into this conversation. Greg, what are your thoughts?

@faboweb
Copy link
Collaborator

faboweb commented Mar 24, 2018

Not an arbitrary Gaia build but a Gaia build that is shareable and has a fixed checksum. The purpose is, that different people on different computers can build Voyager and still create the same hash in the end so we can prove that the builds we ship have no malicious code in it.

For development we can always fall back to the installed Gaia/SDK.

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Mar 26, 2018

Ah, OK. That's exactly how it is now in this pull request.

@greg-szabo
Copy link

Ok, I was able to get through the conversation. Great work. Some notes for clarity:

  1. interblock.io is ours, I manage the DNS, the certificate, and the website. We don't have to worry about trust there (apart from regular paranoia). Eventually, we could move it to packages.tendermint.com or Nexus/Artifactory for better artifact integrity. (And zip it too.)
  2. I think the --binary option makes sense. It should accept a binary on your local machine (built by the dev or automation). In that case, it's easy for developers to add any random gaia binary for testing. Automation deals with downloading binaries from the repository separately. (So, automation will also have a local version of the binary.) For what it's worth, the whole wget part should not be needed or be done separately outside of the container.
  3. I still don't really get in a lot of cases why we build Docker containers though. The binary could be added as part of a volume so we don't rebuild the container for each and every new binary. I think we're abusing docker in a lot of cases. (Thoughts for a later discussion.)
  4. Automation is coming along well, I should be able to create gaia binaries for the repository quite easily. Eventually, it will be automated for every PR and we can have a manual trigger for any branches that you come up with.
  5. Voyager CI/CD is not that far along, yet. :(

@faboweb
Copy link
Collaborator

faboweb commented Mar 27, 2018

@greg-szabo

  1. I don't think we should trust anything, not even ourselves.
  2. For deterministic builds we need deterministic environments. Docker is the logical solution I guess. Do you have another solution?
  3. Not a problem. If this will get important to use, we will push you and/or help you implement this.

name: Add Gaia
command: |
sudo wget https://www.dropbox.com/s/vkyuut8hnzse614/gaia-0.5.0-linux-32?dl=1 -O ~/repo/gaia
sudo wget https://tendermint-packages.interblock.io/binaries/gaia_linux_amd64/gaia_decb23bed0179244e4f42d697dcd4bf759200a2d -O ~/repo/gaia
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I uploaded this myself as there was nothing there when I implemented it.

tasks/release.js Outdated
console.error(`\x1b[31mPlease specify a gaia binary for this platform using the "--binary" flag
Example: npm run build:darwin -- --binary=./gaia
Example: node tasks/release.js --binary=./gaia
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be yarn run build --platform=darwin --binary=./gaia?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, yarn run build and node tasks/release.js are two different processes with two different sets of arguments. yarn run build creates a Docker container and runs node tasks/release.js within it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok cool. But wouldn't the dev be confused, if he did a mistake in yarn run build and gets a recommendation about node tasks/release.js? How about catching this error in the build script then?


# Download Gaia.
RUN wget --output-document=/usr/local/bin/gaia \
https://tendermint-packages.interblock.io/binaries/gaia_linux_amd64/gaia_$GAIA_COMMIT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we still download Gaia by commit?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still downloads if I specify the binary at least and this is only the linux binary. I think this could confuse devs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the commit is used to identify the Gaia version.

We want only the Linux binary because it's executed in the (Linux) Docker container.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understand. I was under the impression, that the docker container isn't executing Gaia but it is just adding it to the files that get bundled into Voyager for each specified platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, you're right of course! I'll fix that.

README.md Outdated
yarn run build 0.4.3 --platform={darwin|win32|linux}
```

You can specify a commit hash for the version of Gaia to use if it has been prebuilt:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we agree, that devs need to provide a build Gaia binary? Shouldn't the documentation reflect that? Maybe we can also add why we chose to do it that way.

README.md Outdated
open builds/Cosmos-{platform}-x64/Cosmos.app
```

When you are testing the build system you can skip the repackaging of the JS files.
```bash
$ yarn run build --platform= --{darwin|win32|linux} --skip-pack --binary=...
$ yarn run build 0.4.3 --platform=darwin --skip-pack
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the here specified version used somewhere? What do you think about taking it from the package.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a version, it's a commit reference. It's explained a few lines earlier in the README:

The first argument is a commit for Voyager (e.g., the tag 0.4.3). Optional
arguments (such as --platform) must come afterwards.

I added this in response to your request:

Maybe we can make the script take a git-tag for Voyager and then it pulls the code according to the tag.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying this.

README.md Outdated
Build the app:

The first argument is a commit for Voyager (e.g., the tag `0.4.3`). Optional
arguments (such as `--platform`) must come afterwards.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if --platform is optional, then we need to detect the OS of the dev I think. I would prefer making it mandatory so the dev knows for what he is building. The build process will in most cases be cross-platform I guess.

Copy link
Contributor Author

@NodeGuy NodeGuy Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If --platform isn't specified then it uses the default that was already in the code: darwin,linux,win32. Do you want me to remove the default so that it's mandatory?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not possible to have a default platform. The binary is OS specific. I think it is a mistake it is still in there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that makes sense.

@@ -104,6 +104,33 @@
"js-tokens": "3.0.2"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about removing the package-lock.json? Having it could create confusion for devs as we have the yarn.lock as our primary lock file. I think a yarn would not update the package-lock.json, am I right?

Copy link
Contributor Author

@NodeGuy NodeGuy Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was added by @jolesbi in dfe698d. Yarn does not update package-lock.json and I just added a new commit to remove it.

@NodeGuy NodeGuy force-pushed the Docker branch 2 times, most recently from 7bc63fb to 6829959 Compare April 3, 2018 14:51
@NodeGuy NodeGuy changed the title WIP: Docker Docker Apr 3, 2018
@NodeGuy NodeGuy force-pushed the Docker branch 6 times, most recently from 35581af to 5929257 Compare April 4, 2018 01:27
@nylira
Copy link
Contributor

nylira commented Apr 4, 2018

Update: The error was a typo on my end. I didn't add the equal sign between --gaia and $GOPATH. Whoops.

@nylira
Copy link
Contributor

nylira commented Apr 4, 2018

I've built Voyager for all three platforms using this Docker branch and gaia-0.5.0 binaries. Here are their hashes:

Cosmos Voyager-darwin-x64_0.4.3.tar.gz SHA256: 
b7602e20b483d088456bc83dd5261c277d43f49c58fec24ad43a51a33e0008ad

Cosmos Voyager-win32-x64_0.4.3.zip SHA256: 
7bfdb84278cdd26fb110bc9dc31489461b1060ed00c637be01dd761c9e7c7f6e

Cosmos Voyager-linux-x64_0.4.3.tar.gz SHA256: 
c995e44dc972a35bd6229583b7943ccae36f1a943b8cedea5a90482cc8798a7c

If we can reproduce these hashes -- sweet. I ran the darwin version and it works. I did not have time to test running the Linux and Windows versions.

@faboweb
Copy link
Collaborator

faboweb commented Apr 4, 2018

Which version of Gaia did you use?
Could you send me the Windows binaries to test?

@nylira
Copy link
Contributor

nylira commented Apr 4, 2018

@faboweb I just posted links to Gaia 0.5.0 in Slack.

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Apr 4, 2018

Here are my hashes, using the Greg-approved Gaia binaries:

$ yarn run build --commit=4f23fdc03b1a2055bd42e2ce431442d822bdd935 --gaia=../gaia/darwin --platform=darwin

Zip successful! /usr/src/app/builds/Cosmos Voyager-darwin-x64_0.4.3.tar.gz SHA256: 5abe9966a6b60cdbead281e3488d5ad87c1a4073c6ca730f16a42427ee9175c8

$ yarn run build --commit=4f23fdc03b1a2055bd42e2ce431442d822bdd935 --gaia=../gaia/linux --platform=linux

Zip successful! /usr/src/app/builds/Cosmos Voyager-linux-x64_0.4.3.tar.gz SHA256: fa7e2fe767f6e7f3f0855ba2e227623fbb8e81b5da848ef6cd0b474317988be1

$ yarn run build --commit=4f23fdc03b1a2055bd42e2ce431442d822bdd935 --gaia=../gaia/win32 --platform=win32

Zip successful! /usr/src/app/builds/Cosmos Voyager-win32-x64_0.4.3.zip SHA256: 53f6402578c918d3d6a80166f80db9b772926ce2c883db4ad21310a151232358

@nylira
Copy link
Contributor

nylira commented Apr 4, 2018

Here are my hashes, using the Greg-approved Gaia binaries:

Zip successful! /usr/src/app/builds/Cosmos Voyager-darwin-x64_0.4.3.tar.gz SHA256: 5abe9966a6b60cdbead281e3488d5ad87c1a4073c6ca730f16a42427ee9175c8

Zip successful! /usr/src/app/builds/Cosmos Voyager-linux-x64_0.4.3.tar.gz SHA256: fa7e2fe767f6e7f3f0855ba2e227623fbb8e81b5da848ef6cd0b474317988be1

Zip successful! /usr/src/app/builds/Cosmos Voyager-win32-x64_0.4.3.zip SHA256: 53f6402578c918d3d6a80166f80db9b772926ce2c883db4ad21310a151232358

The hashes are exactly the same. Awesome job @NodeGuy 🥇

@nylira nylira merged commit 08d008a into develop Apr 4, 2018
@nylira nylira deleted the Docker branch April 4, 2018 20:35
@faboweb
Copy link
Collaborator

faboweb commented Apr 4, 2018 via email

@faboweb
Copy link
Collaborator

faboweb commented Apr 5, 2018

I get the same hash! :)

@faboweb
Copy link
Collaborator

faboweb commented Apr 5, 2018

It works on Windows.

@NodeGuy
Copy link
Contributor Author

NodeGuy commented Apr 5, 2018

Yay yay yay!

faboweb added a commit that referenced this pull request Jun 2, 2020
* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

* load rewards

* steps towards storing the rewards

* fix era format

* fix validator in row needs to be address

* fix gql query

* format bug

* some refactoring

* fix missing await

* correctly get api

* push validator getter inside sources

* added address to lunie reward internaly

* add address correctly

* fix variable naming

* filter empty rewards

* add height from rewards

* fixed tests

* also fixed terra getRewards here

* Update lib/block-listeners/polkadot-node-subscription.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* remove dead code

* fix stuff

* fix operatorAddress of undefined

* readded vanished code

* don't store validatorAddress

Co-authored-by: mariopino <info@quequiereshacer.es>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>
faboweb added a commit that referenced this pull request Jun 2, 2020
* enable account creation for some networks (#252)

* network update time metric added (#256)

* network update time metric added

* added missing dep

Co-authored-by: Fabian <frznhope@gmail.com>

* Fix proposal deposit (#261)

* Remove denom handling from getDeposit()

* Revert undesired change

* delete package-lock.json

* localtestnet config change (#265)

* Ana/handle "address not from this network" error (#263)

* add check address function for all queries

* apply suggestions

* Ana/add fiatvalue to balances query (e-Money) (#262)

* preparation

* more preparation

* add fiatvalue field to balances query

* fix get account info

* apply suggestions

* apply one last suggestion

* suggestions+

Co-authored-by: Fabian <frznhope@gmail.com>

* Ana/emoney fix expected returns with inflation and totalbacked (#243)

* fix expected returns with inflation and supply

* minor fixes. dictionary

* query exchange rates from emoney api

* fix infinite expected returns

* convert api url to const

* add eur value to totalbackedvalue. totalngm gains

* add important comment

* finish calculation

* lint

* catch errors with sentry

Co-authored-by: Fabian <frznhope@gmail.com>

* readd coin conversion (#268)

* delete amount field (#274)

* Fabo/increase gas again (#271)

* icrease gas again

* fixed test

* Fabo/load all txs (even if more then first page in response) (#270)

* load all txs (even if more then first page in response)

* improved handling of txs

* missing renaming

* fixed paginated load

* add pagination fix also to cosmosV0-source

Co-authored-by: iambeone <iambeone@gmail.com>
Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fixing issue with multiple senders in one event (#273)

* fixing issue with multiple senders in one event

* Update lib/source/cosmosV2-source.js

Co-authored-by: Fabian <frznhope@gmail.com>

* Fabo/allow signing for terra + emoney (#267)

* allow signing for terra

* readd coin conversion

* enable actions for terra

* fix correct terra testnet url

* comments and guards

* enabled more txs for emoney and fixed broadcasting

* added a catch for wrongly formatted broadcast urls

* recover default field. change some network titles (#277)

* Fabo/add network data to API (#278)

* non desctructive introduction of better address prefix wording

* added address creator to API

* adjusted test

* added ledger app to networks config

* add icon property to schema (#281)

* add icon property to schema

* fix network schema validation

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* filter out validator specific txs (#279)

* Ana/balances coinreducer good fix (#269)

* balances coinreducer good fix

* refactored fiat value logic

Co-authored-by: Fabian <frznhope@gmail.com>

* Create network_integration.md

* Update network_integration.md

* Update network_integration.md

* Fabo/avoid 500 errors (#288)

* avoid using the latest query

* cleanup

* Ana/filter validator tx cross network and add txvalue reducer (#285)

* filter validators cross network

* add value reducer. necessary for multi claim txs

* add validator txs filter also for cosmosv0 source

* filter and make array only claim rewards msg value

* filter txs by whitelist

* change length in multi claim reward reducer

* add withdrawvalidators

* replace dictionary for set

* refactor transaction snippet. avoid repetition

* Ana/emoney upgrade (mergeable) (#282)

* update emoney api_url

* fix denom. add default fiat currency

* fix rpc endpoint

* fix value (my bad) (#293)

* fix value (my bad)

* trigger another ci flow

* erase space

* set correct new chain id (#294)

* restart API

* restart API

* fix pr alert (#297)

* Fabo/298 tendermint reconnect (#300)

* reconnect on tendermint disconnect

* cleanup

* comments

* Update cosmos-node-subscription.js

* Fabo/299 trigger a chain hangup error (#301)

* trigger a chain hangup error

* increase chain hangup time

* Apply suggestions from code review

* Fabo/store validator addresses (#296)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* add clearTimeout to avoid reconnection hell (#306)

* add clearTimeout to avoid reconnection hell

* removed console.log

* Aleksei/luniedb replaced (#303)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* replaced luniedb

* linted

Co-authored-by: Fabian <frznhope@gmail.com>

* disable reconnection logic

* clear polling interval for tendermint connection

* simple api fixes (#310)

* Fabo/remove tendermint (#311)

* remove tendermint

*  fixed empty blockHeight issue

* small refactoring

* catch on fetches to get logging

* delay block updates

* add retry logic

* refactored getBlockByHeight

* remove pm2 dep

* validator profiles were returned as array (#312)

* remove pr github action (#316)

* fixing caching issue and more (#315)

* fixing caching issue and more

* clear chain hangup timeout

* timeout fixed

* Update lib/block-listeners/cosmos-node-subscription.js

Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* added terra_mainnet to networks (#309)

* added terra_mainnet to networks

* errors fix reverted

* Ana/add multidenom rewards. necessary for emoney (#308)

* add multidenom rewards. necessary for emoney

* add rewards to overview. improve code location

* lint

* add filter rewards for multidenom

* important fix

* another important fix

* fix cannot read propery constructor of undefined (#318)

* change terra mainnet title

* pushing something to trigger new build and to restart the node

* trying out nylira's node

* WIP: Ana/More Terra fixes (#323)

* fixing my mess

* move all rewards logic to terra

* clearly signal single denom rewards

* Revert "WIP: Ana/More Terra fixes (#323)" (#325)

This reverts commit 408186a.

* catch inside block polling function (#327)

* Fabo/disable writing validator addresses for now (#329)

* disable writing validator addresses for now

* linted

* flushing http cache (#332)

* Transaction abstraction schema (#333)

* tx abstraction proposal using union

* Use Coin type

* Cleanup, TransactionV2

* Cleanup, not multisend tx

* Unsupported tx (like multisend) don't have details

* Fabo/switch to docker swarm mode (#330)

* swtich to docker swarm mode

* typo

* Update .github/workflows/development.yml

* Ana/more terra fixes (***THE COMEBACK***) (#324)

* fixing my mess

* move all rewards logic to terra

* clearly signal single denom rewards

* error structure has changed. need to look into it

* also return denom for single denom rewards

* manage errors properly

* delete comments

* Update lib/reducers/terraV3-reducers.js

* loop through transaction messages

* doing crazy stuff

* rewrite the crazy bit

Co-authored-by: Fabian <frznhope@gmail.com>

* cosmosv0 was missing the retry logic (#334)

* add back validator to db logic (#335)

* path_prefix added to network data (#338)

* path_prefix added to network data

* path_prefix replaced to slug

* tests fixed

* remove regen (#337)

Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* Fabo+Mario/transaction abstraction (#336)

* draft for transaction abstraction

* use lunie message types

* Add supported tx types

* WIP

* Draft new reducers

* Fix msg types

* Need to resolve type for TransactionDetails union

* debug resolver

* lint

* Fix

* Cleanup

* fix some union issues

* Almost done

* Small fixes

* Add userTransactionAddedV2

* Add userTransactionAddedV2 to resolvers

Co-authored-by: Mario Pino <info@quequiereshacer.es>

* emoney fixes for fiatvalue (#345)

* emoney fixes for fiatvalue

* refactor with coinreducer

* speaking functions are your friends

* refactor ugly nested code

* lint

* add denoms lookups for terra and emoney (#346)

* Ana/add only tokens gas prices 2nd attempt (#344)

* add terra and emoney gas price. terra reducer

* delete fiatvalue from get balances in cosmos

* add emoney reducer

* hyper important emoney fixes

* fix for emoney denoms

* change gas price to micro units

* add emoney denoms to denomlookup

* transform to microunit also for terra tokens

* return null for emoney gas prices

* add harcoded gas prices

* correct emoney hardcoded values

* hardcoded terra gas prices. not working

* update hardcoded values to working ones

* delete unrelated changes to gas prices

* apply suggestions except coinreducer

* they call me mr coinreducer

* change amount for price. add gas price reducer

* change naming in gas price reducer

* add error message

Co-authored-by: Fabian <frznhope@gmail.com>

* fix rewards denoms (#351)

* updating image on deploy (#352)

* fix my mess once more (#353)

* Ana/add gas prices to other networks (#350)

* add gasprices to cosmos

* format gas prices to three decimals

* Apply suggestions from code review

* Update lib/reducers/cosmosV0-reducers.js

Co-authored-by: Fabian <frznhope@gmail.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* added a tx success push, fallback (#354)

* fix cosmos gas price (#355)

* fix terra for new tmbalance (#358)

* Fabo/new emoney rewards (#357)

* intent to fix the emoney rewards

* intent to fix emoney rewards

* simplified code

* comments

* hack to fix reduce function

* eligable -> eligible

* correct reducer fix

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* Aleksei/prevent constant db calls (#304)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* prevent constant db interaction

* stored object structure changed

* remove nesting in validators

* filter validators list

Co-authored-by: Fabian <frznhope@gmail.com>

* limit txs pages load by two pages per request (#314)

* limit txs pages load by two pages per request

* delete block from loadpaginatedtxs

* small fixes

* Update lib/source/cosmosV2-source.js

* linted

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian <frznhope@gmail.com>

* linted

* linted

* Fabo/Use figment nodes (#362)

* use api keys

* add env variables for nodes

* hard code api keys (#365)

* fix ngm fiatvalue (#361)

* hardcoded urls fix (#366)

* WIP: Improve TransactionV2 implementation (#349)

* Add from field to SendTx type

* add amount to claim rewards transactions

* convert to units in string coin reducer

* fix typo

* add multidenom string coinreducer for claim amount

* Add UnknownTx to schema

* Add BlockV2 type which returns TransactionV2 txs

* Add blockV2 query that returns TransactionV2 txs

* kill handling claim rewards amount

* Update lib/reducers/cosmosV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update lib/reducers/cosmosV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Cleanup

* lint

* Support claim rewards from multiple validators

* Fix, cleanup

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian <frznhope@gmail.com>

* Aleksei/fix db insert (#367)

* fixed insert function to allow empty schema

* Aleksei/statistics in the api (#364)

* collecting statistics in the API

* small fixes

* fixes

* changing address to key in clearOverviewedAddresses

Co-authored-by: Aleksey Rudometov <iambeone@gmail.com>

* add pageNumber to schema (#370)

* add pageNumber to schema

* file wasn't saved

* trigger ci

* added pagination to tx v2 api (#372)

* Together with 3584: Ana/change fiatvalue to object (#360)

* change fiatvalue to object

* handle when selected currency is eur

* include ngm fiatvalue fix

* Ana/amount in claim rewards in transactions v2 (#373)

* bring amount in claim rewards back to life

* change to regex

* simplify

* make the regex understandable

* Ana/add powered to networks (#377)

* add powered by

* more logical powered

* add provider address for avatar

* fix powere validation

* Fabo/add network-type for selecting addrss and signing (#378)

* add network-type for selecting addrss and signing

* adjust according to new network_type param

* add network type to network schema

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fix staking denom (#379)

* fix terra balances and overview (#380)

* Fabo/allow to query experimental networks (#382)

* all to query experimental networks

* fix old small typo

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* First steps to integrate Polkadot (#376)

* Add polkadot-testnet in networks.js

* Install polkadot-api, polkadot-node-sub. draft

* lint

* lint

* lint

* add polkadotV0 source

* add address creator

* Update data/networks.js

Co-Authored-By: Jordan Bibla <jbibla@gmail.com>

* Update data/networks.js

Co-Authored-By: Jordan Bibla <jbibla@gmail.com>

* blocks, events

* Cleanup

* polling instead subscription

* husky

* updateDBValidatorProfiles

* no wait for block data fetching, kind of stable

* Add reducers file

* block subscription works!

* Cleanup, fix memory leak

* lint, node

* comment

* Handle polkadot chain reorgs

* Cleanup

* Optimization, cleanup

* Optimization

* fixes, validators query working, cleanup

* comment

* lint

* fix block time

* handle polkadot chain hangups

* cleanup

* validator reducer

* lint

* wip

* calculate and include a bunch of validator fields

* add bech32_prefix address_prefix to networks.js

* add 1 space so we dont break tests

* remove chain reorg handling, more stable

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian <frznhope@gmail.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* transactions loading time reduced (#383)

* transactions loading time reduced

* increased page number

* add loki to docker-compose (#385)

* add network type (#386)

* removed livepeer from running in API (#390)

* set polkadot to disabled (#392)

* Ana/add totalstake-fiatvalue to Overview (#384)

* add totalstake fiat value to overview

* fix amount in totalstake fiatvalue

* make new code more readable

* Update lib/reducers/cosmosV0-reducers.js

* refactor unit conversion

Co-authored-by: Mario Pino <info@quequiereshacer.es>

* disable polkadot (#395)

Co-authored-by: Fabian <frznhope@gmail.com>

* Fabo/terra returns (#389)

* better error logging

* add result selector to query

* split emoney getAllValidators from Terra

* add expected returns querying to terra

* filter out empty returns

* remove not used code

* missing return

* limit decimals

* fix not found in terra testnet

* temporary hacks

* Revert "temporary hacks"

This reverts commit 88d0918af70489422d6d5d84909df1186a23fa1c.

* Revert "fix not found in terra testnet"

This reverts commit 19a4eca6eb4a9eb2050b368b270d4a39847e016a.

* add terra testnet api

* switch to show all decimals

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fix all fiat values to 2 decimals (#399)

* Ana/correct terra denoms (#398)

* correct terra denoms

* variable renaming

Co-authored-by: Fabian <frznhope@gmail.com>

* Ana/add fiatvalue in rewards (#396)

* add fiatvalue to rewards

* add fiatcurrency to rewards query

* handle unsupported fiat currencies

* apply suggestions

* delete never used delegations parameter (#404)

* fix terra getrewards and gas prices (#409)

* reactivate kusama (#411)

* Ana/fix repeated claim rewards transactions in transaction abstraction (#400)

* fix terra repeated claim rewards transactions

* much better fix

* add claim rewards messages aggregator

* try to apply suggestion

* also not working

* working 🎉

* change name and add comment

* improved implementation by aggregating the claim messags correctly

Co-authored-by: Fabian Weber <frznhope@gmail.com>

* disable polkadot once more for release (#412)

* readd memory limit (#413)

* Use polling instead subscription in Kusama (#406)

* uncomment polkadot

* bug fixes

* pollForNewBlock

* mod getBlockHeight

* add again commented api disconnect to not forget

* enqueueAndPublishBlockAdded

* re-subscribe on error

* stringify error

* stringify errors

* api.isReady

* Add delay to newBlockHandler

* Ana/add balances to kusama (#405)

* rudimentary balance

* add some comment

* Ana/switch polkadot to rest calls (#408)

* add rewards and overview functions. not working

* poll instead of subscribe to blocks

* switch over to http provider

* fix lint errors

* use httpprovider

* getting last block hash

* get blockhash and header. but no height

* back to normal. use mario node subscription

* successfully get block height polling with http

* get block hash from http. use polling

* uncomment all other networks

* pass the store to source classes

* create the api only once

* comment api.disconnect()

* added polling fix and quick querying

* fixed block height query

* clean up

* comment

* cleanup and optimization

Co-authored-by: Fabian Weber <frznhope@gmail.com>
Co-authored-by: mariopino <info@quequiereshacer.es>

* remove unused dependency

Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian Weber <frznhope@gmail.com>

* deactivate polkadot

* trigger deploy

* trigger CI

* swtich to newer caddy version

* activate polkadot again

* deactivate again

* Proposal to enable Kusama network (#424)

* working state

* cleanup

* getBlockHeight()

* update polkadot-api (#423)

* fixing node_exporter call in Caddyfile (#418)

* fixing send amount in statistics (#419)

* fixing send amount in statistics

* denom fixed

* fix validator as selected fiat bug (#415)

* Ana/correct terra denoms in activity (#425)

* correct fix terra denoms in activity

* delete correct terra denom as not needed

* Ana/fix amount null in claim rewards (#416)

* fix amount null in claim rewards

* small refactor

* apply suggestion

* add release script to api (#426)

* Add self stake to validators query (#433)

* add self stake

* Update lib/reducers/polkadotV0-reducers.js

Co-Authored-By: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* lint

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* fix emoney balances denoms (#436)

* [Polkadot] Add delegations query (#435)

* first step, simplified query is working

* lint

* Get validator info from val dictionary

* cleanup, fix comission

* fix

* faster solution

* remove types we dont need in store

* @ALEKSEI suggestions

* fix

* fix

* simplify as @imbeone suggested

* simplify, thanks @Bitcoinera!

* re adding array check

* delegationReducer

* fix

* Ana/update polkadot balances (#441)

* update polkadot balances

* structs are strange

* change comment

* disable kusama

* disable kusama

* Ana/427 polkadot single validator query (#440)

* save validators with operatoraddress as key

* add check to wait to fetch validators

* Update lib/resolvers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update lib/resolvers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* lint

* fix delegations

Co-authored-by: Fabian <frznhope@gmail.com>

* Add denom decimal places to networks.js (#434)

* lint

* add decimals places, refactor POLKADOT_CONVERSION

* add to schema

* add to tests

* refactor with @faboweb suggestions

* fix

* fix

* fix

* cleanup

* apply suggestions

* fix balances

* add factor properly to network

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* fix totalstake fiatvalue only returning euro (#442)

* Fix commission for validators in Polkadot network (#447)

* fix commission

* comment

* Fix expectedReturns for validators in Polkadot network (#446)

* fix expectedReturns

* change -- for null in getrewards and returns

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Ana/emoney validators load optimization (#430)

* just for testing. hang up on validatorssets latest

* fix emoney validators load

* resolve conflict

* remove experimental line

* linted

* Fabo/polkadot overview (#450)

* add first steps towards overview

* correct total

* fixed total

* fix getaccountinfo is not a funciton

* delete hardcoded node rpc url

* endpoint back to normal

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* change polkadot node back to paritys one (#453)

* Bump acorn from 5.7.3 to 5.7.4 (#454)

Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](acornjs/acorn@5.7.3...5.7.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fabo/improve delegations (#455)

* improve delegations

* removed timer

* add hack for accounts with no nominations

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* update polkadot api to latest (#456)

* updated minimist (#457)

* add empty getundelegations for polkadot (#458)

* Update polkadot api to v1.7.1 (#465)

* Ana/fix calculatefiatvalue when fiatcurrency not set (#462)

* fix calculatefiatvalue when fiatcurrency not set

* improve fix and comment

* linted

* Upgrade @polkadot/api to v1.8.0-beta.1 (#471)

* Add intention validators in Polkadot network (#468)

* Add timer to getAllValidators()

* Fetch intention addresses for current session

* wip

* Add validators

* working! getAllValidators exec time less than 10s

* fix status

* Cleanup

* fix free balance (#474)

* Fix delegations query in Polkadot network (#475)

* fetch delegations from stored valid. staking info

* Simplify

* Cleanup

* tx type in v2 subscriptions changed to TransactionV2 (#476)

* Ana/add new release script copying fe (#479)

* add new release script copying fe

* add node executor to circleci

* add aliases for circleci

* missed one alias

* change uluna gas price to recommended one (#481)

* fixing claim rewards pubsub publishing (#480)

* fixing claim rewards pubsub publishing

* only get stakingDenom once

Co-authored-by: Fabian Weber <frznhope@gmail.com>

* Fabo/fix failed txs parsing (#486)

* publish v2 txs and fix failed txs parsing

* linted

* Fabo/add logs to txs v2 (#487)

* add logs to txs v2

* better logic

* michiel/move yarn test to separate step for circleci (#482)

* migrate test.yml github workflow to circleci config.yml

fix executor from web to node

* remove test.yml workflow file

* refactor address extraction into reducers (#488)

* add polkadot prefix (#489)

* add polkadot prefix

* change address prefix to be a number

* Fabo/broadcast polkadot txs (#461)

* first steps to broadcast polkadot txs

* remove package-lock

* fixed api init

* remove debugger

* working broadcasting

* working

* ignore polkadot in tests

* Update lib/controller/transaction/index.js

Co-Authored-By: Jordan Bibla <jbibla@gmail.com>

Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* Fabo/wait for data ready (#497)

* allow to wait for data to be ready

(cherry picked from commit 744d9b3b445286a9637fdadbeb5c473165cec58e)

* wait for data to be ready

(cherry picked from commit b6d665fd88ae22e5e3753249f27730eb12faebcb)

* keep store in cosmos source

(cherry picked from commit a6bb9f023eb56fb57d9a0f3a3ae12c997f6d04e3)

* Update lib/resolvers.js

* adds key to identify and sort txs (#492)

* improve blockHandler logic (#498)

(cherry picked from commit b67fab47adbf5a19caf99e17a9395e62419e8dad)

* Fabo/enable terra governance (#501)

* enable terra governance

* also enable proposals in terra testnet

* Ana/send all claimed rewards to fe (#493)

* send all claimed rewards to fe

* refactor reward coin reducer

* Fabo/allow single network run (#495)

* allow running a single network

* readme

* apply fix in networks

* Update lib/apollo.js

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Ana/refactor network capabilities (#502)

* refactor network capabilities

* refactor to have just a dictionary

* fix terra testnet. deleted accidentally testnet

Co-authored-by: Fabian <frznhope@gmail.com>

* Fabo/fix emoney reward precision (#504)

* fix emoney rewards precision

* comment

* remove polkadot log spamming

* add logging for failing tx parsing

* more kusama log removal

* Fabo/improve emoney loading (#494)

* allow to wait for data to be ready

* wait for data to be ready

* improve blockHandler logic

* keep store in cosmos source

* centralize emoney exchange queries

* fixed balances nto available

* precalculate all exchange rates

* remove mock values

* add sentry to nested block handler

* linted

* keep old emoney tokens for now

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* fix transaction log parsing

* better debugging

* prevent transactionReducerV2 from returning undefined (#508)

* prevent transactionReducerV2 from returning undefined

* Update lib/reducers/cosmosV0-reducers.js

Co-Authored-By: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* linting fix

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fix one more log parsing issue

* WIP Ana/make estimate a query (#509)

* first attempt for estimate

* fix estimate schema

* lint

* Polkadot send transaction extraction (#500)

* tx logic draft

* fix lint

* wip

* lint

* working for send tx type

* should work publishing send tx!

* correct data is being passed to publishers

* cleanup

* working with extrinsics

* implement coin reducer

* Update lib/reducers/polkadotV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update lib/reducers/polkadotV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

Co-authored-by: Fabian <frznhope@gmail.com>

* Ana/add emoney mainnet (#511)

* first preparations

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* add correct chainid

* add validators poller for release

* check emoney mainnet validators recursively

Co-authored-by: Fabian <frznhope@gmail.com>

* fix no iterable for claimrewards amounts (#515)

* emoney mainnet is mainnet (#517)

* remove emoney release hack (#520)

* fix emoney mainnet expected returns (#522)

* useless console.log removed (#519)

* update emoney ngm gasprice (#525)

* Michiel/make clear separation between v0 and v2 reducers (#530)

* Replace transactionReducer with v2 for pollTransactionSuccess

* Replace transactionReducer with v2 for pollTransactionSuccess

* Fix structure

* Make clear seperation between v0 and v2 reducers

* Fix problem publishing transaction

* Fix pollTransactionSuccess

* Fix pollTransactionSuccess

* Ana/fix claim rewards denom for terra and emoney (#534)

* fix claim rewards denom for terra and emoney

* fix again

* Ana/fix expected returns cosmos and emoney (#536)

* fix expected returns for cosmos and emoney

* add missing property in type validator

* delete delegatorshares from type validator

* Ana/add gas estimates query (#503)

* add network fees query

* fix schema

* refactor using networkid with hyphens

* return only estimate for a transaction type

* add gas estimates to network object

* remove network fees from queries

* revert last two commits manually

* add default to network gas estimates

* apply suggestion

* michiel/remove reducer v0 (#535)

* Remove reducer v0

* Update cosmosV0-source.js

* linted

Co-authored-by: Fabian <frznhope@gmail.com>

* comment instructions on github templates (#539)

* Ana/fix gasestimate query and raise terra default gas estimate (#538)

* fix networkfees query

* raise terra default gas estimate

* Michiel/add akash portfolio (#541)

* first steps

* Integrate validators feature for akashv0

* Simplify extending Cosmos logic

* Remove unused imports

* Uncomment networks

* Enable portfolio for Akash

* Commnet livepeer mainnet network

* Commnet livepeer mainnet network

* fix validators expected returns

* apply code review

* use proper reducers

* add gas prices

* fix totalstake and delegation in general

* fix api_url

* correct staking denom to cosmossdk default for now

* add also default stake gas price

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Michiel/add Akash validators (#540)

* first steps

* Integrate validators feature for akashv0

* Simplify extending Cosmos logic

* Remove unused imports

* Uncomment networks

* Commnet livepeer mainnet network

* fix validators expected returns

* apply code review

* Fix version transactionsByHeight

Co-authored-by: michielmulders <michielmulders1@gmail.com>

* switch to the used getBlockByHeightV2 function in polkadot (#545)

* Ana&Mario/add missing coinlookups (#546)

* add missing coinlookups

* fix chaintoview conversion type

* fix claimrewardsamount reducer. get all (#548)

* fix polkadot error (#552)

* Split rewards from other queries (#543)

* moving rewards to resolved in overview

* lint

* working

* Add totalRewards resolver in Overview

* fix

* cleanup

* cleanup

* cleanup

* getViewDenom() is not async

* add rewardsV2 query

* add coinLookup property to all networks

* Update lib/source/cosmosV0-source.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* suggestions, cleanup

* Remove rewardsV2

* revert schema changes

Co-authored-by: Fabian <frznhope@gmail.com>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* raise terra gas estimate for claiming (#553)

* Add tests checkAddress and getRewards (#555)

* disable akash for now (#559)

* [WIP] Show rewards in Polkadot (#513)

* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

Co-authored-by: Fabian Weber <frznhope@gmail.com>

* Fabo/add polkadot fees (#557)

* add polkadot fees

* refactored

* Ana/fix get transaction success from logs (#554)

* fix get transaction success from logs

* fix typo and simplify istxsucceeded logic

* check if claimed message has failed and replace

* move check if claim message failed and replace

* fix everything. all good

* MERGE!! :D Ana/feature not present in network (#510)

* set emoney governance features as null/not present

* change network capabilities to enum

* fix enum. enable gov actions in terra mainnet

* Ana/fix coinlookup for multidenom (#565)

* add multidenom coinlookups

* move coinlookups to separate file for readability

* Ana/3804 real fix polkadot balances also empty when none (#566)

* real fix for 3804 polkadot balance validation

* fix extra 0 decimals in balance

* fix deposit transactions (#570)

* enable terra testnet governance (#569)

* Fabo/rewards per era (#563)

* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

* load rewards

* steps towards storing the rewards

* fix era format

* fix validator in row needs to be address

* fix gql query

* format bug

* some refactoring

* fix missing await

* correctly get api

* push validator getter inside sources

* added address to lunie reward internaly

* add address correctly

* fix variable naming

* filter empty rewards

* add height from rewards

* fixed tests

* also fixed terra getRewards here

* Update lib/block-listeners/polkadot-node-subscription.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* remove dead code

* fix stuff

* fix operatorAddress of undefined

* readded vanished code

* don't store validatorAddress

Co-authored-by: mariopino <info@quequiereshacer.es>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>

* Fabo/query past rewards script (#564)

* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

* load rewards

* steps towards storing the rewards

* fix era format

* fix validator in row needs to be address

* fix gql query

* format bug

* some refactoring

* fix missing await

* correctly get api

* push validator getter inside sources

* added address to lunie reward internaly

* add address correctly

* fix variable naming

* filter empty rewards

* add height from rewards

* added query past rewards script

* calling main

* missing imports

* upsert to prevent conflicts

* flatten rewards

* fix too many labels issue

* typo

* write for each validator

* await finishing

* add validators correctly to the store

* remove timing for rewards

* correctly write validator and filter 0

* add check and filter out undefined validators

* fix amount decimals to 9. allow validator unknown

* added address better

* refactor

* fix tests

* only add needed columns to rows

* missing refactor

* fix getoldpolkadot rewards eras script

* possible fix to lastreward of undefined

* delete forgotten only

* typo

Co-authored-by: mariopino <info@quequiereshacer.es>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Fabo/make db available from store (#567)

* make db available from store

* bad fix

* good fix

* fix delegations, validators, undelegations queries

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

Co-authored-by: iambeone <iambeone@gmail.com>
Co-authored-by: Mario Pino <info@quequiereshacer.es>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michiel Mulders <michielmulders1@gmail.com>
faboweb added a commit that referenced this pull request Jun 2, 2020
* release (#573)

* enable account creation for some networks (#252)

* network update time metric added (#256)

* network update time metric added

* added missing dep

Co-authored-by: Fabian <frznhope@gmail.com>

* Fix proposal deposit (#261)

* Remove denom handling from getDeposit()

* Revert undesired change

* delete package-lock.json

* localtestnet config change (#265)

* Ana/handle "address not from this network" error (#263)

* add check address function for all queries

* apply suggestions

* Ana/add fiatvalue to balances query (e-Money) (#262)

* preparation

* more preparation

* add fiatvalue field to balances query

* fix get account info

* apply suggestions

* apply one last suggestion

* suggestions+

Co-authored-by: Fabian <frznhope@gmail.com>

* Ana/emoney fix expected returns with inflation and totalbacked (#243)

* fix expected returns with inflation and supply

* minor fixes. dictionary

* query exchange rates from emoney api

* fix infinite expected returns

* convert api url to const

* add eur value to totalbackedvalue. totalngm gains

* add important comment

* finish calculation

* lint

* catch errors with sentry

Co-authored-by: Fabian <frznhope@gmail.com>

* readd coin conversion (#268)

* delete amount field (#274)

* Fabo/increase gas again (#271)

* icrease gas again

* fixed test

* Fabo/load all txs (even if more then first page in response) (#270)

* load all txs (even if more then first page in response)

* improved handling of txs

* missing renaming

* fixed paginated load

* add pagination fix also to cosmosV0-source

Co-authored-by: iambeone <iambeone@gmail.com>
Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fixing issue with multiple senders in one event (#273)

* fixing issue with multiple senders in one event

* Update lib/source/cosmosV2-source.js

Co-authored-by: Fabian <frznhope@gmail.com>

* Fabo/allow signing for terra + emoney (#267)

* allow signing for terra

* readd coin conversion

* enable actions for terra

* fix correct terra testnet url

* comments and guards

* enabled more txs for emoney and fixed broadcasting

* added a catch for wrongly formatted broadcast urls

* recover default field. change some network titles (#277)

* Fabo/add network data to API (#278)

* non desctructive introduction of better address prefix wording

* added address creator to API

* adjusted test

* added ledger app to networks config

* add icon property to schema (#281)

* add icon property to schema

* fix network schema validation

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* filter out validator specific txs (#279)

* Ana/balances coinreducer good fix (#269)

* balances coinreducer good fix

* refactored fiat value logic

Co-authored-by: Fabian <frznhope@gmail.com>

* Create network_integration.md

* Update network_integration.md

* Update network_integration.md

* Fabo/avoid 500 errors (#288)

* avoid using the latest query

* cleanup

* Ana/filter validator tx cross network and add txvalue reducer (#285)

* filter validators cross network

* add value reducer. necessary for multi claim txs

* add validator txs filter also for cosmosv0 source

* filter and make array only claim rewards msg value

* filter txs by whitelist

* change length in multi claim reward reducer

* add withdrawvalidators

* replace dictionary for set

* refactor transaction snippet. avoid repetition

* Ana/emoney upgrade (mergeable) (#282)

* update emoney api_url

* fix denom. add default fiat currency

* fix rpc endpoint

* fix value (my bad) (#293)

* fix value (my bad)

* trigger another ci flow

* erase space

* set correct new chain id (#294)

* restart API

* restart API

* fix pr alert (#297)

* Fabo/298 tendermint reconnect (#300)

* reconnect on tendermint disconnect

* cleanup

* comments

* Update cosmos-node-subscription.js

* Fabo/299 trigger a chain hangup error (#301)

* trigger a chain hangup error

* increase chain hangup time

* Apply suggestions from code review

* Fabo/store validator addresses (#296)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* add clearTimeout to avoid reconnection hell (#306)

* add clearTimeout to avoid reconnection hell

* removed console.log

* Aleksei/luniedb replaced (#303)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* replaced luniedb

* linted

Co-authored-by: Fabian <frznhope@gmail.com>

* disable reconnection logic

* clear polling interval for tendermint connection

* simple api fixes (#310)

* Fabo/remove tendermint (#311)

* remove tendermint

*  fixed empty blockHeight issue

* small refactoring

* catch on fetches to get logging

* delay block updates

* add retry logic

* refactored getBlockByHeight

* remove pm2 dep

* validator profiles were returned as array (#312)

* remove pr github action (#316)

* fixing caching issue and more (#315)

* fixing caching issue and more

* clear chain hangup timeout

* timeout fixed

* Update lib/block-listeners/cosmos-node-subscription.js

Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* added terra_mainnet to networks (#309)

* added terra_mainnet to networks

* errors fix reverted

* Ana/add multidenom rewards. necessary for emoney (#308)

* add multidenom rewards. necessary for emoney

* add rewards to overview. improve code location

* lint

* add filter rewards for multidenom

* important fix

* another important fix

* fix cannot read propery constructor of undefined (#318)

* change terra mainnet title

* pushing something to trigger new build and to restart the node

* trying out nylira's node

* WIP: Ana/More Terra fixes (#323)

* fixing my mess

* move all rewards logic to terra

* clearly signal single denom rewards

* Revert "WIP: Ana/More Terra fixes (#323)" (#325)

This reverts commit 408186a.

* catch inside block polling function (#327)

* Fabo/disable writing validator addresses for now (#329)

* disable writing validator addresses for now

* linted

* flushing http cache (#332)

* Transaction abstraction schema (#333)

* tx abstraction proposal using union

* Use Coin type

* Cleanup, TransactionV2

* Cleanup, not multisend tx

* Unsupported tx (like multisend) don't have details

* Fabo/switch to docker swarm mode (#330)

* swtich to docker swarm mode

* typo

* Update .github/workflows/development.yml

* Ana/more terra fixes (***THE COMEBACK***) (#324)

* fixing my mess

* move all rewards logic to terra

* clearly signal single denom rewards

* error structure has changed. need to look into it

* also return denom for single denom rewards

* manage errors properly

* delete comments

* Update lib/reducers/terraV3-reducers.js

* loop through transaction messages

* doing crazy stuff

* rewrite the crazy bit

Co-authored-by: Fabian <frznhope@gmail.com>

* cosmosv0 was missing the retry logic (#334)

* add back validator to db logic (#335)

* path_prefix added to network data (#338)

* path_prefix added to network data

* path_prefix replaced to slug

* tests fixed

* remove regen (#337)

Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* Fabo+Mario/transaction abstraction (#336)

* draft for transaction abstraction

* use lunie message types

* Add supported tx types

* WIP

* Draft new reducers

* Fix msg types

* Need to resolve type for TransactionDetails union

* debug resolver

* lint

* Fix

* Cleanup

* fix some union issues

* Almost done

* Small fixes

* Add userTransactionAddedV2

* Add userTransactionAddedV2 to resolvers

Co-authored-by: Mario Pino <info@quequiereshacer.es>

* emoney fixes for fiatvalue (#345)

* emoney fixes for fiatvalue

* refactor with coinreducer

* speaking functions are your friends

* refactor ugly nested code

* lint

* add denoms lookups for terra and emoney (#346)

* Ana/add only tokens gas prices 2nd attempt (#344)

* add terra and emoney gas price. terra reducer

* delete fiatvalue from get balances in cosmos

* add emoney reducer

* hyper important emoney fixes

* fix for emoney denoms

* change gas price to micro units

* add emoney denoms to denomlookup

* transform to microunit also for terra tokens

* return null for emoney gas prices

* add harcoded gas prices

* correct emoney hardcoded values

* hardcoded terra gas prices. not working

* update hardcoded values to working ones

* delete unrelated changes to gas prices

* apply suggestions except coinreducer

* they call me mr coinreducer

* change amount for price. add gas price reducer

* change naming in gas price reducer

* add error message

Co-authored-by: Fabian <frznhope@gmail.com>

* fix rewards denoms (#351)

* updating image on deploy (#352)

* fix my mess once more (#353)

* Ana/add gas prices to other networks (#350)

* add gasprices to cosmos

* format gas prices to three decimals

* Apply suggestions from code review

* Update lib/reducers/cosmosV0-reducers.js

Co-authored-by: Fabian <frznhope@gmail.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* added a tx success push, fallback (#354)

* fix cosmos gas price (#355)

* fix terra for new tmbalance (#358)

* Fabo/new emoney rewards (#357)

* intent to fix the emoney rewards

* intent to fix emoney rewards

* simplified code

* comments

* hack to fix reduce function

* eligable -> eligible

* correct reducer fix

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* Aleksei/prevent constant db calls (#304)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* prevent constant db interaction

* stored object structure changed

* remove nesting in validators

* filter validators list

Co-authored-by: Fabian <frznhope@gmail.com>

* limit txs pages load by two pages per request (#314)

* limit txs pages load by two pages per request

* delete block from loadpaginatedtxs

* small fixes

* Update lib/source/cosmosV2-source.js

* linted

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian <frznhope@gmail.com>

* linted

* linted

* Fabo/Use figment nodes (#362)

* use api keys

* add env variables for nodes

* hard code api keys (#365)

* fix ngm fiatvalue (#361)

* hardcoded urls fix (#366)

* WIP: Improve TransactionV2 implementation (#349)

* Add from field to SendTx type

* add amount to claim rewards transactions

* convert to units in string coin reducer

* fix typo

* add multidenom string coinreducer for claim amount

* Add UnknownTx to schema

* Add BlockV2 type which returns TransactionV2 txs

* Add blockV2 query that returns TransactionV2 txs

* kill handling claim rewards amount

* Update lib/reducers/cosmosV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update lib/reducers/cosmosV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Cleanup

* lint

* Support claim rewards from multiple validators

* Fix, cleanup

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian <frznhope@gmail.com>

* Aleksei/fix db insert (#367)

* fixed insert function to allow empty schema

* Aleksei/statistics in the api (#364)

* collecting statistics in the API

* small fixes

* fixes

* changing address to key in clearOverviewedAddresses

Co-authored-by: Aleksey Rudometov <iambeone@gmail.com>

* add pageNumber to schema (#370)

* add pageNumber to schema

* file wasn't saved

* trigger ci

* added pagination to tx v2 api (#372)

* Together with 3584: Ana/change fiatvalue to object (#360)

* change fiatvalue to object

* handle when selected currency is eur

* include ngm fiatvalue fix

* Ana/amount in claim rewards in transactions v2 (#373)

* bring amount in claim rewards back to life

* change to regex

* simplify

* make the regex understandable

* Ana/add powered to networks (#377)

* add powered by

* more logical powered

* add provider address for avatar

* fix powere validation

* Fabo/add network-type for selecting addrss and signing (#378)

* add network-type for selecting addrss and signing

* adjust according to new network_type param

* add network type to network schema

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fix staking denom (#379)

* fix terra balances and overview (#380)

* Fabo/allow to query experimental networks (#382)

* all to query experimental networks

* fix old small typo

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* First steps to integrate Polkadot (#376)

* Add polkadot-testnet in networks.js

* Install polkadot-api, polkadot-node-sub. draft

* lint

* lint

* lint

* add polkadotV0 source

* add address creator

* Update data/networks.js

Co-Authored-By: Jordan Bibla <jbibla@gmail.com>

* Update data/networks.js

Co-Authored-By: Jordan Bibla <jbibla@gmail.com>

* blocks, events

* Cleanup

* polling instead subscription

* husky

* updateDBValidatorProfiles

* no wait for block data fetching, kind of stable

* Add reducers file

* block subscription works!

* Cleanup, fix memory leak

* lint, node

* comment

* Handle polkadot chain reorgs

* Cleanup

* Optimization, cleanup

* Optimization

* fixes, validators query working, cleanup

* comment

* lint

* fix block time

* handle polkadot chain hangups

* cleanup

* validator reducer

* lint

* wip

* calculate and include a bunch of validator fields

* add bech32_prefix address_prefix to networks.js

* add 1 space so we dont break tests

* remove chain reorg handling, more stable

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian <frznhope@gmail.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* transactions loading time reduced (#383)

* transactions loading time reduced

* increased page number

* add loki to docker-compose (#385)

* add network type (#386)

* removed livepeer from running in API (#390)

* set polkadot to disabled (#392)

* Ana/add totalstake-fiatvalue to Overview (#384)

* add totalstake fiat value to overview

* fix amount in totalstake fiatvalue

* make new code more readable

* Update lib/reducers/cosmosV0-reducers.js

* refactor unit conversion

Co-authored-by: Mario Pino <info@quequiereshacer.es>

* disable polkadot (#395)

Co-authored-by: Fabian <frznhope@gmail.com>

* Fabo/terra returns (#389)

* better error logging

* add result selector to query

* split emoney getAllValidators from Terra

* add expected returns querying to terra

* filter out empty returns

* remove not used code

* missing return

* limit decimals

* fix not found in terra testnet

* temporary hacks

* Revert "temporary hacks"

This reverts commit 88d0918af70489422d6d5d84909df1186a23fa1c.

* Revert "fix not found in terra testnet"

This reverts commit 19a4eca6eb4a9eb2050b368b270d4a39847e016a.

* add terra testnet api

* switch to show all decimals

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fix all fiat values to 2 decimals (#399)

* Ana/correct terra denoms (#398)

* correct terra denoms

* variable renaming

Co-authored-by: Fabian <frznhope@gmail.com>

* Ana/add fiatvalue in rewards (#396)

* add fiatvalue to rewards

* add fiatcurrency to rewards query

* handle unsupported fiat currencies

* apply suggestions

* delete never used delegations parameter (#404)

* fix terra getrewards and gas prices (#409)

* reactivate kusama (#411)

* Ana/fix repeated claim rewards transactions in transaction abstraction (#400)

* fix terra repeated claim rewards transactions

* much better fix

* add claim rewards messages aggregator

* try to apply suggestion

* also not working

* working 🎉

* change name and add comment

* improved implementation by aggregating the claim messags correctly

Co-authored-by: Fabian Weber <frznhope@gmail.com>

* disable polkadot once more for release (#412)

* readd memory limit (#413)

* Use polling instead subscription in Kusama (#406)

* uncomment polkadot

* bug fixes

* pollForNewBlock

* mod getBlockHeight

* add again commented api disconnect to not forget

* enqueueAndPublishBlockAdded

* re-subscribe on error

* stringify error

* stringify errors

* api.isReady

* Add delay to newBlockHandler

* Ana/add balances to kusama (#405)

* rudimentary balance

* add some comment

* Ana/switch polkadot to rest calls (#408)

* add rewards and overview functions. not working

* poll instead of subscribe to blocks

* switch over to http provider

* fix lint errors

* use httpprovider

* getting last block hash

* get blockhash and header. but no height

* back to normal. use mario node subscription

* successfully get block height polling with http

* get block hash from http. use polling

* uncomment all other networks

* pass the store to source classes

* create the api only once

* comment api.disconnect()

* added polling fix and quick querying

* fixed block height query

* clean up

* comment

* cleanup and optimization

Co-authored-by: Fabian Weber <frznhope@gmail.com>
Co-authored-by: mariopino <info@quequiereshacer.es>

* remove unused dependency

Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian Weber <frznhope@gmail.com>

* deactivate polkadot

* trigger deploy

* trigger CI

* swtich to newer caddy version

* activate polkadot again

* deactivate again

* Proposal to enable Kusama network (#424)

* working state

* cleanup

* getBlockHeight()

* update polkadot-api (#423)

* fixing node_exporter call in Caddyfile (#418)

* fixing send amount in statistics (#419)

* fixing send amount in statistics

* denom fixed

* fix validator as selected fiat bug (#415)

* Ana/correct terra denoms in activity (#425)

* correct fix terra denoms in activity

* delete correct terra denom as not needed

* Ana/fix amount null in claim rewards (#416)

* fix amount null in claim rewards

* small refactor

* apply suggestion

* add release script to api (#426)

* Add self stake to validators query (#433)

* add self stake

* Update lib/reducers/polkadotV0-reducers.js

Co-Authored-By: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* lint

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* fix emoney balances denoms (#436)

* [Polkadot] Add delegations query (#435)

* first step, simplified query is working

* lint

* Get validator info from val dictionary

* cleanup, fix comission

* fix

* faster solution

* remove types we dont need in store

* @ALEKSEI suggestions

* fix

* fix

* simplify as @imbeone suggested

* simplify, thanks @Bitcoinera!

* re adding array check

* delegationReducer

* fix

* Ana/update polkadot balances (#441)

* update polkadot balances

* structs are strange

* change comment

* disable kusama

* disable kusama

* Ana/427 polkadot single validator query (#440)

* save validators with operatoraddress as key

* add check to wait to fetch validators

* Update lib/resolvers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update lib/resolvers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* lint

* fix delegations

Co-authored-by: Fabian <frznhope@gmail.com>

* Add denom decimal places to networks.js (#434)

* lint

* add decimals places, refactor POLKADOT_CONVERSION

* add to schema

* add to tests

* refactor with @faboweb suggestions

* fix

* fix

* fix

* cleanup

* apply suggestions

* fix balances

* add factor properly to network

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* fix totalstake fiatvalue only returning euro (#442)

* Fix commission for validators in Polkadot network (#447)

* fix commission

* comment

* Fix expectedReturns for validators in Polkadot network (#446)

* fix expectedReturns

* change -- for null in getrewards and returns

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Ana/emoney validators load optimization (#430)

* just for testing. hang up on validatorssets latest

* fix emoney validators load

* resolve conflict

* remove experimental line

* linted

* Fabo/polkadot overview (#450)

* add first steps towards overview

* correct total

* fixed total

* fix getaccountinfo is not a funciton

* delete hardcoded node rpc url

* endpoint back to normal

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* change polkadot node back to paritys one (#453)

* Bump acorn from 5.7.3 to 5.7.4 (#454)

Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](acornjs/acorn@5.7.3...5.7.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fabo/improve delegations (#455)

* improve delegations

* removed timer

* add hack for accounts with no nominations

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* update polkadot api to latest (#456)

* updated minimist (#457)

* add empty getundelegations for polkadot (#458)

* Update polkadot api to v1.7.1 (#465)

* Ana/fix calculatefiatvalue when fiatcurrency not set (#462)

* fix calculatefiatvalue when fiatcurrency not set

* improve fix and comment

* linted

* Upgrade @polkadot/api to v1.8.0-beta.1 (#471)

* Add intention validators in Polkadot network (#468)

* Add timer to getAllValidators()

* Fetch intention addresses for current session

* wip

* Add validators

* working! getAllValidators exec time less than 10s

* fix status

* Cleanup

* fix free balance (#474)

* Fix delegations query in Polkadot network (#475)

* fetch delegations from stored valid. staking info

* Simplify

* Cleanup

* tx type in v2 subscriptions changed to TransactionV2 (#476)

* Ana/add new release script copying fe (#479)

* add new release script copying fe

* add node executor to circleci

* add aliases for circleci

* missed one alias

* change uluna gas price to recommended one (#481)

* fixing claim rewards pubsub publishing (#480)

* fixing claim rewards pubsub publishing

* only get stakingDenom once

Co-authored-by: Fabian Weber <frznhope@gmail.com>

* Fabo/fix failed txs parsing (#486)

* publish v2 txs and fix failed txs parsing

* linted

* Fabo/add logs to txs v2 (#487)

* add logs to txs v2

* better logic

* michiel/move yarn test to separate step for circleci (#482)

* migrate test.yml github workflow to circleci config.yml

fix executor from web to node

* remove test.yml workflow file

* refactor address extraction into reducers (#488)

* add polkadot prefix (#489)

* add polkadot prefix

* change address prefix to be a number

* Fabo/broadcast polkadot txs (#461)

* first steps to broadcast polkadot txs

* remove package-lock

* fixed api init

* remove debugger

* working broadcasting

* working

* ignore polkadot in tests

* Update lib/controller/transaction/index.js

Co-Authored-By: Jordan Bibla <jbibla@gmail.com>

Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* Fabo/wait for data ready (#497)

* allow to wait for data to be ready

(cherry picked from commit 744d9b3b445286a9637fdadbeb5c473165cec58e)

* wait for data to be ready

(cherry picked from commit b6d665fd88ae22e5e3753249f27730eb12faebcb)

* keep store in cosmos source

(cherry picked from commit a6bb9f023eb56fb57d9a0f3a3ae12c997f6d04e3)

* Update lib/resolvers.js

* adds key to identify and sort txs (#492)

* improve blockHandler logic (#498)

(cherry picked from commit b67fab47adbf5a19caf99e17a9395e62419e8dad)

* Fabo/enable terra governance (#501)

* enable terra governance

* also enable proposals in terra testnet

* Ana/send all claimed rewards to fe (#493)

* send all claimed rewards to fe

* refactor reward coin reducer

* Fabo/allow single network run (#495)

* allow running a single network

* readme

* apply fix in networks

* Update lib/apollo.js

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Ana/refactor network capabilities (#502)

* refactor network capabilities

* refactor to have just a dictionary

* fix terra testnet. deleted accidentally testnet

Co-authored-by: Fabian <frznhope@gmail.com>

* Fabo/fix emoney reward precision (#504)

* fix emoney rewards precision

* comment

* remove polkadot log spamming

* add logging for failing tx parsing

* more kusama log removal

* Fabo/improve emoney loading (#494)

* allow to wait for data to be ready

* wait for data to be ready

* improve blockHandler logic

* keep store in cosmos source

* centralize emoney exchange queries

* fixed balances nto available

* precalculate all exchange rates

* remove mock values

* add sentry to nested block handler

* linted

* keep old emoney tokens for now

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* fix transaction log parsing

* better debugging

* prevent transactionReducerV2 from returning undefined (#508)

* prevent transactionReducerV2 from returning undefined

* Update lib/reducers/cosmosV0-reducers.js

Co-Authored-By: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* linting fix

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fix one more log parsing issue

* WIP Ana/make estimate a query (#509)

* first attempt for estimate

* fix estimate schema

* lint

* Polkadot send transaction extraction (#500)

* tx logic draft

* fix lint

* wip

* lint

* working for send tx type

* should work publishing send tx!

* correct data is being passed to publishers

* cleanup

* working with extrinsics

* implement coin reducer

* Update lib/reducers/polkadotV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update lib/reducers/polkadotV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

Co-authored-by: Fabian <frznhope@gmail.com>

* Ana/add emoney mainnet (#511)

* first preparations

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* add correct chainid

* add validators poller for release

* check emoney mainnet validators recursively

Co-authored-by: Fabian <frznhope@gmail.com>

* fix no iterable for claimrewards amounts (#515)

* emoney mainnet is mainnet (#517)

* remove emoney release hack (#520)

* fix emoney mainnet expected returns (#522)

* useless console.log removed (#519)

* update emoney ngm gasprice (#525)

* Michiel/make clear separation between v0 and v2 reducers (#530)

* Replace transactionReducer with v2 for pollTransactionSuccess

* Replace transactionReducer with v2 for pollTransactionSuccess

* Fix structure

* Make clear seperation between v0 and v2 reducers

* Fix problem publishing transaction

* Fix pollTransactionSuccess

* Fix pollTransactionSuccess

* Ana/fix claim rewards denom for terra and emoney (#534)

* fix claim rewards denom for terra and emoney

* fix again

* Ana/fix expected returns cosmos and emoney (#536)

* fix expected returns for cosmos and emoney

* add missing property in type validator

* delete delegatorshares from type validator

* Ana/add gas estimates query (#503)

* add network fees query

* fix schema

* refactor using networkid with hyphens

* return only estimate for a transaction type

* add gas estimates to network object

* remove network fees from queries

* revert last two commits manually

* add default to network gas estimates

* apply suggestion

* michiel/remove reducer v0 (#535)

* Remove reducer v0

* Update cosmosV0-source.js

* linted

Co-authored-by: Fabian <frznhope@gmail.com>

* comment instructions on github templates (#539)

* Ana/fix gasestimate query and raise terra default gas estimate (#538)

* fix networkfees query

* raise terra default gas estimate

* Michiel/add akash portfolio (#541)

* first steps

* Integrate validators feature for akashv0

* Simplify extending Cosmos logic

* Remove unused imports

* Uncomment networks

* Enable portfolio for Akash

* Commnet livepeer mainnet network

* Commnet livepeer mainnet network

* fix validators expected returns

* apply code review

* use proper reducers

* add gas prices

* fix totalstake and delegation in general

* fix api_url

* correct staking denom to cosmossdk default for now

* add also default stake gas price

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Michiel/add Akash validators (#540)

* first steps

* Integrate validators feature for akashv0

* Simplify extending Cosmos logic

* Remove unused imports

* Uncomment networks

* Commnet livepeer mainnet network

* fix validators expected returns

* apply code review

* Fix version transactionsByHeight

Co-authored-by: michielmulders <michielmulders1@gmail.com>

* switch to the used getBlockByHeightV2 function in polkadot (#545)

* Ana&Mario/add missing coinlookups (#546)

* add missing coinlookups

* fix chaintoview conversion type

* fix claimrewardsamount reducer. get all (#548)

* fix polkadot error (#552)

* Split rewards from other queries (#543)

* moving rewards to resolved in overview

* lint

* working

* Add totalRewards resolver in Overview

* fix

* cleanup

* cleanup

* cleanup

* getViewDenom() is not async

* add rewardsV2 query

* add coinLookup property to all networks

* Update lib/source/cosmosV0-source.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* suggestions, cleanup

* Remove rewardsV2

* revert schema changes

Co-authored-by: Fabian <frznhope@gmail.com>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* raise terra gas estimate for claiming (#553)

* Add tests checkAddress and getRewards (#555)

* disable akash for now (#559)

* [WIP] Show rewards in Polkadot (#513)

* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

Co-authored-by: Fabian Weber <frznhope@gmail.com>

* Fabo/add polkadot fees (#557)

* add polkadot fees

* refactored

* Ana/fix get transaction success from logs (#554)

* fix get transaction success from logs

* fix typo and simplify istxsucceeded logic

* check if claimed message has failed and replace

* move check if claim message failed and replace

* fix everything. all good

* MERGE!! :D Ana/feature not present in network (#510)

* set emoney governance features as null/not present

* change network capabilities to enum

* fix enum. enable gov actions in terra mainnet

* Ana/fix coinlookup for multidenom (#565)

* add multidenom coinlookups

* move coinlookups to separate file for readability

* Ana/3804 real fix polkadot balances also empty when none (#566)

* real fix for 3804 polkadot balance validation

* fix extra 0 decimals in balance

* fix deposit transactions (#570)

* enable terra testnet governance (#569)

* Fabo/rewards per era (#563)

* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

* load rewards

* steps towards storing the rewards

* fix era format

* fix validator in row needs to be address

* fix gql query

* format bug

* some refactoring

* fix missing await

* correctly get api

* push validator getter inside sources

* added address to lunie reward internaly

* add address correctly

* fix variable naming

* filter empty rewards

* add height from rewards

* fixed tests

* also fixed terra getRewards here

* Update lib/block-listeners/polkadot-node-subscription.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* remove dead code

* fix stuff

* fix operatorAddress of undefined

* readded vanished code

* don't store validatorAddress

Co-authored-by: mariopino <info@quequiereshacer.es>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>

* Fabo/query past rewards script (#564)

* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

* load rewards

* steps towards storing the rewards

* fix era format

* fix validator in row needs to be address

* fix gql query

* format bug

* some refactoring

* fix missing await

* correctly get api

* push validator getter inside sources

* added address to lunie reward internaly

* add address correctly

* fix variable naming

* filter empty rewards

* add height from rewards

* added query past rewards script

* calling main

* missing imports

* upsert to prevent conflicts

* flatten rewards

* fix too many labels issue

* typo

* write for each validator

* await finishing

* add validators correctly to the store

* remove timing for rewards

* correctly write validator and filter 0

* add check and filter out undefined validators

* fix amount decimals to 9. allow validator unknown

* added address better

* refactor

* fix tests

* only add needed columns to rows

* missing refactor

* fix getoldpolkadot rewards eras script

* possible fix to lastreward of undefined

* delete forgotten only

* typo

Co-authored-by: mariopino <info@quequiereshacer.es>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Fabo/make db available from store (#567)

* make db available from store

* bad fix

* good fix

* fix delegations, validators, undelegations queries

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

Co-authored-by: iambeone <iambeone@gmail.com>
Co-authored-by: Mario Pino <info@quequiereshacer.es>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michiel Mulders <michielmulders1@gmail.com>

* trigger CI

* linted

* linted

* restart

* changelog

* remove pm2

* remove changes that are out of scope

* changelog

* delete unrelated change

* Update .github/workflows/development.yml

Co-authored-by: Fabian <frznhope@gmail.com>

Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: iambeone <iambeone@gmail.com>
Co-authored-by: Mario Pino <info@quequiereshacer.es>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michiel Mulders <michielmulders1@gmail.com>
faboweb added a commit that referenced this pull request Jun 6, 2020
* release (#573)

* enable account creation for some networks (#252)

* network update time metric added (#256)

* network update time metric added

* added missing dep

Co-authored-by: Fabian <frznhope@gmail.com>

* Fix proposal deposit (#261)

* Remove denom handling from getDeposit()

* Revert undesired change

* delete package-lock.json

* localtestnet config change (#265)

* Ana/handle "address not from this network" error (#263)

* add check address function for all queries

* apply suggestions

* Ana/add fiatvalue to balances query (e-Money) (#262)

* preparation

* more preparation

* add fiatvalue field to balances query

* fix get account info

* apply suggestions

* apply one last suggestion

* suggestions+

Co-authored-by: Fabian <frznhope@gmail.com>

* Ana/emoney fix expected returns with inflation and totalbacked (#243)

* fix expected returns with inflation and supply

* minor fixes. dictionary

* query exchange rates from emoney api

* fix infinite expected returns

* convert api url to const

* add eur value to totalbackedvalue. totalngm gains

* add important comment

* finish calculation

* lint

* catch errors with sentry

Co-authored-by: Fabian <frznhope@gmail.com>

* readd coin conversion (#268)

* delete amount field (#274)

* Fabo/increase gas again (#271)

* icrease gas again

* fixed test

* Fabo/load all txs (even if more then first page in response) (#270)

* load all txs (even if more then first page in response)

* improved handling of txs

* missing renaming

* fixed paginated load

* add pagination fix also to cosmosV0-source

Co-authored-by: iambeone <iambeone@gmail.com>
Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fixing issue with multiple senders in one event (#273)

* fixing issue with multiple senders in one event

* Update lib/source/cosmosV2-source.js

Co-authored-by: Fabian <frznhope@gmail.com>

* Fabo/allow signing for terra + emoney (#267)

* allow signing for terra

* readd coin conversion

* enable actions for terra

* fix correct terra testnet url

* comments and guards

* enabled more txs for emoney and fixed broadcasting

* added a catch for wrongly formatted broadcast urls

* recover default field. change some network titles (#277)

* Fabo/add network data to API (#278)

* non desctructive introduction of better address prefix wording

* added address creator to API

* adjusted test

* added ledger app to networks config

* add icon property to schema (#281)

* add icon property to schema

* fix network schema validation

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* filter out validator specific txs (#279)

* Ana/balances coinreducer good fix (#269)

* balances coinreducer good fix

* refactored fiat value logic

Co-authored-by: Fabian <frznhope@gmail.com>

* Create network_integration.md

* Update network_integration.md

* Update network_integration.md

* Fabo/avoid 500 errors (#288)

* avoid using the latest query

* cleanup

* Ana/filter validator tx cross network and add txvalue reducer (#285)

* filter validators cross network

* add value reducer. necessary for multi claim txs

* add validator txs filter also for cosmosv0 source

* filter and make array only claim rewards msg value

* filter txs by whitelist

* change length in multi claim reward reducer

* add withdrawvalidators

* replace dictionary for set

* refactor transaction snippet. avoid repetition

* Ana/emoney upgrade (mergeable) (#282)

* update emoney api_url

* fix denom. add default fiat currency

* fix rpc endpoint

* fix value (my bad) (#293)

* fix value (my bad)

* trigger another ci flow

* erase space

* set correct new chain id (#294)

* restart API

* restart API

* fix pr alert (#297)

* Fabo/298 tendermint reconnect (#300)

* reconnect on tendermint disconnect

* cleanup

* comments

* Update cosmos-node-subscription.js

* Fabo/299 trigger a chain hangup error (#301)

* trigger a chain hangup error

* increase chain hangup time

* Apply suggestions from code review

* Fabo/store validator addresses (#296)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* add clearTimeout to avoid reconnection hell (#306)

* add clearTimeout to avoid reconnection hell

* removed console.log

* Aleksei/luniedb replaced (#303)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* replaced luniedb

* linted

Co-authored-by: Fabian <frznhope@gmail.com>

* disable reconnection logic

* clear polling interval for tendermint connection

* simple api fixes (#310)

* Fabo/remove tendermint (#311)

* remove tendermint

*  fixed empty blockHeight issue

* small refactoring

* catch on fetches to get logging

* delay block updates

* add retry logic

* refactored getBlockByHeight

* remove pm2 dep

* validator profiles were returned as array (#312)

* remove pr github action (#316)

* fixing caching issue and more (#315)

* fixing caching issue and more

* clear chain hangup timeout

* timeout fixed

* Update lib/block-listeners/cosmos-node-subscription.js

Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* added terra_mainnet to networks (#309)

* added terra_mainnet to networks

* errors fix reverted

* Ana/add multidenom rewards. necessary for emoney (#308)

* add multidenom rewards. necessary for emoney

* add rewards to overview. improve code location

* lint

* add filter rewards for multidenom

* important fix

* another important fix

* fix cannot read propery constructor of undefined (#318)

* change terra mainnet title

* pushing something to trigger new build and to restart the node

* trying out nylira's node

* WIP: Ana/More Terra fixes (#323)

* fixing my mess

* move all rewards logic to terra

* clearly signal single denom rewards

* Revert "WIP: Ana/More Terra fixes (#323)" (#325)

This reverts commit 408186a.

* catch inside block polling function (#327)

* Fabo/disable writing validator addresses for now (#329)

* disable writing validator addresses for now

* linted

* flushing http cache (#332)

* Transaction abstraction schema (#333)

* tx abstraction proposal using union

* Use Coin type

* Cleanup, TransactionV2

* Cleanup, not multisend tx

* Unsupported tx (like multisend) don't have details

* Fabo/switch to docker swarm mode (#330)

* swtich to docker swarm mode

* typo

* Update .github/workflows/development.yml

* Ana/more terra fixes (***THE COMEBACK***) (#324)

* fixing my mess

* move all rewards logic to terra

* clearly signal single denom rewards

* error structure has changed. need to look into it

* also return denom for single denom rewards

* manage errors properly

* delete comments

* Update lib/reducers/terraV3-reducers.js

* loop through transaction messages

* doing crazy stuff

* rewrite the crazy bit

Co-authored-by: Fabian <frznhope@gmail.com>

* cosmosv0 was missing the retry logic (#334)

* add back validator to db logic (#335)

* path_prefix added to network data (#338)

* path_prefix added to network data

* path_prefix replaced to slug

* tests fixed

* remove regen (#337)

Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* Fabo+Mario/transaction abstraction (#336)

* draft for transaction abstraction

* use lunie message types

* Add supported tx types

* WIP

* Draft new reducers

* Fix msg types

* Need to resolve type for TransactionDetails union

* debug resolver

* lint

* Fix

* Cleanup

* fix some union issues

* Almost done

* Small fixes

* Add userTransactionAddedV2

* Add userTransactionAddedV2 to resolvers

Co-authored-by: Mario Pino <info@quequiereshacer.es>

* emoney fixes for fiatvalue (#345)

* emoney fixes for fiatvalue

* refactor with coinreducer

* speaking functions are your friends

* refactor ugly nested code

* lint

* add denoms lookups for terra and emoney (#346)

* Ana/add only tokens gas prices 2nd attempt (#344)

* add terra and emoney gas price. terra reducer

* delete fiatvalue from get balances in cosmos

* add emoney reducer

* hyper important emoney fixes

* fix for emoney denoms

* change gas price to micro units

* add emoney denoms to denomlookup

* transform to microunit also for terra tokens

* return null for emoney gas prices

* add harcoded gas prices

* correct emoney hardcoded values

* hardcoded terra gas prices. not working

* update hardcoded values to working ones

* delete unrelated changes to gas prices

* apply suggestions except coinreducer

* they call me mr coinreducer

* change amount for price. add gas price reducer

* change naming in gas price reducer

* add error message

Co-authored-by: Fabian <frznhope@gmail.com>

* fix rewards denoms (#351)

* updating image on deploy (#352)

* fix my mess once more (#353)

* Ana/add gas prices to other networks (#350)

* add gasprices to cosmos

* format gas prices to three decimals

* Apply suggestions from code review

* Update lib/reducers/cosmosV0-reducers.js

Co-authored-by: Fabian <frznhope@gmail.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* added a tx success push, fallback (#354)

* fix cosmos gas price (#355)

* fix terra for new tmbalance (#358)

* Fabo/new emoney rewards (#357)

* intent to fix the emoney rewards

* intent to fix emoney rewards

* simplified code

* comments

* hack to fix reduce function

* eligable -> eligible

* correct reducer fix

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* Aleksei/prevent constant db calls (#304)

* add validator addresses to db

* linted

* ignore in local dev

* revert

* fixed fetch

* comment

* refactored db into constructor

* cleanup

* prevent constant db interaction

* stored object structure changed

* remove nesting in validators

* filter validators list

Co-authored-by: Fabian <frznhope@gmail.com>

* limit txs pages load by two pages per request (#314)

* limit txs pages load by two pages per request

* delete block from loadpaginatedtxs

* small fixes

* Update lib/source/cosmosV2-source.js

* linted

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian <frznhope@gmail.com>

* linted

* linted

* Fabo/Use figment nodes (#362)

* use api keys

* add env variables for nodes

* hard code api keys (#365)

* fix ngm fiatvalue (#361)

* hardcoded urls fix (#366)

* WIP: Improve TransactionV2 implementation (#349)

* Add from field to SendTx type

* add amount to claim rewards transactions

* convert to units in string coin reducer

* fix typo

* add multidenom string coinreducer for claim amount

* Add UnknownTx to schema

* Add BlockV2 type which returns TransactionV2 txs

* Add blockV2 query that returns TransactionV2 txs

* kill handling claim rewards amount

* Update lib/reducers/cosmosV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update lib/reducers/cosmosV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Cleanup

* lint

* Support claim rewards from multiple validators

* Fix, cleanup

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian <frznhope@gmail.com>

* Aleksei/fix db insert (#367)

* fixed insert function to allow empty schema

* Aleksei/statistics in the api (#364)

* collecting statistics in the API

* small fixes

* fixes

* changing address to key in clearOverviewedAddresses

Co-authored-by: Aleksey Rudometov <iambeone@gmail.com>

* add pageNumber to schema (#370)

* add pageNumber to schema

* file wasn't saved

* trigger ci

* added pagination to tx v2 api (#372)

* Together with 3584: Ana/change fiatvalue to object (#360)

* change fiatvalue to object

* handle when selected currency is eur

* include ngm fiatvalue fix

* Ana/amount in claim rewards in transactions v2 (#373)

* bring amount in claim rewards back to life

* change to regex

* simplify

* make the regex understandable

* Ana/add powered to networks (#377)

* add powered by

* more logical powered

* add provider address for avatar

* fix powere validation

* Fabo/add network-type for selecting addrss and signing (#378)

* add network-type for selecting addrss and signing

* adjust according to new network_type param

* add network type to network schema

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fix staking denom (#379)

* fix terra balances and overview (#380)

* Fabo/allow to query experimental networks (#382)

* all to query experimental networks

* fix old small typo

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* First steps to integrate Polkadot (#376)

* Add polkadot-testnet in networks.js

* Install polkadot-api, polkadot-node-sub. draft

* lint

* lint

* lint

* add polkadotV0 source

* add address creator

* Update data/networks.js

Co-Authored-By: Jordan Bibla <jbibla@gmail.com>

* Update data/networks.js

Co-Authored-By: Jordan Bibla <jbibla@gmail.com>

* blocks, events

* Cleanup

* polling instead subscription

* husky

* updateDBValidatorProfiles

* no wait for block data fetching, kind of stable

* Add reducers file

* block subscription works!

* Cleanup, fix memory leak

* lint, node

* comment

* Handle polkadot chain reorgs

* Cleanup

* Optimization, cleanup

* Optimization

* fixes, validators query working, cleanup

* comment

* lint

* fix block time

* handle polkadot chain hangups

* cleanup

* validator reducer

* lint

* wip

* calculate and include a bunch of validator fields

* add bech32_prefix address_prefix to networks.js

* add 1 space so we dont break tests

* remove chain reorg handling, more stable

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian <frznhope@gmail.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* transactions loading time reduced (#383)

* transactions loading time reduced

* increased page number

* add loki to docker-compose (#385)

* add network type (#386)

* removed livepeer from running in API (#390)

* set polkadot to disabled (#392)

* Ana/add totalstake-fiatvalue to Overview (#384)

* add totalstake fiat value to overview

* fix amount in totalstake fiatvalue

* make new code more readable

* Update lib/reducers/cosmosV0-reducers.js

* refactor unit conversion

Co-authored-by: Mario Pino <info@quequiereshacer.es>

* disable polkadot (#395)

Co-authored-by: Fabian <frznhope@gmail.com>

* Fabo/terra returns (#389)

* better error logging

* add result selector to query

* split emoney getAllValidators from Terra

* add expected returns querying to terra

* filter out empty returns

* remove not used code

* missing return

* limit decimals

* fix not found in terra testnet

* temporary hacks

* Revert "temporary hacks"

This reverts commit 88d0918af70489422d6d5d84909df1186a23fa1c.

* Revert "fix not found in terra testnet"

This reverts commit 19a4eca6eb4a9eb2050b368b270d4a39847e016a.

* add terra testnet api

* switch to show all decimals

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fix all fiat values to 2 decimals (#399)

* Ana/correct terra denoms (#398)

* correct terra denoms

* variable renaming

Co-authored-by: Fabian <frznhope@gmail.com>

* Ana/add fiatvalue in rewards (#396)

* add fiatvalue to rewards

* add fiatcurrency to rewards query

* handle unsupported fiat currencies

* apply suggestions

* delete never used delegations parameter (#404)

* fix terra getrewards and gas prices (#409)

* reactivate kusama (#411)

* Ana/fix repeated claim rewards transactions in transaction abstraction (#400)

* fix terra repeated claim rewards transactions

* much better fix

* add claim rewards messages aggregator

* try to apply suggestion

* also not working

* working 🎉

* change name and add comment

* improved implementation by aggregating the claim messags correctly

Co-authored-by: Fabian Weber <frznhope@gmail.com>

* disable polkadot once more for release (#412)

* readd memory limit (#413)

* Use polling instead subscription in Kusama (#406)

* uncomment polkadot

* bug fixes

* pollForNewBlock

* mod getBlockHeight

* add again commented api disconnect to not forget

* enqueueAndPublishBlockAdded

* re-subscribe on error

* stringify error

* stringify errors

* api.isReady

* Add delay to newBlockHandler

* Ana/add balances to kusama (#405)

* rudimentary balance

* add some comment

* Ana/switch polkadot to rest calls (#408)

* add rewards and overview functions. not working

* poll instead of subscribe to blocks

* switch over to http provider

* fix lint errors

* use httpprovider

* getting last block hash

* get blockhash and header. but no height

* back to normal. use mario node subscription

* successfully get block height polling with http

* get block hash from http. use polling

* uncomment all other networks

* pass the store to source classes

* create the api only once

* comment api.disconnect()

* added polling fix and quick querying

* fixed block height query

* clean up

* comment

* cleanup and optimization

Co-authored-by: Fabian Weber <frznhope@gmail.com>
Co-authored-by: mariopino <info@quequiereshacer.es>

* remove unused dependency

Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Fabian Weber <frznhope@gmail.com>

* deactivate polkadot

* trigger deploy

* trigger CI

* swtich to newer caddy version

* activate polkadot again

* deactivate again

* Proposal to enable Kusama network (#424)

* working state

* cleanup

* getBlockHeight()

* update polkadot-api (#423)

* fixing node_exporter call in Caddyfile (#418)

* fixing send amount in statistics (#419)

* fixing send amount in statistics

* denom fixed

* fix validator as selected fiat bug (#415)

* Ana/correct terra denoms in activity (#425)

* correct fix terra denoms in activity

* delete correct terra denom as not needed

* Ana/fix amount null in claim rewards (#416)

* fix amount null in claim rewards

* small refactor

* apply suggestion

* add release script to api (#426)

* Add self stake to validators query (#433)

* add self stake

* Update lib/reducers/polkadotV0-reducers.js

Co-Authored-By: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* lint

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* fix emoney balances denoms (#436)

* [Polkadot] Add delegations query (#435)

* first step, simplified query is working

* lint

* Get validator info from val dictionary

* cleanup, fix comission

* fix

* faster solution

* remove types we dont need in store

* @ALEKSEI suggestions

* fix

* fix

* simplify as @imbeone suggested

* simplify, thanks @Bitcoinera!

* re adding array check

* delegationReducer

* fix

* Ana/update polkadot balances (#441)

* update polkadot balances

* structs are strange

* change comment

* disable kusama

* disable kusama

* Ana/427 polkadot single validator query (#440)

* save validators with operatoraddress as key

* add check to wait to fetch validators

* Update lib/resolvers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update lib/resolvers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* lint

* fix delegations

Co-authored-by: Fabian <frznhope@gmail.com>

* Add denom decimal places to networks.js (#434)

* lint

* add decimals places, refactor POLKADOT_CONVERSION

* add to schema

* add to tests

* refactor with @faboweb suggestions

* fix

* fix

* fix

* cleanup

* apply suggestions

* fix balances

* add factor properly to network

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* fix totalstake fiatvalue only returning euro (#442)

* Fix commission for validators in Polkadot network (#447)

* fix commission

* comment

* Fix expectedReturns for validators in Polkadot network (#446)

* fix expectedReturns

* change -- for null in getrewards and returns

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Ana/emoney validators load optimization (#430)

* just for testing. hang up on validatorssets latest

* fix emoney validators load

* resolve conflict

* remove experimental line

* linted

* Fabo/polkadot overview (#450)

* add first steps towards overview

* correct total

* fixed total

* fix getaccountinfo is not a funciton

* delete hardcoded node rpc url

* endpoint back to normal

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* change polkadot node back to paritys one (#453)

* Bump acorn from 5.7.3 to 5.7.4 (#454)

Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](acornjs/acorn@5.7.3...5.7.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fabo/improve delegations (#455)

* improve delegations

* removed timer

* add hack for accounts with no nominations

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* update polkadot api to latest (#456)

* updated minimist (#457)

* add empty getundelegations for polkadot (#458)

* Update polkadot api to v1.7.1 (#465)

* Ana/fix calculatefiatvalue when fiatcurrency not set (#462)

* fix calculatefiatvalue when fiatcurrency not set

* improve fix and comment

* linted

* Upgrade @polkadot/api to v1.8.0-beta.1 (#471)

* Add intention validators in Polkadot network (#468)

* Add timer to getAllValidators()

* Fetch intention addresses for current session

* wip

* Add validators

* working! getAllValidators exec time less than 10s

* fix status

* Cleanup

* fix free balance (#474)

* Fix delegations query in Polkadot network (#475)

* fetch delegations from stored valid. staking info

* Simplify

* Cleanup

* tx type in v2 subscriptions changed to TransactionV2 (#476)

* Ana/add new release script copying fe (#479)

* add new release script copying fe

* add node executor to circleci

* add aliases for circleci

* missed one alias

* change uluna gas price to recommended one (#481)

* fixing claim rewards pubsub publishing (#480)

* fixing claim rewards pubsub publishing

* only get stakingDenom once

Co-authored-by: Fabian Weber <frznhope@gmail.com>

* Fabo/fix failed txs parsing (#486)

* publish v2 txs and fix failed txs parsing

* linted

* Fabo/add logs to txs v2 (#487)

* add logs to txs v2

* better logic

* michiel/move yarn test to separate step for circleci (#482)

* migrate test.yml github workflow to circleci config.yml

fix executor from web to node

* remove test.yml workflow file

* refactor address extraction into reducers (#488)

* add polkadot prefix (#489)

* add polkadot prefix

* change address prefix to be a number

* Fabo/broadcast polkadot txs (#461)

* first steps to broadcast polkadot txs

* remove package-lock

* fixed api init

* remove debugger

* working broadcasting

* working

* ignore polkadot in tests

* Update lib/controller/transaction/index.js

Co-Authored-By: Jordan Bibla <jbibla@gmail.com>

Co-authored-by: Jordan Bibla <jbibla@gmail.com>

* Fabo/wait for data ready (#497)

* allow to wait for data to be ready

(cherry picked from commit 744d9b3b445286a9637fdadbeb5c473165cec58e)

* wait for data to be ready

(cherry picked from commit b6d665fd88ae22e5e3753249f27730eb12faebcb)

* keep store in cosmos source

(cherry picked from commit a6bb9f023eb56fb57d9a0f3a3ae12c997f6d04e3)

* Update lib/resolvers.js

* adds key to identify and sort txs (#492)

* improve blockHandler logic (#498)

(cherry picked from commit b67fab47adbf5a19caf99e17a9395e62419e8dad)

* Fabo/enable terra governance (#501)

* enable terra governance

* also enable proposals in terra testnet

* Ana/send all claimed rewards to fe (#493)

* send all claimed rewards to fe

* refactor reward coin reducer

* Fabo/allow single network run (#495)

* allow running a single network

* readme

* apply fix in networks

* Update lib/apollo.js

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Ana/refactor network capabilities (#502)

* refactor network capabilities

* refactor to have just a dictionary

* fix terra testnet. deleted accidentally testnet

Co-authored-by: Fabian <frznhope@gmail.com>

* Fabo/fix emoney reward precision (#504)

* fix emoney rewards precision

* comment

* remove polkadot log spamming

* add logging for failing tx parsing

* more kusama log removal

* Fabo/improve emoney loading (#494)

* allow to wait for data to be ready

* wait for data to be ready

* improve blockHandler logic

* keep store in cosmos source

* centralize emoney exchange queries

* fixed balances nto available

* precalculate all exchange rates

* remove mock values

* add sentry to nested block handler

* linted

* keep old emoney tokens for now

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* fix transaction log parsing

* better debugging

* prevent transactionReducerV2 from returning undefined (#508)

* prevent transactionReducerV2 from returning undefined

* Update lib/reducers/cosmosV0-reducers.js

Co-Authored-By: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* linting fix

Co-authored-by: Ana G. <40721795+Bitcoinera@users.noreply.github.com>

* fix one more log parsing issue

* WIP Ana/make estimate a query (#509)

* first attempt for estimate

* fix estimate schema

* lint

* Polkadot send transaction extraction (#500)

* tx logic draft

* fix lint

* wip

* lint

* working for send tx type

* should work publishing send tx!

* correct data is being passed to publishers

* cleanup

* working with extrinsics

* implement coin reducer

* Update lib/reducers/polkadotV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update lib/reducers/polkadotV0-reducers.js

Co-Authored-By: Fabian <frznhope@gmail.com>

Co-authored-by: Fabian <frznhope@gmail.com>

* Ana/add emoney mainnet (#511)

* first preparations

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* add correct chainid

* add validators poller for release

* check emoney mainnet validators recursively

Co-authored-by: Fabian <frznhope@gmail.com>

* fix no iterable for claimrewards amounts (#515)

* emoney mainnet is mainnet (#517)

* remove emoney release hack (#520)

* fix emoney mainnet expected returns (#522)

* useless console.log removed (#519)

* update emoney ngm gasprice (#525)

* Michiel/make clear separation between v0 and v2 reducers (#530)

* Replace transactionReducer with v2 for pollTransactionSuccess

* Replace transactionReducer with v2 for pollTransactionSuccess

* Fix structure

* Make clear seperation between v0 and v2 reducers

* Fix problem publishing transaction

* Fix pollTransactionSuccess

* Fix pollTransactionSuccess

* Ana/fix claim rewards denom for terra and emoney (#534)

* fix claim rewards denom for terra and emoney

* fix again

* Ana/fix expected returns cosmos and emoney (#536)

* fix expected returns for cosmos and emoney

* add missing property in type validator

* delete delegatorshares from type validator

* Ana/add gas estimates query (#503)

* add network fees query

* fix schema

* refactor using networkid with hyphens

* return only estimate for a transaction type

* add gas estimates to network object

* remove network fees from queries

* revert last two commits manually

* add default to network gas estimates

* apply suggestion

* michiel/remove reducer v0 (#535)

* Remove reducer v0

* Update cosmosV0-source.js

* linted

Co-authored-by: Fabian <frznhope@gmail.com>

* comment instructions on github templates (#539)

* Ana/fix gasestimate query and raise terra default gas estimate (#538)

* fix networkfees query

* raise terra default gas estimate

* Michiel/add akash portfolio (#541)

* first steps

* Integrate validators feature for akashv0

* Simplify extending Cosmos logic

* Remove unused imports

* Uncomment networks

* Enable portfolio for Akash

* Commnet livepeer mainnet network

* Commnet livepeer mainnet network

* fix validators expected returns

* apply code review

* use proper reducers

* add gas prices

* fix totalstake and delegation in general

* fix api_url

* correct staking denom to cosmossdk default for now

* add also default stake gas price

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Michiel/add Akash validators (#540)

* first steps

* Integrate validators feature for akashv0

* Simplify extending Cosmos logic

* Remove unused imports

* Uncomment networks

* Commnet livepeer mainnet network

* fix validators expected returns

* apply code review

* Fix version transactionsByHeight

Co-authored-by: michielmulders <michielmulders1@gmail.com>

* switch to the used getBlockByHeightV2 function in polkadot (#545)

* Ana&Mario/add missing coinlookups (#546)

* add missing coinlookups

* fix chaintoview conversion type

* fix claimrewardsamount reducer. get all (#548)

* fix polkadot error (#552)

* Split rewards from other queries (#543)

* moving rewards to resolved in overview

* lint

* working

* Add totalRewards resolver in Overview

* fix

* cleanup

* cleanup

* cleanup

* getViewDenom() is not async

* add rewardsV2 query

* add coinLookup property to all networks

* Update lib/source/cosmosV0-source.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* Update data/networks.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* suggestions, cleanup

* Remove rewardsV2

* revert schema changes

Co-authored-by: Fabian <frznhope@gmail.com>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* raise terra gas estimate for claiming (#553)

* Add tests checkAddress and getRewards (#555)

* disable akash for now (#559)

* [WIP] Show rewards in Polkadot (#513)

* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

Co-authored-by: Fabian Weber <frznhope@gmail.com>

* Fabo/add polkadot fees (#557)

* add polkadot fees

* refactored

* Ana/fix get transaction success from logs (#554)

* fix get transaction success from logs

* fix typo and simplify istxsucceeded logic

* check if claimed message has failed and replace

* move check if claim message failed and replace

* fix everything. all good

* MERGE!! :D Ana/feature not present in network (#510)

* set emoney governance features as null/not present

* change network capabilities to enum

* fix enum. enable gov actions in terra mainnet

* Ana/fix coinlookup for multidenom (#565)

* add multidenom coinlookups

* move coinlookups to separate file for readability

* Ana/3804 real fix polkadot balances also empty when none (#566)

* real fix for 3804 polkadot balance validation

* fix extra 0 decimals in balance

* fix deposit transactions (#570)

* enable terra testnet governance (#569)

* Fabo/rewards per era (#563)

* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

* load rewards

* steps towards storing the rewards

* fix era format

* fix validator in row needs to be address

* fix gql query

* format bug

* some refactoring

* fix missing await

* correctly get api

* push validator getter inside sources

* added address to lunie reward internaly

* add address correctly

* fix variable naming

* filter empty rewards

* add height from rewards

* fixed tests

* also fixed terra getRewards here

* Update lib/block-listeners/polkadot-node-subscription.js

Co-Authored-By: Fabian <frznhope@gmail.com>

* remove dead code

* fix stuff

* fix operatorAddress of undefined

* readded vanished code

* don't store validatorAddress

Co-authored-by: mariopino <info@quequiereshacer.es>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>

* Fabo/query past rewards script (#564)

* initial working state

* working, this time is true ;-)

* fix validator, comments

* fix, cleanup

* fix validator

* update comment

* Use coinReducer

* cleanup

* cleanup unused vars

* cleanup

* Flatten era rewards and then aggregate per valid

* refactored

* typo

* uüdated polkadot

* load rewards

* steps towards storing the rewards

* fix era format

* fix validator in row needs to be address

* fix gql query

* format bug

* some refactoring

* fix missing await

* correctly get api

* push validator getter inside sources

* added address to lunie reward internaly

* add address correctly

* fix variable naming

* filter empty rewards

* add height from rewards

* added query past rewards script

* calling main

* missing imports

* upsert to prevent conflicts

* flatten rewards

* fix too many labels issue

* typo

* write for each validator

* await finishing

* add validators correctly to the store

* remove timing for rewards

* correctly write validator and filter 0

* add check and filter out undefined validators

* fix amount decimals to 9. allow validator unknown

* added address better

* refactor

* fix tests

* only add needed columns to rows

* missing refactor

* fix getoldpolkadot rewards eras script

* possible fix to lastreward of undefined

* delete forgotten only

* typo

Co-authored-by: mariopino <info@quequiereshacer.es>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>

* Fabo/make db available from store (#567)

* make db available from store

* bad fix

* good fix

* fix delegations, validators, undelegations queries

Co-authored-by: Bitcoinera <anagjordano@gmail.com>

Co-authored-by: iambeone <iambeone@gmail.com>
Co-authored-by: Mario Pino <info@quequiereshacer.es>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>
Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michiel Mulders <michielmulders1@gmail.com>

* trigger CI

* linted

* linted

* restart

* changelog

* fix typo in deploy script

* trigger CI

* trigger CI

* trigger CI

* remove reconnection logic

* changelog

* linted

Co-authored-by: Bitcoinera <anagjordano@gmail.com>
Co-authored-by: iambeone <iambeone@gmail.com>
Co-authored-by: Mario Pino <info@quequiereshacer.es>
Co-authored-by: Ana G <40721795+Bitcoinera@users.noreply.github.com>
Co-authored-by: Jordan Bibla <jbibla@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michiel Mulders <michielmulders1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use docker the build
4 participants