Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript and Node.js.

Overview

Lucid

GitHub commit activity

Read the Docs

Twitter Follow

Discord

npm version

npm downloads

NPM

Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript and Node.js.

This library is experimental. Expect bugs. It's still work in progress.

Table of contents

Features

  • To be added
  • To be added

Installation

npm install lucid-cardano

Examples

You can check out the examples folder.

Preview

await Lucid.initialize(
  'Testnet',
  new Blockfrost('https://cardano-testnet.blockfrost.io/api/v0', ''),
);

// Assumes you are in a browser environment
await Lucid.selectWallet('nami');

const tx = await Tx.new()
    .payToAddress("addr...", {lovelace: 5000000n})
    .complete();

const signedTx = (await tx.sign()).complete();

const txHash = await signedTx.submit();

console.log(txHash);

Docs

You can generate documentation with:

npm run docs

It'll be located under /docs.

Compatibilty

To run it in the browser Webpack 5 is recommended or any other bundler which allows for top level await and WebAssembly. When you use Webpack 5 enable in the webpack.config.js:

experiments: {
    asyncWebAssembly: true,
    topLevelAwait: true,
    layers: true // optional, with some bundlers/frameworks it doesn't work without
  }

To run the library in Node.js you need to set {"type" : "module"} in your project's package.json. Otherwise you will get import issues.


This library is built on top of a customized version of the serialization-lib (cardano-multiplatform-lib).

Documentation: https://cardano-lucid.readthedocs.io/en/latest

Link: https://github.com/Berry-Pool/cardano-multiplatform-lib/tree/plutus

Branch: Plutus

Commit hash: 5f41e3c1e30a44579ffeef27f497fe7a7334846f

