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
8007573b
Commit
8007573b
authored
Jul 23, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm integration
parent
5e367b54
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
16 deletions
+36
-16
debugger.js
src/app/debugger.js
+25
-14
universal-dapp.js
src/universal-dapp.js
+11
-2
No files found.
src/app/debugger.js
View file @
8007573b
var
remix
=
require
(
'ethereum-remix'
);
var
remix
=
require
(
'ethereum-remix'
);
function
Debugger
(
_executionContext
,
_
id
)
{
function
Debugger
(
executionContext
,
id
)
{
this
.
el
=
document
.
querySelector
(
_
id
);
this
.
el
=
document
.
querySelector
(
id
);
this
.
debugger
=
new
remix
.
Debugger
(
_executionContext
.
web3
()
);
this
.
debugger
=
new
remix
.
ui
.
Debugger
(
);
this
.
el
.
appendChild
(
this
.
debugger
.
render
());
this
.
el
.
appendChild
(
this
.
debugger
.
render
());
this
.
web3
=
_executionContext
.
web3
();
Debugger
.
prototype
.
debug
=
function
(
receipt
)
{
if
(
this
.
onDebugRequested
)
this
.
onDebugRequested
();
var
self
=
this
;
this
.
web3
.
eth
.
getTransaction
(
receipt
.
transactionHash
,
function
(
error
,
tx
)
{
if
(
!
error
)
{
self
.
debugger
.
debug
(
tx
);
}
});
};
}
}
Debugger
.
prototype
.
debug
=
function
(
receipt
)
{
if
(
this
.
onDebugRequested
)
this
.
onDebugRequested
();
var
self
=
this
;
this
.
debugger
.
web3
().
eth
.
getTransaction
(
receipt
.
transactionHash
,
function
(
error
,
tx
)
{
if
(
!
error
)
{
self
.
debugger
.
debug
(
tx
);
}
});
};
Debugger
.
prototype
.
addProvider
=
function
(
type
,
obj
)
{
this
.
debugger
.
addProvider
(
type
,
obj
);
};
Debugger
.
prototype
.
switchProvider
=
function
(
type
)
{
this
.
debugger
.
switchProvider
(
type
);
};
Debugger
.
prototype
.
web3
=
function
(
type
)
{
return
this
.
debugger
.
web3
();
};
module
.
exports
=
Debugger
;
module
.
exports
=
Debugger
;
src/universal-dapp.js
View file @
8007573b
...
@@ -18,6 +18,8 @@ function UniversalDApp (contracts, options, transactionDebugger) {
...
@@ -18,6 +18,8 @@ function UniversalDApp (contracts, options, transactionDebugger) {
self
.
web3
=
options
.
web3
;
self
.
web3
=
options
.
web3
;
self
.
transactionDebugger
=
transactionDebugger
;
self
.
transactionDebugger
=
transactionDebugger
;
transactionDebugger
.
addProvider
(
'EXTERNAL'
,
self
.
web3
);
transactionDebugger
.
switchProvider
(
'EXTERNAL'
)
if
(
options
.
mode
===
'vm'
)
{
if
(
options
.
mode
===
'vm'
)
{
// FIXME: use `options.vm` or `self.vm` consistently
// FIXME: use `options.vm` or `self.vm` consistently
options
.
vm
=
true
;
options
.
vm
=
true
;
...
@@ -25,7 +27,8 @@ function UniversalDApp (contracts, options, transactionDebugger) {
...
@@ -25,7 +27,8 @@ function UniversalDApp (contracts, options, transactionDebugger) {
self
.
accounts
=
{};
self
.
accounts
=
{};
self
.
vm
=
new
EthJSVM
(
null
,
null
,
{
activatePrecompiles
:
true
,
enableHomestead
:
true
});
self
.
vm
=
new
EthJSVM
(
null
,
null
,
{
activatePrecompiles
:
true
,
enableHomestead
:
true
});
transactionDebugger
.
addProvider
(
'VM'
,
self
.
vm
);
transactionDebugger
.
switchProvider
(
'VM'
)
self
.
addAccount
(
'3cd7232cd6f3fc66a57a6bedc1a8ed6c228fff0a327e169c2bcc5e869ed49511'
);
self
.
addAccount
(
'3cd7232cd6f3fc66a57a6bedc1a8ed6c228fff0a327e169c2bcc5e869ed49511'
);
self
.
addAccount
(
'2ac6c190b09897cd8987869cc7b918cfea07ee82038d492abce033c75c1b1d0c'
);
self
.
addAccount
(
'2ac6c190b09897cd8987869cc7b918cfea07ee82038d492abce033c75c1b1d0c'
);
}
else
if
(
options
.
mode
!==
'web3'
)
{
}
else
if
(
options
.
mode
!==
'web3'
)
{
...
@@ -514,6 +517,7 @@ UniversalDApp.prototype.getCallButton = function (args) {
...
@@ -514,6 +517,7 @@ UniversalDApp.prototype.getCallButton = function (args) {
if
(
decoded
)
{
if
(
decoded
)
{
$result
.
append
(
decoded
);
$result
.
append
(
decoded
);
}
}
$result
.
append
(
getDebugTransaction
(
result
));
}
else
if
(
args
.
abi
.
constant
&&
!
isConstructor
)
{
}
else
if
(
args
.
abi
.
constant
&&
!
isConstructor
)
{
clearOutput
(
$result
);
clearOutput
(
$result
);
$result
.
append
(
getReturnOutput
(
result
)).
append
(
getGasUsedOutput
({}));
$result
.
append
(
getReturnOutput
(
result
)).
append
(
getGasUsedOutput
({}));
...
@@ -701,7 +705,12 @@ UniversalDApp.prototype.runTx = function (data, args, cb) {
...
@@ -701,7 +705,12 @@ UniversalDApp.prototype.runTx = function (data, args, cb) {
transactions
:
[],
transactions
:
[],
uncleHeaders
:
[]
uncleHeaders
:
[]
});
});
self
.
vm
.
runTx
({
block
:
block
,
tx
:
tx
,
skipBalance
:
true
,
skipNonce
:
true
},
cb
);
self
.
vm
.
runTx
({
block
:
block
,
tx
:
tx
,
skipBalance
:
true
,
skipNonce
:
true
},
function
(
err
,
result
)
{
if
(
self
.
vm
)
{
result
.
transactionHash
=
self
.
transactionDebugger
.
web3
().
releaseCurrentHash
();
// used to keep track of the transaction
}
cb
(
err
,
result
);
});
}
catch
(
e
)
{
}
catch
(
e
)
{
cb
(
e
,
null
);
cb
(
e
,
null
);
}
}
...
...
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