profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/cblp/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Yuriy Syrovetskiy cblp Yandex Moscow, Russia http://cblp.su/ machine whisperer

cblp/conduit-merge 4

Merge multiple conduits into one.

cblp/Advanced-Haskell-Scripting-Guide 1

coz Haskell is better than Bash

cblp/cblp-github-io 1

former personal web site

Pull request review commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

 decimal = do  -- | Asset name parser. assetName :: Parser AssetName-assetName =-    toAssetName <$> some alphaNum-  where-    toAssetName = AssetName . Text.encodeUtf8 . Text.pack+assetName = do+  hexText <- some hexDigit+  note "AssetName deserisalisation failed" $+    deserialiseFromRawBytesHex AsAssetName $ BSC.pack hexText++note :: MonadFail m => String -> Maybe a -> m a

Sorry, Aeson.Parser has MonadFail, but not MonadError, which is used by Cardano.Prelude.note.

And I can't figure out the right place for MonadFail version, so I repeated the code to save ourselves from bad module structure.

Can you suggest a place for this function?

cblp

comment created time in 2 days

PullRequestReviewEvent

pull request commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

@dcoutts should I fix docs (couttscoins etc.) in this PR?

cblp

comment created time in 2 days

pull request commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

@gitmachtl utxo query is affected only in part of switching from text to hex.

cblp

comment created time in 2 days

pull request commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

how does the output of "Friendly output multi-asset with ASCII version where possible" look like?

Here is an example:

mint:
  policy 52dc3d43b6d2465e96109ce75ab61abe5e9c1d8a3c9ce6ff8a3af528:
    asset 736b79 (sky): 142

i would leave it up to the software behind the CLI to decide to show it as readable or as hex/binary. makes it more complicated to post-process if the output is not hex all the time.

cardano-cli transaction view is an end-user software that uses Cardano API.

API version of cardano-cli is to be built in #3213

cblp

comment created time in 2 days

push eventinput-output-hk/cardano-node

Yuriy Syrovetskiy

commit sha 200272fc54fe39b8524d7ecf460df262005144a8

