Skip to content

Conversation

@premiumjibles
Copy link
Collaborator

@premiumjibles premiumjibles commented Jul 24, 2025

Description

Fix for some adjustments that were made to generic transaction handling that excluded fox farm. We've added explicit checks for display types when calculating the complete message in action centre so we'll need a display type for fox farming.

Issue (if applicable)

closes #

Risk

Low risk, fixes existing bug.

High Risk PRs Require 2 approvals

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

Testing

  • Test that fox farming works and notifications work as expected.
  • Claim, withdraw and deposit
  • Notifications should show pending and eventually complete

Engineering

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Screenshots (if applicable)

image

Summary by CodeRabbit

  • New Features

    • Added support for displaying and categorizing FOX Farming transactions (Deposit, Withdraw, Claim) in the transaction center.
  • Improvements

    • Enhanced transaction notifications and status updates for FOX Farming actions.
    • Updated transaction metadata to consistently require a display type for better clarity.

@premiumjibles premiumjibles requested a review from a team as a code owner July 24, 2025 21:31
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

This change introduces the FoxFarm value to the GenericTransactionDisplayType enum, makes the displayType property required in transaction metadata, and updates Fox Farming deposit, withdraw, and claim flows to include this display type in dispatched actions. The generic transaction subscriber hook is also updated to handle the new display type.

Changes

File(s) Change Summary
src/state/slices/actionSlice/types.ts Added FoxFarm to GenericTransactionDisplayType enum; made displayType required in ActionGenericTransactionMetadata.
.../fox-farming/components/FoxFarmingManager/Claim/ClaimConfirm.tsx
.../Deposit/components/Confirm.tsx
.../Withdraw/components/Confirm.tsx
Updated action dispatches to include displayType: GenericTransactionDisplayType.FoxFarm in transaction metadata.
src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx Added support for FoxFarm display type in message mapping and processing logic within the generic transaction subscriber hook.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI_Component as FoxFarming UI (Deposit/Withdraw/Claim)
    participant ReduxStore
    participant ActionSubscriber

    User->>UI_Component: Initiates Deposit/Withdraw/Claim
    UI_Component->>ReduxStore: Dispatch upsertAction with displayType=FoxFarm
    ReduxStore-->>ActionSubscriber: Notifies of new action
    ActionSubscriber->>ActionSubscriber: Processes action with displayType FoxFarm
    ActionSubscriber->>ReduxStore: Updates status, triggers notifications
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • gomesalexandre

Poem

In fields where Foxes farm and play,
A new display type hops in today.
Actions now marked, no longer stray,
The subscriber listens, hooray hooray!
With every deposit, claim, or withdraw,
🦊 The Action Center keeps perfect law.
— A rabbit, with code in its paw.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

yarn install v1.22.22
[1/4] Resolving packages...
(node:22949) [DEP0169] DeprecationWarning: url.parse() behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for url.parse() vulnerabilities.
(Use node --trace-deprecation ... to show where the warning was created)
warning eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
warning eslint > file-entry-cache > flat-cache > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
warning eslint > @humanwhocodes/config-array > @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > inflight@1.0.6: This

... [truncated 5212 characters] ...

com/cosmos for further assistance.
warning @metaplex-foundation/js@0.20.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
warning @metaplex-foundation/js > lodash.isequal@4.5.0: This package is deprecated. Use require('node:util').isDeepStrictEqual instead.
warning @metaplex-foundation/js > @irys/sdk@0.0.2: Arweave support is deprecated - We recommend migrating to the Irys datachain: https://migrate-to.irys.xyz/
warning @metaplex-foundation/js > @irys/sdk > aptos@1.8.5: Package aptos is no longer supported, please migrate to https://www.npmjs.com/package/@aptos-labs/ts-sdk
error Couldn't find any versions for "@shapeshiftoss/caip" that matches "workspace:^"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65e3aad and 6325358.

📒 Files selected for processing (5)
  • src/features/defi/providers/fox-farming/components/FoxFarmingManager/Claim/ClaimConfirm.tsx (2 hunks)
  • src/features/defi/providers/fox-farming/components/FoxFarmingManager/Deposit/components/Confirm.tsx (2 hunks)
  • src/features/defi/providers/fox-farming/components/FoxFarmingManager/Withdraw/components/Confirm.tsx (2 hunks)
  • src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx (2 hunks)
  • src/state/slices/actionSlice/types.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: gomesalexandre
PR: shapeshift/web#10074
File: src/features/defi/providers/fox-farming/components/FoxFarmingManager/Withdraw/components/Confirm.tsx:192-194
Timestamp: 2025-07-24T10:07:54.919Z
Learning: For fox farming withdrawals in the ShapeShift web app, the architectural preference is to either not handle errors with old-style toast notifications or handle broadcast on-chain errors holistically through the action center system. On-chain errors are considered rare and not a major concern worth individual toast handling.
Learnt from: gomesalexandre
PR: shapeshift/web#10073
File: src/features/defi/providers/fox-farming/components/FoxFarmingManager/Claim/Claim.tsx:77-84
Timestamp: 2025-07-24T11:07:20.536Z
Learning: In fox farming components, the `opportunity?.rewardsCryptoBaseUnit?.amounts` property has a well-defined type signature that is always an array (never undefined), but can be empty: `readonly [] | readonly [string, string, string] | readonly [string, string] | readonly [string]`. Using optional chaining on the `amounts` property itself is unnecessary since it's always defined, though accessing `amounts[0]` on an empty array returns undefined which bnOrZero() handles safely.
src/features/defi/providers/fox-farming/components/FoxFarmingManager/Withdraw/components/Confirm.tsx (2)

