|
|
@ -14,14 +14,13 @@ import EventManager from "events" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class RemixClient extends PluginClient { |
|
|
|
export class RemixClient extends PluginClient { |
|
|
|
|
|
|
|
provider |
|
|
|
constructor() { |
|
|
|
constructor() { |
|
|
|
super(); |
|
|
|
super(); |
|
|
|
|
|
|
|
createClient(this); |
|
|
|
this.methods = ["sendAsync"]; |
|
|
|
this.methods = ["sendAsync"]; |
|
|
|
this.internalEvents = new EventManager() |
|
|
|
this.internalEvents = new EventManager() |
|
|
|
createClient(this); |
|
|
|
|
|
|
|
this.onload() |
|
|
|
this.onload() |
|
|
|
|
|
|
|
|
|
|
|
this.web3Modal = new Web3Modal({ |
|
|
|
this.web3Modal = new Web3Modal({ |
|
|
|
providerOptions: this.getProviderOptions() // required
|
|
|
|
providerOptions: this.getProviderOptions() // required
|
|
|
|
}); |
|
|
|
}); |
|
|
@ -79,7 +78,7 @@ export class RemixClient extends PluginClient { |
|
|
|
async detectNetwork(id) { |
|
|
|
async detectNetwork(id) { |
|
|
|
|
|
|
|
|
|
|
|
let networkName = null; |
|
|
|
let networkName = null; |
|
|
|
|
|
|
|
id = parseInt(id) |
|
|
|
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
|
|
|
|
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
|
|
|
|
if (id === 1) networkName = "Main"; |
|
|
|
if (id === 1) networkName = "Main"; |
|
|
|
else if (id === 2) networkName = "Morden (deprecated)"; |
|
|
|
else if (id === 2) networkName = "Morden (deprecated)"; |
|
|
@ -119,6 +118,7 @@ export class RemixClient extends PluginClient { |
|
|
|
package: WalletConnectProvider, |
|
|
|
package: WalletConnectProvider, |
|
|
|
options: { |
|
|
|
options: { |
|
|
|
infuraId: '83d4d660ce3546299cbe048ed95b6fad', |
|
|
|
infuraId: '83d4d660ce3546299cbe048ed95b6fad', |
|
|
|
|
|
|
|
bridge: 'https://static.225.91.181.135.clients.your-server.de:9090/' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
torus: { |
|
|
|
torus: { |
|
|
@ -182,12 +182,11 @@ export class RemixClient extends PluginClient { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
if (this.provider) { |
|
|
|
if (this.provider) { |
|
|
|
this.provider.sendAsync(data, (error, message) => { |
|
|
|
this.provider.sendAsync(data, (error, message) => { |
|
|
|
// console.log('in plugin', data, error, message)
|
|
|
|
|
|
|
|
if (error) return reject(error) |
|
|
|
if (error) return reject(error) |
|
|
|
resolve(message) |
|
|
|
resolve(message) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return reject('Provider not loaded') |
|
|
|
resolve({"jsonrpc": "2.0", "result": [], "id": data.id}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|