Comments
  • Appears to be Incompatible with Plutarch generated CBOR

    Appears to be Incompatible with Plutarch generated CBOR

    If I use https://github.com/Liqwid-Labs/agora/tree/staging/agora/Agora to obtain CBOR hex for scripts relating to Agora, I have found that all transactions that require validation with these scripts will throw "ScriptFailures": { "mint:0": [ { "validatorFailed": { "error": "DeserialiseFailure 0 \"expected bytes\"", "traces": [] } } ] }

    I believe this to be an issue related more generally to Plutarch (but haven't verified), it would appear based on conversations with other engineers, that the same process to procure CBOR for these scripts, the scripts are working fine with an alternative to Lucid that we would prefer to avoid due to overhead (https://github.com/Plutonomicon/cardano-transaction-lib), I am almost sure that this is a discrepancy in deserialization between the libraries used (custom CSL from mlabs vs custom CML in Lucid).

    I'm not even really sure where to start looking, but will be spending my day trying to figure this out. Any help would be appreciated.

    opened by Riley-Kilgore 16
  • Package doesn't work for me with NextJS

    Package doesn't work for me with NextJS

    I tried to use this package with NextJS, unfortunately, unsuccessfuly.

    • Create next app
    • NPM install lucid-cardano
    • Create component with a button using Lucid
    • dynamically load on a page
    • build -> error with topLevelAwait
    • add webpack conf experiments: { asyncWebAssembly: true, topLevelAwait: true }
    • build -> error with node-fetch dependencies

    I managed to create a custom build that works with NextJS, however I didn't manage to create version suitable for all out of it. I did two things:

    1. I removed node-fetch import, NextJS has fetch out of the box,
    2. I installed 'buffer' and added import { Buffer } from 'buffer' where it's used

    I would really prefer to not use custom version of the lib, so if there is a way to fix it on my side, or if I can help for example with testing for this, please let me know.

    opened by zachyking 15
  • updating (blockfrost) provider when changing network

    updating (blockfrost) provider when changing network

    Hi.

    I am currently working on an example repo with a blockfrost proxy api, as discussed in https://github.com/spacebudz/lucid/issues/25#issuecomment-1145689280.

    In this example, I want to be able to communicate to the blockforst API that corresponds to the wallet-active network. Ie. if the user - using Nami - switches network from Mainnet to Testnet, I want this to be reflected in the Blockfrost API.

    This can be tracked with

    window.cardano.nami.expermintal.on("networkChange", updateNetwork)
    

    but my design-related question is how to best update the Lucid client. As I understand it, the only way to set the provider is at instantiation, ie.

    const lucid = Lucid.new(new Blockfrost(url, key))
    

    With this API, I could - using React - keep the lucid client as a state and override it, but that feels a bit awkward, since I would prefer it to be a global singletong of sorts.

    Is it possible to simply update the provider, ie. lucid.provider = newProvider or is there an API for this?

    Thanks.

    opened by GGAlanSmithee 14
  • Add optional shape check to data parser

    Add optional shape check to data parser

    as per https://github.com/spacebudz/lucid/issues/126

    The core functionality stays the same, just refactored it since the branching got too big. Deno tests run through, but I didn't add any of myself yet.

    opened by lemmon-714 11
  • Cannot spend from script and pay back to script in the same transaction.

    Cannot spend from script and pay back to script in the same transaction.

    When trying to spend a UTxO from a contract and spend a subset of that UTxO back to the contract the following error occurs:

    {"code":2,"info":"Wallet could not send the tx.","message":"\"transaction submit error ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (PPViewHashesDontMatch (SJust (SafeHash \\\"8418cd2dd198020bc9569dc564b3459bb820340b6ea04e2090360af4c5e61073\\\")) (SJust (SafeHash \\\"e0c20279f42f99018f0d5727e1336654f8f5209e0d9cb5699f9e0b7b1309afb9\\\")))])\""}

    Steps to reproduce:

    1: Construct address for always successful validator.

    `const exampleScript: SpendingValidator = { // This always evaluates true. type: 'Plutus', script: '4e4d01000033222220051200120011', }

    const exampleAddress: Address = C.EnterpriseAddress.new( 0, // testnet C.StakeCredential.from_scripthash( C.PlutusScript.from_bytes( Buffer.from(exampleScript.script, 'hex'), ).hash(C.ScriptHashNamespace.PlutusV1), ), ) .to_address() .to_bech32();`

    2: Fund the validator script.

    `let tx: TxComplete tx = await Tx.new() .payToContract(exampleAddress, ANY_DATUM(), { lovelace: BigInt(5000000) }) .complete();

    const signedTx = (await tx.sign()).complete();

    await signedTx.submit(); `

    3: Spend from the validator, but send 2 ADA back to the contract.

    `const utxo = (await Lucid.utxosAt(exampleAddress))[0];

    let tx: TxComplete tx = await Tx.new() .payToContract(exampleAddress, ANY_DATUM(), { lovelace: BigInt(2000000) }) // This breaks. .collectFrom([utxo], ANY_REDEEMER()) .attachSpendingValidator(exampleScript) .complete();

    const signedTx = (await tx.sign()).complete();

    await signedTx.submit(); `

    opened by Riley-Kilgore 10
  • getDelegation error Blockfrost API

    getDelegation error Blockfrost API

    I try to get delegation info with this method:

    let delegation =  await lucid.wallet.getDelegation();
    console.log("delegation", delegation);
    

    I obtain null information despite I've delegate to a pool.

    The problem I think it's in the Blockfrost Api. Infact, I think the address passed is in raw address format, but Bockfrost Api would have a address in stake format.

    Here a screenshot of console error.

    image

    opened by albertorizzi 9
  • 0.7.2 - Cannot read properties of undefined (reading 'getUtxosCore')

    0.7.2 - Cannot read properties of undefined (reading 'getUtxosCore')

    With the last change, I am getting this error after calling switchProvider followed by submitting a transaction. https://github.com/GGAlanSmithee/cardano-lucid-blockfrost-proxy-example can be used as a reproduction. Everything was working fine in 0.7.1 as far as I could tell.

    opened by GGAlanSmithee 7
  • Package does not work with next@latest (v. 13)

    Package does not work with next@latest (v. 13)

    I've submitted an issue in the next.js repo, because the bug only appears once I updated to their latest build, but I'm reporting it here as well, because looking at this code there might be an actual issue with setting global.Headers in node.js versions => 16.15.0, if it is readonly, as the error suggests: documentation.

    I've actually not been able to reproduce this in isolation, so might be nothing.

    opened by GGAlanSmithee 7
  • Add `utxos` option to `Tx.complete` method

    Add `utxos` option to `Tx.complete` method

    I'm still learning the ins and outs of this lib and the serialization lib so this may not be necessary...

    I'd like to control the utxo set that is passed to the coin selection algorithm during Tx.complete(). Currently, if coinSelection is enabled during Tx.complete() it will fetch the entire utxo set from the wallet by default. I'd like the option to pass specific a specific utxo set instead.

    I imagine there is another way to do this - but this approach does work. I'll note that support for "single utxo" transactions would need to be added as well, the method below requires at least 2 utxos to work (this is because the add_inputs_from method is being used).

    // Create tx and create 1 output within the txBuilder
    let tx = await lucid.newTx()
      .payToAddress(receiverAddr, { lovelace: 2000000n });
    
    // Insert the first 2 utxos from an arbitrary number of utxos
    const utxos = await lucid.wallet.getUtxos();
    const coreUtxos = C.TransactionUnspentOutputs.new();
    coreUtxos.add(utxoToCore(utxos[0]));
    coreUtxos.add(utxoToCore(utxos[1]));
    tx.txBuilder.add_inputs_from(coreUtxos, C.Address.from_bech32(changeAddr));
    
    // Pass the 2 specified utxos to coin selection
    tx = await tx.complete({
        utxos: coreUtxos,
    });
    
    opened by eliasearlym 7
  • Invalid Character error while using Lucid

    Invalid Character error while using Lucid

    Hello, was wondering if you have encountered this error before, and why lucid is throwing it at me. I am trying to use the payToAddress function but with a variable for address. Here is relevant code.

    lucid.selectWalletFromSeed(process.env.POOLSEED)
        let address = await lucid.wallet.address();
        let token = "<sometokenID>";
        let tx = await lucid.newTx().payToAddress(addressC, { lovelace: BigInt(1000000), [token]: BigInt(5) }).complete();
    

    error I get: error invalid character (code=")

    opened by ssbright 7
  • "BabbageOutputTooSmallUtxo" error submitting testnet native asset transactions

    This was working pre-Vasil so I'm presuming it's related to the network fork; Attempting to build a simple tx containing an NFT and allowing Lucid to calculate the minimum required amount results in txs which error out in the wallet. Tested with Nami, Flint and Eternl with similar "OutputTooSmallUtxo" errors.

    opened by hazryder 7
  • Advanced parsing into PlutusData?

    Advanced parsing into PlutusData?

    Imo it would be neat to be able to

    1. specify expectations about incoming datums' shapes
    2. parse arrays originally generated from record-types back into some kind of named shape
    • Am I missing this existing already?
    • Is it desirable for me to do it?

    I would probably modify the Data class.

    opened by lemmon-714 3
  • Automatically adjust fee when spending all UTxO assets?

    Automatically adjust fee when spending all UTxO assets?

    Hey Ales, sorry to add to the list..I just thought there might be a simple solution to a problem I was encountering...

    Description of the issue:

    • My wallet has 1 specific UTxO I want to use in a tx
    • I want to send the entire contents of that UTxO to another address.
    • So I add the UTxO to the inputs and outputs via payToAddress and collectFrom
    • When completing the transaction however, an error is thrown Insufficient inputs.
    // Fetch the specific utxo I want to consume entirely (at index 0)
    const specificUtxo = await wallet.getUtxos()[0];
    
    // Create tx
    const tx = await lucid.newTx()
      .payToAddress(receiver, specificUtxo.assets)
      .collectFrom([specificUtxo])
      .complete({ coinSelection: false })
      
    // Console: Insufficient input
    

    Basically, I'm looking for an easy way to "Spend Everything" from a UTxO - but the fee isn't being adjusted. Any ideas on how to fix this easily?

    opened by defiyass26 2
  • Add graphql provider

    Add graphql provider

    draft, I have no idea if it works, needs some debug, but somebody might want to get to it sooner

    Allows using Cardano GraphQL instance as data provider in combination with Cardano submit API for submitting txs. (e.g. dandelion.link for free GraphQL by the community and https://www.freeloaderz.io/ for free load balanced submit api from SPOs)

    I have a question though @alessandrokonrad, I am not sure about delegation endpoint, I can get list of records with poolId and reward, so I just return first record rn. Should I count those reward amounts together from all records and return sum with latest poolId?

    opened by zachyking 10
  • Lucid txs fail due to underestimated budget?

    Lucid txs fail due to underestimated budget?

    After upgrading from 0.6.2 to 0.6.9 when submitting certain txs I get

    transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (UtxosFailure (ValidationTagMismatch (IsValid True) (FailedUnexpectedly (PlutusFailure \\\"\\\\nThe 3 arg plutus script (PlutusScript PlutusV1 ScriptHash \\\\\\\"de6d958351421f03dcab4e8d01afbddd630fad7a9add9229eb8fec40\\\\\\\") fails.\\\\nCekError An error has occurred: User error:\\\\nThe machine terminated part way through evaluation due to overspending the budget.\\\\nThe budget when the machine terminated was:\\\\n({ cpu: -9454\\\\n| mem: 8980\\\\n})\\\\nNegative numbers indicate the overspent budget; note that this only indicatessthe budget that was needed for the next step, not to run the program to completion.\\\\nThe protocol version is: ProtVer {pvMajor = 7, pvMinor = 0}\\\\nThe data
    

    when I set txPartial.complete({ nativeUplc: false }) then the tx works again.

    The cbor of a tx in tx.submit() that triggers this is

    84a70083825820f6580884307b60dab9a41974a61f8b7955e854547e52402683b234173835cfe002825820517fbf68f1403780339f6da910e36ff7cbf24062810d003472a49224e2c4619600825820d09ac00445dfbfcd9c21ecabe528ed3f9899aa815faf11a2f7e7a397e630c7f503018283583910de6d958351421f03dcab4e8d01afbddd630fad7a9add9229eb8fec4004cd0323f7a9e2e6ad452187af62b116224de1f9099ecc90cd4c3886821a3cb0caa9a1581c3465fa438d34bbb12475b666752125577d44aa2c05b7fd7342929c78a158202fc0343bc979dc53907afdc5b57564e6a81328cdd5fd2f1ac9abd88348305cff015820cb037ba35022cc7366bd8a5445fbe3cef259a4527d7f735fce1dd73cf19e729482583900b951195adf9faf776544441b2e3bb9f528c58dd316ca0e34199b833a04cd0323f7a9e2e6ad452187af62b116224de1f9099ecc90cd4c38861a9830b3d9021a00064a8a0b5820f6924edd201e321dc6e95b17d5c36111fb2565e82f657da07ea9865272aa24e70d81825820e259f54c8b6ce5edaf0ce5b29da8531b4ba8997fa706de970f2f8209332f1f35011082583900b951195adf9faf776544441b2e3bb9f528c58dd316ca0e34199b833a04cd0323f7a9e2e6ad452187af62b116224de1f9099ecc90cd4c38861b0000000254178cc5111a00096fcfa40081825820efe3e91137383c8e49eed661512487e97b319b144c5a9a9108d4638d77f29f7e58401b991a031706747624354c929ff84e90e357ede4a8cd01de66b3d01d0ef2252dd49660b022769eb8abcfaef3787271cab353ec30ee22e451990b8269afc7b70e038159110659110301000033333232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232222222233322232533303b001149858c8c8c8c8c8c8c8c8c8c8c8ccccc888cc0d48cdc3a400466606e6eacc134c130c0e800400c00800cdd6182480480a1bae30490062323232323232323232533304f3370e900000109919191919191919199919822919baf026305d304a001001375860b6036464a6609864a6660b400220022660be921214d7573742062652076616c69642077697468696e2073696e676c652065706f6368000013370e605c01200e2a6609864a6660b400220022660be92115506f736974696f6e206e6f7420636c6f7361626c650000153323305a00114a2646606a606c466e21200000133303970200200a6606e00c01c266e20dd6982e80d99b81007375a60ba60b802c2a6609864a6660b400220022660be9210e4f7074696d206e6f7420706169640000132330353036233712900000099981cb810020013330387000066660540660669040497a008a9982619299982d000880089982fa49114f7574707574206e6f7420636c6f73656400001332232323232533305f3370e90000010a99832249705061747465726e206d61746368206661696c75726520696e207175616c69666965642027646f2720626c6f636b206174206f7074696d2d636f6d6d6f6e2d706c7574617263682f4f7074696d2f4f6e636861696e2f436f6d6d6f6e2f506c7574617263682e68733a3133343a332d343400161533305f3371e6eb8c18c0040bc4c8c8c94ccc188cdc3a40000042646464a6660ca66e1d200000213375e60d20020182a660d49201705061747465726e206d61746368206661696c75726520696e207175616c69666965642027646f2720626c6f636b206174206f7074696d2d636f6d6d6f6e2d706c7574617263682f4f7074696d2f4f6e636861696e2f436f6d6d6f6e2f506c7574617263682e68733a3133383a372d32310016306b002306b001375460cc0022a660ce9201705061747465726e206d61746368206661696c75726520696e207175616c69666965642027646f2720626c6f636b206174206f7074696d2d636f6d6d6f6e2d706c7574617263682f4f7074696d2f4f6e636861696e2f436f6d6d6f6e2f506c7574617263682e68733a3133373a372d3234001630680023068001375460c660c40082940c194008c194004dd51830000982600099ba548000cc158c1740592f5c00242a6609864a6660b400220022660be08600266068606a466e1c0052000333038702666070e0004000c04454ccc16403c403c4cc17810c03cdd5982e182d98248008a9982e2481785061747465726e206d61746368206661696c75726520696e207175616c69666965642027646f2720626c6f636b206174206f7074696d2d626f6e64732f7372632f4f7074696d2f4f6e636861696e2f426f6e64732f506c7574617263682f436f6e7472616374732f4f70656e2e68733a3135313a392d323000163303b233706002098660686eb4c168050004ccc0d1c0299982b0068806899982a99baf305d305900d375205e60b001a01a64a6660ac66062466066466e2120000010010011001153305b4901184e6567617469766520616d6f756e7420696e2056616c7565001633302602f02f3370200c66e09208084af5f001375a60b00286644a6660aa66e2000800440084004dd6982b80a99b80337020026eb4c15cc158040dd6982b809181380099191919299982a99b87480080084dd6982c8008b182d801182d8009baa32305730440013056305530430013055302930540153232323253330543370e900100109bad305800116305a002305a00137546460ac608600260aa608400260a8605060a6028a6660a000e29000099982799baf3057305300737520526eb4c158c14cdd5982b1829803a40002a66609e66e1d20040021533042325333050001100113305549122496e636f72726563742061646472657373206361727279696e6720556e69714e4654000013375e0120102a6608464a6660a000220022660aa9211d45706f6368732076616c7565206d75737420626520706f736974697665000013371090001bad30530011533042533304f0051005133054039005132533305000110011330554911b4f75747075742068617320696e636f727265637420616d6f756e7400001333222323302e302f23370e0029000199819381001330310040083330317000026606e466e052000001002375a60a600200e00c2666660766eb0c14c050074dd718298081299821992999828800880089982b01d000999825911299982a0010a99982a0008a5114a02a6660a8002294054ccc14d4cc118cdd7982d982b801182d982b800899baf305a3057002305a30570011330033056002305600114a001000e2a66086a6660a000c200c2660aa07400c264a6660a200220022660ac921274c6f636b696e672061646472657373206e6f7420707265736572766564206f6e206f7574707574000013375e60a8608201460a860820122a660a8921785061747465726e206d61746368206661696c75726520696e207175616c69666965642027646f2720626c6f636b206174206f7074696d2d626f6e64732f7372632f4f7074696d2f4f6e636861696e2f426f6e64732f506c7574617263682f436f6e7472616374732f4f70656e2e68733a3132333a392d313500163055002305500137540286eacc13c038cdd79827181a981d8031827181a981d8029bab304d304c303a0043756609860966072008609660700046094606e0042a66094921775061747465726e206d61746368206661696c75726520696e207175616c69666965642027646f2720626c6f636b206174206f7074696d2d626f6e64732f7372632f4f7074696d2f4f6e636861696e2f426f6e64732f506c7574617263682f436f6e7472616374732f4f70656e2e68733a38363a352d3137001633333030375860900120266eb8c1200148c124c120c0d800454cc1252401775061747465726e206d61746368206661696c75726520696e207175616c69666965642027646f2720626c6f636b206174206f7074696d2d626f6e64732f7372632f4f7074696d2f4f6e636861696e2f426f6e64732f506c7574617263682f436f6e7472616374732f4f70656e2e68733a38323a372d313900163046001304500130440013043001304230420013041001302e006303f001302c001303e302b00132323232007533303a3370e90000010991919191919191919299982199baf00103a132323232323232323232323232323232323232323232324994ccc168004526153305e05b16305b003375a00260b400260b0008a6660a866e1cdc6800a40702930a9982c8230b1bae001305600130540045333050533043337129000000899b89001045149854cc15411858dd6800982900098280019bad001304f001304d003375a00260980026094008a66608c66e24dc6800a40802930a998258220b1bae001304800130460021323232323232323232323232323232323232323232323232324994ccc170004526153306005d16305d003375a00260b800260b4008a6660ac66e1cdc6800a40702930a9982d8240b1bae001305800130560045333052533045337129000000899b89001047149854cc15c12058dd6800982a00098290019bad0013051001304f003375a002609c0026098008a66609066e24dc6800a40802930a998268230b1bae001304a001304800453330443370e6e340052038149854cc12410c58dd7000982300098220019bad00130430013041005303537560066606c4a66607a66ebcc1140040d04c8c8c8cdd818240021823802181b9bab304600333038232323233760609400860920086eb4c12000d4ccc100cdc49b8d00148100526153304503e16375c608e0020026eacc1100044c8c8c8c8c8cdd818250031824803181c9bab30480053303a232323233760609800860960086eb4c12800d4ccc108cdc49b8d00148100526153304704016375c60920020026eacc11800d4ccc0f8cdc39b8d001480e0526153304303d16375c608a0020026eac004c0f800454cc0fc10058c100008c100004dd500199191919003299981d19b87480000084c926533303b001149854cc0fc0f05854ccc0e8cdc3a400400426493299981d8008a4c2a6607e0782c2a66607466e1d20040021323232324994ccc0f8004526153304203f16303f003375a002607c0022a6607e0802c608000460800026ea80080048894ccc0c8cdc3800a4000205c2660080066600a00400244660086ea4008dd300091198019ba90023750002446605666ec00080040a88cdc199b81001002003483c202179fd57d2080dddb012302c30020012302b3013001489002233004230033756605e0020024466006460066eb4c0b80040048c07c894ccc09c0045288a9980c9801981500089801181480091299981219b88480000084cc0288cc0308cdc10008020008008b1111998021119980380280100080100091801911ba63300337560046eac0048c00888dd4198019bad002375a002444666600800644004004002460326004002446464466002006004444a66604600226603e0060042646464a66604a66ebc0080044cc088cdd800119804981600318160019998041100100298140020a99981299b90375c0046eb80044cc088018cccc0208800400cc0a00100144cc08800ccccc02088004018014c0a0010c0b0008c0ac010c098004894ccc08400840044cccc00c88004c090008c08c00800488cc00c8cc01400c0040048c00c8dd318011bab001230022375060046eb400488cc054894ccc07400440604cc064cdd8181218100009802181198100009801180f800800a491d56616c7565206e6f7420707265736572766564206f6e206f75747075740049011d446174756d206e6f7420707265736572766564206f6e206f7574707574002301930190012223300423370e9001199803191bab301d301c300a001301c301b3009001003002003300e22253330170011225001153330163002301a001132223002003301a00113300300230190012223333004002480008cccc014009200075a6eac00400c8c008dd480091111980791299980b80088028a99980b19baf301e301a00100613004301d301a0011300230190010012301737540029212461205075624b6579486173682073686f756c64206265203238206279746573206c6f6e67002233300f00200100314a090504e00a491f426173697320706f696e7473206e6f7420696e2076616c69642072616e6765004c01014000233300422533300c001120041322533300d300100215330120061613300430100032337200020066eb8c04cc03c00400492824810c756e736f72746564206d6170002300222533300a00110051330063003300d0013002300c0012323002233002002001230022330020020014bd6f7b6302ba0491296120546f6b656e4e616d65206d757374206265206174206d6f7374203332204279746573206c6f6e6700490128612043757272656e637953796d626f6c2073686f756c64206265203238206279746573206c6f6e67005734aae7d241186c697374206973206c6f6e676572207468616e207a65726f005744ae855ce2493f7265616368656420656e64206f662073756d207768696c65207374696c6c206e6f7420686176696e6720666f756e642074686520636f6e7374727563746f72005573caae7522011c0cf620732ca49e9c45c2d436974c761d27f1f8d3a58d6c9d3403a1a90048811c3465fa438d34bbb12475b666752125577d44aa2c05b7fd7342929c780048811c110257923868ca76f27ac4137b20a197fbec1d64ce328f38874a03cc004c0150d8799fd8799f581cfefefefefefefefefefefefefefefefefefefefefefefefefefefefeffd8799fd8799fd8799f581cababababababababababababababababababababababababababababffffffff0001049fd8799fa140a1401a000ea1b81836581c5647fdf8b80725d51c229d53726a13ceb35e8919c9179567932458f858202fc0343bc979dc53907afdc5b57564e6a81328cdd5fd2f1ac9abd88348305cff0a0619012c581cabababababababababababababababababababababababababababab1928a1ffff0581840002d87b9f01ff821a0005d3191a0845e192f5f6
    
    opened by eddiemundo 7
  • Add more providers

    Add more providers

    Lucid has the following Provider interface: https://github.com/spacebudz/lucid/blob/04bf6166fec75b6050686d7aea168cecbb7fc625/src/types/types.ts#L25-L36

    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 the getUtxosWithUnit 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

    opened by alessandrokonrad 0
Owner
Berry
Berry
Tool to sign data with a Cardano-Secret-Key // verify data with a Cardano-Public-Key // generate CIP-8 & CIP-36 data

Tool to sign data with a Cardano-Secret-Key // verify data with a Cardano-Public-Key // generate CIP-8 & CIP-36 data

Martin Lang 11 Dec 21, 2022
Ethereum chain sniperbot for tokens. This bot sniffs the mempool for pending transactions for trading enabled and also liquidity add functions.

Ethereum chain sniperbot for tokens. This bot sniffs the mempool for pending transactions for trading enabled and also liquidity add functions.

null 12 Dec 5, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Vaultacks lets users store files off-chain on Gaia. Files are encrypted by default but also can be made public and shared

Vaultacks Vaultacks is built on the Stacks Chain. It lets users upload files to Gaia, a off-chain data storage system. Vaultacks currently uses the de

Anish De 5 Sep 14, 2022
How to create an NFT on the Cardano blockchain using JavaScript

How to create an NFT on the Cardano blockchain using JavaScript Youtube Video: https://www.youtube.com/watch?v=OeOliguGn7Y Who is this guide for? For

Armada Alliance 117 Dec 31, 2022
chain-syncer is a module which allows you to synchronize your app with any ethereum-compatible blockchain/contract state. Fast. Realtime. Reliable.

Chain Syncer Chain Syncer is a JS module which allows you to synchronize your app with any ethereum-compatible blockchain/contract state. Fast. Realti

Miroslaw Shpak 10 Dec 15, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A helper CLI for Plutus-Light

Hyperion This is a CLI meant to accompany the Plutus Light compiler. Installation [WIP] The end goal is to host Hyperion on NPM and make it available

null 3 Jul 27, 2022
☁️ Application using Node.js, AdonisJs, Adonis ACL, Adonis Kue Provider, Adonis Mail, Adonis Lucid Slugify, Adonis Validator, AdonisJs Redis, ESLint and pg

Node.js - SaaS ☁️ Application using Node.js, AdonisJs, Adonis ACL, Adonis Kue Provider, Adonis Mail, Adonis Lucid Slugify, Adonis Validator, AdonisJs

null 4 Aug 19, 2022
A decentralized protocol for indexing and querying data from DecentraMix's on chain contracts across all supported blockchains.

A decentralized protocol for indexing and querying data from DeMix contracts across all supported blockchains.

DecentraWorld Ecosystem 92 May 3, 2022
How often do you get asked about the gadgets or software that you use? If the answer is quite often, you should be trying show off out. Curate the list of gadgets and software and share it with your fans and followers.

Show Off - Showcase your setup! How often do you get asked about the gadgets or software that you use? If the answer is quite often, you should be try

Adithya Sreyaj 15 Nov 24, 2022
Auto-preload multiple relationships when retrieving Lucid models

Adonis Auto-Preload Auto-preload multiple relationships when retrieving Lucid models Pre-requisites Node.js >= 16.17.0 Installation npm install @melch

Oussama Benhamed 25 Nov 26, 2022
Nami Wallet is a browser based wallet extension to interact with the Cardano blockchain.

Nami Wallet Nami Wallet is a browser based wallet extension to interact with the Cardano blockchain. It's an open-source project and built by Berry Po

Berry 335 Dec 29, 2022
Cardano DApp Wallet Connector

Cardano DApp Wallet Connector This project was bootstrapped with Create React App. React JS demo In the project directory, you can run: npm start run

null 105 Dec 18, 2022
A typescript wrapper package to use the cardano-cli

Coti cardano-cli A package to run cardano-cli commands from nodejs, if you hold a blockfrost API-KEY you could add while creating a cardano-cli instan

Coti 6 Aug 10, 2022
Keep a track of all the tasks you need to do and Check off ones you have completed - Created using HTML, SCSS, JavaScript and Webpack.

To Do List Keep a track of tasks you need to do. An Application where you can keep a track of the tasks you need to do and checkout the ones that have

Awais Amjed 19 Jul 28, 2022
Cindy Dorantes 12 Oct 18, 2022
Benefit cards API, create and store card data and log transactions

Valex ?? Benefit cards for companies and employees! ?? Tech used Overview An API to store benefit cards from companies to employees and log transactio

Felipe Ventura 2 Apr 25, 2022