#57 - Sapling address in Human Readable format #57
3 changed files with 25 additions and 0 deletions
|
@ -153,3 +153,21 @@ decryptOrchardAction key encAction =
|
|||
decodedAction =
|
||||
withPureBorshVarBuffer $
|
||||
rustWrapperOrchardNoteDecode (o_key key) encAction
|
||||
|
||||
chrToByteString :: [Char] -> C.ByteString
|
||||
chrToByteString = C.pack
|
||||
|
||||
getSaplingFromUA :: BS.ByteString -> T.Text
|
||||
getSaplingFromUA uadd = do
|
||||
let a = isValidUnifiedAddress uadd
|
||||
case a of
|
||||
Nothing -> "xxx"
|
||||
Just a -> do
|
||||
let sraw = s_rec a
|
||||
case sraw of
|
||||
Nothing -> "xxx"
|
||||
Just sraw -> do
|
||||
let net = ua_net a
|
||||
case net of
|
||||
MainNet -> encodeBech32m (chrToByteString sapPaymentAddressHrp) ( getBytes sraw )
|
||||
TestNet -> encodeBech32m (chrToByteString sapTestPaymentAddressHrp) ( getBytes sraw )
|
|
@ -115,3 +115,4 @@ readZebraTransaction hex =
|
|||
else Just rawTx
|
||||
where
|
||||
rawTx = (withPureBorshVarBuffer . rustWrapperTxRead) $ hexBytes hex
|
||||
|
||||
|
|
|
@ -844,6 +844,12 @@ main = do
|
|||
let tb = zt_tBundle t'
|
||||
print tb
|
||||
show tb `shouldNotBe` ""
|
||||
describe "Extract Sapling Address" $ do
|
||||
let sr = getSaplingFromUA "u1y3224rl7f5tz262apkmj33z6pe5rn3z4y6pqtces45valg9qsvuer688crr8xvvqq4u7umhrvt0qaj5jv05ec7jd66qedq97dvrhhzryq69lrm8mc25ql0zt6yk2yks9zyp0qv7tgtfqw5zgl7q3p660v37f0ra5aj2g8y75mrzkgrgr8fl5cmur07tcqcrvzf96t4ennh45vnxemp8"
|
||||
it "Extract sapling address" $ do
|
||||
print sr
|
||||
sr `shouldBe` "zs1algtrzkczkl5708yaw2sr58jkutm8wcx2tj0a9ex3ns8nu8l3wtlusemfcpllnfmhyhw7vk9m0h"
|
||||
|
||||
|
||||
-- | Properties
|
||||
prop_PhraseLength :: Property
|
||||
|
|
Loading…
Reference in a new issue