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
43e08c38
Commit
43e08c38
authored
Feb 06, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move tx action logic from udapp-ui to udapp
parent
52769263
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
52 deletions
+50
-52
universal-dapp-ui.js
src/universal-dapp-ui.js
+3
-48
universal-dapp.js
src/universal-dapp.js
+47
-4
No files found.
src/universal-dapp-ui.js
View file @
43e08c38
...
@@ -2,12 +2,9 @@
...
@@ -2,12 +2,9 @@
'use strict'
'use strict'
var
$
=
require
(
'jquery'
)
var
$
=
require
(
'jquery'
)
var
ethJSUtil
=
require
(
'ethereumjs-util'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
txFormat
=
require
(
'./app/execution/txFormat'
)
var
txHelper
=
require
(
'./app/execution/txHelper'
)
var
txHelper
=
require
(
'./app/execution/txHelper'
)
var
txExecution
=
require
(
'./app/execution/txExecution'
)
var
helper
=
require
(
'./lib/helper'
)
var
helper
=
require
(
'./lib/helper'
)
var
executionContext
=
require
(
'./execution-context'
)
var
executionContext
=
require
(
'./execution-context'
)
var
copyToClipboard
=
require
(
'./app/ui/copy-to-clipboard'
)
var
copyToClipboard
=
require
(
'./app/ui/copy-to-clipboard'
)
...
@@ -251,51 +248,9 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
...
@@ -251,51 +248,9 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
button
.
innerHTML
=
title
button
.
innerHTML
=
title
function
clickButton
()
{
function
clickButton
()
{
call
(
true
)
self
.
udapp
.
call
(
true
,
args
,
inputField
.
value
,
(
decoded
)
=>
{
}
outputOverride
.
innerHTML
=
''
outputOverride
.
appendChild
(
decoded
)
function
call
(
isUserAction
)
{
var
logMsg
if
(
isUserAction
)
{
if
(
!
args
.
funABI
.
constant
)
{
logMsg
=
`transact to
${
args
.
contractName
}
.
${(
args
.
funABI
.
name
)
?
args
.
funABI
.
name
:
'(fallback)'
}
`
}
else
{
logMsg
=
`call to
${
args
.
contractName
}
.
${(
args
.
funABI
.
name
)
?
args
.
funABI
.
name
:
'(fallback)'
}
`
}
}
txFormat
.
buildData
(
args
.
contractName
,
args
.
contractAbi
,
self
.
udapp
.
contracts
,
false
,
args
.
funABI
,
inputField
.
value
,
self
,
(
error
,
data
)
=>
{
if
(
!
error
)
{
if
(
isUserAction
)
{
if
(
!
args
.
funABI
.
constant
)
{
self
.
udapp
.
_api
.
logMessage
(
`
${
logMsg
}
pending ... `
)
}
else
{
self
.
udapp
.
_api
.
logMessage
(
`
${
logMsg
}
`
)
}
}
txExecution
.
callFunction
(
args
.
address
,
data
,
args
.
funABI
,
self
,
(
error
,
txResult
)
=>
{
if
(
!
error
)
{
var
isVM
=
executionContext
.
isVM
()
if
(
isVM
)
{
var
vmError
=
txExecution
.
checkVMError
(
txResult
)
if
(
vmError
.
error
)
{
self
.
udapp
.
_api
.
logMessage
(
`
${
logMsg
}
errored:
${
vmError
.
message
}
`
)
return
}
}
if
(
lookupOnly
)
{
var
decoded
=
txFormat
.
decodeResponseToTreeView
(
executionContext
.
isVM
()
?
txResult
.
result
.
vm
.
return
:
ethJSUtil
.
toBuffer
(
txResult
.
result
),
args
.
funABI
)
outputOverride
.
innerHTML
=
''
outputOverride
.
appendChild
(
decoded
)
}
}
else
{
self
.
udapp
.
_api
.
logMessage
(
`
${
logMsg
}
errored:
${
error
}
`
)
}
})
}
else
{
self
.
udapp
.
_api
.
logMessage
(
`
${
logMsg
}
errored:
${
error
}
`
)
}
},
(
msg
)
=>
{
self
.
udapp
.
_api
.
logMessage
(
msg
)
})
})
}
}
...
...
src/universal-dapp.js
View file @
43e08c38
...
@@ -7,9 +7,9 @@ var remixLib = require('remix-lib')
...
@@ -7,9 +7,9 @@ var remixLib = require('remix-lib')
var
EventManager
=
remixLib
.
EventManager
var
EventManager
=
remixLib
.
EventManager
var
crypto
=
require
(
'crypto'
)
var
crypto
=
require
(
'crypto'
)
var
TxRunner
=
require
(
'./app/execution/txRunner'
)
var
TxRunner
=
require
(
'./app/execution/txRunner'
)
//
var txFormat = require('./app/execution/txFormat')
var
txFormat
=
require
(
'./app/execution/txFormat'
)
// var txHelper = require('./app/execution/txHelper')
// var txHelper = require('./app/execution/txHelper')
//
var txExecution = require('./app/execution/txExecution')
var
txExecution
=
require
(
'./app/execution/txExecution'
)
// var helper = require('./lib/helper')
// var helper = require('./lib/helper')
var
executionContext
=
require
(
'./execution-context'
)
var
executionContext
=
require
(
'./execution-context'
)
var
modalCustom
=
require
(
'./app/ui/modal-dialog-custom'
)
var
modalCustom
=
require
(
'./app/ui/modal-dialog-custom'
)
...
@@ -25,8 +25,6 @@ function UniversalDAppModel (opts = {}) {
...
@@ -25,8 +25,6 @@ function UniversalDAppModel (opts = {}) {
self
.
removable
=
opts
.
opt
.
removable
self
.
removable
=
opts
.
opt
.
removable
self
.
removable_instances
=
opts
.
opt
.
removable_instances
self
.
removable_instances
=
opts
.
opt
.
removable_instances
self
.
personalMode
=
opts
.
opt
.
personalMode
||
false
self
.
personalMode
=
opts
.
opt
.
personalMode
||
false
// self.contracts
// self.transactionContextAPI
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
self
.
reset
(
self
.
contracts
)
self
.
reset
(
self
.
contracts
)
})
})
...
@@ -141,6 +139,51 @@ UniversalDAppModel.prototype.pendingTransactions = function () {
...
@@ -141,6 +139,51 @@ UniversalDAppModel.prototype.pendingTransactions = function () {
return
this
.
txRunner
.
pendingTxs
return
this
.
txRunner
.
pendingTxs
}
}
UniversalDAppModel
.
prototype
.
call
=
function
(
isUserAction
,
args
,
value
,
outputCb
)
{
const
self
=
this
var
logMsg
if
(
isUserAction
)
{
if
(
!
args
.
funABI
.
constant
)
{
logMsg
=
`transact to
${
args
.
contractName
}
.
${(
args
.
funABI
.
name
)
?
args
.
funABI
.
name
:
'(fallback)'
}
`
}
else
{
logMsg
=
`call to
${
args
.
contractName
}
.
${(
args
.
funABI
.
name
)
?
args
.
funABI
.
name
:
'(fallback)'
}
`
}
}
txFormat
.
buildData
(
args
.
contractName
,
args
.
contractAbi
,
self
.
contracts
,
false
,
args
.
funABI
,
value
,
self
,
(
error
,
data
)
=>
{
if
(
!
error
)
{
if
(
isUserAction
)
{
if
(
!
args
.
funABI
.
constant
)
{
self
.
_api
.
logMessage
(
`
${
logMsg
}
pending ... `
)
}
else
{
self
.
_api
.
logMessage
(
`
${
logMsg
}
`
)
}
}
txExecution
.
callFunction
(
args
.
address
,
data
,
args
.
funABI
,
self
,
(
error
,
txResult
)
=>
{
if
(
!
error
)
{
var
isVM
=
executionContext
.
isVM
()
if
(
isVM
)
{
var
vmError
=
txExecution
.
checkVMError
(
txResult
)
if
(
vmError
.
error
)
{
self
.
_api
.
logMessage
(
`
${
logMsg
}
errored:
${
vmError
.
message
}
`
)
return
}
}
if
(
lookupOnly
)
{
var
decoded
=
txFormat
.
decodeResponseToTreeView
(
executionContext
.
isVM
()
?
txResult
.
result
.
vm
.
return
:
ethJSUtil
.
toBuffer
(
txResult
.
result
),
args
.
funABI
)
outputCb
(
decoded
)
}
}
else
{
self
.
_api
.
logMessage
(
`
${
logMsg
}
errored:
${
error
}
`
)
}
})
}
else
{
self
.
_api
.
logMessage
(
`
${
logMsg
}
errored:
${
error
}
`
)
}
},
(
msg
)
=>
{
self
.
_api
.
logMessage
(
msg
)
})
}
function
execute
(
pipeline
,
env
,
callback
)
{
function
execute
(
pipeline
,
env
,
callback
)
{
function
next
(
err
,
env
)
{
function
next
(
err
,
env
)
{
if
(
err
)
return
callback
(
err
)
if
(
err
)
return
callback
(
err
)
...
...
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