13.0.0 Set theory
Serialization Changes:
-
Set Type Serialization: All set types are now serialized with a tag "258", which will become mandatory after the next hard fork (HF). There is no way to force serialization without the tag. The period between the current and the next era serves as a transition between the old CBOR format and the new CBOR format for sets.
-
Preservation of Original Transaction Bytes: Only the
FixedTransaction
type can preserve original transaction bytes. This is crucial when signing a transaction from a third party, as there is no guarantee that all CBOR types will be in a specific format. -
Redeemers Collection Serialization: The redeemers collection is now serialized as a map by default. After the next HF, redeemers will only be allowed as a map.
API Changes:
-
New Function
has_transaction_set_tag
: We've added thehas_transaction_set_tag
function to help you check if all sets in a transaction have the tag. It returnsTransactionSetsState
based on the transaction's content. This is useful for determining whether a transaction can be signed by a hardware wallet. In the case ofMixedSets
, it might be impossible to sign a transaction with a hardware wallet. Once the tag "258" becomes mandatory, we will remove thehas_transaction_set_tag
function.enum TransactionSetsState { AllSetsHaveTag = 0, AllSetsHaveNoTag = 1, MixedSets = 2, }
-
Removal of
hash_transaction
: Thehash_transaction
function has been removed because it cannot guarantee the correctness of a transaction hash for a transaction from a third-party tool. Instead, you should use theFixedTransaction
type.WARNING: If you need to sign a transaction from a third party, use the
FixedTransaction
type. Do not use theTransaction
type, as it is not serialization round-trip safe and the transaction hash might be incorrect.
Examples:
-
Getting a Transaction Hash from a Third-Party Transaction:
let transaction = FixedTransaction::from_hex("tx_hex")?; // Or use from_bytes if you have a byte array. let tx_hash = transaction.transaction_hash();
-
Getting a Transaction Hash from a Transaction from a Transaction Builder:
let tx = tx_builder.build_tx()?; let transaction = FixedTransaction::from_bytes(tx.to_bytes())?; let tx_hash = transaction.transaction_hash();
-
Getting a Transaction Hash from a Transaction Body from a Transaction Builder:
let tx_body = tx_builder.build()?; let transaction = FixedTransaction::new_from_body_bytes(tx_body.to_bytes())?; let tx_hash = transaction.transaction_hash();
-
Signing a Transaction or Adding a Signature:
let mut transaction = FixedTransaction::new_from(tx_body.to_bytes())?; transaction.add_vkey_witness(get_vkey_witness()); // To add an existing signature. transaction.sign_and_add_vkey_signature(get_private_key()); // To sign and add a signature with a private key. // You can also use: // .add_bootstrap_witness // .sign_and_add_icarus_bootstrap_signature // .sign_and_add_daedalus_bootstrap_signature
Published
https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-browser/v/13.0.0
https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-nodejs/v/13.0.0
https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-asmjs/v/13.0.0
https://crates.io/crates/cardano-serialization-lib/13.0.0
Experimental packages with gc support
https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-nodejs-gc/v/13.0.0
https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-browser-gc/v/13.0.0
https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-asmjs-gc/v/13.0.0
Full Changelog: 12.1.1...13.0.0