This is a library, written in Rust, for serialization & deserialization of data structures used in Cardano's Haskell implementation of Alonzo along with useful utility functions.
How do I add assets to TX build as inputs when having them returned in JSON format not cbor hex like you do with getUTxos() from wallet extensions defined in cip30.
So for example first code snippet will add UTXOs that are returned in CBOR hex from a wallet extension in the frontend and the CBOR hex already has all the assets defined in it, and this works great for frontend applications in the web browsers where you have access to wallet extensions and CIP30 methods
/* ###########################################################################################
Use this when getting UTXOS in array CBOR hex like cip30 getUtxos() method returns.
#############################d#############################################################
*/
const utxos = [
"828258204b82398febd68fab512a56fd1786f05cc13ae2af706ebb9dc90502b499dfff010082583901130768a0e391b8c77be560580729ec927393e688991929129e609a4bb093f044b77f2fb13ce1828c954b1858ac9f76935e74e391c4255e72821a004c4b40a2581cb812d5a466604bcc25d2313183c387cebf52302738b5a178daf146f0a6494d616e64616c6123311864494d616e64616c6123321864494d616e64616c6123331864494d616e64616c6123341864494d616e64616c6123351864494d616e64616c6123361864581cb88d9fe270b184cf02c99b19ffa5ab0181daeff00c52811c6511c12aa8494d65726b61626123301864494d65726b61626123311864494d65726b61626123321864494d65726b61626123331864494d65726b616261233418644a4d65726b616261232d3118644a4d65726b616261232d3218644a4d65726b616261232d331864",
"82825820ad7828a65ced5b48058230c88f1b420973bafa2fd546d5161cf008ab807624760082583901130768a0e391b8c77be560580729ec927393e688991929129e609a4bb093f044b77f2fb13ce1828c954b1858ac9f76935e74e391c4255e721a002dc6c0",
"82825820ad7828a65ced5b48058230c88f1b420973bafa2fd546d5161cf008ab807624760182583901130768a0e391b8c77be560580729ec927393e688991929129e609a4bb093f044b77f2fb13ce1828c954b1858ac9f76935e74e391c4255e721a000eedc2",
"828258205d8e75f465e9d7fc413bb03caf7a0b0d280b62d01bb9b853afbef8a25523ae820082583901130768a0e391b8c77be560580729ec927393e688991929129e609a4bb093f044b77f2fb13ce1828c954b1858ac9f76935e74e391c4255e721a002b1d8b"
]
// console.log("utxos", utxos);
let txUnspentOutputs = CSLwasm.TransactionUnspentOutputs.new();
await Promise.all(
await utxos.map((utxo) => {
txUnspentOutputs.add(CSLwasm.TransactionUnspentOutput.from_hex(utxo));
})
);
Example two is using CSL in the backend like Nodejs where you don't have access to wallet extensions but sources like Kupo or Blockfrost. Question here is how to add the assets with the inputs in the example below?
Hi @bakon11 ! the "0fe7b9c1abbf139414d8e138721a85dd8d6e24ee7dc0d895587b4f57.6a633030303030303133" has pattern "policy_id,asset_name" you can use to build current one MintAssets object
How do I add assets to TX build as inputs when having them returned in JSON format not cbor hex like you do with
getUTxos()
from wallet extensions defined in cip30.So for example first code snippet will add UTXOs that are returned in CBOR hex from a wallet extension in the frontend and the CBOR hex already has all the assets defined in it, and this works great for frontend applications in the web browsers where you have access to wallet extensions and CIP30 methods
Example two is using CSL in the backend like Nodejs where you don't have access to wallet extensions but sources like Kupo or Blockfrost. Question here is how to add the assets with the inputs in the example below?
Thank you!!