diff --git a/package-lock.json b/package-lock.json index 4d6845ef5b..e120ac76fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4851,6 +4851,16 @@ "@remixproject/plugin-utils": "0.3.11" } }, + "@remixproject/plugin-iframe": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/@remixproject/plugin-iframe/-/plugin-iframe-0.3.11.tgz", + "integrity": "sha512-zvn7SIUK4jIQbY9O1kC8G3gzXrvflkbLof2cG1FGeqZDW+Yv164Rf98tLlGo8sUALYvKuTBBcl+89e//BWFKPg==", + "requires": { + "@remixproject/plugin": "0.3.11", + "@remixproject/plugin-api": "0.3.11", + "@remixproject/plugin-utils": "0.3.11" + } + }, "@remixproject/plugin-utils": { "version": "0.3.11", "resolved": "https://registry.npmjs.org/@remixproject/plugin-utils/-/plugin-utils-0.3.11.tgz", diff --git a/src/App.js b/src/App.js index 2fc4b30e36..373fc28146 100644 --- a/src/App.js +++ b/src/App.js @@ -1,9 +1,9 @@ import React from 'react'; import './App.css'; import { RemixClient } from './RemixClient' - +const p = new RemixClient() function App() { - const p = new RemixClient() + const openModal = () => { p.onConnect() } @@ -22,11 +22,12 @@ function App() { for(const account of accounts){ document.getElementById('accounts').innerHTML += `
  • ${account}
  • ` } - showButtons(accounts.length > 0) + }) p.internalEvents.on('chainChanged', (chain) => { document.getElementById('chain').innerHTML = chain + showButtons(chain) }) p.internalEvents.on('disconnect', (chain) => { diff --git a/src/RemixClient.js b/src/RemixClient.js index f6e8f8416c..1486ef8140 100644 --- a/src/RemixClient.js +++ b/src/RemixClient.js @@ -14,14 +14,13 @@ import EventManager from "events" export class RemixClient extends PluginClient { - + provider constructor() { super(); + createClient(this); this.methods = ["sendAsync"]; this.internalEvents = new EventManager() - createClient(this); this.onload() - this.web3Modal = new Web3Modal({ providerOptions: this.getProviderOptions() // required }); @@ -79,7 +78,7 @@ export class RemixClient extends PluginClient { async detectNetwork(id) { let networkName = null; - + id = parseInt(id) // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md if (id === 1) networkName = "Main"; else if (id === 2) networkName = "Morden (deprecated)"; @@ -119,6 +118,7 @@ export class RemixClient extends PluginClient { package: WalletConnectProvider, options: { infuraId: '83d4d660ce3546299cbe048ed95b6fad', + bridge: 'https://static.225.91.181.135.clients.your-server.de:9090/' } }, torus: { @@ -182,12 +182,11 @@ export class RemixClient extends PluginClient { return new Promise((resolve, reject) => { if (this.provider) { this.provider.sendAsync(data, (error, message) => { - // console.log('in plugin', data, error, message) if (error) return reject(error) resolve(message) }) } else { - return reject('Provider not loaded') + resolve({"jsonrpc": "2.0", "result": [], "id": data.id}) } }) }