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
658a4f69
Commit
658a4f69
authored
Mar 18, 2016
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to support latest ethereumjs-vm API
parent
408d746f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
universal-dapp.js
assets/js/universal-dapp.js
+9
-11
No files found.
assets/js/universal-dapp.js
View file @
658a4f69
...
@@ -7,15 +7,13 @@ function UniversalDApp (contracts, options) {
...
@@ -7,15 +7,13 @@ function UniversalDApp (contracts, options) {
if
(
!
options
.
vm
&&
web3
.
currentProvider
)
{
if
(
!
options
.
vm
&&
web3
.
currentProvider
)
{
}
else
if
(
options
.
vm
)
{
}
else
if
(
options
.
vm
)
{
this
.
vm
=
new
EthVm
();
this
.
BN
=
EthVm
.
deps
.
ethUtil
.
BN
;
//@todo this does not calculate the gas costs correctly but gets the job done.
this
.
stateTrie
=
new
EthVm
.
deps
.
Trie
();
this
.
identityCode
=
'return { gasUsed: 1, return: opts.data, exception: 1 };'
;
this
.
vm
=
new
EthVm
(
this
.
stateTrie
);
this
.
identityAddr
=
ethUtil
.
pad
(
new
Buffer
(
'04'
,
'hex'
),
20
)
this
.
vm
.
loadCompiled
(
this
.
identityAddr
,
this
.
identityCode
);
this
.
secretKey
=
'3cd7232cd6f3fc66a57a6bedc1a8ed6c228fff0a327e169c2bcc5e869ed49511'
this
.
secretKey
=
'3cd7232cd6f3fc66a57a6bedc1a8ed6c228fff0a327e169c2bcc5e869ed49511'
this
.
publicKey
=
'0406cc661590d48ee972944b35ad13ff03c7876eae3fd191e8a2f77311b0a3c6613407b5005e63d7d8d76b89d5f900cde691497688bb281e07a5052ff61edebdc0'
this
.
publicKey
=
'0406cc661590d48ee972944b35ad13ff03c7876eae3fd191e8a2f77311b0a3c6613407b5005e63d7d8d76b89d5f900cde691497688bb281e07a5052ff61edebdc0'
this
.
address
=
ethUtil
.
pubToAddress
(
new
Buffer
(
this
.
publicKey
,
'hex'
));
this
.
address
=
ethUtil
.
pubToAddress
(
new
Buffer
(
this
.
publicKey
,
'hex'
)
,
true
);
this
.
account
=
new
Account
();
this
.
account
=
new
EthVm
.
deps
.
Account
();
this
.
account
.
balance
=
'f00000000000000001'
;
this
.
account
.
balance
=
'f00000000000000001'
;
this
.
nonce
=
0
;
this
.
nonce
=
0
;
this
.
vm
.
stateManager
.
trie
.
put
(
this
.
address
,
this
.
account
.
serialize
());
this
.
vm
.
stateManager
.
trie
.
put
(
this
.
address
,
this
.
account
.
serialize
());
...
@@ -437,13 +435,13 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
...
@@ -437,13 +435,13 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
}
}
}
else
{
}
else
{
try
{
try
{
var
tx
=
new
Tx
({
var
tx
=
new
EthVm
.
deps
.
Transaction
({
nonce
:
new
Buffer
([
this
.
nonce
++
]),
//@todo count beyond 255
nonce
:
new
Buffer
([
this
.
nonce
++
]),
//@todo count beyond 255
gasPrice
:
'01'
,
gasPrice
:
1
,
gasLimit
:
'3000000000'
,
//plenty
gasLimit
:
3000000000
,
//plenty
to
:
to
,
to
:
to
,
value
:
value
,
value
:
value
,
data
:
data
data
:
new
Buffer
(
data
.
slice
(
2
),
'hex'
)
});
});
tx
.
sign
(
new
Buffer
(
this
.
secretKey
,
'hex'
));
tx
.
sign
(
new
Buffer
(
this
.
secretKey
,
'hex'
));
this
.
vm
.
runTx
({
tx
:
tx
},
cb
);
this
.
vm
.
runTx
({
tx
:
tx
},
cb
);
...
...
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