Skip to content

[Co-staking] - remove window.dispatchEvent #369

@gbarkhatov

Description

@gbarkhatov

Switch from window.dispatchEvent introduced in this PR: #357 to a proper context/state

The basic idea is that we need to query with GET the /v2/apr endpoint:

  • once we stake BTC (API data + local storage). Local storage -> we are not counting verified, but instead the ones that were signed + submitted to BTC
  • once we stake BABY

In both cases this is needed since back-end is not immediately aware of user staked BTC or BABY

window.dispatchEvent was introduced to overcome the context issue and simplify the consumption of back-end data for co-staking split and calculations

The outcome of this ticket should be the same:

  • once we stake BTC we receive the feedback in the co-staking CTA modal after staking, with updated A%, B%, X
  • once we stake BABY we immediately fetch the updated data, and see the X on baby route/tab
  • rewards also work as expected, showing the split, able to claim, etc.

This issue requires #357 to be merged first

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions