Skip to content

feat: init token and yield when disconnected - #426

Merged
petar-omni merged 1 commit into
mainfrom
feat/init-token-yield-on-disconnected
Aug 15, 2025
Merged

petar-omni merged 1 commit into
mainfrom
feat/init-token-yield-on-disconnected

Conversation

@petar-omni

Copy link
Copy Markdown
Contributor

This pull request introduces improvements to how the widget initializes tokens and yields when there is no direct connection or when preferred token/yield information is missing. The main focus is to provide sensible defaults by falling back to the first available token or yield in these cases.

Enhancements to default token and yield initialization:

  • Updated getInitialToken in stake.ts to fall back to the first available token yield when a preferred token yield is not specified, ensuring smoother initialization when disconnected.
  • Modified firstEligibleYield in use-multi-yields.ts` to select the first available yield as a fallback if the preferred yield is not found, improving robustness in yield selection logic.

Changelog update:

  • Added a patch changelog entry describing the new fallback logic for token and yield initialization when disconnected.

@changeset-bot

changeset-bot Bot commented Aug 14, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 47d6d0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stakekit/widget Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 14, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
dashboard-finery Ready Preview Comment Aug 14, 2025 1:30pm
dashboard-utila Ready Preview Comment Aug 14, 2025 1:30pm
staging-widget Ready Preview Comment Aug 14, 2025 1:30pm
stakekit-widget Ready Preview Comment Aug 14, 2025 1:30pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the widget's initialization behavior when disconnected by implementing fallback logic for token and yield selection. When preferred tokens or yields are not available for the current network, the system now falls back to the first available option from any network.

  • Enhanced getInitialToken to use fallback token selection when preferred tokens are unavailable
  • Updated firstEligibleYield to implement similar fallback logic for yield selection
  • Added changelog entry documenting the new disconnected initialization behavior

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/widget/src/domain/types/stake.ts Added fallback logic to select first available token when preferred tokens are missing
packages/widget/src/hooks/api/use-multi-yields.ts Implemented fallback yield selection using first available network's yields
.changeset/warm-worms-study.md Added changelog entry for the new fallback initialization feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread packages/widget/src/hooks/api/use-multi-yields.ts
Comment thread packages/widget/src/domain/types/stake.ts
@petar-omni
petar-omni merged commit 45e02b2 into main Aug 15, 2025
9 checks passed
@petar-omni
petar-omni deleted the feat/init-token-yield-on-disconnected branch August 15, 2025 12:00
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