wharfkit / wallet-plugin-wombat

WalletPlugin for the Wharf Session Kit. Allow users to login and sign transactions with Wombat wallet.
https://wharfkit.com
Other
1 stars 1 forks source link

Cannot read properties of undefined (reading 'default') #13

Open Wapaca opened 8 months ago

Wapaca commented 8 months ago

Hello,

I'm trying to implement wombat wallet but either with nuxt 2 or nuxt 3 i get the error in the title. It can happen from two files:

on wallet-plugin-wombat.js `} else if (typeof self !== 'undefined') { ws$1 = self.WebSocket || self.MozWebSocket; }

var browser$3$1 = ws$1;

browser$3$1.default;

var inherits$d$1; if (typeof Object.create === 'function'){`

browser$3$1 is undefined

And on protocol-scatter.m.js

`} else if (typeof self !== 'undefined') { ws = self.WebSocket || self.MozWebSocket; }

var browser$3 = ws;

browser$3.default;

var inherits$d; if (typeof Object.create === 'function'){ inherits$d = function inherits(ctor, superCtor) {`

Same browser variable is undefined.

I'm not sure why i get the error, you can check on this nuxt 3 repo https://github.com/Wapaca/waxel_claim_ninjas/tree/add-wombat this branch doesn't work but the master with only anchor and mycloudwallet does.

aaroncox commented 8 months ago

Hrm, seems like the Scatter SDKs that Wombat uses aren't building properly. I'll circulate this with the team and see if they have any ideas.

dafuga commented 8 months ago

Hey @Wapaca ! My best guess is that you are running into this error because nuxt is trying to run your code in node during server side rendering. Unfortunately, the Scatter SDK (which is a dependency of the Wombat plugin) only works in the browser. Your best bet is probably going to be to load the plugin dynamically in a part of your code that will only run in the browser. You can use what we did in the starter kit as a reference: https://github.com/wharfkit/starter/blob/main/eos/src/index.ts#L23

Wapaca commented 8 months ago

Hi @dafuga your solution worked thanks. I pushed into the add-wombat branch of the above repo + pushed it here https://waxeltool.waxpaca.fr/ .

I still can't manage to login with wombat desktop but i get up to the same error than on other websites (including alcor which use their own scatter wrapper). I installed wombat desktop yesterday and it's the first time i'm using it, maybe i should try with the mobile version or it doesn't like me having Anchor too.

dafuga commented 8 months ago

Hi @Wapaca, we just tried Wombat desktop and it seems like the process for third party sites to login and trigger transactions is broken. You can use their in-app browser, but unfortunately you won't be able to leverage the wombat plugin like you are trying to. We are hoping that they will fix that at some point, but in the meantime there isn't much we can do to help you on that front. The mobile app on the other hand should work with the plugin (at least it did the last time we tried it) as long as you don't also have Anchor mobile installed (because they use the same ESR protocol, having both installed can cause issues).