spacebudz / lucid

Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript, Deno and Node.js.
https://lucid.spacebudz.io
MIT License
339 stars 139 forks source link

Using Node modules in the Deno-based Vasil branch #63

Closed SamDelaney closed 2 years ago

SamDelaney commented 2 years ago

I'm working on creating an Ogmios provider with the idea of creating a PR here when it's ready, but am having a hell of a time getting CDNs or std/node to work for the @cardano-ogmios typescript client.

I've never worked with Deno before. Do you have a preferred method for integrating node libraries that aren't available in deno.land or deno.land/x/? My next approach would probably be denoify but the process of re-denoifying after updates to the library seems unnecessarily burdensome.

alessandrokonrad commented 2 years ago

You could check out esm.sh, but I doubt the ogmios typescript client won't work anyway. Also would prefer to not have external dependencies in Lucid if possible because it makes it much harder to be interoperable between Deno, Node.js and the browser. One problem I see straighaway is that Node.js doesn't have WebSocket built in. It's an external package. Deno and the browser do have it built in tho. It would be better to to make use of "raw" ogmios and work with the WebSocket connection directly.

SamDelaney commented 2 years ago

Thanks for the response!

I already tried esm with little luck. I did figure out a way to do it through CDNs with a combination of unpkg and jspm yesterday, but obviously that's not ideal. I'll look into doing it with raw Ogmios and see how that goes.