Skip to content

Commit

Permalink
implement Mary's 'encodeUTxO' and adjust related JSON-WSP definition
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Feb 19, 2021
1 parent cb8e9c1 commit 6743c8b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
24 changes: 23 additions & 1 deletion docs/static/ogmios.wsp.json
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,10 @@
, "pattern": "[1-9A-HJ-NP-Za-km-z]*"
}

, "AssetQuantity":
{ "type": "integer"
}

, "Block":
{ "type": "object"
, "oneOf":
Expand Down Expand Up @@ -2135,7 +2139,12 @@
, "required": [ "address", "value" ]
, "properties":
{ "address": { "$ref": "#/definitions/Address" }
, "value": { "$ref": "#/definitions/Lovelace" }
, "value":
{ "oneOf":
[ { "$ref": "#/definitions/Lovelace" }
, { "$ref": "#/definitions/Value" }
]
}
}
}

Expand Down Expand Up @@ -2347,6 +2356,19 @@
}
}

, "Value":
{ "type": "object"
, "additionalProperties": false
, "required": [ "coins", "assets" ]
, "properties":
{ "coins": { "$ref": "#/definitions/Lovelace" }
, "assets":
{ "type": "object"
, "additionalProperties": { "$ref": "#/definitions/AssetQuantity" }
}
}
}

, "Vote":
{ "type": "object"
, "additionalProperties": false
Expand Down
4 changes: 3 additions & 1 deletion ogmios-server/src/Ogmios/Data/Json/Mary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ encodeUtxo
=> Sh.UTxO (MaryEra crypto)
-> Json
encodeUtxo =
undefined
encodeList id . Map.foldrWithKey (\i o -> (:) (encodeIO i o)) [] . Sh.unUTxO
where
encodeIO = curry (encode2Tuple Shelley.encodeTxIn encodeTxOut)

encodeValue
:: MA.Value crypto
Expand Down

0 comments on commit 6743c8b

Please sign in to comment.