note - instead of calling await client.details() (Asynchronous)
you can also just call client.lockClient....
This is useful if you have a client but have not called details, for whatever reason.
(Usually the UI has access to the details object via the useSunriseStake() hook)
NOTE
The API is simpler (fewer arguments need to be passed around), and more efficient (it doesn't have to load the state, and balance, all the time).
However, the client lock balance is now stored inside the state, which means it has to be refreshed. This differs from the gsol balance, which is retrieved on the details() call, so the lock client has user balance state whereas the main client does not, which is inconsistent. We might want to fix this later.
This means that after locking, unlocking or updating, the client needs to be refreshed. This is happening, but I am not sure if client.details() is re-called. So depending on how this is wired into the UI, it may need client.details() to be retriggered in the wrapper.
Refactored lock logic into a lock client.
To use:
Get the lock balance
Get the current impact nft level
To get the amount needed to get to the next level
note - instead of calling await client.details() (Asynchronous) you can also just call client.lockClient.... This is useful if you have a client but have not called details, for whatever reason. (Usually the UI has access to the details object via the useSunriseStake() hook)
NOTE
The API is simpler (fewer arguments need to be passed around), and more efficient (it doesn't have to load the state, and balance, all the time). However, the client lock balance is now stored inside the state, which means it has to be refreshed. This differs from the gsol balance, which is retrieved on the details() call, so the lock client has user balance state whereas the main client does not, which is inconsistent. We might want to fix this later.
This means that after locking, unlocking or updating, the client needs to be refreshed. This is happening, but I am not sure if client.details() is re-called. So depending on how this is wired into the UI, it may need client.details() to be retriggered in the wrapper.