Learnt from: gomesalexandre
PR: #10074
File: src/features/defi/providers/fox-farming/components/FoxFarmingManager/Withdraw/components/Confirm.tsx:192-194
Timestamp: 2025-07-24T10:07:54.919Z
Learning: For fox farming withdrawals in the ShapeShift web app, the architectural preference is to either not handle errors with old-style toast notifications or handle broadcast on-chain errors holistically through the action center system. On-chain errors are considered rare and not a major concern worth individual toast handling.

Learnt from: CR
PR: shapeshift/web#0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/**/*.ts : Use TypeScript with explicit types (e.g., SupportedChainIds) in all swapper-related files.

src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx (2)

Learnt from: gomesalexandre
PR: #10074
File: src/features/defi/providers/fox-farming/components/FoxFarmingManager/Withdraw/components/Confirm.tsx:192-194
Timestamp: 2025-07-24T10:07:54.919Z
Learning: For fox farming withdrawals in the ShapeShift web app, the architectural preference is to either not handle errors with old-style toast notifications or handle broadcast on-chain errors holistically through the action center system. On-chain errors are considered rare and not a major concern worth individual toast handling.

Learnt from: gomesalexandre
PR: #10073
File: src/features/defi/providers/fox-farming/components/FoxFarmingManager/Claim/Claim.tsx:77-84
Timestamp: 2025-07-24T11:07:20.536Z
Learning: In fox farming components, the opportunity?.rewardsCryptoBaseUnit?.amounts property has a well-defined type signature that is always an array (never undefined), but can be empty: readonly [] | readonly [string, string, string] | readonly [string, string] | readonly [string]. Using optional chaining on the amounts property itself is unnecessary since it's always defined, though accessing amounts[0] on an empty array returns undefined which bnOrZero() handles safely.

src/features/defi/providers/fox-farming/components/FoxFarmingManager/Claim/ClaimConfirm.tsx (1)

Learnt from: gomesalexandre
PR: #10074
File: src/features/defi/providers/fox-farming/components/FoxFarmingManager/Withdraw/components/Confirm.tsx:192-194
Timestamp: 2025-07-24T10:07:54.919Z
Learning: For fox farming withdrawals in the ShapeShift web app, the architectural preference is to either not handle errors with old-style toast notifications or handle broadcast on-chain errors holistically through the action center system. On-chain errors are considered rare and not a major concern worth individual toast handling.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install and Cache
🔇 Additional comments (12)
src/state/slices/actionSlice/types.ts (2)

66-66: LGTM! FoxFarm display type addition is well-structured.

The new enum member follows the established pattern with a clear, user-friendly display string.


71-71: Good change making displayType required.

This ensures explicit categorization of all transactions and prevents potential runtime errors from missing display types. The breaking change aligns with the PR's objective to fix generic transaction handling.

src/features/defi/providers/fox-farming/components/FoxFarmingManager/Claim/ClaimConfirm.tsx (2)

44-48: LGTM! Proper import of the new display type.

The import addition is clean and follows the established pattern.


150-150: Good addition of required displayType.

This explicitly categorizes fox farming claim transactions and prevents potential runtime errors now that displayType is required in the type definition.

src/features/defi/providers/fox-farming/components/FoxFarmingManager/Withdraw/components/Confirm.tsx (2)

36-40: LGTM! Consistent import pattern.

The import follows the same clean pattern used in other components.


148-148: Good addition of displayType for withdraw transactions.

This properly categorizes fox farming withdrawal transactions and aligns with the required displayType field.

src/features/defi/providers/fox-farming/components/FoxFarmingManager/Deposit/components/Confirm.tsx (2)

36-40: LGTM! Consistent import across fox farming components.

The import pattern is identical across all fox farming components, showing good consistency.


155-155: Good addition of displayType for deposit transactions.

This completes the categorization of all fox farming transaction types (deposit, withdraw, claim) with the new display type.

src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx (4)

34-34: LGTM! Proper message mapping for fox farming deposits.

The translation key 'actionCenter.deposit.complete' is appropriate for completed deposit transactions.


39-39: LGTM! Proper message mapping for fox farming withdrawals.

The translation key 'actionCenter.withdrawal.complete' correctly handles completed withdrawal transactions.


41-43: Good addition of Claim action type support.

Adding the entire Claim action type with FoxFarm mapping ensures fox farming claim transactions are properly handled by the subscriber.


66-70: Essential filter update to process FoxFarm transactions.

Including GenericTransactionDisplayType.FoxFarm in the filter ensures that fox farming transactions are actually processed by the subscriber, completing the integration.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-fox-farm

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Member

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does as promises!

Image

@0xApotheosis 0xApotheosis merged commit bf0ebce into develop Jul 24, 2025
4 checks passed
@0xApotheosis 0xApotheosis deleted the fix-fox-farm branch July 24, 2025 22:05
@coderabbitai coderabbitai bot mentioned this pull request Jan 8, 2026
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.

3 participants