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
bb6142a3
Commit
bb6142a3
authored
Jul 02, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add logCallback fn to log to the remix console
parent
65732069
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
24 deletions
+25
-24
app.js
src/app.js
+4
-0
run-tab.js
src/app/tabs/run-tab.js
+8
-11
recorder.js
src/recorder.js
+6
-6
universal-dapp.js
src/universal-dapp.js
+7
-7
No files found.
src/app.js
View file @
bb6142a3
...
@@ -384,6 +384,10 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -384,6 +384,10 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}
}
})
})
registry
.
put
({
api
:
(
msg
)
=>
{
self
.
_components
.
editorpanel
.
logHtmlMessage
(
msg
)
},
name
:
'logCallback'
})
// ----------------- Compiler -----------------
// ----------------- Compiler -----------------
self
.
_components
.
compiler
=
new
Compiler
((
url
,
cb
)
=>
self
.
importFileCb
(
url
,
cb
))
self
.
_components
.
compiler
=
new
Compiler
((
url
,
cb
)
=>
self
.
importFileCb
(
url
,
cb
))
var
compiler
=
self
.
_components
.
compiler
var
compiler
=
self
.
_components
.
compiler
...
...
src/app/tabs/run-tab.js
View file @
bb6142a3
...
@@ -42,8 +42,7 @@ function runTab (localRegistry) {
...
@@ -42,8 +42,7 @@ function runTab (localRegistry) {
udappUI
:
self
.
_components
.
registry
.
get
(
'udappUI'
).
api
,
udappUI
:
self
.
_components
.
registry
.
get
(
'udappUI'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
editorPanel
:
self
.
_components
.
registry
.
get
(
'editorpanel'
).
api
,
logCallback
:
self
.
_components
.
registry
.
get
(
'logCallback'
).
api
editor
:
self
.
_components
.
registry
.
get
(
'editor'
).
api
}
}
self
.
_view
.
recorderCount
=
yo
`<span>0</span>`
self
.
_view
.
recorderCount
=
yo
`<span>0</span>`
self
.
_view
.
instanceContainer
=
yo
`<div class="
${
css
.
instanceContainer
}
"></div>`
self
.
_view
.
instanceContainer
=
yo
`<div class="
${
css
.
instanceContainer
}
"></div>`
...
@@ -198,9 +197,7 @@ function updateAccountBalances (container, self) {
...
@@ -198,9 +197,7 @@ function updateAccountBalances (container, self) {
RECORDER
RECORDER
------------------------------------------------ */
------------------------------------------------ */
function
makeRecorder
(
registry
,
runTabEvent
,
self
)
{
function
makeRecorder
(
registry
,
runTabEvent
,
self
)
{
var
recorder
=
new
Recorder
(
self
.
_deps
.
compiler
,
self
.
_deps
.
udapp
,
(
msg
)
=>
{
var
recorder
=
new
Recorder
(
self
.
_deps
.
compiler
,
self
.
_deps
.
udapp
,
self
.
_deps
.
logCallback
)
self
.
_deps
.
editorPanel
.
logMessage
(
msg
)
})
recorder
.
event
.
register
(
'newTxRecorded'
,
(
count
)
=>
{
recorder
.
event
.
register
(
'newTxRecorded'
,
(
count
)
=>
{
self
.
data
.
count
=
count
self
.
data
.
count
=
count
...
@@ -370,21 +367,21 @@ function contractDropdown (events, self) {
...
@@ -370,21 +367,21 @@ function contractDropdown (events, self) {
var
constructor
=
txHelper
.
getConstructorInterface
(
selectedContract
.
contract
.
object
.
abi
)
var
constructor
=
txHelper
.
getConstructorInterface
(
selectedContract
.
contract
.
object
.
abi
)
txFormat
.
buildData
(
selectedContract
.
name
,
selectedContract
.
contract
.
object
,
self
.
_deps
.
compiler
.
getContracts
(),
true
,
constructor
,
args
,
(
error
,
data
)
=>
{
txFormat
.
buildData
(
selectedContract
.
name
,
selectedContract
.
contract
.
object
,
self
.
_deps
.
compiler
.
getContracts
(),
true
,
constructor
,
args
,
(
error
,
data
)
=>
{
if
(
!
error
)
{
if
(
!
error
)
{
self
.
_deps
.
editorPanel
.
logMessage
(
`creation of
${
selectedContract
.
name
}
pending...`
)
self
.
_deps
.
logCallback
(
`creation of
${
selectedContract
.
name
}
pending...`
)
self
.
_deps
.
udapp
.
createContract
(
data
,
(
error
,
txResult
)
=>
{
self
.
_deps
.
udapp
.
createContract
(
data
,
(
error
,
txResult
)
=>
{
if
(
error
)
{
if
(
error
)
{
self
.
_deps
.
editorPanel
.
logMessage
(
`creation of
${
selectedContract
.
name
}
errored: `
+
error
)
self
.
_deps
.
logCallback
(
`creation of
${
selectedContract
.
name
}
errored: `
+
error
)
}
else
{
}
else
{
var
isVM
=
executionContext
.
isVM
()
var
isVM
=
executionContext
.
isVM
()
if
(
isVM
)
{
if
(
isVM
)
{
var
vmError
=
txExecution
.
checkVMError
(
txResult
)
var
vmError
=
txExecution
.
checkVMError
(
txResult
)
if
(
vmError
.
error
)
{
if
(
vmError
.
error
)
{
self
.
_deps
.
editorPanel
.
logMessage
(
vmError
.
message
)
self
.
_deps
.
logCallback
(
vmError
.
message
)
return
return
}
}
}
}
if
(
txResult
.
result
.
status
&&
txResult
.
result
.
status
===
'0x0'
)
{
if
(
txResult
.
result
.
status
&&
txResult
.
result
.
status
===
'0x0'
)
{
self
.
_deps
.
editorPanel
.
logMessage
(
`creation of
${
selectedContract
.
name
}
errored: transaction execution failed`
)
self
.
_deps
.
logCallback
(
`creation of
${
selectedContract
.
name
}
errored: transaction execution failed`
)
return
return
}
}
var
noInstancesText
=
self
.
_view
.
noInstancesText
var
noInstancesText
=
self
.
_view
.
noInstancesText
...
@@ -394,10 +391,10 @@ function contractDropdown (events, self) {
...
@@ -394,10 +391,10 @@ function contractDropdown (events, self) {
}
}
})
})
}
else
{
}
else
{
self
.
_deps
.
editorPanel
.
logMessage
(
`creation of
${
selectedContract
.
name
}
errored: `
+
error
)
self
.
_deps
.
logCallback
(
`creation of
${
selectedContract
.
name
}
errored: `
+
error
)
}
}
},
(
msg
)
=>
{
},
(
msg
)
=>
{
self
.
_deps
.
editorPanel
.
logMessage
(
msg
)
self
.
_deps
.
logCallback
(
msg
)
},
(
data
,
runTxCallback
)
=>
{
},
(
data
,
runTxCallback
)
=>
{
// called for libraries deployment
// called for libraries deployment
self
.
_deps
.
udapp
.
runTx
(
data
,
runTxCallback
)
self
.
_deps
.
udapp
.
runTx
(
data
,
runTxCallback
)
...
...
src/recorder.js
View file @
bb6142a3
...
@@ -13,9 +13,9 @@ var modal = require('./app/ui/modal-dialog-custom')
...
@@ -13,9 +13,9 @@ var modal = require('./app/ui/modal-dialog-custom')
*
*
*/
*/
class
Recorder
{
class
Recorder
{
constructor
(
compiler
,
udapp
,
ms
gCallBack
)
{
constructor
(
compiler
,
udapp
,
lo
gCallBack
)
{
var
self
=
this
var
self
=
this
self
.
msgCallBack
=
ms
gCallBack
self
.
logCallBack
=
lo
gCallBack
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
data
=
{
_listen
:
true
,
_replay
:
false
,
journal
:
[],
_createdContracts
:
{},
_createdContractsReverse
:
{},
_usedAccounts
:
{},
_abis
:
{},
_contractABIReferences
:
{},
_linkReferences
:
{}
}
self
.
data
=
{
_listen
:
true
,
_replay
:
false
,
journal
:
[],
_createdContracts
:
{},
_createdContractsReverse
:
{},
_usedAccounts
:
{},
_abis
:
{},
_contractABIReferences
:
{},
_linkReferences
:
{}
}
...
@@ -178,7 +178,7 @@ class Recorder {
...
@@ -178,7 +178,7 @@ class Recorder {
run
(
records
,
accounts
,
options
,
abis
,
linkReferences
,
udapp
,
newContractFn
)
{
run
(
records
,
accounts
,
options
,
abis
,
linkReferences
,
udapp
,
newContractFn
)
{
var
self
=
this
var
self
=
this
self
.
setListen
(
false
)
self
.
setListen
(
false
)
self
.
ms
gCallBack
(
`Running
${
records
.
length
}
transaction(s) ...`
)
self
.
lo
gCallBack
(
`Running
${
records
.
length
}
transaction(s) ...`
)
async
.
eachOfSeries
(
records
,
function
(
tx
,
index
,
cb
)
{
async
.
eachOfSeries
(
records
,
function
(
tx
,
index
,
cb
)
{
var
record
=
self
.
resolveAddress
(
tx
.
record
,
accounts
,
options
)
var
record
=
self
.
resolveAddress
(
tx
.
record
,
accounts
,
options
)
var
abi
=
abis
[
tx
.
record
.
abi
]
var
abi
=
abis
[
tx
.
record
.
abi
]
...
@@ -235,14 +235,14 @@ class Recorder {
...
@@ -235,14 +235,14 @@ class Recorder {
cb
(
data
.
error
)
cb
(
data
.
error
)
return
return
}
else
{
}
else
{
self
.
ms
gCallBack
(
`(
${
index
}
)
${
JSON
.
stringify
(
record
,
null
,
'
\
t'
)}
`
)
self
.
lo
gCallBack
(
`(
${
index
}
)
${
JSON
.
stringify
(
record
,
null
,
'
\
t'
)}
`
)
self
.
ms
gCallBack
(
`(
${
index
}
) data:
${
data
.
data
}
`
)
self
.
lo
gCallBack
(
`(
${
index
}
) data:
${
data
.
data
}
`
)
record
.
data
=
{
dataHex
:
data
.
data
,
funArgs
:
tx
.
record
.
parameters
,
funAbi
:
fnABI
,
contractBytecode
:
tx
.
record
.
bytecode
,
contractName
:
tx
.
record
.
contractName
}
record
.
data
=
{
dataHex
:
data
.
data
,
funArgs
:
tx
.
record
.
parameters
,
funAbi
:
fnABI
,
contractBytecode
:
tx
.
record
.
bytecode
,
contractName
:
tx
.
record
.
contractName
}
}
}
udapp
.
runTx
(
record
,
function
(
err
,
txResult
)
{
udapp
.
runTx
(
record
,
function
(
err
,
txResult
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
)
console
.
error
(
err
)
self
.
ms
gCallBack
(
err
+
'. Execution failed at '
+
index
)
self
.
lo
gCallBack
(
err
+
'. Execution failed at '
+
index
)
}
else
{
}
else
{
var
address
=
executionContext
.
isVM
()
?
txResult
.
result
.
createdAddress
:
txResult
.
result
.
contractAddress
var
address
=
executionContext
.
isVM
()
?
txResult
.
result
.
createdAddress
:
txResult
.
result
.
contractAddress
if
(
address
)
{
if
(
address
)
{
...
...
src/universal-dapp.js
View file @
bb6142a3
...
@@ -29,7 +29,7 @@ function UniversalDApp (opts, localRegistry) {
...
@@ -29,7 +29,7 @@ function UniversalDApp (opts, localRegistry) {
self
.
removable
=
opts
.
removable
self
.
removable
=
opts
.
removable
self
.
removable_instances
=
opts
.
removable_instances
self
.
removable_instances
=
opts
.
removable_instances
self
.
_deps
=
{
self
.
_deps
=
{
config
:
self
.
_components
.
registry
.
get
(
'config
'
).
api
logCallback
:
self
.
_components
.
registry
.
get
(
'logCallback
'
).
api
}
}
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
self
.
reset
(
self
.
contracts
)
self
.
reset
(
self
.
contracts
)
...
@@ -190,9 +190,9 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
...
@@ -190,9 +190,9 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
if
(
!
error
)
{
if
(
!
error
)
{
if
(
isUserAction
)
{
if
(
isUserAction
)
{
if
(
!
args
.
funABI
.
constant
)
{
if
(
!
args
.
funABI
.
constant
)
{
self
.
_deps
.
editorpanel
.
logMessage
(
`
${
logMsg
}
pending ... `
)
self
.
_deps
.
logCallback
(
`
${
logMsg
}
pending ... `
)
}
else
{
}
else
{
self
.
_deps
.
editorpanel
.
logMessage
(
`
${
logMsg
}
`
)
self
.
_deps
.
logCallback
(
`
${
logMsg
}
`
)
}
}
}
}
self
.
callFunction
(
args
.
address
,
data
,
args
.
funABI
,
(
error
,
txResult
)
=>
{
self
.
callFunction
(
args
.
address
,
data
,
args
.
funABI
,
(
error
,
txResult
)
=>
{
...
@@ -201,7 +201,7 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
...
@@ -201,7 +201,7 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
if
(
isVM
)
{
if
(
isVM
)
{
var
vmError
=
txExecution
.
checkVMError
(
txResult
)
var
vmError
=
txExecution
.
checkVMError
(
txResult
)
if
(
vmError
.
error
)
{
if
(
vmError
.
error
)
{
self
.
_deps
.
editorpanel
.
logMessage
(
`
${
logMsg
}
errored:
${
vmError
.
message
}
`
)
self
.
_deps
.
logCallback
(
`
${
logMsg
}
errored:
${
vmError
.
message
}
`
)
return
return
}
}
}
}
...
@@ -210,14 +210,14 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
...
@@ -210,14 +210,14 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
outputCb
(
decoded
)
outputCb
(
decoded
)
}
}
}
else
{
}
else
{
self
.
_deps
.
editorpanel
.
logMessage
(
`
${
logMsg
}
errored:
${
error
}
`
)
self
.
_deps
.
logCallback
(
`
${
logMsg
}
errored:
${
error
}
`
)
}
}
})
})
}
else
{
}
else
{
self
.
_deps
.
editorpanel
.
logMessage
(
`
${
logMsg
}
errored:
${
error
}
`
)
self
.
_deps
.
logCallback
(
`
${
logMsg
}
errored:
${
error
}
`
)
}
}
},
(
msg
)
=>
{
},
(
msg
)
=>
{
self
.
_deps
.
editorpanel
.
logMessage
(
msg
)
self
.
_deps
.
logCallback
(
msg
)
},
(
data
,
runTxCallback
)
=>
{
},
(
data
,
runTxCallback
)
=>
{
// called for libraries deployment
// called for libraries deployment
self
.
runTx
(
data
,
runTxCallback
)
self
.
runTx
(
data
,
runTxCallback
)
...
...
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