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
1774bfbc
Commit
1774bfbc
authored
Jun 04, 2016
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass web3 instance in every case and have a mode selector between vm and web3
parent
d9eecd08
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
renderer.js
src/app/renderer.js
+2
-2
universal-dapp.js
src/universal-dapp.js
+10
-4
No files found.
src/app/renderer.js
View file @
1774bfbc
...
@@ -101,8 +101,8 @@ function Renderer(editor, compiler, updateFiles) {
...
@@ -101,8 +101,8 @@ function Renderer(editor, compiler, updateFiles) {
}
}
var
dapp
=
new
UniversalDApp
(
udappContracts
,
{
var
dapp
=
new
UniversalDApp
(
udappContracts
,
{
vm
:
executionContext
===
'vm
'
,
mode
:
executionContext
===
'vm'
?
'vm'
:
'web3
'
,
web3
:
executionContext
!==
'vm'
?
web3
:
null
,
web3
:
web3
,
removable
:
false
,
removable
:
false
,
getAddress
:
function
(){
return
$
(
'#txorigin'
).
val
();
},
getAddress
:
function
(){
return
$
(
'#txorigin'
).
val
();
},
getValue
:
function
(){
getValue
:
function
(){
...
...
src/universal-dapp.js
View file @
1774bfbc
...
@@ -12,7 +12,15 @@ function UniversalDApp (contracts, options) {
...
@@ -12,7 +12,15 @@ function UniversalDApp (contracts, options) {
this
.
contracts
=
contracts
;
this
.
contracts
=
contracts
;
this
.
renderOutputModifier
=
options
.
renderOutputModifier
||
function
(
name
,
content
)
{
return
content
;
};
this
.
renderOutputModifier
=
options
.
renderOutputModifier
||
function
(
name
,
content
)
{
return
content
;
};
if
(
options
.
vm
)
{
this
.
web3
=
options
.
web3
;
if
(
!
this
.
web3
)
{
throw
new
Error
(
'Web3 is required for ABI encoding'
);
}
if
(
options
.
mode
===
'vm'
)
{
// FIXME: use `options.vm` or `this.vm` consistently
options
.
vm
=
true
;
this
.
accounts
=
{};
this
.
accounts
=
{};
this
.
BN
=
ethJSUtil
.
BN
;
this
.
BN
=
ethJSUtil
.
BN
;
...
@@ -21,9 +29,7 @@ function UniversalDApp (contracts, options) {
...
@@ -21,9 +29,7 @@ function UniversalDApp (contracts, options) {
this
.
addAccount
(
'3cd7232cd6f3fc66a57a6bedc1a8ed6c228fff0a327e169c2bcc5e869ed49511'
);
this
.
addAccount
(
'3cd7232cd6f3fc66a57a6bedc1a8ed6c228fff0a327e169c2bcc5e869ed49511'
);
this
.
addAccount
(
'2ac6c190b09897cd8987869cc7b918cfea07ee82038d492abce033c75c1b1d0c'
);
this
.
addAccount
(
'2ac6c190b09897cd8987869cc7b918cfea07ee82038d492abce033c75c1b1d0c'
);
}
else
if
(
options
.
web3
)
{
}
else
if
(
options
.
mode
!==
'web3'
)
{
this
.
web3
=
options
.
web3
;
}
else
{
throw
new
Error
(
"Either VM or Web3 mode must be selected"
);
throw
new
Error
(
"Either VM or Web3 mode must be selected"
);
}
}
}
}
...
...
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