Skip to content

Midnight redeem functions#4423

Merged
Nebyt merged 32 commits intodevelopfrom
feat/YOEXT-2355/midnight-redeem-1
Dec 17, 2025
Merged

Midnight redeem functions#4423
Nebyt merged 32 commits intodevelopfrom
feat/YOEXT-2355/midnight-redeem-1

Conversation

@yushih
Copy link
Collaborator

@yushih yushih commented Nov 18, 2025

Note

Implements Midnight airdrop redemption: scans address thaw schedules, shows statuses/details, and builds/signs redemption tx with collateral handling, while refactoring UI to shared i18n strings.

  • Airdrop UI/Flow:
    • Add AirdropPage overhaul to scan wallet addresses for thaws, list destinations (AddressCard), and show schedule/details (AddressDetails).
    • Introduce Redeem dialog to fetch collateral, build redemption tx, handle reorg flow, and send via tx review modal.
    • Refactor dialogs/components (AbortDialog, ClaimDialog, LedgerClaimDialog, ClaimInfo, Terms, Zero) to use shared strings via useStrings.
  • API/Logic:
    • Extend api/ada/midnight.js with thaw scanning (scanAddressesForThaws), thaw schedule fetch, collateral selection (getCollateralUtxos with reorg path), reorg tx creation, and redemption tx builder (getRedemptionTransaction).
    • Add midnightRedemption.ts with Schedule types and helpers (formatNumber, getRedeemable, getTotal, getStatus).
  • Localization/Theme:
    • Add numerous airdrop i18n keys and useStrings hook; update en-US.json.
    • Add illustration_static to light/dark palettes; tweak TopBarLayout overflow to auto.

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

@sonarqube-yoroi
Copy link

@Nebyt Nebyt added this to the 5.20.0 milestone Dec 5, 2025
@yushih yushih marked this pull request as ready for review December 15, 2025 11:45
banklesss
banklesss previously approved these changes Dec 15, 2025
Copy link
Contributor

@banklesss banklesss left a comment

Choose a reason for hiding this comment

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

It seems that the cursor suggestions make sense.

//hack: detect that the copy address icon is clicked
if ((event.target as HTMLElement).tagName === 'svg') {
return;
}
Copy link

Choose a reason for hiding this comment

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

Bug: SVG click detection only catches parent element clicks

The click handler checks if event.target.tagName === 'svg' to detect clicks on the copy icon, but this only works when clicking directly on the SVG element itself. Clicking on child elements inside the SVG (like path, rect, or circle elements) will have a different tagName, causing the check to fail and onSelect() to be called unintentionally when users click on parts of the copy icon.

Fix in Cursor Fix in Web

const [getCollateralUtxosResult, setGetCollateralUtxosResult] = useState<any>(null);
const [redemptionTxBuildingResponse, setRedemptionTxBuildingResponse] = useState<any>(null);
const [error, setError] = useState<string | null>(null);
void error;
Copy link

Choose a reason for hiding this comment

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

Bug: Error state captured but never displayed to user

The error state is declared and set when getRedemptionTransaction fails, but it's immediately voided with void error and never rendered in the component. When an error occurs, users will see the loading indicator indefinitely with no feedback about what went wrong, since redemptionTxBuildingResponse remains null and the component displays strings.redeemLoading.

Fix in Cursor Fix in Web

@Nebyt Nebyt merged commit ae05bcf into develop Dec 17, 2025
30 of 33 checks passed
@Nebyt Nebyt deleted the feat/YOEXT-2355/midnight-redeem-1 branch December 17, 2025 14:10
@zuzunker zuzunker mentioned this pull request Dec 22, 2025
18 tasks
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