near / wallet-selector

This is a wallet selector modal that allows users to interact with NEAR dApps with a selection of available wallets.
https://near.github.io/wallet-selector/
Apache License 2.0
151 stars 153 forks source link

Ability to connect to custom net #212

Closed JoaquimLey closed 2 years ago

JoaquimLey commented 2 years ago

Is your feature request related to a problem? Please describe. I cannot connect to a local node when developing, this would be especially useful when running into issues with betanet or testnet and having to constantly delete state and re-deploy contracts.

Describe the solution you'd like Ability to pass an array with our own config.

Acceptance criteria Ability to spin up a kurtosis localnet and connect to it using the wallet selector by passing down my local node url.

Additional context We can get the currently "hardcoded" config here but would be great to add/change this as a config param

lewis-sqa commented 2 years ago

Hey @JoaquimLey,

Thanks for opening this issue! I've made an attempt to resolve what I understand is the problem: #215. Could you clarify what you mean by "an array with our own config"? This library assumes a dApp is tied to only one network at any time

lewis-sqa commented 2 years ago

We're in the process of introducing a number of fundamental changes to the library in dev. To avoid delaying a fix for this issue, I've raised a slightly different PR #216

JoaquimLey commented 2 years ago

Hey @JoaquimLey,

Thanks for opening this issue! I've made an attempt to resolve what I understand is the problem: #215. Could you clarify what you mean by "an array with our own config"? This library assumes a dApp is tied to only one network at any time

Hey @lewis-sqa thank you for the quick reply to my issue.

So what I mean by "an array with our own config" is to simply enable us to pass down a prop with our "own" getConfig() instead of having to rely on the hardcoded array of networks.

This would enable us to have multiple options at instantiation time, yes at runtime we would connect to one network at a time but would allow me for instance to run a local NearVM. With the current wallet-selector implementation we are "limited" to what you have defined.

In the ideal world, I should be able to declare a "localnet" where I would be able to provide my own network object with its own networkId (in this case would be localnet) nodeUrl, walletUrl and helperUrl.

That way when the getConfig() gets called to "attach" the selected NetworkConfiguration I would connect to that local node.


Was this clear? If not I'm happy to record a 30 second loom ;)

lewis-sqa commented 2 years ago

Thanks for clarifying @JoaquimLey.

I think the approach in #216 supports what you're looking for. You'll set the networkId as "customnet" (to bypass the internal presets) and define your own custom network configuration in a new network object. Further upstream in the dev branch, we'll move away from networkId entirely (as part of #215) and just use network which can be either a string (preset like the current networkId) or a custom object

JoaquimLey commented 2 years ago

Ah got it, it definitely does! Thank you for clarifying and sorry but I had searched for local in the current issues and it did not come up.

I'm going to close this issue now since it as already being addressed.

lewis-sqa commented 2 years ago

We'll keep this issue open until we've merged and released #216 👍

No need to apologise, I think there's some misunderstanding. The PRs mentioned above are directly related to this issue. It hadn't been addressed because our team usually points to "testnet" to keep our local dev environment lightweight, but I completely understand the need for custom network configuration

lewis-sqa commented 2 years ago

Hey @JoaquimLey, we've just published 2.1.0 containing the changes from #216 🙂