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.Sapling
|
||||||
import ZcashHaskell.Types
|
import ZcashHaskell.Types
|
||||||
( BlockResponse(..)
|
( BlockResponse(..)
|
||||||
|
, DecodedNote(..)
|
||||||
, RawData(..)
|
, RawData(..)
|
||||||
, RawTxResponse(..)
|
, RawTxResponse(..)
|
||||||
, RpcCall(..)
|
, RpcCall(..)
|
||||||
|
@ -1880,10 +1881,7 @@ scanTxNative pipe db nodeUser nodePwd = do
|
||||||
if isValidSaplingViewingKey (E.encodeUtf8 k)
|
if isValidSaplingViewingKey (E.encodeUtf8 k)
|
||||||
then do
|
then do
|
||||||
print "decoding Sapling tx"
|
print "decoding Sapling tx"
|
||||||
let decodedSapList' =
|
let decodedSapList' = map (decodeSaplingTx k) txList'
|
||||||
map
|
|
||||||
(decodeSaplingOutput (bytes (decodeBech32 $ E.encodeUtf8 k)))
|
|
||||||
sOutList
|
|
||||||
print decodedSapList'
|
print decodedSapList'
|
||||||
else do
|
else do
|
||||||
let vk = decodeUfvk $ E.encodeUtf8 k
|
let vk = decodeUfvk $ E.encodeUtf8 k
|
||||||
|
@ -1897,6 +1895,35 @@ scanTxNative pipe db nodeUser nodePwd = do
|
||||||
(decryptOrchardAction v)
|
(decryptOrchardAction v)
|
||||||
(concatMap rt_orchardActions txList')
|
(concatMap rt_orchardActions txList')
|
||||||
print decodedOrchList
|
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
|
debug = flip trace
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,15 @@ packages:
|
||||||
commit: 085c16fb21b9f856a435a3faab980e7e0b319341
|
commit: 085c16fb21b9f856a435a3faab980e7e0b319341
|
||||||
git: https://github.com/reach-sh/haskell-hexstring.git
|
git: https://github.com/reach-sh/haskell-hexstring.git
|
||||||
- completed:
|
- completed:
|
||||||
commit: 00090dbfcd511895c2d6b9cced6d55545c4d4db7
|
commit: 7992e5bfbe4e747d702f5bc6e27d85a7a9041ba4
|
||||||
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||||
name: zcash-haskell
|
name: zcash-haskell
|
||||||
pantry-tree:
|
pantry-tree:
|
||||||
sha256: 911ef15253ed951762f45154f45adb97df926fade2e94d758af3032481591d53
|
sha256: d84e098e80f7c9b682ef798702fcbfcd884947abc7661b18882d70fd1ad92c7a
|
||||||
size: 1229
|
size: 1229
|
||||||
version: 0.2.0
|
version: 0.2.0
|
||||||
original:
|
original:
|
||||||
commit: 00090dbfcd511895c2d6b9cced6d55545c4d4db7
|
commit: 7992e5bfbe4e747d702f5bc6e27d85a7a9041ba4
|
||||||
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||||
- completed:
|
- completed:
|
||||||
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
||||||
|
|
Loading…
Reference in a new issue