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
ccd7ad02
Commit
ccd7ad02
authored
Feb 07, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove old code
parent
0d2a7d35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
95 deletions
+0
-95
universal-dapp.js
src/universal-dapp.js
+0
-95
No files found.
src/universal-dapp.js
View file @
ccd7ad02
...
@@ -261,99 +261,4 @@ UniversalDApp.prototype.runTx = function (args, cb) {
...
@@ -261,99 +261,4 @@ UniversalDApp.prototype.runTx = function (args, cb) {
],
cb
)
],
cb
)
}
}
UniversalDApp
.
prototype
.
runTx
=
function
(
args
,
cb
)
{
var
self
=
this
var
tx
=
{
to
:
args
.
to
,
data
:
args
.
data
.
dataHex
,
useCall
:
args
.
useCall
,
from
:
args
.
from
,
value
:
args
.
value
}
var
payLoad
=
{
funAbi
:
args
.
data
.
funAbi
,
funArgs
:
args
.
data
.
funArgs
,
contractBytecode
:
args
.
data
.
contractBytecode
,
contractName
:
args
.
data
.
contractName
}
// contains decoded parameters
var
pipeline
=
[
queryGasLimit
]
if
(
!
args
.
value
)
{
pipeline
.
push
(
queryValue
)
}
if
(
!
args
.
from
)
{
pipeline
.
push
(
queryAddress
)
}
pipeline
.
push
(
runTransaction
)
var
env
=
{
self
,
tx
,
payLoad
}
execute
(
pipeline
,
env
,
cb
)
}
function
execute
(
pipeline
,
env
,
callback
)
{
function
next
(
err
,
env
)
{
if
(
err
)
return
callback
(
err
)
var
step
=
pipeline
.
shift
()
if
(
step
)
step
(
env
,
next
)
else
callback
(
null
,
env
.
result
)
}
next
(
null
,
env
)
}
function
queryGasLimit
(
env
,
next
)
{
var
{
self
,
tx
}
=
env
tx
.
gasLimit
=
3000000
if
(
self
.
transactionContextAPI
.
getGasLimit
)
{
self
.
transactionContextAPI
.
getGasLimit
(
function
(
err
,
ret
)
{
if
(
err
)
return
next
(
err
)
tx
.
gasLimit
=
ret
next
(
null
,
env
)
})
}
else
next
(
null
,
env
)
}
function
queryValue
(
env
,
next
)
{
var
{
self
,
tx
}
=
env
tx
.
value
=
0
if
(
tx
.
useCall
)
return
next
(
null
,
env
)
if
(
self
.
transactionContextAPI
.
getValue
)
{
self
.
transactionContextAPI
.
getValue
(
function
(
err
,
ret
)
{
if
(
err
)
return
next
(
err
)
tx
.
value
=
ret
next
(
null
,
env
)
})
}
else
next
(
null
,
env
)
}
function
queryAddress
(
env
,
next
)
{
var
{
self
,
tx
}
=
env
if
(
self
.
transactionContextAPI
.
getAddress
)
{
self
.
transactionContextAPI
.
getAddress
(
function
(
err
,
ret
)
{
if
(
err
)
return
next
(
err
)
tx
.
from
=
ret
next
(
null
,
env
)
})
}
else
{
self
.
getAccounts
(
function
(
err
,
ret
)
{
if
(
err
)
return
next
(
err
)
if
(
ret
.
length
===
0
)
return
next
(
'No accounts available'
)
if
(
executionContext
.
isVM
()
&&
!
self
.
accounts
[
ret
[
0
]])
{
return
next
(
'Invalid account selected'
)
}
tx
.
from
=
ret
[
0
]
next
(
null
,
env
)
})
}
}
function
runTransaction
(
env
,
next
)
{
var
{
self
,
tx
,
payLoad
}
=
env
var
timestamp
=
Date
.
now
()
self
.
event
.
trigger
(
'initiatingTransaction'
,
[
timestamp
,
tx
,
payLoad
])
self
.
txRunner
.
rawRun
(
tx
,
function
(
error
,
result
)
{
if
(
!
tx
.
useCall
)
{
self
.
event
.
trigger
(
'transactionExecuted'
,
[
error
,
tx
.
from
,
tx
.
to
,
tx
.
data
,
false
,
result
,
timestamp
,
payLoad
])
}
else
{
self
.
event
.
trigger
(
'callExecuted'
,
[
error
,
tx
.
from
,
tx
.
to
,
tx
.
data
,
true
,
result
,
timestamp
,
payLoad
])
}
if
(
error
)
{
if
(
typeof
(
error
)
!==
'string'
)
{
if
(
error
.
message
)
error
=
error
.
message
else
{
try
{
error
=
'error: '
+
JSON
.
stringify
(
error
)
}
catch
(
e
)
{}
}
}
}
env
.
result
=
result
next
(
error
,
env
)
})
}
module
.
exports
=
UniversalDApp
module
.
exports
=
UniversalDApp
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