From 2fb6747bfb3cc45a416e42531ad2a01ada9e37dc Mon Sep 17 00:00:00 2001 From: "Rene V. Vergara A." Date: Sun, 12 May 2024 20:39:48 -0400 Subject: [PATCH] rvv041 - Address Book table added to database getAdrBook function to get a list of all addresses recorded in AddressBook table --- .gitignore | 2 ++ src/Zenith/DB.hs | 17 +++++++++++++++++ zenith.db | Bin 163840 -> 0 bytes 3 files changed, 19 insertions(+) delete mode 100644 zenith.db diff --git a/.gitignore b/.gitignore index 1c231fa..32d1170 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .stack-work/ *~ dist-newstyle/ +zenith.db +zenith.log \ No newline at end of file diff --git a/src/Zenith/DB.hs b/src/Zenith/DB.hs index a48151d..26cf8d5 100644 --- a/src/Zenith/DB.hs +++ b/src/Zenith/DB.hs @@ -246,6 +246,12 @@ share position Int UniqueSSPos tx position deriving Show Eq + AddressBook + network ZcashNetDB + descrip T.Text + address HexStringDB + UniqueABA address + deriving Show Eq |] -- * Database functions @@ -1467,5 +1473,16 @@ readUnifiedAddressDB :: WalletAddress -> Maybe UnifiedAddress readUnifiedAddressDB = isValidUnifiedAddress . TE.encodeUtf8 . getUA . walletAddressUAddress +-- | Get list of external zcash addresses from database +getAdrBook :: ConnectionPool -> ZcashNet -> IO [Entity AddressBook] +getAdrBook pool n = + runNoLoggingT $ + PS.retryOnBusy $ + flip PS.runSqlPool pool $ do + select $ do + adrbook <- from $ table @AddressBook + where_ (adrbook ^. AddressBookNetwork ==. val (ZcashNetDB n)) + pure adrbook + rmdups :: Ord a => [a] -> [a] rmdups = map head . group . sort diff --git a/zenith.db b/zenith.db deleted file mode 100644 index 56295146e35ad1fa390fa881c2df792ddb84b77a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 163840 zcmeI*&2!u4odGe&O5s3#V32zccrTnXhO65>C$SPXAZv+Y`$t$k(WB zkPd<8Ch*A{p~$^!!GI*!#J;-QBK?8mb**hKb3MM*5;accJDl7mYnUSmZ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