Skip to content

feat: add Kyoto #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

rubensmachion
Copy link
Collaborator

@rubensmachion rubensmachion commented May 25, 2025

Description

This PR proposes to demonstrate an implementation of Kyoto while keeping the Esplora server.

[issue] #293

Notes to the reviewers

This implementation proposes adding Kyoto synchronization while keeping the Esplora server, to demonstrate to the user how we can support both synchronization methods.

To encapsulate Kyoto and Esplora, it introduces a protocol called BDKSyncService, which is used by the BDKService client.

Checklists

All Submissions:

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature
  • UI changes tested on small, medium, and large devices to ensure layout consistency

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@rubensmachion rubensmachion self-assigned this May 25, 2025
@rubensmachion rubensmachion added the WIP working in progress label May 25, 2025
@rubensmachion rubensmachion requested a review from reez May 26, 2025 21:06
@rubensmachion rubensmachion marked this pull request as ready for review May 26, 2025 21:06
@rubensmachion rubensmachion changed the title WIP feat: add Kyoto feat: add Kyoto May 26, 2025
@rubensmachion rubensmachion added enhancement New feature or request and removed WIP working in progress labels May 26, 2025
Copy link
Collaborator

@reez reez left a comment

Choose a reason for hiding this comment

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

Really good! I know we probably talked a lot about this in our call earlier but I added some comments to the PR.

Some more fine tuning to be done but very cool that we tested and saw this working already!

UI:

Misc:

  • Remove printLogs and updateWarn potentially before merging this

Comment on lines +125 to +127
Picker("Sync type", selection: $viewModel.syncMode) {
Text("Esplora Server").tag(SyncMode.esplora)
Text("Kyoto").tag(SyncMode.kyoto)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Simulator Screen Recording - iPhone 16 Pro - 2025-05-28 at 11 32 08

I'm seeing this (bug?) when I load OnboardingView for the first time, where I think maybe its supposed to say "Esplora Server" as the default here? Maybe that's not the issue, but attached is a gif of what I'm seeing

Group {
if viewModel.syncMode == .kyoto {
Section(header: Text("Network")) {
Text("Using Kyoto")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Text("Using Kyoto")
Text("Kyoto")

case "bitcoin": self = .bitcoin
case "bitcoin": self = .signet
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why this was changed from .bitcoin to .signet?

case esplora, kyoto
}

protocol BDKSyncService {
Copy link
Collaborator

Choose a reason for hiding this comment

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

would like to use a concrete type instead of protocol

similar to https://github.com/bitcoindevkit/BDKSwiftExampleWallet/blob/main/BDKSwiftExampleWallet/Service/BDK%20Service/BDKService.swift

happy to collaborate with you to do this, because I do think it would be nice to stay consistent with existing way the codebase tries to do this

reason for preference for concrete types over protocols comes a lot from pointfree folks (for example, see comment from Brandon pointfreeco/swift-composable-architecture#522)

@@ -93,4 +95,13 @@ extension Network {
Constants.Config.EsploraServerURLNetwork.Testnet4.allValues.first ?? ""
}
}

var taprootHeight: UInt32 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we remove "Full Scan" do we still need taprootHeight? Maybe we do, but from what I'm seeing taprootHeight is only called from the code where we use full scan (correct me if I'm wrong about any of this though!)

@@ -62,6 +62,23 @@ private struct KeyService {
func saveNetwork(network: String) throws {
keychain[string: "SelectedNetwork"] = network
}

func deletaAllData() throws {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: spelling

Suggested change
func deletaAllData() throws {
func deleteAllData() throws {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants