Satscard Integration (Android & iOS) #1269
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey, this is my implementation of Satscard slot initialization and sweeping. The logic for communicating with Satscards is handled by a separate Flutter plugin which I created. This plugin is relatively simple, it provides an FFI wrapper around Nunchuk's tap-protocol library. Maintenance should be minimal, I created a separate release/breez branch in the plugin repository, this will get updated as Nunchuk update their C++ library. You may wish to fork my plugin if you prefer control over the repository, I could then open PRs when I think there's a bugfix you might need. My plugin is built for NDK 21.4 which other plugins in the app currently depend on however my plugin works with NDK 26+.
This PR doesn't support viewing/sweeping unsealed slots however I wish to add that later and the current balance/sweep UI pages are built to support it already. Each UI page supports vertical scrolling for small displays. The initialize page has fully validated "Spend Code" and "Chain Code" fields. The new Satscard NFC dialog is quite reactive and communicates different success, pending and failure states to the user. Sweeping a Satscard clearly communicates the fees paid by the user including failure conditions such as not having enough balance to deposit, having too high a balance, not meeting the reserve, etc. The "Spend Code" field rejects previously entered incorrect codes, intentionally I chose not to persist these between pages. If a "Chain Code" is not entered then it will be generated by the tap-protocol library.
The PR depends these two other PRs:
breez/Breez-Translations#28& breez/breez#229. This PR supersedes #1258Here are a selection of images and videos demonstrating the implementation
Videos
initialize.mp4
sweep.mp4
nfc_errors.mp4
iOS Differences
iOS handles NFC differently to Android, it requires a system prompt to be shown and you can't scan the Satscards in the background. As such a new option was added to the Receive option on the home page called "Sweep Satscard" and the NFC status is communicated to the use through the system prompt.
Note: There are some typos in these videos that have already been fixed.
scan_satscard_option.mp4
ios_nfc_messages.mp4
Screenshots