Stellar-Wallets-Kit icon indicating copy to clipboard operation
Stellar-Wallets-Kit copied to clipboard

Add Trezor Wallet connection

Open earrietadev opened this issue 1 year ago β€’ 10 comments

earrietadev avatar Jan 11 '24 15:01 earrietadev

@earrietadev can I be assigned this task

NueloSE avatar Jun 19 '24 06:06 NueloSE

Hey @earrietadev ! I'm Lau Chaves, I would like to contribute on this one! I think this might take me 2-5 days to completed. I have over 5 years of experience working with react,ts... this is my first OD Hack! So I'm pretty excited about it!

here's my onlydust profile https://app.onlydust.com/u/lauchaves not so much there since I'm starting in this world but here's my git as well https://github.com/lauchaves

lauchaves avatar Jun 20 '24 15:06 lauchaves

Hey! @earrietadev, I'll give you a heads-up if I come across any issues. Thanks!

lauchaves avatar Jun 22 '24 02:06 lauchaves

Hi @earrietadev i want to work on this issue

ktarun1419 avatar Jun 23 '24 18:06 ktarun1419

@earrietadev hey πŸ‘‹ ! I have a couple of questions...

Regarding the signTx method, I noticed that the Trezor wallet's signTransaction method requires specifying a coin. Do we need to specify one? In my review of other wallet integrations, they do not require specifying a coin, and also that method doesn’t have a transaction parameter for the transaction: params.xdr like the other wallets.

Additionally, I found another Trezor method called stellarSignTransaction, which accepts a transaction directly instead of an XDR string,

the transaction for stellar approach should be something like this: image which is close to what is intended but no the same, idk if there's a way to decode the XDR

Given this, do we need to refactor our approach to match any of those methods?

Lastly, I tried to run the Stellar Wallet Kits on a simple project but had no luck. Is there a specific Node.js or TypeScript version required? I encountered errors related to TypeScript and ESM. Even after installing the necessary packages, it still didn't work. Is there another workaround to get it running, or might I be missing something? I followed the steps in the README.

btw is there a Discord or Telegram group chat for support, or is it okay to ask questions here on GitHub? πŸ˜„

lauchaves avatar Jun 24 '24 22:06 lauchaves

Hi @lauchaves it's ok to ask questions here,

I encountered errors related to TypeScript and ESM

You can try with the latest version, the kit is intended to be used in ES Module environment but I've seen some users asking for it to work on CommonJS workspaces too so I added the support for that.

Additionally, I found another Trezor method called stellarSignTransaction, which accepts a transaction directly instead of an XDR string

Most likely this will be the approach, and yeah Trezor requires the XDR to be parsed in their own way. You will need to include the Stellar SDK library into the kit and decode the XDR into a Stellar Transaction so you can then parse it in the way Trezor requires it.

Also, make sure to use the extended versions of the Trezor libraries... That's where they put all the utils when handling Stellar transactions (not sure why but the Trezor team is not that quick when it comes to Stellar compatibility)

earrietadev avatar Jun 25 '24 04:06 earrietadev

Hey πŸ‘‹ @earrietadev Im still having issues testing it, I got the Trezor integration ready to test it... (I can open the PR in the meantime If you would like to go ahead and do some code review)

I tried with type: "module", es6 and even commonjs still no luck :c

I'm getting image

I tried installing esm package as well didn't work either

lauchaves avatar Jun 26 '24 04:06 lauchaves

@lauchaves make sure your bundle is importing all the dependencies correctly. The kit works with Angular, React, Vue, Svelte and others.

If you're not sure if your bundle is correctly importing everything, you can create a blank React project with npx create-react-app my-app or a blank Angular app, they will import everything correctly

earrietadev avatar Jun 26 '24 05:06 earrietadev

@earrietadev got it πŸš€ thanks! will test it now!

lauchaves avatar Jun 26 '24 06:06 lauchaves

Hey @earrietadev, I just open a PR for this!

lauchaves avatar Jun 28 '24 04:06 lauchaves