Thanks @ryanio!
Note: discourse won’t let me put more than two links… so some of my links are mangled.
Ah, there is just some ambiguity in the EIP; at the top it states that:
The provider is designed to be minimal containing 2 methods:
send
andon
.
And then later:
[…] the provider MAY provide as many methods as it can reasonably provide, but MUST provide at least
on
,emit
, andremoveListener
.
I’m wondering if requiring that the provider expose an emit
method is necessary. Obviously the provider itself needs to be able to emit events/notifications, but the mechanism in which it does so probably doesn’t matter to the dapp. Of course I could be totally wrong here; maybe there are valid use-cases for dapps to emit events via the provider?
Ah OK, that makes sense. I do still have concerns though, though they are mostly related to the discussions in EIP-1102 than they are to EIP-1193:
- Defining the entry point in this EIP seems like in may be in the domain of an IETF RFC (the IETF documents Internet standards; RFCs are those documents). The reason this may be in the IETF RFC domain is because we may run into compatibility problems with future RFCs that may need to implement an interface on
window.ethereum
in the future. For example: https [colon] //bugzilla [dot] mozilla [dot] org/show_bug.cgi?id=1075059 and https [colon] //bugzilla [dot] mozilla [dot] org/show_bug.cgi?id=1102219 document issues where individual libraries polluting JS prototypes caused naming issues for browsers. It is possible that in the future browsers (other than Mist) may want to include awindow.ethereum
object themselves, and this current spec may not be in line with the needs of browsers in the future. - polluting the global namespace by default is usually frowned upon.
- what if a dapp wants to use multiple providers? (EIP-1102 is discussing this already)
I think the recommendation for using window.ethereum
is outside the scope of this provider implementation API, and should likely just be documented as the intended namespace for browsers, browser extensions, etc. that inject their own Ethereum Provider into the global context; client libraries like ganache-core
should not behave this way. Or perhaps we could just link to EIP-1102 for details on how browsers and extensions should expose their provider API?