Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with local development #251

Open
kozer opened this issue Jun 28, 2024 · 1 comment
Open

Help with local development #251

kozer opened this issue Jun 28, 2024 · 1 comment

Comments

@kozer
Copy link

kozer commented Jun 28, 2024

I'm developing a Cardano application using nextjs setup with MeshJS template project. I'm using MeshJS in the frontend for its better React hooks etc. Although it's possible to use it fully, for the backend (Next.js API routes), I'm trying to use Lucid, as it is suggested by Aiken, which I use for the contract development. Also note that I'm using YACI with Kupos, and I'm trying to make lucid use Kupmios Provider to connect to YACI. However, I encounter the following error:

Error: TypeError: Cannot read properties of undefined (reading 'costModels')
    at client.addEventListener.once (file:///mnt/BACKUP/programming-free-time/blockchain/cardano/cofeemonks/frontend/node_modules/lucid-cardano/esm/src/provider/kupmios.js:34:40)

Development Stack:

  • Next.js for both frontend and API routes
  • MeshJS for frontend Cardano interactions (used for its better React support)
  • Lucid-cardano library for backend Cardano interactions (in Next.js API routes)
  • YACI (Yet Another Cardano Index) as the local Cardano node and indexer for development
  • Kupmios provider in Lucid to connect to YACI
  • Blockfrost provider planned for production environment

Code Structure:

  • Project structure based on the MeshJS Next.js template
  • Frontend: Using MeshJS for Cardano interactions
  • Backend (API routes): Attempting to use Lucid for Cardano operations
  • Using a LucidService class to manage Lucid initialization in API routes
  • Attempting to use different providers (Kupmios for development, Blockfrost for production)

Environment:

Local machine with YACI running ( Archlinux )

  1. Is there a known compatibility issue between Lucid, YACI, and Next.js API routes?
  2. Are there any specific considerations for using WebSocket-based providers (like Ogmios/Kupmios) in a serverless environment like Next.js API routes?
  3. How can I properly debug the Kupmios provider initialization in this setup?
  4. Are there any recommended best practices for using Lucid in Next.js API routes while using MeshJS in the frontend?
    Are there potential issues in using different libraries (MeshJS and Lucid) for frontend and backend Cardano interactions in the same project?
  5. Any insights or suggestions on resolving this error and setting up a robust Cardano development environment with this specific setup (MeshJS for frontend, Lucid for backend in Next.js) would be greatly appreciated. Additionally, any advice on best practices for this dual-library approach would be very helpful.​​​​​​​​​​​​​​​​
@Vortecsmaster
Copy link

You might want to check out Lucid Evolution from Anastasia Labs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants