Skip to content

[Feature]: allow instantiation of the web3-onboard with only the ChainID (no RPC URL, token name, etc) Β #1520

@MOZGIII

Description

@MOZGIII

Is your request related to a problem?

We are building the UI that doesn't know what chain it will operate on. We can't specify the RPC URL and/or chain name or token.

Feature Description

Allow instantiating the Onboard without the chain parameters (besides chainId) known upfront. This is meant to support both public chains and private chains via the same deployment.

const chains = [
  { // no `token`, `label` or `rpcUrl`
    id: userSpecifiedChainId
  }
];

const onboard = Onboard({
  wallets,
  chains,
  appMetadata
})

The injected wallets are perfectly capable of carrying the sending of transactions without us specifying the RPC URL or other chain info. Further, wallet's switchNetwork should only require chainId, and the rest is only needed for adding a chain to the wallet. In our case this is a limiting factor.

Alternative Solutions

We could display the form to the user to input the rest of the parameters, but that would mean that user has to enter the parameters required only for adding the chain to the wallet even if they already have the required chain in their wallet. In other words, it would just suck.

Anything else?

No response

Metadata

Metadata

Labels

featureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions