Skip to content

Conversation

@r-czajkowski
Copy link
Contributor

@r-czajkowski r-czajkowski commented Feb 7, 2022

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 in KeepTokenStaking contract and T tokens staked in TTokenStaking contract.

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.
@github-actions
Copy link

github-actions bot commented Feb 7, 2022

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`.
@github-actions
Copy link

github-actions bot commented Feb 9, 2022

There is no need to use `*.tsx` extension. This commit changes extension
for this file to `*.ts`.
@github-actions
Copy link

github-actions bot commented Feb 9, 2022

@r-czajkowski r-czajkowski marked this pull request as ready for review February 9, 2022 13:26
@r-czajkowski r-czajkowski mentioned this pull request Feb 9, 2022
library,
active
? library
: new JsonRpcProvider(getEnvVariable(EnvVariable.ETH_HOSTNAME_HTTP)),
Copy link
Contributor

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

@georgeweiler georgeweiler merged commit c8fd72c into main Feb 15, 2022
@georgeweiler georgeweiler deleted the tvl branch February 15, 2022 18:46
georgeweiler added a commit that referenced this pull request Sep 8, 2022
Display tvl w/o connected wallet
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.

Token factors not displaying on mobile

3 participants