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
364cd2fd
Commit
364cd2fd
authored
Oct 09, 2015
by
d11e9
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gh-pages' of
https://github.com/chriseth/browser-solidity
into gist
parents
e6fb3317
083df317
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
19 deletions
+34
-19
universal-dapp.css
assets/css/universal-dapp.css
+1
-0
universal-dapp.js
assets/js/universal-dapp.js
+30
-19
index.html
index.html
+3
-0
No files found.
assets/css/universal-dapp.css
View file @
364cd2fd
...
...
@@ -44,6 +44,7 @@
.udapp
.contract
{
margin-bottom
:
1em
;
clear
:
both
;
}
.udapp
.create
{
...
...
assets/js/universal-dapp.js
View file @
364cd2fd
...
...
@@ -221,57 +221,65 @@ UniversalDApp.prototype.getCallButton = function(args) {
}
var
getOutput
=
function
()
{
var
values
=
Array
.
prototype
.
slice
.
call
(
arguments
);
var
$result
=
$
(
'<div class="result" />'
);
var
$close
=
$
(
'<div class="udapp-close" />'
);
$close
.
click
(
function
(){
$result
.
remove
();
}
);
$result
.
append
(
$close
);
for
(
var
v
in
values
)
{
$result
.
append
(
values
[
v
]
);
}
return
$result
;
}
};
var
clearOutput
=
function
(
$result
)
{
$
(
':not(.udapp-close)'
,
$result
).
remove
();
};
var
replaceOutput
=
function
(
$result
,
message
)
{
clearOutput
(
$result
);
$result
.
append
(
message
);
};
var
handleCallButtonClick
=
function
(
ev
)
{
var
handleCallButtonClick
=
function
(
ev
,
$result
)
{
var
funArgs
=
$
.
parseJSON
(
'['
+
inputField
.
val
()
+
']'
);
var
data
=
fun
.
toPayload
(
funArgs
).
data
;
if
(
data
.
slice
(
0
,
2
)
==
'0x'
)
data
=
data
.
slice
(
2
);
var
$result
=
getOutput
(
$
(
'<a class="waiting" href="#" title="Waiting for transaction to be mined.">Polling for tx receipt...</a>'
)
);
if
(
!
$result
)
{
$result
=
getOutput
();
if
(
lookupOnly
&&
!
inputs
.
length
)
$outputOverride
.
empty
().
append
(
$result
);
else
outputSpan
.
append
(
$result
);
}
replaceOutput
(
$result
,
$
(
'<span>Waiting for transaction to be mined...</span>'
));
if
(
isConstructor
)
{
if
(
args
.
bytecode
.
indexOf
(
'_'
)
>=
0
)
{
replaceOutput
(
$result
,
$
(
'<span>Deploying and linking required libraries...</span>'
));
if
(
self
.
options
.
vm
)
self
.
linkBytecode
(
args
.
contractName
,
function
(
err
,
bytecode
)
{
if
(
err
)
$result
.
replaceWith
(
getOutput
(
$
(
'<span/>'
).
text
(
'Error deploying required libraries: '
+
err
)
));
replaceOutput
(
$result
,
$
(
'<span/>'
).
text
(
'Error deploying required libraries: '
+
err
));
else
{
args
.
bytecode
=
bytecode
;
handleCallButtonClick
(
ev
);
handleCallButtonClick
(
ev
,
$result
);
}
});
else
$result
.
replaceWith
(
getOutput
(
$
(
'<span>Contract needs to be linked to a library, this is only supported in the JavaScript VM for now.</span>'
)
));
replaceOutput
(
$result
,
$
(
'<span>Contract needs to be linked to a library, this is only supported in the JavaScript VM for now.</span>'
));
return
;
}
else
data
=
args
.
bytecode
+
data
.
slice
(
8
);
}
if
(
lookupOnly
&&
!
inputs
.
length
)
{
$outputOverride
.
empty
().
append
(
$result
);
}
else
{
outputSpan
.
append
(
$result
);
}
self
.
runTx
(
data
,
args
,
function
(
err
,
result
)
{
if
(
err
)
{
$result
.
replaceWith
(
getOutput
(
$
(
'<span/>'
).
text
(
err
).
addClass
(
'error'
)
)
);
replaceOutput
(
$result
,
$
(
'<span/>'
).
text
(
err
).
addClass
(
'error'
)
);
}
else
if
(
self
.
options
.
vm
&&
isConstructor
)
{
$result
.
replaceWith
(
getOutput
(
getGasUsedOutput
(
result
)
)
);
replaceOutput
(
$result
,
getGasUsedOutput
(
result
)
);
args
.
appendFunctions
(
result
.
createdAddress
);
}
else
if
(
self
.
options
.
vm
){
var
outputObj
=
fun
.
unpackOutput
(
'0x'
+
result
.
vm
.
return
.
toString
(
'hex'
));
$result
.
replaceWith
(
getOutput
(
getReturnOutput
(
outputObj
),
getGasUsedOutput
(
result
.
vm
)
)
);
clearOutput
(
$result
);
$result
.
append
(
getReturnOutput
(
outputObj
)).
append
(
getGasUsedOutput
(
result
.
vm
));
}
else
if
(
args
.
abi
.
constant
&&
!
isConstructor
)
{
$result
.
replaceWith
(
getOutput
(
getReturnOutput
(
result
)
)
);
replaceOutput
(
$result
,
getReturnOutput
(
result
)
);
}
else
{
function
tryTillResponse
(
txhash
,
done
)
{
...
...
@@ -288,7 +296,10 @@ UniversalDApp.prototype.getCallButton = function(args) {
if
(
isConstructor
)
{
$result
.
html
(
''
);
args
.
appendFunctions
(
result
.
contractAddress
);
}
else
$result
.
replaceWith
(
getOutput
(
getReturnOutput
(
result
),
getGasUsedOutput
(
result
)
)
);
}
else
{
clearOutput
(
$result
);
$result
.
append
(
getReturnOutput
(
result
)).
append
(
getGasUsedOutput
(
result
));
}
})
}
...
...
index.html
View file @
364cd2fd
...
...
@@ -602,7 +602,10 @@ THE SOFTWARE.
web3
.
eth
.
getAccounts
(
function
(
err
,
accounts
)
{
if
(
err
)
renderError
(
err
.
message
);
if
(
accounts
&&
accounts
[
0
])
$
(
'#txorigin'
).
text
(
accounts
[
0
]);
else
$
(
'#txorigin'
).
text
(
'unknown'
);
});
$contractOutput
.
find
(
'.title'
).
click
(
function
(
ev
){
$
(
this
).
closest
(
'.contract'
).
toggleClass
(
'hide'
);
});
...
...
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