Skip to content

Move Transaction decoding out of Client #182

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

Closed
epost opened this issue Jun 4, 2019 · 0 comments
Closed

Move Transaction decoding out of Client #182

epost opened this issue Jun 4, 2019 · 0 comments
Assignees
Labels
decode Parse / decode / deserialise transaction Statebox API transaction

Comments

@epost
Copy link
Member

epost commented Jun 4, 2019

This stuff, currently in stbx-client-http:

newtype DecodingError = DecodingError String

instance showDecodingError :: Show DecodingError where
  show = case _ of
    DecodingError e -> "(DecodingError " <> show e <> ")"

decodeTxSum :: HashStr -> Json -> DecodingError \/ TxSum
decodeTxSum hash json =
  lmap DecodingError (decodeWiring json <|> decodeFiring json)
  where
    decodeWiring :: Json -> String \/ TxSum
    decodeWiring json = WiringTxInj <<< _.decoded <$> decodeJson json :: String \/ Tx WiringTx

    decodeFiring :: Json -> String \/ TxSum
    decodeFiring json = FiringTxInj <<< _.decoded <$> decodeJson json :: String \/ Tx FiringTx

should probably be somewhere under theCore module. I wanted to try and keep it separate initially (one reason being the current argonaut dependency) but the HTTP API module is not the right place for this.

@epost epost added decode Parse / decode / deserialise transaction Statebox API transaction labels Jun 4, 2019
@epost epost self-assigned this Jun 4, 2019
@epost epost closed this as completed Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decode Parse / decode / deserialise transaction Statebox API transaction
Projects
None yet
Development

No branches or pull requests

1 participant