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
dd693ebc
Commit
dd693ebc
authored
Mar 28, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use callFunction && createContract from udapp
parent
b7d50ce5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
run-tab.js
src/app/tabs/run-tab.js
+1
-1
universal-dapp.js
src/universal-dapp.js
+26
-1
No files found.
src/app/tabs/run-tab.js
View file @
dd693ebc
...
...
@@ -284,7 +284,7 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) {
txFormat
.
buildData
(
selectedContract
.
name
,
selectedContract
.
contract
.
object
,
appAPI
.
getContracts
(),
true
,
constructor
,
args
,
(
error
,
data
)
=>
{
if
(
!
error
)
{
appAPI
.
logMessage
(
`creation of
${
selectedContract
.
name
}
pending...`
)
txExecution
.
createContract
(
data
,
appAPI
.
udapp
()
,
(
error
,
txResult
)
=>
{
appAPI
.
udapp
().
createContract
(
data
,
(
error
,
txResult
)
=>
{
if
(
!
error
)
{
var
isVM
=
executionContext
.
isVM
()
if
(
isVM
)
{
...
...
src/universal-dapp.js
View file @
dd693ebc
...
...
@@ -171,7 +171,7 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
self
.
_api
.
logMessage
(
`
${
logMsg
}
`
)
}
}
txExecution
.
callFunction
(
args
.
address
,
data
,
args
.
funABI
,
self
,
(
error
,
txResult
)
=>
{
self
.
callFunction
(
args
.
address
,
data
,
args
.
funABI
,
(
error
,
txResult
)
=>
{
if
(
!
error
)
{
var
isVM
=
executionContext
.
isVM
()
if
(
isVM
)
{
...
...
@@ -200,6 +200,31 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
})
}
/**
* deploy the given contract
*
* @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ).
* @param {Function} callback - callback.
*/
UniversalDApp
.
prototype
.
createContract
=
function
(
data
,
callback
)
{
this
.
runTx
({
data
:
data
,
useCall
:
false
},
(
error
,
txResult
)
=>
{
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
callback
(
error
,
txResult
)
})
}
/**
* call the current given contract
*
* @param {String} to - address of the contract to call.
* @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ).
* @param {Object} funAbi - abi definition of the function to call.
* @param {Function} callback - callback.
*/
UniversalDApp
.
prototype
.
callFunction
=
function
(
to
,
data
,
funAbi
,
callback
)
{
this
.
runTx
({
to
:
to
,
data
:
data
,
useCall
:
funAbi
.
constant
},
(
error
,
txResult
)
=>
{
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
callback
(
error
,
txResult
)
})
}
...
...
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