fix(sdk): wallet-flow network fixes for SwiftExampleApp - #3772
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue being fixed or feature implemented
A set of wallet-flow fixes in the iOS SwiftExampleApp / swift-sdk for operating across multiple networks. The same mnemonic can now live on several networks, and the create / rescan / add-to-network flows behave correctly when the target network isn't the currently-active one.
Bugs fixed:
platformQuorumURLoverride was applied to every network, leaking a non-httpshttp://…quorum URL into mainnet/testnet SDK construction. Rust's trusted context provider rejects a non-https custom quorum URL on those networks, so the build failed and no wallet was created.CreateWalletView, but the pushedSeedBackupViewstayed on top with its submit button stuck disabled — the user was stranded with no visible error.@Query, listing every wallet across every network instead of just the active-network ones.What was done?
Per-network persistence infrastructure
PersistentWallet.swift— make rows unique per(walletId, network)and addpredicate(walletId:)/predicate(walletId:network:)helpers, so the same mnemonic can coexist across networks without colliding.PlatformWalletPersistenceHandler.swift/PlatformWalletManager.swift— scope persister wallet lookups to the manager's network, so each per-network manager restores only its own rows.Create flow
CreateWalletView.swift— create the wallet in every ticked network viaWalletManagerStore.backgroundManager(for:)(each network has its own network-locked Rust manager);walletIdis network-independent, so the Keychain mnemonic + metadata are written once andisImportedis stamped on every per-network row. On failure, pop the pushed backup screen so the error alert becomes visible.SDK.swift— gate theplatformQuorumURL(and DAPI address) override behinduseOverrideAddresses(regtest/devnet or opt-in docker). Mainnet/testnet now use the SDK's automatic canonical quorum endpoints.Add-to-network / identities / rescan
WalletDetailView.swift— implement the per-network "+" add-to-network action.IdentitiesContentView.swift— take an explicitnetworkand scope the identities@Queryto it;IdentitiesView.swiftpasses the active network;ContentView.swiftthreads the active network through.SearchWalletsForIdentitiesView.swift— addplatformState, query all wallets, and filter to the active network via a computed property (mirrorsWalletsContentView—@Querycan't reference a runtime env-object value at property-init time). The rescan sheet re-injectsplatformState.All changes are Swift-side only (persist / load / bridge) — no Rust/FFI changes, no protocol changes.
How Has This Been Tested?
Verified on the booted iOS simulator (iPhone 17 Pro) against the live SwiftData store:
networkRaw=1row and no devnet fallback row.currentNetwork = mainnetand 9 persisted wallet rows across 4 networks (mainnet ×1, testnet ×3, devnet ×2, regtest ×3), the Re-scan for Identities picker now lists only the single mainnet wallet — count dropped 9 → 1, matching the active-network set exactly.no DAPI addresses provided, using defaults for network/Mainnet(no leaked devnethttp://…:8080quorum URL), while the devnet manager still uses its caller-provided quorum URL.Breaking Changes
None. Swift SDK / example-app behavior only; no consensus or protocol changes.
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Bug Fixes