Fix DecoderErrorDeserialiseFailure (#3224) Allow decode pre-Alonzo 2-tuple tx body

view details

Yuriy Syrovetskiy

commit sha d662566a2fd41ea47d9c57f38783e46fab06442d

cardano-cli: Apply HLint fix

view details

iohk-bors[bot]

commit sha bbc4398d02df9964cace64f42373b4186ecad59e

Merge #3226 3226: Fix DecoderErrorDeserialiseFailure (#3224) r=cblp a=cblp Allow decode pre-Alonzo 2-tuple tx body Co-authored-by: Yuriy Syrovetskiy <yuriy.syrovetskiy@iohk.io>

view details

iohk-bors[bot]

commit sha 5f0d2401354cbdf2f356be0247fad85c18b717f2

Merge #3234 3234: cardano-cli: Apply HLint fix "Use map once" r=cblp a=cblp Co-authored-by: Yuriy Syrovetskiy <yuriy.syrovetskiy@iohk.io>

view details

Yuriy Syrovetskiy

commit sha 9310905a682151cc1cf78ff29375d39731912711

cardano-api: Serialize AssetName to JSON as hex string with latin-1 helper

view details

Yuriy Syrovetskiy

commit sha ff78412ad4e329adccf66f825b084076e49c834a

cardano-cli: Expect AssetName in hex in --mint and --tx-out

view details

Yuriy Syrovetskiy

commit sha b42035d46297f87c2f657e47b43e2a16552c51e7

cardano-api-test: Add AssetName roundtrip tests

view details

Yuriy Syrovetskiy

commit sha a8660e297e536b010ed06b50cba915b95145054e

cardano-cli: Friendly output multi-asset with ASCII version where possible As desktop client does

view details

push time in 2 days

push eventinput-output-hk/cardano-node

Yuriy Syrovetskiy

commit sha caf2e3f46e23690e4af7004b64c5594d661a0dd7

cardano-cli: Friendly output multi-asset with ASCII version where possible As desktop client does

view details

push time in 2 days

pull request commentinput-output-hk/cardano-node

cardano-cli: Apply HLint fix "Use map once"

bors merge

cblp

comment created time in 3 days

pull request commentinput-output-hk/cardano-node

Fix DecoderErrorDeserialiseFailure (#3224)

bors merge

cblp

comment created time in 3 days

Pull request review commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

 renderPolicyId (PolicyId scriptHash) = serialiseToRawBytesHexText scriptHash  renderAssetId :: AssetId -> Text renderAssetId AdaAssetId = "lovelace"-renderAssetId (AssetId polId (AssetName assetName))-  | BS.null assetName = renderPolicyId polId-  | otherwise         = renderPolicyId polId <> "." <> Text.decodeUtf8 assetName+renderAssetId (AssetId polId (AssetName "")) = renderPolicyId polId+renderAssetId (AssetId polId assetName) =+  renderPolicyId polId <> "." <> renderAssetName assetName++renderAssetName :: AssetName -> Text

done

cblp

comment created time in 3 days

PullRequestReviewEvent

push eventinput-output-hk/cardano-node

Konstantinos Lambrou-Latreille

commit sha 3ba917af6980566cde20aa1fc7536cbf20faba8f

Added ToJSON/FromJSON instances for EraInMode in cardano-api. Also added a few types like AsMaryTx, AsAllegraTx and AsAlonzoTx.

view details

iohk-bors[bot]

commit sha 385b45d5f492c0f86ac22a531d7064295fd0cbb2

Merge #3163 3163: Added additionnal instances and a few types in cardano-api r=Jimbo4350 a=koslambrou Added ToJSON/FromJSON instances for EraInMode in cardano-api. Also added a few types like AsMaryTx, AsAllegraTx and AsAlonzoTx. Co-authored-by: Konstantinos Lambrou-Latreille <konstantinos.lambrou@iohk.io>

view details

Yuriy Syrovetskiy

commit sha c1b4f1e0c5a13a8848ad3f98ac3d95bc859ae0f4

cardano-api: Serialize AssetName to JSON as hex string with latin-1 helper

view details

Yuriy Syrovetskiy

commit sha 47bc78fa4dfcf3a6a6e540f209a62e70dee40c64

cardano-cli: Expect AssetName in hex in --mint and --tx-out

view details

Yuriy Syrovetskiy

commit sha 9faf6ea58b46b475e2866519edc29f5c97c7238e

cardano-api-test: Add AssetName roundtrip tests

view details

push time in 3 days

PullRequestReviewEvent

Pull request review commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

 instance FromJSON ValueNestedRep where     where       parsePid :: (Text, Aeson.Value) -> Parser ValueNestedBundle       parsePid ("lovelace", q) = ValueNestedBundleAda <$> parseJSON q-      parsePid (pid, q) =-        case deserialiseFromRawBytesHex AsScriptHash (Text.encodeUtf8 pid) of-          Just sHash -> ValueNestedBundle (PolicyId sHash) <$> parseJSON q-          Nothing -> fail $ "Failure when deserialising PolicyId: "-                         <> Text.unpack pid+      parsePid (pid, quantityBundleJson) = do+        sHash <-+          note ("Failure when deserialising PolicyId: " <> Text.unpack pid) $+          deserialiseFromRawBytesHex AsScriptHash $ Text.encodeUtf8 pid+        quantityBundleRaw <- parseJSON quantityBundleJson+        quantityBundle <-+          Map.fromList+          <$> for (Map.assocs quantityBundleRaw) \(nameText, quantity) -> do+                name <-+                  note+                    ("Failure when deserialising AssetName"

done

cblp

comment created time in 3 days

create barnchinput-output-hk/cardano-node

branch : cblp/map-once

created branch time in 3 days

push eventinput-output-hk/cardano-node

Yuriy Syrovetskiy

commit sha d3e92046ac0d89365f8e30829a8ccec644c4db04

Add AssetName roundtrip tests

view details

push time in 3 days

Pull request review commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

 instance FromJSON ValueNestedRep where     where       parsePid :: (Text, Aeson.Value) -> Parser ValueNestedBundle       parsePid ("lovelace", q) = ValueNestedBundleAda <$> parseJSON q-      parsePid (pid, q) =-        case deserialiseFromRawBytesHex AsScriptHash (Text.encodeUtf8 pid) of-          Just sHash -> ValueNestedBundle (PolicyId sHash) <$> parseJSON q-          Nothing -> fail $ "Failure when deserialising PolicyId: "-                         <> Text.unpack pid+      parsePid (pid, quantityBundleJson) = do+        sHash <-+          note ("Failure when deserialising PolicyId: " <> Text.unpack pid) $

done

cblp

comment created time in 3 days

PullRequestReviewEvent

push eventinput-output-hk/cardano-node

Yuriy Syrovetskiy

commit sha dc7145af6e2e89be123cc9e3b8bfdd29817543d3

cardano-api: Serialize AssetName to JSON as hex string with latin-1 helper

view details

Yuriy Syrovetskiy

commit sha 748de22ad34dfc8b666e24abe789051b918a22d2

cardano-cli: Expect AssetName in hex in --mint and --tx-out

view details

push time in 3 days

Pull request review commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

 decimal = do  -- | Asset name parser. assetName :: Parser AssetName-assetName =-    toAssetName <$> some alphaNum-  where-    toAssetName = AssetName . Text.encodeUtf8 . Text.pack+assetName = do+  hexText <- some hexDigit+  note "AssetName deserisalisation failed" $+    deserialiseFromRawBytesHex AsAssetName $ BSC.pack hexText++note :: MonadFail m => String -> Maybe a -> m a

Parser has no MonadFail

cblp

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

 decimal = do  -- | Asset name parser. assetName :: Parser AssetName-assetName =-    toAssetName <$> some alphaNum-  where-    toAssetName = AssetName . Text.encodeUtf8 . Text.pack+assetName = do+  hexText <- some hexDigit+  note "AssetName deserisalisation failed" $+    deserialiseFromRawBytesHex AsAssetName $ BSC.pack hexText++note :: MonadFail m => String -> Maybe a -> m a

each one has type incompatible with others

cblp

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

 instance FromJSON ValueNestedRep where     where       parsePid :: (Text, Aeson.Value) -> Parser ValueNestedBundle       parsePid ("lovelace", q) = ValueNestedBundleAda <$> parseJSON q-      parsePid (pid, q) =-        case deserialiseFromRawBytesHex AsScriptHash (Text.encodeUtf8 pid) of-          Just sHash -> ValueNestedBundle (PolicyId sHash) <$> parseJSON q-          Nothing -> fail $ "Failure when deserialising PolicyId: "-                         <> Text.unpack pid+      parsePid (pid, quantityBundleJson) = do+        sHash <-+          note ("Failure when deserialising PolicyId: " <> Text.unpack pid) $+          deserialiseFromRawBytesHex AsScriptHash $ Text.encodeUtf8 pid+        quantityBundleRaw <- parseJSON quantityBundleJson+        quantityBundle <-+          Map.fromList+          <$> for (Map.assocs quantityBundleRaw) \(nameText, quantity) -> do+                name <-+                  note+                    ("Failure when deserialising AssetName"+                      <> Text.unpack nameText) $+                  deserialiseFromRawBytesHex AsAssetName $+                  Text.encodeUtf8 nameText+                pure (name, quantity)+        pure $ ValueNestedBundle (PolicyId sHash) quantityBundle++note :: MonadFail m => String -> Maybe a -> m a

this name is used in Cardano.Prelude (but with a slightly different type) and https://hackage.haskell.org/package/errors-2.3.0/docs/Control-Error-Util.html#v:note. I consider it somewhat traditional.

cblp

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

 valueFromNestedRep (ValueNestedRep bundles) = instance ToJSON ValueNestedRep where   toJSON (ValueNestedRep bundles) = object $ map toPair bundles     where-     toPair :: ValueNestedBundle -> (Text, Aeson.Value)-     toPair (ValueNestedBundleAda q) = ("lovelace", toJSON q)-     toPair (ValueNestedBundle pid assets) = (renderPolicyId pid, toJSON assets)+      toPair :: ValueNestedBundle -> (Text, Aeson.Value)+      toPair (ValueNestedBundleAda q) = ("lovelace", toJSON q)+      toPair (ValueNestedBundle pid assets) =+        ( renderPolicyId pid+        , toJSON $ Map.mapKeys serialiseToRawBytesHexText assets

done

cblp

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentinput-output-hk/cardano-node

Serialize AssetName to JSON as hex string

+{-# LANGUAGE BlockArguments #-}

done

cblp

comment created time in 3 days

PullRequestReviewEvent