Description
Lucid has the following Provider interface:
Lines 25 to 36 in 04bf616
Ideally all providers implement the entire interface. Most importantly are the functions getProtocolParameters
, getUtxos
, getDatum
and submitTx
. With this minimal implementation you can do most of the things in Lucid already.
Some special functions explained:
getUtxosWithUnit
: I assume this function only exists in the blockfrost provider natively. Basically what it does it returns UTxOs at a specific address filtered by a specific asset. If you provider doesn't have such an endpoint, just query all UTxOs and filter by the asset in thegetUtxosWithUnit
function in Lucid itself.awaitTx
: In the blockfrost provider you query a tx by tx hash. As long as no result is found you "wait". As soon as there is a result the function is done. Maybe it can be done differently when having access to the mempool API.
Querying UTxOs in general should not ony fetch the UTxOs at a particular address, but all the ones from the payment credential.
To add a new provider go to ./src/provider
and create a new file <provider_name>.ts
.
You can take a look at the blockfrost.ts
file, where the Blockfrost provider is implemented.
All types are described here: https://github.com/spacebudz/lucid/blob/main/src/types/types.ts