web icon indicating copy to clipboard operation
web copied to clipboard

feat: display rFOX reward transactions on dashboard

Open woodenfurniture opened this issue 1 year ago • 2 comments

Description

Upgrades the rFOX dashboard to show all rewards received for the current rFOX staking account.

Supports display of rewards sent to any thorchain account currently connected to the app, corresponding to the staking account on the rFOX page. Includes historically changed thorchain addresses as long as they are connected to the app.

Refactoring and general improvements:

  • Makes getReadStakingInfoQueryFn and getReadStakingInfoQueryKey functions for re-usable application to the new useStakingInfoHistoryQuery
  • Added loading skeleton to TransactionsGroupByDate
  • Safer selectors selectRuneAddress and selectStakingBalance replacing repeated, less safe equivalents

Cleanup:

  • Moves types into types.ts files
  • Moves helpers into helpers.ts files
  • Moves constants into constants.ts files
  • Removed unused selectHighestAccountNumberForChainId
  • Fixed incorrect naming of some functions noticed while devving

Doesnt do:

  • Does not support displaying rewards received to thorchain accounts not connected to the app
  • Does not support multiple staking accounts

Pull Request Type

  • [ ] :bug: Bug fix (Non-breaking Change: Fixes an issue)
  • [ ] :hammer_and_wrench: Chore (Non-breaking Change: Doc updates, pkg upgrades, typos, etc..)
  • [x] :nail_care: New Feature (Breaking/Non-breaking Change)

Issue (if applicable)

closes #7281

Risk

High Risk PRs Require 2 approvals

Moderate risk, affects rFOX hooks responsible for fetching rFOX data for dashboard. Does not affect sending of funds or transacting.

What protocols, transaction types or contract interactions might be affected by this PR?

Testing

Impossible to thoroughly test without mock data (engineers please test this, see below). Smoke test of rFOX dashboard to ensure no crashing or insane behavior.

Engineering

Set up your .env for testing with mock data:

REACT_APP_FEATURE_RFOX_REWARDS_TX_HISTORY=true
REACT_APP_FEATURE_RFOX_MOCK_REWARDS_TX_HISTORY=true
REACT_APP_RFOX_REWARDS_MOCK_RUNE_ADDRESS=<your connected rune address>

Clear cache when finished testing to remove mock txs.

Operations

Screenshots (if applicable)

https://jam.dev/c/cfb51e7a-5e95-46ea-a655-0181a8000ec6

woodenfurniture avatar Jul 04 '24 05:07 woodenfurniture

Note: we should avoid any requests that would require an archive node in the front end.

We can get the historic rune address from the tx data directly vs having to pull that at a given block height / state.

0xean avatar Jul 08 '24 22:07 0xean

Blocking: we cannot fetch rune address historically from the node as this would require an archive node in production. ~~Instead we should lookup the logs with rune address changes, and then grab the tx data associated with that log, decode it to get the rune address.~~

Scheduled to move directly to IPFS for all of this

woodenfurniture avatar Jul 08 '24 22:07 woodenfurniture

Merging now so we can re-work all dashboard queries to work without archive node, and instead use IPFS https://github.com/shapeshift/web/issues/7343

woodenfurniture avatar Jul 09 '24 02:07 woodenfurniture