The following code allows me to query a Datum from the blockchain using Lucid and Blockfrost:
import { Blockfrost, Lucid } from "https://deno.land/x/[email protected]/mod.ts";
const lucid = await Lucid.new(
new Blockfrost(
"https://cardano-preview.blockfrost.io/api/v0",
<your BLOCKFROST_API_KEY>
),
"Preview"
);
const nft = "b7e0e70f653f23abc39d16f6f6be16fd72e3fe3030db9b16cecccf68524549545f5354415445"; // example
const utxo = await lucid.utxoByUnit(nft);
const datum = utxo.datum
console.log(datum);
The output to the console, for this example, is:
d8799f1903e819f80c1903e81903e8ff
My question now is, what command in Lucid allows me to deserialize this output? I don't even know what kind of encoding I am dealing with (I suspect it is CBOR).
By the way, I know that the desired deserialization, for this example, should be:
{
constructor: 0,
fields: [
{
int: 1000
},
{
int: 63500
},
{
int: 1000
},
{
int: 1000
}
]
}