Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
09f63359
Commit
09f63359
authored
Jan 27, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed #23
parent
42a25f2f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
6 deletions
+46
-6
ethereum.js
dist/ethereum.js
+5
-1
ethereum.js.map
dist/ethereum.js.map
+3
-3
ethereum.min.js
dist/ethereum.min.js
+1
-1
abi.js
lib/abi.js
+2
-0
web3.js
lib/web3.js
+3
-1
abi.parsers.js
test/abi.parsers.js
+32
-0
No files found.
dist/ethereum.js
View file @
09f63359
...
...
@@ -212,6 +212,7 @@ var signedIsNegative = function (value) {
/// Formats input right-aligned input bytes to int
/// @returns right-aligned input bytes formatted to int
var
formatOutputInt
=
function
(
value
)
{
value
=
value
||
"0"
;
// check if it's negative number
// it it is, return two's complement
if
(
signedIsNegative
(
value
))
{
...
...
@@ -223,6 +224,7 @@ var formatOutputInt = function (value) {
/// Formats big right-aligned input bytes to uint
/// @returns right-aligned input bytes formatted to uint
var
formatOutputUInt
=
function
(
value
)
{
value
=
value
||
"0"
;
return
new
BigNumber
(
value
,
16
);
};
...
...
@@ -1078,7 +1080,9 @@ var web3 = {
/// @returns decimal representaton of hex value prefixed by 0x
toDecimal
:
function
(
val
)
{
return
(
new
BigNumber
(
val
.
substring
(
2
),
16
).
toString
(
10
));
// remove 0x and place 0, if it's required
val
=
val
.
length
>
2
?
val
.
substring
(
2
)
:
"0"
;
return
(
new
BigNumber
(
val
,
16
).
toString
(
10
));
},
/// @returns hex representation (prefixed by 0x) of decimal value
...
...
dist/ethereum.js.map
View file @
09f63359
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
09f63359
This diff is collapsed.
Click to expand it.
lib/abi.js
View file @
09f63359
...
...
@@ -211,6 +211,7 @@ var signedIsNegative = function (value) {
/// Formats input right-aligned input bytes to int
/// @returns right-aligned input bytes formatted to int
var
formatOutputInt
=
function
(
value
)
{
value
=
value
||
"0"
;
// check if it's negative number
// it it is, return two's complement
if
(
signedIsNegative
(
value
))
{
...
...
@@ -222,6 +223,7 @@ var formatOutputInt = function (value) {
/// Formats big right-aligned input bytes to uint
/// @returns right-aligned input bytes formatted to uint
var
formatOutputUInt
=
function
(
value
)
{
value
=
value
||
"0"
;
return
new
BigNumber
(
value
,
16
);
};
...
...
lib/web3.js
View file @
09f63359
...
...
@@ -233,7 +233,9 @@ var web3 = {
/// @returns decimal representaton of hex value prefixed by 0x
toDecimal
:
function
(
val
)
{
return
(
new
BigNumber
(
val
.
substring
(
2
),
16
).
toString
(
10
));
// remove 0x and place 0, if it's required
val
=
val
.
length
>
2
?
val
.
substring
(
2
)
:
"0"
;
return
(
new
BigNumber
(
val
,
16
).
toString
(
10
));
},
/// @returns hex representation (prefixed by 0x) of decimal value
...
...
test/abi.parsers.js
View file @
09f63359
...
...
@@ -823,6 +823,38 @@ describe('abi', function() {
});
it
(
'should parse 0x value'
,
function
()
{
// given
var
d
=
clone
(
description
);
d
[
0
].
outputs
=
[
{
type
:
'int'
}
];
// when
var
parser
=
abi
.
outputParser
(
d
);
// then
assert
.
equal
(
parser
.
test
(
"0x"
)[
0
],
0
);
});
it
(
'should parse 0x value'
,
function
()
{
// given
var
d
=
clone
(
description
);
d
[
0
].
outputs
=
[
{
type
:
'uint'
}
];
// when
var
parser
=
abi
.
outputParser
(
d
);
// then
assert
.
equal
(
parser
.
test
(
"0x"
)[
0
],
0
);
});
});
});
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