Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
d1bedca8
Unverified
Commit
d1bedca8
authored
Mar 05, 2020
by
yann300
Committed by
GitHub
Mar 05, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2592 from ethereum/addWeb3ProviderPlugin
Add global web3 provider plugin
parents
1026ea93
656a77a4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
7 deletions
+42
-7
app.js
src/app.js
+6
-2
web3-provider.js
src/app/tabs/web3-provider.js
+31
-0
sendTxCallbacks.js
src/app/ui/sendTxCallbacks.js
+3
-3
universal-dapp-ui.js
src/app/ui/universal-dapp-ui.js
+1
-1
remixAppManager.js
src/remixAppManager.js
+1
-1
No files found.
src/app.js
View file @
d1bedca8
...
...
@@ -48,6 +48,7 @@ import { FramingService } from './framingService'
import
{
MainView
}
from
'./app/panels/main-view'
import
{
ThemeModule
}
from
'./app/tabs/theme-module'
import
{
NetworkModule
}
from
'./app/tabs/network-module'
import
{
Web3ProviderModule
}
from
'./app/tabs/web3-provider'
import
{
SidePanel
}
from
'./app/components/side-panel'
import
{
HiddenPanel
}
from
'./app/components/hidden-panel'
import
{
VerticalIcons
}
from
'./app/components/vertical-icons'
...
...
@@ -267,6 +268,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// ----------------- network service (resolve network id / name) -----
const
networkModule
=
new
NetworkModule
(
blockchain
)
// ----------------- represent the current selected web3 provider ----
const
web3Provider
=
new
Web3ProviderModule
(
blockchain
)
// ----------------- convert offset to line/column service -----------
const
offsetToLineColumnConverter
=
new
OffsetToLineColumnConverter
()
registry
.
put
({
api
:
offsetToLineColumnConverter
,
name
:
'offsettolinecolumnconverter'
})
...
...
@@ -300,7 +303,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
networkModule
,
offsetToLineColumnConverter
,
contextualListener
,
terminal
terminal
,
web3Provider
])
// LAYOUT & SYSTEM VIEWS
...
...
@@ -383,7 +387,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
console
.
log
(
'couldn
\'
t register iframe plugins'
,
e
.
message
)
}
await
appManager
.
activatePlugin
([
'contentImport'
,
'theme'
,
'editor'
,
'fileManager'
,
'compilerMetadata'
,
'compilerArtefacts'
,
'network'
,
'offsetToLineColumnConverter'
])
await
appManager
.
activatePlugin
([
'contentImport'
,
'theme'
,
'editor'
,
'fileManager'
,
'compilerMetadata'
,
'compilerArtefacts'
,
'network'
,
'
web3Provider'
,
'
offsetToLineColumnConverter'
])
await
appManager
.
activatePlugin
([
'mainPanel'
,
'menuicons'
])
await
appManager
.
activatePlugin
([
'home'
,
'sidePanel'
,
'hiddenPanel'
,
'pluginManager'
,
'fileExplorers'
,
'settings'
,
'contextualListener'
,
'scriptRunner'
,
'terminal'
])
...
...
src/app/tabs/web3-provider.js
0 → 100644
View file @
d1bedca8
import
{
Plugin
}
from
'@remixproject/engine'
import
*
as
packageJson
from
'../../../package.json'
export
const
profile
=
{
name
:
'web3Provider'
,
displayName
:
'Global Web3 Provider'
,
description
:
'Represent the current web3 provider used by the app at global scope'
,
methods
:
[
'sendAsync'
],
version
:
packageJson
.
version
,
kind
:
'provider'
}
export
class
Web3ProviderModule
extends
Plugin
{
constructor
(
blockchain
)
{
super
(
profile
)
this
.
blockchain
=
blockchain
}
/*
that is used by plugins to call the current ethereum provider.
Should be taken carefully and probably not be release as it is now.
*/
sendAsync
(
payload
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
blockchain
.
web3
().
currentProvider
.
sendAsync
(
payload
,
(
error
,
message
)
=>
{
if
(
error
)
return
reject
(
error
)
resolve
(
message
)
})
})
}
}
src/app/ui/sendTxCallbacks.js
View file @
d1bedca8
...
...
@@ -7,13 +7,13 @@ const typeConversion = remixLib.execution.typeConversion
const
Web3
=
require
(
'web3'
)
module
.
exports
=
{
getCallBacksWithContext
:
(
udappUI
,
executionContext
)
=>
{
getCallBacksWithContext
:
(
udappUI
,
blockchain
)
=>
{
let
callbacks
=
{}
callbacks
.
confirmationCb
=
confirmationCb
callbacks
.
continueCb
=
continueCb
callbacks
.
promptCb
=
promptCb
callbacks
.
udappUI
=
udappUI
callbacks
.
executionContext
=
executionContext
callbacks
.
blockchain
=
blockchain
return
callbacks
}
}
...
...
@@ -67,7 +67,7 @@ const confirmationCb = function (network, tx, gasEstimation, continueTxExecution
cb
(
txFeeText
,
priceStatus
)
},
(
cb
)
=>
{
self
.
executionContext
.
web3
().
eth
.
getGasPrice
((
error
,
gasPrice
)
=>
{
self
.
blockchain
.
web3
().
eth
.
getGasPrice
((
error
,
gasPrice
)
=>
{
const
warnMessage
=
' Please fix this issue before sending any transaction. '
if
(
error
)
{
return
cb
(
'Unable to retrieve the current network gas price.'
+
warnMessage
+
error
)
...
...
src/app/ui/universal-dapp-ui.js
View file @
d1bedca8
...
...
@@ -233,7 +233,7 @@ UniversalDAppUI.prototype.runTransaction = function (lookupOnly, args, valArr, i
const
functionName
=
args
.
funABI
.
type
===
'function'
?
args
.
funABI
.
name
:
`(
${
args
.
funABI
.
type
}
)`
const
logMsg
=
`
${
lookupOnly
?
'call'
:
'transact'
}
to
${
args
.
contractName
}
.
${
functionName
}
`
const
callbacksInContext
=
txCallBacks
.
getCallBacksWithContext
(
this
,
this
.
executionContext
)
const
callbacksInContext
=
txCallBacks
.
getCallBacksWithContext
(
this
,
this
.
blockchain
)
const
outputCb
=
(
returnValue
)
=>
{
if
(
outputOverride
)
{
...
...
src/remixAppManager.js
View file @
d1bedca8
...
...
@@ -4,7 +4,7 @@ import { EventEmitter } from 'events'
import
QueryParams
from
'./lib/query-params'
const
requiredModules
=
[
// services + layout views + system views
'manager'
,
'compilerArtefacts'
,
'compilerMetadata'
,
'contextualListener'
,
'editor'
,
'offsetToLineColumnConverter'
,
'network'
,
'theme'
,
'fileManager'
,
'contentImport'
,
'scriptRunner'
,
'manager'
,
'compilerArtefacts'
,
'compilerMetadata'
,
'contextualListener'
,
'editor'
,
'offsetToLineColumnConverter'
,
'network'
,
'theme'
,
'fileManager'
,
'contentImport'
,
'
web3Provider'
,
'
scriptRunner'
,
'mainPanel'
,
'hiddenPanel'
,
'sidePanel'
,
'menuicons'
,
'fileExplorers'
,
'terminal'
,
'settings'
,
'pluginManager'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment