No worries! Happy to help. Can you send me your code? Are you sure that fees are 0?

Reply to this note

Please Login to reply.

Discussion

I'm pretty sure it's related to my code and not the cashu-ts library

When I run the cashu-ts pure typescript in terminal I have no issue minting 1 sat and generating a token

I tried to build a webpack version of cashu-ts so I could easily integrate it into my webapp

The error arises when I try to execute the sendTokens command:

const { keep, send, cashuToken } = await CashuBuddy.sendTokens(wallet, secretAmount.value, proofs, secretInput.value);

Here's the webpack code for reference:

https://github.com/happylemonprogramming/cashubuddy/blob/main/src/index.ts

I think I figured it out actually

Thanks for your help 🙏

Awesome! What turned out to be the issue?

I’m not familiar with typescript so I just kept struggling and stumbling through it

Here’s what I eventually did and maybe you can tell me if there was an easier way

-Created a typescript project folder

-npm installed your library

-Created a file to export each function I needed (see image below)

-Packaged it into a webpack

-npm run build to get bundle.js file

-Host bundle.js on cloudflare

Now my webapp has your functions and all I need in my HTML is:

Great! The package actually already has an inbuilt command to create a standalone bundle. Simply clone the repo and do

- npm i

- npm run compile:standalone

lol nice, that’s way easier

At least it was a good learning experience 😅

Is the standalone bundle already hosted on a CDN anywhere?

I could at least do that if that benefits anyone

I got this error in the image below because I'm on an old Windows machine

I had to:

- npm i

- npm install --save-dev cross-env

- update "compile:standalone": "cross-env BUILD_FORMAT=iife vite build" on package.json

- npm run compile:standalone

But now I think I got the full cashu-ts library working! Thanks for your help!

Can I lock e-cash to an npub using cashu-ts?

Yes, you can lock to schnorr public keys. Just make sure to convert them accordingly