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
e7fe06c8
Commit
e7fe06c8
authored
Oct 08, 2015
by
chriseth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All contracts in a single Universal DApp.
parent
90d51b82
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
24 deletions
+31
-24
index.html
index.html
+25
-15
universal-dapp.js
libs/universal-dapp.js
+2
-1
browser-solidity.css
stylesheets/browser-solidity.css
+4
-8
No files found.
index.html
View file @
e7fe06c8
...
@@ -500,34 +500,44 @@ THE SOFTWARE.
...
@@ -500,34 +500,44 @@ THE SOFTWARE.
};
};
var
renderContracts
=
function
(
data
,
source
)
{
var
renderContracts
=
function
(
data
,
source
)
{
var
udappContracts
=
[];
for
(
var
contractName
in
data
.
contracts
)
{
for
(
var
contractName
in
data
.
contracts
)
{
var
contract
=
data
.
contracts
[
contractName
];
var
contract
=
data
.
contracts
[
contractName
];
var
dapp
=
new
UniversalDApp
([
{
udappContracts
.
push
(
{
name
:
contractName
,
name
:
contractName
,
interface
:
contract
[
'interface'
],
interface
:
contract
[
'interface'
],
bytecode
:
contract
.
bytecode
bytecode
:
contract
.
bytecode
}],
{
vm
:
executionContext
===
'vm'
,
removable
:
false
,
removable_instances
:
true
});
});
var
$contractOutput
=
dapp
.
render
();
}
$contractOutput
var
dapp
=
new
UniversalDApp
(
udappContracts
,
{
vm
:
executionContext
===
'vm'
,
removable
:
false
,
removable_instances
:
true
,
renderOutputModifier
:
function
(
contractName
,
$contractOutput
)
{
var
contract
=
data
.
contracts
[
contractName
];
return
$contractOutput
.
append
(
textRow
(
'Bytecode'
,
contract
.
bytecode
))
.
append
(
textRow
(
'Bytecode'
,
contract
.
bytecode
))
.
append
(
textRow
(
'Interface'
,
contract
[
'interface'
]))
.
append
(
textRow
(
'Interface'
,
contract
[
'interface'
]))
.
append
(
textRow
(
'Web3 deploy'
,
gethDeploy
(
contractName
.
toLowerCase
(),
contract
[
'interface'
],
contract
.
bytecode
),
'deploy'
))
.
append
(
textRow
(
'Web3 deploy'
,
gethDeploy
(
contractName
.
toLowerCase
(),
contract
[
'interface'
],
contract
.
bytecode
),
'deploy'
))
.
append
(
textRow
(
'uDApp'
,
combined
(
contractName
,
contract
[
'interface'
],
contract
.
bytecode
),
'deploy'
))
.
append
(
textRow
(
'uDApp'
,
combined
(
contractName
,
contract
[
'interface'
],
contract
.
bytecode
),
'deploy'
))
.
append
(
getDetails
(
contract
,
source
,
contractName
));
.
append
(
getDetails
(
contract
,
source
,
contractName
));
}});
if
(
executionContext
===
'vm'
)
$
(
'#txorigin'
).
text
(
'0x'
+
dapp
.
address
.
toString
(
'hex'
));
var
$contractOutput
=
dapp
.
render
();
else
web3
.
eth
.
getAccounts
(
function
(
err
,
accounts
)
{
if
(
err
)
renderError
(
err
.
message
);
if
(
executionContext
===
'vm'
)
$
(
'#txorigin'
).
text
(
'0x'
+
dapp
.
address
.
toString
(
'hex'
));
else
web3
.
eth
.
getAccounts
(
function
(
err
,
accounts
)
{
if
(
err
)
renderError
(
err
.
message
);
$
(
'#txorigin'
).
text
(
accounts
[
0
]);
$
(
'#txorigin'
).
text
(
accounts
[
0
]);
});
});
$contractOutput
.
find
(
'.title'
).
click
(
function
(
ev
){
$
(
this
).
closest
(
'.udapp'
).
toggleClass
(
'hide'
)
});
$contractOutput
.
find
(
'.title'
).
click
(
function
(
ev
){
$
(
'#output'
).
append
(
$contractOutput
);
console
.
log
(
$
(
this
));
}
$
(
this
).
closest
(
'.contract'
).
toggleClass
(
'hide'
);
});
$
(
'#output'
).
append
(
$contractOutput
);
$
(
'.col2 input,textarea'
).
click
(
function
()
{
this
.
select
();
});
$
(
'.col2 input,textarea'
).
click
(
function
()
{
this
.
select
();
});
};
};
var
tableRowItems
=
function
(
first
,
second
,
cls
)
{
var
tableRowItems
=
function
(
first
,
second
,
cls
)
{
...
...
libs/universal-dapp.js
View file @
e7fe06c8
...
@@ -2,6 +2,7 @@ function UniversalDApp (contracts, options) {
...
@@ -2,6 +2,7 @@ function UniversalDApp (contracts, options) {
this
.
options
=
options
||
{};
this
.
options
=
options
||
{};
this
.
$el
=
$
(
'<div class="udapp" />'
);
this
.
$el
=
$
(
'<div class="udapp" />'
);
this
.
contracts
=
contracts
;
this
.
contracts
=
contracts
;
this
.
renderOutputModifier
=
options
.
renderOutputModifier
||
function
(
name
,
content
)
{
return
content
;
};
if
(
!
options
.
vm
&&
web3
.
currentProvider
)
{
if
(
!
options
.
vm
&&
web3
.
currentProvider
)
{
...
@@ -44,7 +45,7 @@ UniversalDApp.prototype.render = function () {
...
@@ -44,7 +45,7 @@ UniversalDApp.prototype.render = function () {
}
}
$contractEl
.
append
(
$title
).
append
(
this
.
getCreateInterface
(
$contractEl
,
this
.
contracts
[
c
])
);
$contractEl
.
append
(
$title
).
append
(
this
.
getCreateInterface
(
$contractEl
,
this
.
contracts
[
c
])
);
}
}
this
.
$el
.
append
(
$contractEl
);
this
.
$el
.
append
(
this
.
renderOutputModifier
(
this
.
contracts
[
c
].
name
,
$contractEl
)
);
}
}
}
}
$legend
=
$
(
'<div class="legend" />'
)
$legend
=
$
(
'<div class="legend" />'
)
...
...
stylesheets/browser-solidity.css
View file @
e7fe06c8
...
@@ -126,19 +126,15 @@ body {
...
@@ -126,19 +126,15 @@ body {
float
:
left
;
float
:
left
;
}
}
.
udapp
.hide
{
.
contract
.hide
{
padding-bottom
:
0
;
padding-bottom
:
0
;
}
}
.udapp.hide
>
*
:not
(
.contract
)
{
.contract.hide
{
display
:
none
;
}
.udapp.hide
.contract
{
margin
:
0
;
margin
:
0
;
}
}
.
udapp.hide
.contract
>
*
:not
(
.title
)
{
.
contract.hide
>
*
:not
(
.title
)
{
display
:
none
;
display
:
none
;
}
}
...
@@ -153,7 +149,7 @@ body {
...
@@ -153,7 +149,7 @@ body {
font-size
:
10px
;
font-size
:
10px
;
}
}
.
udapp.hide
>
.contract
>
.title
:before
{
.
contract.hide
>
.title
:before
{
content
:
"\25B6"
;
content
:
"\25B6"
;
}
}
...
...
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