graz-sh / graz

React hooks for Cosmos 🪐
https://graz.sh/
MIT License
109 stars 32 forks source link

Vectis Wallet integration #98

Closed j0nl1 closed 1 year ago

j0nl1 commented 1 year ago

Is your feature request related to a problem? Please describe.

It's related with a wallet integration question.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] I've been working on add vectis extension into graz library but I found some limitations.

First limitation is wallet interface only is compatible with the Keplr one. https://github.com/strangelove-ventures/graz/blob/dev/packages/graz/src/types/wallet.ts#L26

Second limitation is about adaptersI don't see any documentation or code where they are being used. I guess these adapters solve the interface issue.

Describe the solution you'd like

A clear and concise description of what you want to happen.

It would be great instead of define the wallet inside graz library, receive the wallets externally (using these adapters) and fit to the interface.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

...

Additional context

Add any other context or screenshots about the feature request here.

Integration commit: https://github.com/nymlab/graz/commit/48d3a552d47d7b36279aeafd9a31a55ea27bb93a

Any kind of help would be really useful to complete the integration.

codingki commented 1 year ago

@j0nl1 thanks for the interest to add a new wallet to graz.

Those adapters haven't implemented. We are planning to extract wallet integration from the graz package but not sure when, thats why we have those adapters for example. Yes we have homework to create a documentation for wallet integration #99.

For now follow these steps for adding new wallet integration: Your code is already correct, since we haven't extract the wallets from the package, you need to add it in our functions

  1. Add the wallet type name here

    this already correct

  2. Add it to actions/wallet.ts. I've seen your code, is the wallet object following keplr object structure? window.vectis.cosmos === window.keplr?

  3. add it to useActiveWalletType hook, this already correct

  4. add the event listener, this already correct

And then make a PR to this repo. Let me know if you have any question or assist

j0nl1 commented 1 year ago

@codingki thanks for the guidance and details provided.

In our case object structure is different to keplr one and for that reason my question. I wanted to make sure that adapting the object to ours is okay.

I will add changes in actions/wallet.ts and create the pull request. I will also include the adapter in order to be supported in the future.

I will bind this issue with the pull request, again, thank you.

codingki commented 1 year ago

yeah it's ok to add to wallet type, yes include the adapter that would be great. Thank you

codingki commented 1 year ago

@j0nl1 Released in v0.0.44 https://github.com/strangelove-ventures/graz/releases/tag/v0.0.44