Skip to content

Conversation

tuna1207
Copy link
Member

@tuna1207 tuna1207 commented Oct 14, 2025

Description

Auto check for user crypto balance and trigger subscription server validation if current subscription is paused and token balance is sufficient

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

  1. Subscribe to shield using crypto
  2. Have insufficient fund error for subscription
  3. After adding fund, app should automatically trigger server validation for fund eligibility

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Automatically monitors crypto balance for paused Shield subscriptions and triggers server revalidation when sufficient funds are detected, with throttling and billing-cycle calculations.

  • Shield subscription (UI):
    • Adds useShieldAddFundTrigger to auto-check user crypto balances for paused Shield subscriptions and trigger updateSubscriptionCryptoPaymentMethod + getSubscriptions when funds are sufficient.
    • Integrates trigger into ShieldSubscriptionProvider and types Redux dispatch to MetaMaskReduxDispatch.
    • Introduces throttling via new useThrottle hook (with comprehensive tests) to avoid frequent triggers.
  • Pricing/Balances:
    • Leverages pricing data (useSubscriptionPricing, product plans, payment methods) and current EVM balances to determine fund sufficiency per selected token/chain.
  • Shared:
    • Adds calculateSubscriptionRemainingBillingCycles in shared/modules/shield.ts using RECURRING_INTERVALS to compute remaining cycles used in balance checks.

Written by Cursor Bugbot for commit 2f72178. This will update automatically on new commits. Configure here.

@tuna1207 tuna1207 marked this pull request as ready for review October 15, 2025 05:02
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants