-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Update interfaces, clarify type intentions #2673
Update interfaces, clarify type intentions #2673
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, thanks for putting this together from the feedback!
@ryanio after further discussion with @MicahZoltu and others, I expanded these changes, and changed the type of cc: @alcuadrado |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a fan of short and concise standards that clearly indicate the set of things necessary for communication between two systems implementing the standard. As indicated in my comments, I feel like a number of the additions (along with some of the text that was present prior to this PR) needlessly hand hold developers and are not necessary for the standard to serve its purpose in providing a mechanism for two systems to communicate with each other.
TypeScript is structurally typed (duck typed), and JavaScript is untyped so there is no need for any mention of what else may or may not be on an object and we can instead focus this specification on what MUST be on the object. The time when MAY is useful is when something is optional but if present then it MUST meet some constraints. That is, I think an MAY statement that doesn't also contain a MUST (or in some cases a MUST NOT) should be removed from the spec.
I would also generally like to see this standard cleaned up a of much of the opinion and style comments, and also get rid of some of the redundancy that is currently present. While we have been having a lot of discussion and disagreement on what the standard should be, I think whatever that is can be described in very few words and we should strive to be pithy (unlike this comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, nice summary and changes, thx! 👍
459c9c9
to
a119f2d
Compare
These changes look good. Thanks @rekmarks. |
a119f2d
to
875aaf0
Compare
FYI: I'm not making any changes to this PR anymore, I'm just force-pushing to cause CI to rerun. |
Thanks for that @rekmarks! |
MetaMask has a working implementation here: https://github.com/MetaMask/inpage-provider/blob/master/src/MetamaskInpageProvider.js Edit: Our implementation includes a lot of cruft related the old API and some of our internals. I'm considering extracting all of the method and event implementations into a sample implementation gist that could be attached to 1193 itself. |
I mean a one liner:
Not a full implementation. We shouldn’t need to go to one companies implantation for reference, as this could be biased. (Don’t get me wrong, I like MM) |
Ah, got it! Haha, our implementation is definitely biased. There are a number of examples like that in the |
Oh yes,
I forgot about those. Sorry I am on my phone.
|
875aaf0
to
32055a0
Compare
32055a0
to
ee2bcba
Compare
Hi, I'm a bot! This change was automatically merged because: - It only modifies existing Draft or Last Call EIP(s) - The PR was approved or written by at least one author of each modified EIP - The build is passing
Hi, I'm a bot! This change was automatically merged because: - It only modifies existing Draft or Last Call EIP(s) - The PR was approved or written by at least one author of each modified EIP - The build is passing
Hi, I'm a bot! This change was automatically merged because: - It only modifies existing Draft or Last Call EIP(s) - The PR was approved or written by at least one author of each modified EIP - The build is passing
Link to file: https://github.com/rekmarks/EIPs/blob/1193-update-interfaces/EIPS/eip-1193.md
Summary of Changes
[key: string]: unknown
; the ability to add properties is impliedRequestArguments
params?: unknown
->params?: unknown[] | object
RequestArguments
fields and RPC method names and parametersA Note on
request
After review, here's where I currently stand on the signature of
request
.request
takes a single, options bag argument, to make it as extensible as possible. We are extremely unlikely to have to revisit it ever again. This is a wonderful thing.RequestArguments
and itsparams
property however it makes practical sense to do so. Presumably, they'll type it such that it supports whatever RPC methods the implementation supports.params?: unknown[] | object
.request
in this way:typeof args?.method === 'string'
).params
in handler.Ref #2319
cc: @alcuadrado @ryanio @MicahZoltu