From 570df1f5eda2dd638f4d394a93467b424e171ba6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Sat, 8 Sep 2018 16:18:45 +0200 Subject: [PATCH] add getProviderEndpoint API --- src/app/plugin/pluginAPI.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/plugin/pluginAPI.js b/src/app/plugin/pluginAPI.js index fb9844efd5..ce7f355c0e 100644 --- a/src/app/plugin/pluginAPI.js +++ b/src/app/plugin/pluginAPI.js @@ -11,6 +11,13 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) => getExecutionContextProvider: (mod, cb) => { cb(null, executionContext.getProvider()) }, + getProviderEndpoint: (mod, cb) => { + if (executionContext.getProvider() === 'web3') { + cb(null, executionContext.web3().currentProvider.host) + } else { + cb('no endpoint: current provider is either injected or vm') + } + }, updateTitle: (mod, title, cb) => { pluginManager.plugins[mod].modal.setTitle(title) if (cb) cb()