Beacon-sdk won't work

So I’m trying to build a semi decentralized app (on tezos) that has users provide their wallet address by approving permissions on their wallet. This is all handled by a JS framework called “beacon-sdk”. I have 0 js experience and can’t make it work, despite the provided example looking so easy:

I used jsdelivr to get the packages instead of npm, I tried it in native libraries, I tried calling all logic in a form using anvil.js, but I get all sorts of errors from “exports is not defined” errors to module errors

Any tips would be appreciated to get this simple handshake to run. JS interactions just don’t make sense to me so it’s hard for me to even know if it’s possible in anvil.

Hey - have you read the section of the docs on working with external Js libraries.
(They were very recently updated with anvil’s new feature anvil.js.import_from)

Anvil Docs | Accessing JavaScript


A couple of relevant sentences:

Not all Javascript runs in the browser, and often library authors will provide a Javascript option specifically for the browser

Be aware that finding a Javascript library on jsdelivr, unpkg or cdnjs does not guarantee its suitability for the browser

The library docs do seem to have a browser version - see this section Standalone Delegation | Beacon Docs - which might work for you.

4 Likes

just a custom HTML form and some anvil.call() magic and it worked flawlessly - thank you!

2 Likes