scan for names owned by wallet

This commit is contained in:
Alain Brenzikofer
2026-09-22 15:58:26 +02:00
parent 4d4a3ce42d
commit 610610a73c
10 changed files with 99 additions and 6 deletions
+6
View File
@@ -15,6 +15,7 @@ module Simplex.Chat.Wallet
deriveAccountKey,
accountSecret,
checkAccountIndex,
scanGapLimit,
)
where
@@ -57,6 +58,11 @@ data WalletError
| WEDerivation {derivationError :: String} -- BIP-32 or BIP-39 said no
deriving (Eq, Show)
-- | BIP-44's gap limit: a scan of a recovered seed stops after this many
-- accounts in a row that nothing on chain has used.
scanGapLimit :: Int
scanGapLimit = 20
-- | Refuse an index at or above 2^31: BIP-32 would harden it onto another index's key.
checkAccountIndex :: AccountIndex -> Either WalletError ()
checkAccountIndex n = if n >= B32.hardenedOffset then Left WEIndexTooLarge else Right ()