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
78b672e7
Unverified
Commit
78b672e7
authored
Mar 05, 2019
by
yann300
Committed by
GitHub
Mar 05, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1741 from ethereum/remix-plugin-new-api
Integrate more remix plugin API
parents
f09f7616
918d933b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
51 deletions
+89
-51
app.js
src/app.js
+28
-17
SourceHighlighters.js
src/app/editor/SourceHighlighters.js
+16
-10
browser-files-tree.js
src/app/files/browser-files-tree.js
+1
-0
compile-tab.js
src/app/tabs/compile-tab.js
+6
-0
remixAppManager.js
src/remixAppManager.js
+1
-1
universal-dapp.js
src/universal-dapp.js
+37
-23
No files found.
src/app.js
View file @
78b672e7
...
...
@@ -253,32 +253,43 @@ class App {
})
}
getExecutionContextProvider
(
cb
)
{
cb
(
null
,
executionContext
.
getProvider
())
getExecutionContextProvider
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
resolve
(
executionContext
.
getProvider
())
})
}
getProviderEndpoint
(
cb
)
{
if
(
executionContext
.
getProvider
()
===
'web3'
)
{
cb
(
null
,
executionContext
.
web3
().
currentProvider
.
host
)
}
else
{
cb
(
'no endpoint: current provider is either injected or vm'
)
}
getProviderEndpoint
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
executionContext
.
getProvider
()
===
'web3'
)
{
resolve
(
executionContext
.
web3
().
currentProvider
.
host
)
}
else
{
reject
(
'no endpoint: current provider is either injected or vm'
)
}
})
}
detectNetWork
(
cb
)
{
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
cb
(
error
,
network
)
detectNetWork
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
if
(
error
)
return
reject
(
error
)
resolve
(
network
)
})
})
}
addProvider
(
name
,
url
,
cb
)
{
executionContext
.
addProvider
({
name
,
url
})
cb
()
addProvider
(
name
,
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
executionContext
.
addProvider
({
name
,
url
})
resolve
()
})
}
removeProvider
(
name
,
cb
)
{
executionContext
.
removeProvider
(
name
)
cb
()
removeProvider
(
name
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
executionContext
.
removeProvider
(
name
)
resolve
()
})
}
}
...
...
src/app/editor/SourceHighlighters.js
View file @
78b672e7
...
...
@@ -18,19 +18,25 @@ class SourceHighlighters {
// TODO what to do with mod?
async
highlight
(
mod
,
lineColumnPos
,
filePath
,
hexColor
)
{
let
position
try
{
position
=
JSON
.
parse
(
lineColumnPos
)
}
catch
(
e
)
{
throw
e
}
if
(
!
this
.
highlighters
[
mod
])
this
.
highlighters
[
mod
]
=
new
SourceHighlighter
()
this
.
highlighters
[
mod
].
currentSourceLocation
(
null
)
this
.
highlighters
[
mod
].
currentSourceLocationFromfileName
(
position
,
filePath
,
hexColor
)
return
new
Promise
((
resolve
,
reject
)
=>
{
let
position
try
{
position
=
JSON
.
parse
(
lineColumnPos
)
}
catch
(
e
)
{
throw
e
}
if
(
!
this
.
highlighters
[
mod
])
this
.
highlighters
[
mod
]
=
new
SourceHighlighter
()
this
.
highlighters
[
mod
].
currentSourceLocation
(
null
)
this
.
highlighters
[
mod
].
currentSourceLocationFromfileName
(
position
,
filePath
,
hexColor
)
resolve
()
})
}
async
discardHighlight
(
mod
)
{
if
(
this
.
highlighters
[
mod
])
this
.
highlighters
[
mod
].
currentSourceLocation
(
null
)
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
highlighters
[
mod
])
this
.
highlighters
[
mod
].
currentSourceLocation
(
null
)
resolve
()
})
}
}
...
...
src/app/files/browser-files-tree.js
View file @
78b672e7
...
...
@@ -132,6 +132,7 @@ function FilesTree (name, storage) {
}
this
.
profile
=
function
()
{
// TODO should make them promisable
return
{
name
:
this
.
type
,
methods
:
[
'get'
,
'set'
,
'remove'
],
...
...
src/app/tabs/compile-tab.js
View file @
78b672e7
...
...
@@ -143,6 +143,12 @@ class CompileTab {
}
}
getCompilationResult
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
resolve
(
this
.
compileTabLogic
.
compiler
.
lastCompilationResult
)
})
}
/*********
* SUB-COMPONENTS
*/
...
...
src/remixAppManager.js
View file @
78b672e7
...
...
@@ -76,7 +76,7 @@ export class RemixAppManager extends AppManagerApi {
events
:
[],
methods
:
[],
notifications
:
{},
url
:
'http
://localhost:8080
'
,
url
:
'http
s://remix-pipeline.surge.sh
'
,
description
:
' - '
,
icon
:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAAAAACIM/FCAAAJU0lEQVR42u3ce1QUVRgA8EEemgoWvjkltIZlIJhCmmTmqVBJJSofaaWpYUUn08wHmkfR6GFWqKh51CDzLZkPKs2MNAkFVAgxw007WZklaWqsLutt0b13LusM7LDfN+x07vcXe3dmvvkxszN35rszEvmfhCQgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgHgspXbcsdVoybKQsXrPfqivk0qoBJqSImV+uG6Tyq34mxOi+7oI+EMt4E3L0P60H5PRjJvSIOYwPsejgsO9ev6FDXjXpEgMvIUM2mXSKibgQWz+9IJ3OoEJWcbtx+t4yM2gcK8jk/k9TUSHyefClUjNClM0NpQnCLiJCfmCOJDNSLGQpNiJCVgQ1b+YfcFPrdt1KsSDmwSFtAgP8AwLbjMeCVGYOu1FyRPvEfBzG4WlRXo4cfvGv/4sByYm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VxjMfv1w0DoY7l+/OvaanqUu+kxzZBoOm8F11hBGyNgILSIHKbYGVGIbaTuEAt/bqGNnWAg9LVa4S5C3iTaIX3pzPwjTyXAu1agY3GNXNq1AneQOkA878c+Ruk9p7VDWD24A3f4ZSfJd2Egz7BzlXz4LQ5QQPjHpim/eFbTCdFSvyfEpZnZJTa11awdcll+5rS3o4vCjshSO6CLqzy5izLE0UVhBxkpwZVLDa2dxlmLZunQaUxX7zS6Afn3TtWj4G2HoSC71Lvxrj1YabwLKzcgKm8/s/evzYARrXKpu5jAQWzD9Lj5EO7azQd3IMQap5DifuAXJRy4Q2G/SiKgEE+6QecmhBwcUO2W6QPbzAjxYTRPCXjmJIGH1MNNbE2PI2oqK6TQssKDR7Eg+ayssI4QNIhHFHogINZoJkk8iOHYI5feniaIEI8ohoJAKmL0Kk8PJ6gQ/QYMFCJDPGAIBxDk4mg9HBMJOqT+hzlBQcjl97AHnq0hRA9IfQ8FBIQQ29fJWIMzZxcRoh+kKuptuCw0xNNCQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATEY+M/DV/rjLxphEwAAAAASUVORK5CYII='
,
prefferedLocation
:
'mainPanel'
...
...
src/universal-dapp.js
View file @
78b672e7
...
...
@@ -33,7 +33,7 @@ UniversalDApp.prototype.profile = function () {
return
{
name
:
'udapp'
,
displayName
:
'universal dapp'
,
methods
:
[
'runTx'
,
'getAccounts'
,
'createVMAccount'
],
methods
:
[
'runT
estT
x'
,
'getAccounts'
,
'createVMAccount'
],
description
:
'service - run transaction and access account'
}
}
...
...
@@ -73,11 +73,13 @@ UniversalDApp.prototype.resetAPI = function (transactionContextAPI) {
}
UniversalDApp
.
prototype
.
createVMAccount
=
function
(
privateKey
,
balance
,
cb
)
{
if
(
executionContext
.
getProvider
()
!==
'vm'
)
return
cb
(
'plugin API does not allow creating a new account through web3 connection. Only vm mode is allowed'
)
this
.
_addAccount
(
privateKey
,
balance
)
executionContext
.
vm
().
stateManager
.
cache
.
flush
(
function
()
{})
privateKey
=
Buffer
.
from
(
privateKey
,
'hex'
)
cb
(
null
,
'0x'
+
ethJSUtil
.
privateToAddress
(
privateKey
).
toString
(
'hex'
))
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
executionContext
.
getProvider
()
!==
'vm'
)
return
reject
(
'plugin API does not allow creating a new account through web3 connection. Only vm mode is allowed'
)
this
.
_addAccount
(
privateKey
,
balance
)
executionContext
.
vm
().
stateManager
.
cache
.
flush
(
function
()
{})
privateKey
=
Buffer
.
from
(
privateKey
,
'hex'
)
resolve
(
'0x'
+
ethJSUtil
.
privateToAddress
(
privateKey
).
toString
(
'hex'
))
})
}
UniversalDApp
.
prototype
.
newAccount
=
function
(
password
,
passwordPromptCb
,
cb
)
{
...
...
@@ -116,24 +118,36 @@ UniversalDApp.prototype._addAccount = function (privateKey, balance) {
}
}
// TODO should remove this cb
UniversalDApp
.
prototype
.
getAccounts
=
function
(
cb
)
{
var
self
=
this
if
(
!
executionContext
.
isVM
())
{
// Weirdness of web3: listAccounts() is sync, `getListAccounts()` is async
// See: https://github.com/ethereum/web3.js/issues/442
if
(
this
.
_deps
.
config
.
get
(
'settings/personal-mode'
))
{
return
executionContext
.
web3
().
personal
.
getListAccounts
(
cb
)
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
executionContext
.
isVM
())
{
// Weirdness of web3: listAccounts() is sync, `getListAccounts()` is async
// See: https://github.com/ethereum/web3.js/issues/442
if
(
this
.
_deps
.
config
.
get
(
'settings/personal-mode'
))
{
return
executionContext
.
web3
().
personal
.
getListAccounts
((
error
,
accounts
)
=>
{
if
(
cb
)
cb
(
error
,
accounts
)
if
(
error
)
return
reject
(
error
)
resolve
(
accounts
)
})
}
else
{
executionContext
.
web3
().
eth
.
getAccounts
((
error
,
accounts
)
=>
{
if
(
cb
)
cb
(
error
,
accounts
)
if
(
error
)
return
reject
(
error
)
resolve
(
accounts
)
})
}
}
else
{
executionContext
.
web3
().
eth
.
getAccounts
(
cb
)
}
}
else
{
if
(
!
self
.
accounts
)
{
return
cb
(
'No accounts?'
)
if
(
!
self
.
accounts
)
{
if
(
cb
)
cb
(
'No accounts?'
)
reject
(
'No accounts?'
)
return
}
if
(
cb
)
cb
(
null
,
Object
.
keys
(
self
.
accounts
))
resolve
(
Object
.
keys
(
self
.
accounts
))
}
cb
(
null
,
Object
.
keys
(
self
.
accounts
))
}
})
}
UniversalDApp
.
prototype
.
getBalance
=
function
(
address
,
cb
)
{
...
...
@@ -235,12 +249,12 @@ UniversalDApp.prototype.getInputs = function (funABI) {
UniversalDApp
.
prototype
.
runTestTx
=
function
(
tx
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
if
(
error
)
reject
(
error
)
if
(
error
)
re
turn
re
ject
(
error
)
if
(
network
.
name
===
'Main'
&&
network
.
id
===
'1'
)
{
reject
(
new
Error
(
'It is not allowed to make this action against mainnet'
))
re
turn
re
ject
(
new
Error
(
'It is not allowed to make this action against mainnet'
))
}
this
.
silentRunTx
(
tx
,
(
error
,
result
)
=>
{
if
(
error
)
reject
(
error
)
if
(
error
)
re
turn
re
ject
(
error
)
resolve
({
transactionHash
:
result
.
transactionHash
,
status
:
result
.
result
.
status
,
...
...
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