-
Notifications
You must be signed in to change notification settings - Fork 5k
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
EIP-1102: Transitionary API #5256
Conversation
app/scripts/inpage.js
Outdated
// Augment the provider with its enable method | ||
inpageProvider.enable = function () { | ||
return new Promise((resolve) => { | ||
resolve(inpageProvider.send({ method: 'eth_accounts' }).result) |
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.
Does inpageProvider.send({ method: 'eth_accounts' })
return a synchronous result, for grabbing .result
off of?
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 think I would rather use the async method and return that method, these sync methods historically are unreliable.
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.
Updated. We can't return it directly since enable
technically resolves directly to the array of accounts, but we can definitely use the async version.
8f1025b
to
2d74a6c
Compare
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.
11/02 incoming my dudettes and dudes
This pull request adds a transitionary EIP-1102 API so dapps can begin preemptively calling it. Specifically, this pull request does the following:
window.ethereum
provider#enable
methodNote: User-rejection can be tested by passing an object into the
enable
method with amockRejection
property set totrue
: