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
60ebbee3
Commit
60ebbee3
authored
Jun 02, 2016
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Standard: include curly brackets in branches as required
parent
3a7bc52e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
169 additions
and
83 deletions
+169
-83
app.js
src/app.js
+4
-2
compiler.js
src/app/compiler.js
+25
-15
editor.js
src/app/editor.js
+4
-2
gist-handler.js
src/app/gist-handler.js
+3
-1
query-params.js
src/app/query-params.js
+3
-1
renderer.js
src/app/renderer.js
+36
-19
storage-handler.js
src/app/storage-handler.js
+9
-3
universal-dapp.js
src/universal-dapp.js
+82
-38
web3-adapter.js
src/web3-adapter.js
+3
-2
No files found.
src/app.js
View file @
60ebbee3
...
@@ -40,8 +40,9 @@ var run = function () {
...
@@ -40,8 +40,9 @@ var run = function () {
loadFiles
(
files
);
loadFiles
(
files
);
};
};
if
(
filesToLoad
!==
null
)
if
(
filesToLoad
!==
null
)
{
loadFiles
(
filesToLoad
);
loadFiles
(
filesToLoad
);
}
// ------------------ query params (hash) ----------------
// ------------------ query params (hash) ----------------
...
@@ -133,8 +134,9 @@ var run = function () {
...
@@ -133,8 +134,9 @@ var run = function () {
'To which other browser-solidity instance do you want to copy over all files?'
,
'To which other browser-solidity instance do you want to copy over all files?'
,
'https://ethereum.github.io/browser-solidity/'
'https://ethereum.github.io/browser-solidity/'
);
);
if
(
target
===
null
)
if
(
target
===
null
)
{
return
;
return
;
}
var
files
=
editor
.
packageFiles
();
var
files
=
editor
.
packageFiles
();
var
iframe
=
$
(
'<iframe/>'
,
{
src
:
target
,
style
:
'display:none;'
,
load
:
function
()
{
var
iframe
=
$
(
'<iframe/>'
,
{
src
:
target
,
style
:
'display:none;'
,
load
:
function
()
{
this
.
contentWindow
.
postMessage
([
'loadFiles'
,
files
],
'*'
);
this
.
contentWindow
.
postMessage
([
'loadFiles'
,
files
],
'*'
);
...
...
src/app/compiler.js
View file @
60ebbee3
...
@@ -24,10 +24,13 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
...
@@ -24,10 +24,13 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
editor
.
setCacheFileContent
(
''
);
editor
.
setCacheFileContent
(
''
);
return
;
return
;
}
}
if
(
input
===
previousInput
)
if
(
input
===
previousInput
)
{
return
;
return
;
}
previousInput
=
input
;
previousInput
=
input
;
if
(
compileTimeout
)
window
.
clearTimeout
(
compileTimeout
);
if
(
compileTimeout
)
{
window
.
clearTimeout
(
compileTimeout
);
}
compileTimeout
=
window
.
setTimeout
(
compile
,
300
);
compileTimeout
=
window
.
setTimeout
(
compile
,
300
);
}
}
...
@@ -112,24 +115,30 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
...
@@ -112,24 +115,30 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
if
(
data
[
'error'
]
!==
undefined
)
{
if
(
data
[
'error'
]
!==
undefined
)
{
renderer
.
error
(
data
[
'error'
]);
renderer
.
error
(
data
[
'error'
]);
if
(
utils
.
errortype
(
data
[
'error'
])
!==
'warning'
)
noFatalErrors
=
false
;
if
(
utils
.
errortype
(
data
[
'error'
])
!==
'warning'
)
{
noFatalErrors
=
false
;
}
}
}
if
(
data
[
'errors'
]
!==
undefined
)
{
if
(
data
[
'errors'
]
!==
undefined
)
{
data
[
'errors'
].
forEach
(
function
(
err
)
{
data
[
'errors'
].
forEach
(
function
(
err
)
{
renderer
.
error
(
err
);
renderer
.
error
(
err
);
if
(
utils
.
errortype
(
err
)
!==
'warning'
)
noFatalErrors
=
false
;
if
(
utils
.
errortype
(
err
)
!==
'warning'
)
{
noFatalErrors
=
false
;
}
});
});
}
}
if
(
missingInputs
!==
undefined
&&
missingInputs
.
length
>
0
)
if
(
missingInputs
!==
undefined
&&
missingInputs
.
length
>
0
)
{
compile
(
missingInputs
);
compile
(
missingInputs
);
else
if
(
noFatalErrors
&&
!
hidingRHP
())
}
else
if
(
noFatalErrors
&&
!
hidingRHP
())
{
renderer
.
contracts
(
data
,
editor
.
getValue
());
renderer
.
contracts
(
data
,
editor
.
getValue
());
}
}
}
this
.
initializeWorker
=
function
(
version
,
setVersionText
)
{
this
.
initializeWorker
=
function
(
version
,
setVersionText
)
{
if
(
worker
!==
null
)
if
(
worker
!==
null
)
{
worker
.
terminate
();
worker
.
terminate
();
}
worker
=
new
Worker
(
'worker.js'
);
worker
=
new
Worker
(
'worker.js'
);
worker
.
addEventListener
(
'message'
,
function
(
msg
)
{
worker
.
addEventListener
(
'message'
,
function
(
msg
)
{
var
data
=
msg
.
data
;
var
data
=
msg
.
data
;
...
@@ -154,8 +163,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
...
@@ -154,8 +163,7 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
function
gatherImports
(
files
,
importHints
,
cb
)
{
function
gatherImports
(
files
,
importHints
,
cb
)
{
importHints
=
importHints
||
[];
importHints
=
importHints
||
[];
if
(
!
compilerAcceptsMultipleFiles
)
if
(
!
compilerAcceptsMultipleFiles
)
{
{
cb
(
files
[
editor
.
getCacheFile
()]);
cb
(
files
[
editor
.
getCacheFile
()]);
return
;
return
;
}
}
...
@@ -166,12 +174,15 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
...
@@ -166,12 +174,15 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
reloop
=
false
;
reloop
=
false
;
for
(
var
fileName
in
files
)
{
for
(
var
fileName
in
files
)
{
var
match
;
var
match
;
while
(
match
=
importRegex
.
exec
(
files
[
fileName
]))
while
(
match
=
importRegex
.
exec
(
files
[
fileName
]))
{
importHints
.
push
(
match
[
1
]);
importHints
.
push
(
match
[
1
]);
}
}
}
while
(
importHints
.
length
>
0
)
{
while
(
importHints
.
length
>
0
)
{
var
m
=
importHints
.
pop
();
var
m
=
importHints
.
pop
();
if
(
m
in
files
)
continue
;
if
(
m
in
files
)
{
continue
;
}
if
(
editor
.
hasFile
(
m
))
{
if
(
editor
.
hasFile
(
m
))
{
files
[
m
]
=
window
.
localStorage
[
utils
.
fileKey
(
m
)];
files
[
m
]
=
window
.
localStorage
[
utils
.
fileKey
(
m
)];
reloop
=
true
;
reloop
=
true
;
...
@@ -183,15 +194,14 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
...
@@ -183,15 +194,14 @@ function Compiler (editor, handleGithubCall, outputField, hidingRHP, updateFiles
reloop
=
true
;
reloop
=
true
;
}
else
if
(
githubMatch
=
/^
(
https
?
:
\/\/)?(
www.
)?
github.com
\/([^\/]
*
\/[^\/]
*
)\/(
.*
)
/
.
exec
(
m
))
{
}
else
if
(
githubMatch
=
/^
(
https
?
:
\/\/)?(
www.
)?
github.com
\/([^\/]
*
\/[^\/]
*
)\/(
.*
)
/
.
exec
(
m
))
{
handleGithubCall
(
githubMatch
[
3
],
githubMatch
[
4
],
function
(
result
)
{
handleGithubCall
(
githubMatch
[
3
],
githubMatch
[
4
],
function
(
result
)
{
if
(
'content'
in
result
)
if
(
'content'
in
result
)
{
{
var
content
=
Base64
.
decode
(
result
.
content
);
var
content
=
Base64
.
decode
(
result
.
content
);
cachedRemoteFiles
[
m
]
=
content
;
cachedRemoteFiles
[
m
]
=
content
;
files
[
m
]
=
content
;
files
[
m
]
=
content
;
gatherImports
(
files
,
importHints
,
cb
);
gatherImports
(
files
,
importHints
,
cb
);
}
}
else
{
else
cb
(
null
,
'Unable to import "'
+
m
+
'"'
);
cb
(
null
,
'Unable to import "'
+
m
+
'"'
);
}
}).
fail
(
function
()
{
}).
fail
(
function
()
{
cb
(
null
,
'Unable to import "'
+
m
+
'"'
);
cb
(
null
,
'Unable to import "'
+
m
+
'"'
);
});
});
...
...
src/app/editor.js
View file @
60ebbee3
...
@@ -7,8 +7,9 @@ function Editor (loadingFromGist) {
...
@@ -7,8 +7,9 @@ function Editor (loadingFromGist) {
this
.
newFile
=
function
()
{
this
.
newFile
=
function
()
{
untitledCount
=
''
;
untitledCount
=
''
;
while
(
window
.
localStorage
[
SOL_CACHE_UNTITLED
+
untitledCount
])
while
(
window
.
localStorage
[
SOL_CACHE_UNTITLED
+
untitledCount
])
{
untitledCount
=
(
untitledCount
-
0
)
+
1
;
untitledCount
=
(
untitledCount
-
0
)
+
1
;
}
SOL_CACHE_FILE
=
SOL_CACHE_UNTITLED
+
untitledCount
;
SOL_CACHE_FILE
=
SOL_CACHE_UNTITLED
+
untitledCount
;
sessions
[
SOL_CACHE_FILE
]
=
null
;
sessions
[
SOL_CACHE_FILE
]
=
null
;
this
.
setCacheFileContent
(
''
);
this
.
setCacheFileContent
(
''
);
...
@@ -120,8 +121,9 @@ function Editor (loadingFromGist) {
...
@@ -120,8 +121,9 @@ function Editor (loadingFromGist) {
if
(
!
files
.
length
||
window
.
localStorage
[
'sol-cache'
])
{
if
(
!
files
.
length
||
window
.
localStorage
[
'sol-cache'
])
{
if
(
loadingFromGist
)
return
;
if
(
loadingFromGist
)
return
;
// Backwards-compatibility
// Backwards-compatibility
while
(
window
.
localStorage
[
SOL_CACHE_UNTITLED
+
untitledCount
])
while
(
window
.
localStorage
[
SOL_CACHE_UNTITLED
+
untitledCount
])
{
untitledCount
=
(
untitledCount
-
0
)
+
1
;
untitledCount
=
(
untitledCount
-
0
)
+
1
;
}
SOL_CACHE_FILE
=
SOL_CACHE_UNTITLED
+
untitledCount
;
SOL_CACHE_FILE
=
SOL_CACHE_UNTITLED
+
untitledCount
;
window
.
localStorage
[
SOL_CACHE_FILE
]
=
window
.
localStorage
[
'sol-cache'
]
||
BALLOT_EXAMPLE
;
window
.
localStorage
[
SOL_CACHE_FILE
]
=
window
.
localStorage
[
'sol-cache'
]
||
BALLOT_EXAMPLE
;
window
.
localStorage
.
removeItem
(
'sol-cache'
);
window
.
localStorage
.
removeItem
(
'sol-cache'
);
...
...
src/app/gist-handler.js
View file @
60ebbee3
...
@@ -15,7 +15,9 @@ function handleLoad (cb) {
...
@@ -15,7 +15,9 @@ function handleLoad (cb) {
gistId
=
params
[
'gist'
];
gistId
=
params
[
'gist'
];
loadingFromGist
=
!!
gistId
;
loadingFromGist
=
!!
gistId
;
}
}
if
(
loadingFromGist
)
cb
(
gistId
);
if
(
loadingFromGist
)
{
cb
(
gistId
);
}
}
}
return
loadingFromGist
;
return
loadingFromGist
;
}
}
...
...
src/app/query-params.js
View file @
60ebbee3
...
@@ -11,7 +11,9 @@ function getQueryParams () {
...
@@ -11,7 +11,9 @@ function getQueryParams () {
var
parts
=
qs
.
split
(
'&'
);
var
parts
=
qs
.
split
(
'&'
);
for
(
var
x
in
parts
)
{
for
(
var
x
in
parts
)
{
var
keyValue
=
parts
[
x
].
split
(
'='
);
var
keyValue
=
parts
[
x
].
split
(
'='
);
if
(
keyValue
[
0
]
!==
''
)
params
[
keyValue
[
0
]]
=
keyValue
[
1
];
if
(
keyValue
[
0
]
!==
''
)
{
params
[
keyValue
[
0
]]
=
keyValue
[
1
];
}
}
}
return
params
;
return
params
;
}
}
...
...
src/app/renderer.js
View file @
60ebbee3
...
@@ -25,18 +25,20 @@ function Renderer (editor, compiler, updateFiles) {
...
@@ -25,18 +25,20 @@ function Renderer (editor, compiler, updateFiles) {
function
setProviderFromEndpoint
()
{
function
setProviderFromEndpoint
()
{
var
endpoint
=
$web3endpoint
.
val
();
var
endpoint
=
$web3endpoint
.
val
();
if
(
endpoint
===
'ipc'
)
if
(
endpoint
===
'ipc'
)
{
web3
.
setProvider
(
new
web3
.
providers
.
IpcProvider
());
web3
.
setProvider
(
new
web3
.
providers
.
IpcProvider
());
else
}
else
{
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
endpoint
));
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
endpoint
));
}
}
}
var
$vmToggle
=
$
(
'#vm'
);
var
$vmToggle
=
$
(
'#vm'
);
var
$web3Toggle
=
$
(
'#web3'
);
var
$web3Toggle
=
$
(
'#web3'
);
var
$web3endpoint
=
$
(
'#web3Endpoint'
);
var
$web3endpoint
=
$
(
'#web3Endpoint'
);
if
(
web3
.
providers
&&
web3
.
currentProvider
instanceof
web3
.
providers
.
IpcProvider
)
if
(
web3
.
providers
&&
web3
.
currentProvider
instanceof
web3
.
providers
.
IpcProvider
)
{
$web3endpoint
.
val
(
'ipc'
);
$web3endpoint
.
val
(
'ipc'
);
}
$vmToggle
.
get
(
0
).
checked
=
true
;
$vmToggle
.
get
(
0
).
checked
=
true
;
...
@@ -44,7 +46,9 @@ function Renderer (editor, compiler, updateFiles) {
...
@@ -44,7 +46,9 @@ function Renderer (editor, compiler, updateFiles) {
$web3Toggle
.
on
(
'change'
,
executionContextChange
);
$web3Toggle
.
on
(
'change'
,
executionContextChange
);
$web3endpoint
.
on
(
'change'
,
function
()
{
$web3endpoint
.
on
(
'change'
,
function
()
{
setProviderFromEndpoint
();
setProviderFromEndpoint
();
if
(
executionContext
===
'web3'
)
compiler
.
compile
();
if
(
executionContext
===
'web3'
)
{
compiler
.
compile
();
}
});
});
})();
})();
...
@@ -126,13 +130,16 @@ function Renderer (editor, compiler, updateFiles) {
...
@@ -126,13 +130,16 @@ function Renderer (editor, compiler, updateFiles) {
var
$txOrigin
=
$
(
'#txorigin'
);
var
$txOrigin
=
$
(
'#txorigin'
);
function
renderAccounts
(
err
,
accounts
)
{
function
renderAccounts
(
err
,
accounts
)
{
if
(
err
)
if
(
err
)
{
renderError
(
err
.
message
);
renderError
(
err
.
message
);
}
if
(
accounts
&&
accounts
[
0
])
{
if
(
accounts
&&
accounts
[
0
])
{
$txOrigin
.
empty
();
$txOrigin
.
empty
();
for
(
var
a
in
accounts
)
{
$txOrigin
.
append
(
$
(
'<option />'
).
val
(
accounts
[
a
]).
text
(
accounts
[
a
]));
}
for
(
var
a
in
accounts
)
{
$txOrigin
.
append
(
$
(
'<option />'
).
val
(
accounts
[
a
]).
text
(
accounts
[
a
]));
}
$txOrigin
.
val
(
accounts
[
0
]);
$txOrigin
.
val
(
accounts
[
0
]);
}
else
$txOrigin
.
val
(
'unknown'
);
}
else
{
$txOrigin
.
val
(
'unknown'
);
}
}
}
dapp
.
getAccounts
(
renderAccounts
);
dapp
.
getAccounts
(
renderAccounts
);
...
@@ -173,17 +180,18 @@ function Renderer (editor, compiler, updateFiles) {
...
@@ -173,17 +180,18 @@ function Renderer (editor, compiler, updateFiles) {
details
.
append
(
$
(
'<pre/>'
).
text
(
funHashes
));
details
.
append
(
$
(
'<pre/>'
).
text
(
funHashes
));
details
.
append
(
$
(
'<span class="col1">Gas Estimates</span>'
));
details
.
append
(
$
(
'<span class="col1">Gas Estimates</span>'
));
details
.
append
(
$
(
'<pre/>'
).
text
(
formatGasEstimates
(
contract
.
gasEstimates
)));
details
.
append
(
$
(
'<pre/>'
).
text
(
formatGasEstimates
(
contract
.
gasEstimates
)));
if
(
contract
.
runtimeBytecode
&&
contract
.
runtimeBytecode
.
length
>
0
)
if
(
contract
.
runtimeBytecode
&&
contract
.
runtimeBytecode
.
length
>
0
)
{
details
.
append
(
tableRow
(
'Runtime Bytecode'
,
contract
.
runtimeBytecode
));
details
.
append
(
tableRow
(
'Runtime Bytecode'
,
contract
.
runtimeBytecode
));
if
(
contract
.
assembly
!==
null
)
}
{
if
(
contract
.
assembly
!==
null
)
{
details
.
append
(
$
(
'<span class="col1">Assembly</span>'
));
details
.
append
(
$
(
'<span class="col1">Assembly</span>'
));
var
assembly
=
$
(
'<pre/>'
).
text
(
formatAssemblyText
(
contract
.
assembly
,
''
,
source
));
var
assembly
=
$
(
'<pre/>'
).
text
(
formatAssemblyText
(
contract
.
assembly
,
''
,
source
));
details
.
append
(
assembly
);
details
.
append
(
assembly
);
}
}
button
.
click
(
function
()
{
detailsOpen
[
contractName
]
=
!
detailsOpen
[
contractName
];
details
.
toggle
();
});
button
.
click
(
function
()
{
detailsOpen
[
contractName
]
=
!
detailsOpen
[
contractName
];
details
.
toggle
();
});
if
(
detailsOpen
[
contractName
])
if
(
detailsOpen
[
contractName
])
{
details
.
show
();
details
.
show
();
}
return
$
(
'<div class="contractDetails"/>'
).
append
(
button
).
append
(
details
);
return
$
(
'<div class="contractDetails"/>'
).
append
(
button
).
append
(
details
);
};
};
...
@@ -191,38 +199,46 @@ function Renderer (editor, compiler, updateFiles) {
...
@@ -191,38 +199,46 @@ function Renderer (editor, compiler, updateFiles) {
var
gasToText
=
function
(
g
)
{
return
g
===
null
?
'unknown'
:
g
;
}
var
gasToText
=
function
(
g
)
{
return
g
===
null
?
'unknown'
:
g
;
}
var
text
=
''
;
var
text
=
''
;
var
fun
;
var
fun
;
if
(
'creation'
in
data
)
if
(
'creation'
in
data
)
{
text
+=
'Creation: '
+
gasToText
(
data
.
creation
[
0
])
+
' + '
+
gasToText
(
data
.
creation
[
1
])
+
'
\
n'
;
text
+=
'Creation: '
+
gasToText
(
data
.
creation
[
0
])
+
' + '
+
gasToText
(
data
.
creation
[
1
])
+
'
\
n'
;
}
text
+=
'External:
\
n'
;
text
+=
'External:
\
n'
;
for
(
fun
in
data
.
external
)
for
(
fun
in
data
.
external
)
{
text
+=
' '
+
fun
+
': '
+
gasToText
(
data
.
external
[
fun
])
+
'
\
n'
;
text
+=
' '
+
fun
+
': '
+
gasToText
(
data
.
external
[
fun
])
+
'
\
n'
;
}
text
+=
'Internal:
\
n'
;
text
+=
'Internal:
\
n'
;
for
(
fun
in
data
.
internal
)
for
(
fun
in
data
.
internal
)
{
text
+=
' '
+
fun
+
': '
+
gasToText
(
data
.
internal
[
fun
])
+
'
\
n'
;
text
+=
' '
+
fun
+
': '
+
gasToText
(
data
.
internal
[
fun
])
+
'
\
n'
;
}
return
text
;
return
text
;
};
};
var
formatAssemblyText
=
function
(
asm
,
prefix
,
source
)
{
var
formatAssemblyText
=
function
(
asm
,
prefix
,
source
)
{
if
(
typeof
asm
===
typeof
''
||
asm
===
null
||
asm
===
undefined
)
if
(
typeof
asm
===
typeof
''
||
asm
===
null
||
asm
===
undefined
)
{
return
prefix
+
asm
+
'
\
n'
;
return
prefix
+
asm
+
'
\
n'
;
}
var
text
=
prefix
+
'.code
\
n'
;
var
text
=
prefix
+
'.code
\
n'
;
$
.
each
(
asm
[
'.code'
],
function
(
i
,
item
)
{
$
.
each
(
asm
[
'.code'
],
function
(
i
,
item
)
{
var
v
=
item
.
value
===
undefined
?
''
:
item
.
value
;
var
v
=
item
.
value
===
undefined
?
''
:
item
.
value
;
var
src
=
''
;
var
src
=
''
;
if
(
item
.
begin
!==
undefined
&&
item
.
end
!==
undefined
)
if
(
item
.
begin
!==
undefined
&&
item
.
end
!==
undefined
)
{
src
=
source
.
slice
(
item
.
begin
,
item
.
end
).
replace
(
'
\
n'
,
'
\\
n'
,
'g'
);
src
=
source
.
slice
(
item
.
begin
,
item
.
end
).
replace
(
'
\
n'
,
'
\\
n'
,
'g'
);
if
(
src
.
length
>
30
)
}
if
(
src
.
length
>
30
)
{
src
=
src
.
slice
(
0
,
30
)
+
'...'
;
src
=
src
.
slice
(
0
,
30
)
+
'...'
;
if
(
item
.
name
!==
'tag'
)
}
if
(
item
.
name
!==
'tag'
)
{
text
+=
' '
;
text
+=
' '
;
}
text
+=
prefix
+
item
.
name
+
' '
+
v
+
'
\
t
\
t
\
t'
+
src
+
'
\
n'
;
text
+=
prefix
+
item
.
name
+
' '
+
v
+
'
\
t
\
t
\
t'
+
src
+
'
\
n'
;
});
});
text
+=
prefix
+
'.data
\
n'
;
text
+=
prefix
+
'.data
\
n'
;
if
(
asm
[
'.data'
])
if
(
asm
[
'.data'
])
{
$
.
each
(
asm
[
'.data'
],
function
(
i
,
item
)
{
$
.
each
(
asm
[
'.data'
],
function
(
i
,
item
)
{
text
+=
' '
+
prefix
+
''
+
i
+
':
\
n'
;
text
+=
' '
+
prefix
+
''
+
i
+
':
\
n'
;
text
+=
formatAssemblyText
(
item
,
prefix
+
' '
,
source
);
text
+=
formatAssemblyText
(
item
,
prefix
+
' '
,
source
);
});
});
}
return
text
;
return
text
;
};
};
...
@@ -259,11 +275,12 @@ function Renderer (editor, compiler, updateFiles) {
...
@@ -259,11 +275,12 @@ function Renderer (editor, compiler, updateFiles) {
function
getConstructorInterface
(
abi
)
{
function
getConstructorInterface
(
abi
)
{
var
funABI
=
{
'name'
:
''
,
'inputs'
:
[],
'type'
:
'constructor'
,
'outputs'
:
[]
};
var
funABI
=
{
'name'
:
''
,
'inputs'
:
[],
'type'
:
'constructor'
,
'outputs'
:
[]
};
for
(
var
i
=
0
;
i
<
abi
.
length
;
i
++
)
for
(
var
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
if
(
abi
[
i
].
type
===
'constructor'
)
{
if
(
abi
[
i
].
type
===
'constructor'
)
{
funABI
.
inputs
=
abi
[
i
].
inputs
||
[];
funABI
.
inputs
=
abi
[
i
].
inputs
||
[];
break
;
break
;
}
}
}
return
funABI
;
return
funABI
;
}
}
...
...
src/app/storage-handler.js
View file @
60ebbee3
...
@@ -4,7 +4,9 @@ function StorageHandler (updateFiles) {
...
@@ -4,7 +4,9 @@ function StorageHandler (updateFiles) {
this
.
sync
=
function
()
{
this
.
sync
=
function
()
{
if
(
typeof
chrome
===
'undefined'
||
!
chrome
||
!
chrome
.
storage
||
!
chrome
.
storage
.
sync
)
return
;
if
(
typeof
chrome
===
'undefined'
||
!
chrome
||
!
chrome
.
storage
||
!
chrome
.
storage
.
sync
)
{
return
;
}
var
obj
=
{};
var
obj
=
{};
var
done
=
false
;
var
done
=
false
;
...
@@ -23,16 +25,20 @@ function StorageHandler (updateFiles) {
...
@@ -23,16 +25,20 @@ function StorageHandler (updateFiles) {
obj
[
key
]
=
localStorage
[
key
];
obj
[
key
]
=
localStorage
[
key
];
}
}
done
++
;
done
++
;
if
(
done
>=
count
)
chrome
.
storage
.
sync
.
set
(
obj
,
function
()
{
if
(
done
>=
count
)
{
chrome
.
storage
.
sync
.
set
(
obj
,
function
()
{
console
.
log
(
'updated cloud files with: '
,
obj
,
this
,
arguments
);
console
.
log
(
'updated cloud files with: '
,
obj
,
this
,
arguments
);
})
})
}
})
})
}
}
for
(
var
y
in
window
.
localStorage
)
{
for
(
var
y
in
window
.
localStorage
)
{
console
.
log
(
'checking'
,
y
);
console
.
log
(
'checking'
,
y
);
obj
[
y
]
=
window
.
localStorage
.
getItem
(
y
);
obj
[
y
]
=
window
.
localStorage
.
getItem
(
y
);
if
(
y
.
indexOf
(
utils
.
getCacheFilePrefix
())
!==
0
)
continue
;
if
(
y
.
indexOf
(
utils
.
getCacheFilePrefix
())
!==
0
)
{
continue
;
}
count
++
;
count
++
;
check
(
y
);
check
(
y
);
}
}
...
...
src/universal-dapp.js
View file @
60ebbee3
This diff is collapsed.
Click to expand it.
src/web3-adapter.js
View file @
60ebbee3
...
@@ -3,9 +3,10 @@
...
@@ -3,9 +3,10 @@
var
Web3
=
require
(
'web3'
);
var
Web3
=
require
(
'web3'
);
if
(
typeof
web3
!==
'undefined'
)
if
(
typeof
web3
!==
'undefined'
)
{
web3
=
new
Web3
(
web3
.
currentProvider
);
web3
=
new
Web3
(
web3
.
currentProvider
);
else
}
else
{
web3
=
new
Web3
(
new
Web3
.
providers
.
HttpProvider
(
'http://localhost:8545'
));
web3
=
new
Web3
(
new
Web3
.
providers
.
HttpProvider
(
'http://localhost:8545'
));
}
module
.
exports
=
web3
;
module
.
exports
=
web3
;
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