graz-sh / graz

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

Trouble while connecting to wallet #68

Closed Xyzjesus closed 1 year ago

Xyzjesus commented 1 year ago

Describe the bug

sup bros! we have another issue about connecting with graz.

  1. while connecting with wallet, I have 2 problems: window.keplr is not defined and error with gas price. Screenshot 2023-04-24 at 17 32 26

https://user-images.githubusercontent.com/62913761/234012034-0d7165d2-7b74-47b0-8188-0d33c4c2aa21.mp4

telegram-cloud-photo-size-2-5345868170843506598-x

  1. in 0.34 version we've used method "validateaddress" but in 0.35 version it doesn't work, could you please add this feature to new version? we also had a bunch of problems with prefix, so we decided to get it manually Screenshot 2023-04-24 at 17 38 09

A clear and concise description of what the bug is.

...

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'https://gutenberg.tools/#/create'
  2. Click on 'connect wallet'
  3. Check console
  4. See error

Expected behavior

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

...

Screenshots

If applicable, add screenshots to help explain your problem.

...

Device

Please complete the following device information. macOS, safari, chrome,brave

Desktop

Smartphone (haven't tried)

Additional context

Add any other context about the problem here.

...

codingki commented 1 year ago

Hey @Xyzjesus for validateAddress() we decided to remove that because we don't want to have bech32 in our deps. You can copy this block of code to your utils:

import { bech32 } from "bech32";

export const validateAddress = (address: string, prefix: string) => {
  if (!address) return false;
  try {
    return bech32.decode(address).prefix === prefix;
  } catch (error) {
    return false;
  }
};
codingki commented 1 year ago

@Xyzjesus Can you give me the ChainInfo that you using.

codingki commented 1 year ago

as for window.keplr Can you confirm that you already have keplr wallet extension installed in you browser?

codingki commented 1 year ago

I'll recheck mainnetChains.juno

Xyzjesus commented 1 year ago

hey @codingki thanks with validation method, I'll try it

as for window.keplr Can you confirm that you already have [keplr wallet extension] installed in you browser? Yes, It's already installed. We have same problem with different accounts, about 3-4 users from other locations and same browsers (brave, chrome) can't connect with this error. telegram-cloud-photo-size-2-5348469778563581941-y for example this test was made yesterday from keplr's user.

Can you give me the ChainInfo that you using. of course, here it is: https://github.com/diekuche/gutenberg/blob/56f4806b67bd4bda4a607e0718392dbf0f018dcb/src/components/Header/Header.tsx#L16

I'll recheck mainnetChains.juno thanks a lot bro, it would be awesome, because everything works well with Bostrom chain

codingki commented 1 year ago

Hey @Xyzjesus mainnetChains.juno works fine for me, I can't reproduce window.keplr error but from the code perspective if keplr is not installed it will return that error and recheck our packages there's nothing wrong. Try our example here to check https://graz-example.vercel.app/

Tips: use useCheckWallet hook to check installed wallet docs here: https://graz.strange.love/docs/hooks/useCheckWallet

There's a bug that I found when using mainnetChains.juno idk if it's related to this, it's useBalances bug. In mainnetChains.juno we have cw20: prefix in the coinMinimalDenom it is returning an error. Will be fix in next release #69