Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core: 2.3.2-alpha.4]: [fix] - Recommended Injected Wallets #1115

Merged
merged 2 commits into from
Jun 30, 2022

Conversation

lnbc1QWFyb24
Copy link
Collaborator

@lnbc1QWFyb24 lnbc1QWFyb24 commented Jun 30, 2022

Description

When only the injected wallets module is used and the user has no injected wallets installed, Onboard was no longer displaying the links included in the recommendedInjectedWallets parameter of the appMetadata object. This was due to checks not being updated for autoSelect now being an object that is always set.

This PR updates all checks for the autoSelect parameter which fixes this issue.

Checklist

  • The version field in package.json is incremented following semantic versioning
  • The box that allows repo maintainers to update this PR is checked
  • I tested locally to make sure this feature/fix works
  • This PR passes the Circle CI checks

Copy link
Contributor

@taylorjdawson taylorjdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice! 🚀

@lnbc1QWFyb24 lnbc1QWFyb24 merged commit 6305261 into v2-web3-onboard-develop Jun 30, 2022
@lnbc1QWFyb24 lnbc1QWFyb24 deleted the fix/recommended-injected branch June 30, 2022 01:44
This was referenced Jun 30, 2022
@mihaic195
Copy link

mihaic195 commented Jul 4, 2022

Hey @aaronbarnardsound I'm getting Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'label') on line 55 in packages/core/src/views/connect/Index.svelte. Could this be a bug?

@lnbc1QWFyb24
Copy link
Collaborator Author

Hey @mihaic195, could you share how you are calling the connectWallet function?

@lnbc1QWFyb24
Copy link
Collaborator Author

@mihaic195 I get the error you described if an empty object is passed in to the connect wallet function: onboard.connectWallet({}).

Is that what you are passing in?

Our validation should not allow that value, so I am going to update it to error indicating that is not a valid value.

@lnbc1QWFyb24
Copy link
Collaborator Author

Fix is included in #1121

@ArshiaDhiman
Copy link

Hey @aaronbarnardsound I'm getting this error: TypeError: Cannot read properties of undefined (reading 'label'), is this a bug? I am putting an empty object in the connect({}) when a user clicks the connect wallet button and using the web3-onboard/react. Also use the autoSelect options when trying to connect using a useEffect and staying connected when the page is refreshed.

connect({
autoSelect: {
label: previouslyConnectedWallets[0],
disableModals: true,
},
}).then(setCurrentChain);

Have been stuck on this a while just wondering if maybe I am using it wrong? Thanks

@lnbc1QWFyb24
Copy link
Collaborator Author

Hey @ArshiaDhiman yes passing in an empty object is what causes the error and the fix above fixes our validation to indicate that an empty object is an invalid parameter to the connectWallet function. If you are not auto selecting a wallet, just call the connectWallet function without any arguments (connectWallet()).

@ArshiaDhiman
Copy link

ArshiaDhiman commented Jul 7, 2022

Okay perfect thanks @aaronbarnardsound. I just thought I would specify that I am using @web3-onboard/react. I was unable to call the connect() function without a empty object but using the code below I fixed the error.

     connect({ autoSelect: {
                     label:  "any",
                     disableModals: false,
                        },
                    }).then(setChain)`

@lnbc1QWFyb24
Copy link
Collaborator Author

Ah ok, we need to get the types fixed in the React package then! I'll create an issue so that we can get that fixed up.

@lnbc1QWFyb24
Copy link
Collaborator Author

@ArshiaDhiman Actually it looks like our types are correct and the connect options are optional - https://github.com/blocknative/web3-onboard/blob/v2-web3-onboard-develop/packages/react/src/index.ts#L74

@ArshiaDhiman
Copy link

@aaronbarnardsound okay thanks. I still get a error when I try use connect without a empty object or autoSelect. I have attached an example here, the fix above solved my issue so there is no problem. Thanks! 😄 Screenshot (394)

@lnbc1QWFyb24
Copy link
Collaborator Author

@ArshiaDhiman which version of the react package are you on? Could you try updating to the latest?

@ArshiaDhiman
Copy link

The issue was fixed thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants