-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add plugin provider #178
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
Add plugin provider #178
Conversation
c511a92 to
3d97156
Compare
c28b7ac to
69e17a5
Compare
b3a5907 to
e20ddb8
Compare
| addNetwork (customNetwork) { | ||
| this.blockchain.addProvider(customNetwork) | ||
| addNetwork (network) { // { name, url } | ||
| if (network.url === 'ipc') { |
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.
suggestion:
const provider = network.url === 'ipc' ? new Web3.providers.IpcProvider() : new Web3.providers.HttpProvider(network.url)
this.blockchain.addProvider({ name: network.name, provider })| } | ||
| } | ||
| this.blockchain.addProvider({ name: profile.displayName, provider: web3Provider }) | ||
| })(profile, this) |
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.
is this really necessary (() => {})() it feels like it could be removed, and use this instead of app
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.
this can be removed yes.
(() => {})() is to make sure the creation of the provider is encapsulated. (that the local var profile doesn't get overridden in case the event callback is triggered multiple time.
But there might be better way to handle that.
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.
actually I had to keep this ...
| this.on('manager', 'pluginDeactivated', profile => { | ||
| if (profile.kind === 'provider') this.blockchain.removeProvider(profile.name) | ||
| }) | ||
| this.on('manager', 'pluginActivated', profile => { |
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.
suggestion: this.on('manager', 'pluginActivated', this.addProfileProvider.bind(this) and then move the code to that function
| if (profile.kind === 'provider') { | ||
| ((profile, app) => { | ||
| const web3Provider = { | ||
| sendAsync (payload, callback) { |
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.
suggestion, something like:
async sendAsync (payload, callback) {
console.log('wallet connect', payload)
try {
const result = await app.call(profile.name, 'sendAsync', payload)
console.log('wallet connect', result)
callback(null, result)
} catch (e) {
console.log('wallet connect', e)
callback(e)
})
}a526adf to
eaa811e
Compare
eaa811e to
bad90e2
Compare
|
@iurimatias just pushed some updates |
14d39dd to
4e7491e
Compare
4e7491e to
69b9196
Compare
|
I like the update where you can have the walletconnect plugin as the active tab and the txn can still be run. The Clear Current Request button - is important - we'll see if users can find it - but if they find the button ( by realizing they should look at the walletconnect tab) then this will solve txns getting piled up. Also - I think the 2 min timeout works well - at least it worked for me. |
This add the ability to reference new web3 provider.
Each "provider" plugin will be listed in the environment section of the run tab.
fix #30
Current state:
with metamask, rejecting a transaction doesn't resolve the call in the client.
sometimes
gasEstimatereturns a JSON RPC error (probably when the transaction fails), then force sending the transaction doesn't pop up anything in the mobile side.EDIT: https://github.com/ethereum/remix-project/pull/178/files#diff-b41d6048d9047202a90628384dd7d690R181
can take more than 10 seconds for a call to resolve.we'll probably need if the problem persist to have our own bridge.
call to a plugin can't be done asynchronously, so when a call doesn't resolve, all the other call to web3 are lined up (This probably can't be solved right now).this can't be solved. Plugin calls are synchronous (cc @GrandSchtroumpf fyi)