Skip to content

feat: CDK multimint sends#3773

Open
a-khushal wants to merge 38 commits intoZeusLN:masterfrom
a-khushal:feat/cashu-multimint
Open

feat: CDK multimint sends#3773
a-khushal wants to merge 38 commits intoZeusLN:masterfrom
a-khushal:feat/cashu-multimint

Conversation

@a-khushal
Copy link
Copy Markdown
Contributor

@a-khushal a-khushal commented Mar 1, 2026

Description

Relates to issue: ZEUS-2951
Most of the code's been taken from #3177

This pull request is categorized as a:

  • New feature
  • Bug fix
  • Code refactor
  • Configuration change
  • Locales update
  • Quality assurance
  • Other

Checklist

  • I’ve run yarn run tsc and made sure my code compiles correctly
  • I’ve run yarn run lint and made sure my code didn’t contain any problematic patterns
  • I’ve run yarn run prettier and made sure my code is formatted correctly
  • I’ve run yarn run test and made sure all of the tests pass

Testing

If you modified or added a utility file, did you add new unit tests?

  • No, I’m a fool
  • Yes
  • N/A

I have tested this PR on the following platforms (please specify OS version and phone model/VM):

  • Android
  • iOS

I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):

  • Embedded LND
  • LND (REST)
  • LND (Lightning Node Connect)
  • Core Lightning (CLNRest)
  • Nostr Wallet Connect
  • LndHub

Locales

  • I’ve added new locale text that requires translations
  • I’m aware that new translations should be made on the ZEUS Transfix page and not directly to this repo

Third Party Dependencies and Packages

  • Contributors will need to run yarn after this PR is merged in
  • 3rd party dependencies have been modified:
    • verify that package.json and yarn.lock have been properly updated
    • verify that dependencies are installed for both iOS and Android platforms

Other:

  • Changes were made that require an update to the README
  • Changes were made that require an update to onboarding

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the Cashu payment system by enabling multi-mint sends. This feature allows users to aggregate funds from several Cashu mints to complete a single payment, improving the user experience by providing more robust payment options. The changes span across the core Cashu DevKit, the application's data stores, and various user interface components to seamlessly integrate this new capability.

Highlights

  • Multi-Mint Payment Functionality: Introduced the capability to send Cashu payments using multiple mints simultaneously, enhancing payment flexibility and reliability.
  • New UI for Multi-Mint Selection: Implemented a new MultimintPayment screen to orchestrate and display the progress of payments across various Cashu mints, along with updates to EcashMintPicker and Mints views for multi-mint selection.
  • Cashu DevKit Enhancements: Added transferExactReceive and transferFullBalance methods to the Cashu DevKit for both Android (Kotlin) and iOS (Swift) to facilitate multi-mint transfers, and updated meltQuote to support additional options.
  • Cashu Store Logic Updates: Modified the CashuStore to manage multiple selected mints (selectedMintUrls), implement transferToMintCDK for topping up mints, and orchestrate multi-mint payment logic via payLnInvoiceFromEcashMultiMint.
  • User Setting for Multi-Mint: Added a new setting (enableMultiMint) in EcashSettings to allow users to toggle the multi-mint functionality on or off.
Changelog
  • App.tsx
    • Imported and registered the new MultimintPayment screen into the application's navigation stack.
  • android/app/src/main/java/com/zeus/cashudevkit/CashuDevKitModule.kt
    • Added helper functions readPositiveLong, parseMeltOptions, and encodeTransferResult to handle JSON parsing and result encoding.
    • Implemented transferExactReceive and transferFullBalance methods to enable multi-mint transfers.
    • Modified the meltQuote method to accept an optionsJson parameter for more flexible melt options.
  • cashu-cdk/CashuDevKit.ts
    • Imported the CDKTransferResult type.
    • Added asynchronous methods transferExactReceive and transferFullBalance to the CashuDevKit class.
  • cashu-cdk/types.ts
    • Defined the CDKTransferResult interface to represent the outcome of multi-mint transfers.
    • Extended the CashuDevKitNativeModule interface with transferExactReceive and transferFullBalance method signatures.
  • components/EcashMintPicker.tsx
    • Injected SettingsStore into the component props.
    • Updated EcashMintPickerProps to include SettingsStore and isReceiveView.
    • Refactored rendering logic to dynamically display single or multiple selected mints based on multiMintEnabled and isReceiveView props, improving multi-mint selection UI.
  • ios/CashuDevKit/CashuDevKitModule.m
    • Declared transferExactReceive and transferFullBalance methods for Objective-C bridging to React Native.
  • ios/CashuDevKit/CashuDevKitModule.swift
    • Added helper functions parseMeltOptions and encodeTransferResult for JSON parsing and result encoding.
    • Implemented transferExactReceive and transferFullBalance methods to support multi-mint transfers.
    • Modified the meltQuote method to accept an optionsJson parameter.
  • locales/en.json
    • Added new locale strings for multi-mint functionality, including 'Enable Cashu Multi-mint sends', 'NUT-15 required', 'Multi-mint', and 'No mints selected'.
  • stores/CashuStore.ts
    • Imported CDKTransferResult type.
    • Added observable properties selectedMintUrls to track multiple selected mints and lastMultiMintUsedMints to record mints used in the last multi-mint payment.
    • Implemented transferToMintCDK to facilitate topping up a target mint's balance from other mints.
    • Added mintSupportsMpp helper function to check if a mint supports NUT-15 (Multi-Path Payments).
    • Introduced payLnInvoiceFromEcashMultiMint for orchestrating payments across multiple mints.
    • Modified createMeltQuoteCDK to accept an optional options parameter.
    • Updated setSelectedMint, setReceiveMint, setSelectedMintUrls, and toggleMintSelection actions to manage single and multi-mint selections.
    • Adjusted removeMint logic to correctly filter selectedMintUrls when a mint is removed.
    • Updated initialize and clearWallet methods to properly handle the new selectedMintUrls state.
    • Modified payLnInvoiceFromEcash to conditionally use payLnInvoiceFromEcashMultiMint when multi-mint is enabled.
  • stores/SettingsStore.ts
    • Added the enableMultiMint boolean property to the EcashSettings interface and its default values.
  • views/Cashu/CashuPaymentRequest.tsx
    • Imported the Switch component.
    • Added multiMintLoading to the component's state to manage loading indicators.
    • Modified triggerPayment to navigate to the new MultimintPayment screen if multi-mint functionality is enabled.
    • Updated the UI to include a toggle for multi-mint functionality and dynamically adjust layout based on the number of selected mints.
    • Disabled payment buttons during multi-mint loading or settings updates to prevent unintended actions.
  • views/Cashu/CashuSendingLightning.tsx
    • Adjusted the logic for handling donation payments to correctly process results from multi-mint payment scenarios.
  • views/Cashu/LegacySeedRecovery.tsx
    • Added the isReceiveView prop to EcashMintPicker to differentiate between send and receive contexts.
  • views/Cashu/LightningAddress/LightningAddressSettings.tsx
    • Modified the navigation to the 'Mints' screen to force single mint selection for Lightning Address settings.
  • views/Cashu/Mints.tsx
    • Injected SettingsStore into the component props.
    • Updated MintsProps to include SettingsStore and a forceSingleMint route parameter.
    • Modified handleFocus to invoke syncMultiMintSelection for consistent multi-mint state management.
    • Added syncMultiMintSelection to filter and set selectedMintUrls based on NUT-15 support.
    • Refactored the render method to support multi-mint selection UI with checkboxes and a 'Confirm' button.
    • Implemented logic to visually disable mints that do not support NUT-15 when multi-mint is enabled.
  • views/Cashu/MultimintPayment.tsx
    • Added a new React Native screen (MultimintPayment) responsible for displaying the real-time status and results of a payment made across multiple Cashu mints. This screen includes loading indicators, success/error messages, and a list of participating mints with their individual statuses.
  • views/Cashu/ReceiveEcash.tsx
    • Added the isReceiveView prop to EcashMintPicker for receive-specific mint selection behavior.
  • views/Settings/EcashSettings.tsx
    • Added enableMultiMint to the component's state.
    • Updated componentDidMount to load the enableMultiMint setting.
    • Modified the render method to include a toggle for 'Enable Cashu Multi-mint sends' and update the settings accordingly.
Activity
  • The pull request introduces a new feature related to CDK multimint sends, as indicated by the title and description.
  • The author, a-khushal, has confirmed that all necessary development checks (TypeScript compilation, linting, Prettier formatting, and tests) have passed.
  • Testing was performed on Android using an Embedded LND node.
  • New locale strings have been added, and the author is aware of the translation process via Transifex.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant new feature: multi-mint sends for Cashu ecash. This allows users to pay Lightning invoices using funds from multiple mints simultaneously. The changes are extensive, touching native Android and iOS code, the TypeScript bridge, data stores, and multiple UI components.

My review focuses on the new logic and its integration. I've identified opportunities to reduce code duplication in the native modules for both Android and iOS, which will improve maintainability. The overall implementation of the multi-mint payment flow, including the UI for mint selection and the payment progress screen, appears robust and well-designed.

Comment thread android/app/src/main/java/com/zeus/cashudevkit/CashuDevKitModule.kt
Comment thread ios/CashuDevKit/CashuDevKitModule.swift Outdated
@a-khushal a-khushal force-pushed the feat/cashu-multimint branch from f6a6870 to 4445487 Compare March 1, 2026 13:49
@kaloudis kaloudis added this to the v0.13.0 milestone Mar 2, 2026
@kaloudis kaloudis mentioned this pull request Mar 3, 2026
28 tasks
Comment thread views/Cashu/MultimintPayment.tsx Outdated
Comment thread components/EcashMintPicker.tsx
Comment thread views/Cashu/MultimintPayment.tsx Outdated
ajaysehwal

This comment was marked as resolved.

@a-khushal a-khushal force-pushed the feat/cashu-multimint branch 2 times, most recently from 8a9cbb3 to 611117d Compare March 5, 2026 20:14
@ajaysehwal
Copy link
Copy Markdown
Contributor

@a-khushal, Please resolve branch conflicts

@a-khushal a-khushal force-pushed the feat/cashu-multimint branch 4 times, most recently from 8b7d1cb to 1f4de93 Compare March 10, 2026 05:07
@kaloudis
Copy link
Copy Markdown
Contributor

Current UI selection clashes with Random mint selection for receives, we have to reconcile that.

@kaloudis
Copy link
Copy Markdown
Contributor

Simulator Screenshot - iPhone 16 Pro - 2026-03-11 at 00 20 20

This doesn't work. See the approach we've used for showing multiple mints on the Ecash balance slider

@kaloudis kaloudis linked an issue Mar 11, 2026 that may be closed by this pull request
@a-khushal a-khushal force-pushed the feat/cashu-multimint branch from 1f4de93 to 101ea1b Compare March 11, 2026 06:00
@a-khushal
Copy link
Copy Markdown
Contributor Author

a-khushal commented Mar 11, 2026

This doesn't work. See the approach we've used for showing multiple mints on the Ecash balance slider

image

@a-khushal a-khushal force-pushed the feat/cashu-multimint branch 7 times, most recently from b458178 to 86cfeab Compare March 11, 2026 10:43
kaloudis and others added 29 commits April 19, 2026 04:09
…t view, and show invoice details on insufficient funds
… mint to single mint

fix lnurl ecash flow to continue on not enough funds error
@a-khushal a-khushal force-pushed the feat/cashu-multimint branch from 66d7462 to 36eec46 Compare April 18, 2026 22:44
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.

Cashu: enable multi-mint sends

4 participants