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
06292d53
Commit
06292d53
authored
Apr 13, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
79764e2d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
23 deletions
+4
-23
compiler.js
src/compiler.js
+0
-2
deployer.js
src/deployer.js
+2
-10
provider.js
src/provider.js
+1
-3
txProcess.js
src/txProcess.js
+1
-8
No files found.
src/compiler.js
View file @
06292d53
...
@@ -38,8 +38,6 @@ function compileFileOrFiles (filename, isDirectory, cb) {
...
@@ -38,8 +38,6 @@ function compileFileOrFiles (filename, isDirectory, cb) {
compiler
.
compile
(
sources
,
filepath
)
compiler
.
compile
(
sources
,
filepath
)
}
}
],
function
(
err
,
result
)
{
],
function
(
err
,
result
)
{
console
.
dir
(
err
);
console
.
dir
(
result
);
let
errors
=
(
result
.
errors
||
[]).
filter
((
e
)
=>
e
.
type
===
'Error'
)
let
errors
=
(
result
.
errors
||
[]).
filter
((
e
)
=>
e
.
type
===
'Error'
)
if
(
errors
.
length
>
0
)
{
if
(
errors
.
length
>
0
)
{
console
.
dir
(
errors
)
console
.
dir
(
errors
)
...
...
src/deployer.js
View file @
06292d53
...
@@ -79,17 +79,11 @@ function deployAll (compileResult, web3, callback) {
...
@@ -79,17 +79,11 @@ function deployAll (compileResult, web3, callback) {
let
deployObject
=
contractObject
.
deploy
({
arguments
:
[],
data
:
contractCode
})
let
deployObject
=
contractObject
.
deploy
({
arguments
:
[],
data
:
contractCode
})
deployObject
.
estimateGas
().
then
((
gasValue
)
=>
{
deployObject
.
estimateGas
().
then
((
gasValue
)
=>
{
console
.
dir
(
"got gas estimation "
+
gasValue
);
console
.
dir
(
accounts
);
deployObject
.
send
({
deployObject
.
send
({
from
:
accounts
[
0
],
from
:
accounts
[
0
],
//
gas: Math.ceil(gasValue * 1.2)
gas
:
Math
.
ceil
(
gasValue
*
1.2
)
gas
:
1200000
//
gas: 1200000
}).
on
(
'receipt'
,
function
(
receipt
)
{
}).
on
(
'receipt'
,
function
(
receipt
)
{
console
.
dir
(
"==== got the receipt"
);
console
.
dir
(
receipt
);
contractObject
.
options
.
address
=
receipt
.
contractAddress
contractObject
.
options
.
address
=
receipt
.
contractAddress
contractObject
.
options
.
from
=
accounts
[
0
]
contractObject
.
options
.
from
=
accounts
[
0
]
contractObject
.
options
.
gas
=
5000
*
1000
contractObject
.
options
.
gas
=
5000
*
1000
...
@@ -99,8 +93,6 @@ function deployAll (compileResult, web3, callback) {
...
@@ -99,8 +93,6 @@ function deployAll (compileResult, web3, callback) {
nextEach
()
nextEach
()
}).
on
(
'error'
,
function
(
err
)
{
}).
on
(
'error'
,
function
(
err
)
{
console
.
dir
(
"==============="
);
console
.
dir
(
"error"
);
console
.
dir
(
err
);
console
.
dir
(
err
);
})
})
})
})
...
...
src/provider.js
View file @
06292d53
...
@@ -23,14 +23,12 @@ Provider = function() {
...
@@ -23,14 +23,12 @@ Provider = function() {
Provider
.
prototype
.
sendAsync
=
function
(
payload
,
callback
)
{
Provider
.
prototype
.
sendAsync
=
function
(
payload
,
callback
)
{
const
self
=
this
;
const
self
=
this
;
//console.log("=========== sendAsync");
//console.dir(payload);
if
(
payload
.
method
===
'eth_accounts'
)
{
if
(
payload
.
method
===
'eth_accounts'
)
{
return
callback
(
null
,
jsonRPCResponse
(
payload
.
id
,
this
.
accounts
.
map
((
x
)
=>
x
.
address
)))
return
callback
(
null
,
jsonRPCResponse
(
payload
.
id
,
this
.
accounts
.
map
((
x
)
=>
x
.
address
)))
}
}
if
(
payload
.
method
===
'eth_estimateGas'
)
{
if
(
payload
.
method
===
'eth_estimateGas'
)
{
callback
(
null
,
jsonRPCResponse
(
payload
.
id
,
12
00000
))
callback
(
null
,
jsonRPCResponse
(
payload
.
id
,
30
00000
))
}
}
if
(
payload
.
method
===
'eth_gasPrice'
)
{
if
(
payload
.
method
===
'eth_gasPrice'
)
{
callback
(
null
,
jsonRPCResponse
(
payload
.
id
,
1
))
callback
(
null
,
jsonRPCResponse
(
payload
.
id
,
1
))
...
...
src/txProcess.js
View file @
06292d53
...
@@ -8,13 +8,9 @@ function jsonRPCResponse(id, result) {
...
@@ -8,13 +8,9 @@ function jsonRPCResponse(id, result) {
}
}
function
runTx
(
payload
,
from
,
to
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
isCall
,
callback
)
{
function
runTx
(
payload
,
from
,
to
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
isCall
,
callback
)
{
console
.
log
(
'-- runTx'
);
let
finalCallback
=
function
(
err
,
result
)
{
let
finalCallback
=
function
(
err
,
result
)
{
let
toReturn
;
let
toReturn
;
if
(
isCall
)
{
if
(
isCall
)
{
console
.
dir
(
'---- result is '
);
console
.
dir
(
result
.
result
.
vm
.
return
);
console
.
dir
(
result
.
result
.
vm
);
toReturn
=
"0x"
+
result
.
result
.
vm
.
return
.
toString
(
'hex'
)
toReturn
=
"0x"
+
result
.
result
.
vm
.
return
.
toString
(
'hex'
)
if
(
toReturn
===
'0x'
)
{
if
(
toReturn
===
'0x'
)
{
toReturn
=
'0x0'
toReturn
=
'0x0'
...
@@ -30,8 +26,6 @@ function runTx(payload, from, to, data, value, gasLimit, txRunner, callbacks, is
...
@@ -30,8 +26,6 @@ function runTx(payload, from, to, data, value, gasLimit, txRunner, callbacks, is
}
}
function
createContract
(
payload
,
from
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
callback
)
{
function
createContract
(
payload
,
from
,
data
,
value
,
gasLimit
,
txRunner
,
callbacks
,
callback
)
{
console
.
log
(
'-- createContract'
);
console
.
dir
(
arguments
);
let
finalCallback
=
function
(
err
,
result
)
{
let
finalCallback
=
function
(
err
,
result
)
{
if
(
err
)
{
if
(
err
)
{
return
callback
(
err
);
return
callback
(
err
);
...
@@ -44,7 +38,6 @@ function createContract(payload, from, data, value, gasLimit, txRunner, callback
...
@@ -44,7 +38,6 @@ function createContract(payload, from, data, value, gasLimit, txRunner, callback
}
}
function
processTx
(
accounts
,
payload
,
isCall
,
callback
)
{
function
processTx
(
accounts
,
payload
,
isCall
,
callback
)
{
console
.
log
(
'-- processTx'
);
let
api
=
{
let
api
=
{
logMessage
:
(
msg
)
=>
{
logMessage
:
(
msg
)
=>
{
},
},
...
@@ -75,7 +68,7 @@ function processTx(accounts, payload, isCall, callback) {
...
@@ -75,7 +68,7 @@ function processTx(accounts, payload, isCall, callback) {
let
txRunner
=
new
TxRunner
(
accounts
,
api
);
let
txRunner
=
new
TxRunner
(
accounts
,
api
);
let
{
from
:
from
,
to
:
to
,
data
:
data
,
value
:
value
,
gas
:
gas
}
=
payload
.
params
[
0
];
let
{
from
:
from
,
to
:
to
,
data
:
data
,
value
:
value
,
gas
:
gas
}
=
payload
.
params
[
0
];
gas
=
gas
||
12
00000
;
gas
=
gas
||
30
00000
;
let
callbacks
=
{
let
callbacks
=
{
confirmationCb
:
(
network
,
tx
,
gasEstimation
,
continueTxExecution
,
cancelCb
)
=>
{
confirmationCb
:
(
network
,
tx
,
gasEstimation
,
continueTxExecution
,
cancelCb
)
=>
{
...
...
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