Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajust jsonToMetadata and jsonFromMetadata from cardano-api #2098

Closed
KtorZ opened this issue Sep 1, 2020 · 2 comments
Closed

Ajust jsonToMetadata and jsonFromMetadata from cardano-api #2098

KtorZ opened this issue Sep 1, 2020 · 2 comments
Assignees

Comments

@KtorZ
Copy link
Member

KtorZ commented Sep 1, 2020

Context

These functions are making several implicit conversion when dealing with JSON data which make them very unpractical to use.

Decision

a. Encode JSON as CBOR considering only the following "optimizations"
b. Hexadecimal sequences starting with 0x are encoded as CBOR bytestring.
c. JSON keys that are numbers are encoded as CBOR numbers.
d. CBOR is shown as JSON when possible, or as a string representing JSON-encoded data when not (i.e. when map keys aren't numbers or strings).
e. CBOR bytestrings are represented as hexadecimal strings prefixed with 0x

NOTE 1: Roundtripping would only work in one direction, when coming from a JSON value and that's totally fine.
NOTE 2: Complexe metadata using non-string keys in maps will render with funky keys in JSON, that's acceptable.
NOTE 3: Related Slack thread https://input-output-rnd.slack.com/archives/GR599HMFX/p1598966521093500

Acceptance Criteria


Development

QA

@KtorZ KtorZ added this to the (ADP-307) Transaction metadata milestone Sep 1, 2020
@KtorZ KtorZ self-assigned this Sep 1, 2020
@rvl
Copy link
Contributor

rvl commented Sep 2, 2020

I have a slight preference for a JSON representation which can perfectly map one-to-one with the on-chain metadata.

It's not much more burden on API users. There are already several limitations on what metadata they can set. It's definitely not POJO.

@piotr-iohk
Copy link
Contributor

lgtm

iohk-bors bot added a commit that referenced this issue Sep 21, 2020
2142: cardano-node: 1.19.1-patched -> 1.20.0 r=rvl a=rvl

### Issue Number

ADP-307 / #2098

### Overview

Updates cardano-node to [1.20.0](https://github.com/input-output-hk/cardano-node/releases/tag/1.20.0)

There are quite a few upstream API changes.

Snapshot PR is input-output-hk/cardano-haskell#28.


Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
iohk-bors bot added a commit that referenced this issue Sep 21, 2020
2142: cardano-node: 1.19.1-patched -> 1.20.0 r=rvl a=rvl

### Issue Number

ADP-307 / #2098

### Overview

Updates cardano-node to [1.20.0](https://github.com/input-output-hk/cardano-node/releases/tag/1.20.0)

There are quite a few upstream API changes.

Snapshot PR is input-output-hk/cardano-haskell#28.


Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants