SharedStake / SharedStake-ui

SharedStake User Interface using vue.js
https://www.sharedstake.org/
GNU General Public License v3.0
16 stars 15 forks source link

Use window.ethereum to get vETH2 total supply #89

Closed exitonoff closed 3 years ago

exitonoff commented 3 years ago

Landing page used Etherscan to fetch vETH2 total supply. That call was failing so changed the fetch to use window.ethereum. If it doesn't exist, fallback values are used. Those fallback values should maybe be updated to be a bit closer to the current values?

sharedStake-main commented 3 years ago

As a side note, I suggest to use a second fall-back with the etherscan link.

exitonoff commented 3 years ago

As a side note, I suggest to use a second fall-back with the etherscan link.

So leave Etherscan API call as a fallback, even though it exposes your API key? Just wanting to make sure I got what you are saying.

sharedStake-main commented 3 years ago

@exitonoff yes, codeflow should be:

Does it sound good?

exitonoff commented 3 years ago

@sharedStake-main

I changed the code to primarily use Etherscan API. Secondary we use window.ethereum and if it doesn't exist we fallback to hard coded values.

I went ahead and separated the code into own functions to make the code bit easier to read and to make the code bit more fault resilient. Also updated the hard coded TVL to represent the locked ETH amount bit more accurately :D