This topic is for discussing EIP-3085. Discussion was originally located at this GitHub issue on the EIPs repository.
Discussion is expected to pick up again as 3085 moves to Review and then Last Call.
This topic is for discussing EIP-3085. Discussion was originally located at this GitHub issue on the EIPs repository.
Discussion is expected to pick up again as 3085 moves to Review and then Last Call.
A draft PR is up for a related method, wallet_switchEthereumChain
: https://github.com/ethereum/EIPs/pull/3326
Instead of decimals
, consider requiring a scaling factor instead. This would allow chains that have scaling factors other than base 10 to be supported. Ethereum would be 10^18
but other-chain may be 2^32
.
Oh, interesting idea. Something like scalingFactor: string
matching RegEx /[1-9]\d*\^[1-9]\d*/
? Or maybe scalingFactor: [base: number, exponent: number]
where the tuple members are positive integers?
Then we could make scalingFactor
mutually exclusive with decimals
.
Scaling factor can just be a QUANTITY
(hex string encoded number). No need for anything fancy here I think.
Ah, naturally. Iâll PR that in the morning
Watch an overview of the proposal with @rekmarks
Hello,
I am facing an issue while calling wallet_addEthereumChain.
I will appreciate it if you can help me to fix this issue.
ethereum.request({
method: âwallet_addEthereumChainâ,
params: [{
âchainIdâ: â0x3â,
âchainNameâ: âRopsten Networkâ,
ârpcUrlsâ: [
âhttps://ropsten.infura.io/v3/4ee71c3a70404cf8b1241df95bbc1347â,
],
âiconUrlsâ: [
âhttps://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0/logo.pngâ
],
ânativeCurrencyâ: {
ânameâ: âETHER Tokenâ,
âsymbolâ: âETHâ,
âdecimalsâ: 18
}
}]
And this is the issue:
Thanks in advance.
Actually, I added blockExplorerUrls to the params. Sorry to forgot adding it to the code.
âblockExplorerUrlsâ: [
âhttps://ropsten.etherscan.ioâ
],
FYI, I confirmed that my Infura Project ID is working. This issue is definitely related to the ârpcUrlsâ.
When I change it to âhttps://dai.poa.networkâ with xDAI Chain, it perfectly worked.
I imagine you figured this out by now, but:
wallet_addEthereumChain
doesnât (or at least originally didnât) support switching to a default network (any Ethereum network like Mainnet, Ropsten, etc.)
Now you can use a combination of wallet_addEthereumChain
and wallet_switchEthereumChain
in your dapp to add new networks for users if they do not have it in their MM already, and switch back to default chains like Ropsten afterwards.
You can read more here:
Iâm finding the wording in this EIP a bit puzzling, particularly around the rpcUrls
fieldâs requirements.
Initially, the document states:
Only the chainId is required per this specification, but a wallet MAY require any other fields listed, impose additional requirements on them, or outright ignore them.
However, later on, it asserts:
The wallet MUST reject the request if the rpcUrls field is not provided, or if the rpcUrls field is an empty array.
Moreover, the parameter interface is described as follows:
interface AddEthereumChainParameter {
chainId: string;
blockExplorerUrls?: string[];
chainName?: string;
iconUrls?: string[];
nativeCurrency?: {
name: string;
symbol: string;
decimals: number;
};
rpcUrls?: string[];
}
From my understanding, this suggests a wallet âMAYâ need the rpcUrls
fields, yet it also states a wallet âMUSTâ reject requests lacking the rpcUrls
field. This seems contradictory to me. If this isnât a contradiction, perhaps the wording needs clarification to explain why this isnât the case. Could there also be an explanation or scenario where a wallet could function without an rpcUrl
, if such a situation is feasible?