Modify tx scanner to generate ZcashTx
This commit is contained in:
parent
cd259f244a
commit
bf740857b3
2 changed files with 34 additions and 7 deletions
|
@ -69,6 +69,7 @@ import ZcashHaskell.Orchard
|
|||
import ZcashHaskell.Sapling
|
||||
import ZcashHaskell.Types
|
||||
( BlockResponse(..)
|
||||
, DecodedNote(..)
|
||||
, RawData(..)
|
||||
, RawTxResponse(..)
|
||||
, RpcCall(..)
|
||||
|
@ -1880,10 +1881,7 @@ scanTxNative pipe db nodeUser nodePwd = do
|
|||
if isValidSaplingViewingKey (E.encodeUtf8 k)
|
||||
then do
|
||||
print "decoding Sapling tx"
|
||||
let decodedSapList' =
|
||||
map
|
||||
(decodeSaplingOutput (bytes (decodeBech32 $ E.encodeUtf8 k)))
|
||||
sOutList
|
||||
let decodedSapList' = map (decodeSaplingTx k) txList'
|
||||
print decodedSapList'
|
||||
else do
|
||||
let vk = decodeUfvk $ E.encodeUtf8 k
|
||||
|
@ -1897,6 +1895,35 @@ scanTxNative pipe db nodeUser nodePwd = do
|
|||
(decryptOrchardAction v)
|
||||
(concatMap rt_orchardActions txList')
|
||||
print decodedOrchList
|
||||
decodeSaplingTx :: T.Text -> RawTxResponse -> [ZcashTx]
|
||||
decodeSaplingTx k t =
|
||||
map
|
||||
(buildZcashTx t .
|
||||
decodeSaplingOutput (bytes (decodeBech32 $ E.encodeUtf8 k)))
|
||||
(rt_shieldedOutputs t)
|
||||
buildZcashTx :: RawTxResponse -> Maybe DecodedNote -> ZcashTx
|
||||
buildZcashTx t n =
|
||||
case n of
|
||||
Nothing ->
|
||||
ZcashTx
|
||||
(rt_id t)
|
||||
0.0
|
||||
0
|
||||
(rt_blockheight t)
|
||||
(rt_blocktime t)
|
||||
True
|
||||
(rt_confirmations t)
|
||||
""
|
||||
Just n ->
|
||||
ZcashTx
|
||||
(rt_id t)
|
||||
(fromIntegral (a_value n) * 0.00000001)
|
||||
(toInteger $ a_value n)
|
||||
(rt_blockheight t)
|
||||
(rt_blocktime t)
|
||||
False
|
||||
(rt_confirmations t)
|
||||
(E.decodeUtf8Lenient $ a_memo n)
|
||||
|
||||
debug = flip trace
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@ packages:
|
|||
commit: 085c16fb21b9f856a435a3faab980e7e0b319341
|
||||
git: https://github.com/reach-sh/haskell-hexstring.git
|
||||
- completed:
|
||||
commit: 00090dbfcd511895c2d6b9cced6d55545c4d4db7
|
||||
commit: 7992e5bfbe4e747d702f5bc6e27d85a7a9041ba4
|
||||
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||
name: zcash-haskell
|
||||
pantry-tree:
|
||||
sha256: 911ef15253ed951762f45154f45adb97df926fade2e94d758af3032481591d53
|
||||
sha256: d84e098e80f7c9b682ef798702fcbfcd884947abc7661b18882d70fd1ad92c7a
|
||||
size: 1229
|
||||
version: 0.2.0
|
||||
original:
|
||||
commit: 00090dbfcd511895c2d6b9cced6d55545c4d4db7
|
||||
commit: 7992e5bfbe4e747d702f5bc6e27d85a7a9041ba4
|
||||
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||
- completed:
|
||||
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
||||
|
|
Loading…
Reference in a new issue