Lucid Integration
Developed by SpaceBudz, Lucid is a PAB in JavaScript, Deno and Node.js. This makes it particularly adapted to Web development and JavaScript programing language, giving it a lot of flexibility and ease of use out of the box. In particular, it lowers the barrier to entry for many developers who aren’t familiar with Haskell and struggle with the functional programming paradigm. Lastly, it integrates with Aiken to perform smart contract evaluation.
Maestro Data Provider
Lucid must be configured with Maestro's data provider config in order to interface with the Cardano blockchain.
import { Lucid, Maestro } from "https://deno.land/x/lucid/mod.ts";
const lucid = await Lucid.new(
new Maestro({
network: "Preprod",
apiKey: "<Your-API-Key>",
turboSubmit: true
}),
"Preprod",
);
JSON keys definition:
network
: Define your network type: "Mainnet", "Preprod", "Preview".apiKey
: Maestro apiKey. Get a Free key hereturboSubmit
: Turn on Turbo Transaction submission, learn more here
Available Data Provider Queries
Checkout full Provider API Reference.
Query UTxOs
Query UTxOs by address or payment credential.
const utxos = await lucid.provider.getUtxos("addr_test...");
For convenience you can also query utxos like this:
const utxos = await lucid.utxosAt("addr_test...");
Query UTxOs by the output reference (tx hash and index).
const utxos = await lucid.provider.getUtxosByOutRef(["Array<OutRef>"])
This endpoint is optimized for a list ofOutRef
, therefore it will be resolved in 1 batch query instead of many individual queries.
Query datums
const datum = await lucid.provider.getDatum("<datum_hash>");
Query protocol parameters
const protocolParameters = await lucid.provider.getProtocolParameters();
Submit a (turbo) transaction
Automatically tracked in Maestro's Transaction Dashboard
const txHash = await lucid.provider.submitTx("transaction_CBOR");
To benefit from Turbo Transactions, set turboSubmit: true
in the Maestro provider config above.
Lucid Resources: