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
821489c2
Commit
821489c2
authored
Nov 30, 2016
by
yann300
Committed by
Alex Beregszaszi
Dec 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix vmaccounts
parent
e6239d1a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
txRunner.js
src/app/txRunner.js
+8
-3
universal-dapp.js
src/universal-dapp.js
+7
-7
No files found.
src/app/txRunner.js
View file @
821489c2
...
@@ -4,7 +4,7 @@ var EthJSBlock = require('ethereumjs-block')
...
@@ -4,7 +4,7 @@ var EthJSBlock = require('ethereumjs-block')
var
ethJSUtil
=
require
(
'ethereumjs-util'
)
var
ethJSUtil
=
require
(
'ethereumjs-util'
)
var
BN
=
ethJSUtil
.
BN
var
BN
=
ethJSUtil
.
BN
function
TxRunner
(
executionContext
,
opts
)
{
function
TxRunner
(
executionContext
,
vmaccounts
,
opts
)
{
this
.
executionContext
=
executionContext
this
.
executionContext
=
executionContext
this
.
web3
=
executionContext
.
web3
()
this
.
web3
=
executionContext
.
web3
()
this
.
vm
=
executionContext
.
vm
()
this
.
vm
=
executionContext
.
vm
()
...
@@ -16,6 +16,7 @@ function TxRunner (executionContext, opts) {
...
@@ -16,6 +16,7 @@ function TxRunner (executionContext, opts) {
}
}
this
.
running
=
false
this
.
running
=
false
this
.
pendingTxs
=
[]
this
.
pendingTxs
=
[]
this
.
vmaccounts
=
vmaccounts
}
}
TxRunner
.
prototype
.
rawRun
=
function
(
args
,
cb
)
{
TxRunner
.
prototype
.
rawRun
=
function
(
args
,
cb
)
{
...
@@ -83,15 +84,19 @@ TxRunner.prototype.execute = function () {
...
@@ -83,15 +84,19 @@ TxRunner.prototype.execute = function () {
}
}
}
else
{
}
else
{
try
{
try
{
var
account
=
self
.
vmaccounts
[
from
]
if
(
!
account
)
{
return
cb
(
'Invalid account selected'
)
}
tx
=
new
EthJSTX
({
tx
=
new
EthJSTX
({
nonce
:
new
BN
(
from
.
nonce
++
),
nonce
:
new
BN
(
account
.
nonce
++
),
gasPrice
:
new
BN
(
1
),
gasPrice
:
new
BN
(
1
),
gasLimit
:
new
BN
(
gasLimit
,
10
),
gasLimit
:
new
BN
(
gasLimit
,
10
),
to
:
to
,
to
:
to
,
value
:
new
BN
(
value
,
10
),
value
:
new
BN
(
value
,
10
),
data
:
new
Buffer
(
data
.
slice
(
2
),
'hex'
)
data
:
new
Buffer
(
data
.
slice
(
2
),
'hex'
)
})
})
tx
.
sign
(
from
.
privateKey
)
tx
.
sign
(
account
.
privateKey
)
var
block
=
new
EthJSBlock
({
var
block
=
new
EthJSBlock
({
header
:
{
header
:
{
// FIXME: support coinbase, difficulty and gasLimit
// FIXME: support coinbase, difficulty and gasLimit
...
...
src/universal-dapp.js
View file @
821489c2
...
@@ -33,7 +33,7 @@ function UniversalDApp (executionContext, options, txdebugger) {
...
@@ -33,7 +33,7 @@ function UniversalDApp (executionContext, options, txdebugger) {
self
.
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
self
.
executionContext
.
event
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
self
.
reset
(
self
.
contracts
)
self
.
reset
(
self
.
contracts
)
})
})
self
.
txRunner
=
new
TxRunner
(
executionContext
,
{
self
.
txRunner
=
new
TxRunner
(
executionContext
,
{
},
{
queueTxs
:
true
,
queueTxs
:
true
,
personalMode
:
this
.
personalMode
personalMode
:
this
.
personalMode
})
})
...
@@ -41,10 +41,6 @@ function UniversalDApp (executionContext, options, txdebugger) {
...
@@ -41,10 +41,6 @@ function UniversalDApp (executionContext, options, txdebugger) {
UniversalDApp
.
prototype
.
reset
=
function
(
contracts
,
getAddress
,
getValue
,
getGasLimit
,
renderer
)
{
UniversalDApp
.
prototype
.
reset
=
function
(
contracts
,
getAddress
,
getValue
,
getGasLimit
,
renderer
)
{
this
.
$el
.
empty
()
this
.
$el
.
empty
()
this
.
txRunner
=
new
TxRunner
(
this
.
executionContext
,
{
queueTxs
:
true
,
personalMode
:
this
.
personalMode
})
this
.
contracts
=
contracts
this
.
contracts
=
contracts
this
.
getAddress
=
getAddress
this
.
getAddress
=
getAddress
this
.
getValue
=
getValue
this
.
getValue
=
getValue
...
@@ -58,6 +54,10 @@ UniversalDApp.prototype.reset = function (contracts, getAddress, getValue, getGa
...
@@ -58,6 +54,10 @@ UniversalDApp.prototype.reset = function (contracts, getAddress, getValue, getGa
this
.
_addAccount
(
'd74aa6d18aa79a05f3473dd030a97d3305737cbc8337d940344345c1f6b72eea'
)
this
.
_addAccount
(
'd74aa6d18aa79a05f3473dd030a97d3305737cbc8337d940344345c1f6b72eea'
)
this
.
_addAccount
(
'71975fbf7fe448e004ac7ae54cad0a383c3906055a65468714156a07385e96ce'
)
this
.
_addAccount
(
'71975fbf7fe448e004ac7ae54cad0a383c3906055a65468714156a07385e96ce'
)
}
}
this
.
txRunner
=
new
TxRunner
(
this
.
executionContext
,
this
.
accounts
,
{
queueTxs
:
true
,
personalMode
:
this
.
personalMode
})
}
}
UniversalDApp
.
prototype
.
newAccount
=
function
(
password
)
{
UniversalDApp
.
prototype
.
newAccount
=
function
(
password
)
{
...
@@ -728,7 +728,7 @@ UniversalDApp.prototype.runTx = function (args, cb) {
...
@@ -728,7 +728,7 @@ UniversalDApp.prototype.runTx = function (args, cb) {
return
callback
(
err
)
return
callback
(
err
)
}
}
tx
.
from
=
self
.
executionContext
.
isVM
()
?
self
.
accounts
[
ret
]
:
ret
tx
.
from
=
ret
callback
()
callback
()
})
})
...
@@ -746,7 +746,7 @@ UniversalDApp.prototype.runTx = function (args, cb) {
...
@@ -746,7 +746,7 @@ UniversalDApp.prototype.runTx = function (args, cb) {
return
callback
(
'Invalid account selected'
)
return
callback
(
'Invalid account selected'
)
}
}
tx
.
from
=
self
.
executionContext
.
isVM
()
?
self
.
accounts
[
ret
[
0
]]
:
ret
[
0
]
tx
.
from
=
ret
[
0
]
callback
()
callback
()
})
})
...
...
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