atlas-cardano-0.6.2: Application backend for Plutus smart contracts on Cardano
Copyright(c) 2023 GYELD GMBH
LicenseApache 2.0
Maintainer[email protected]
Stabilitydevelop
Safe HaskellSafe-Inferred
LanguageGHC2021

GeniusYield.Transaction.CBOR

Description

The transaction CBOR as obtained by Cardano API library may not be in format as desired by some hardware/browser wallets. This module attempts to simplify this obtained CBOR to the manner more acceptable.

Review this file whenever a hardfork occurs.

Synopsis

Documentation

simplifyGYTxBodyCborGYTxBodyEither CborSimplificationError GYTxBody #

This GYTxBody doesn't represent transaction_body as mentioned in CDDL specification, it's API's internal type to represent transaction without signing key witnesses. However GYTx does represent transaction as defined in specification. We therefore obtain GYTx and work with it. Here we need an invariant, which is if we receive our simplified GYTx transaction, then obtaining GYTxBody via getTxBody and obtaining GYTx back via unsignedTx should have the same serialisation for the modifications to CBOR encoding we do here.

simplifyTxCborGYTxEither CborSimplificationError GYTx #

Function to simplify transaction CBOR.

We as of now, only modify transaction_body (terms are as defined in CDDL) in it.

The modifications done is as follows:-

  • All indefinite-length items are made definite.
  • Wherever map occurs, it's keys are sorted as required by CIP 21.