-
Notifications
You must be signed in to change notification settings - Fork 26
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
Display tvl w/o connected wallet #85
Conversation
Use a default `JsonRpcProvider` with our url to the Ethereum node if user is not connected to the any wallet yet to fetch data that does not require a wallet connection- eg. total value locked.
This is a workaround because if we provide wrong param to the contrct's function eg. `undefined` the `_.contract?.interface.encodeFunctionData(_.method, _.args),` will fail. We want to fetch token balances only if a user is connected to a wallet- to avoid passing the `undefined` if a user is not connected yet we pass the `AddressZero` to the `useTokensBalanceCall` hook which uses the `useMulticall` hook.
We should take into account the KEEP tokens staked in `KeepTokenStaking` and T tokens `staked` in `TStakingContract`.
Subscribe to event only if user is connected to a wallet.
Preview uploaded to https://preview.dashboard.test.threshold.network/tvl/index.html. |
Update a `useSubscribeToContractEvent` test and add a new test case- test the hook when a user is not connected to a wallet.
In `eceb3d4` we added support for creating a contract instance with a default provider w/o connected wallet and this commit adjusts test cases for this feature.
In `1f4a1dc` we unnecessary updated the `useTokenBalance` hook because we thought this hook was causing the balance update problem after catching the `Transfer` event. There was actually a bug in `useSubscribeToContractEvent` hook which was fixed in `ad0bccd`.
Preview uploaded to https://preview.dashboard.test.threshold.network/tvl/index.html. |
There is no need to use `*.tsx` extension. This commit changes extension for this file to `*.ts`.
Preview uploaded to https://preview.dashboard.test.threshold.network/tvl/index.html. |
library, | ||
active | ||
? library | ||
: new JsonRpcProvider(getEnvVariable(EnvVariable.ETH_HOSTNAME_HTTP)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing. this is what we've been missing for a ton of unconnected queries in the app
Display tvl w/o connected wallet
Closes: #87
This PR adds support for fetching and displaying the tvl w/o connected wallet. It also updates tvl calculations- adds a value of
KEEP
tokens staked inKeepTokenStaking
contract andT
tokens staked inTTokenStaking
contract.