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
e94da808
Commit
e94da808
authored
Jan 16, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default padding set to 32, separated to one variable
parent
a1c0bb68
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
ethereum.js
dist/ethereum.js
+6
-4
ethereum.js.map
dist/ethereum.js.map
+2
-2
ethereum.min.js
dist/ethereum.min.js
+1
-1
abi.js
lib/abi.js
+6
-4
No files found.
dist/ethereum.js
View file @
e94da808
...
...
@@ -31,6 +31,8 @@ var web3 = require('./web3'); // jshint ignore:line
BigNumber
.
config
({
ROUNDING_MODE
:
BigNumber
.
ROUND_DOWN
});
var
ETH_PADDING
=
32
;
// TODO: make these be actually accurate instead of falling back onto JS's doubles.
var
hexToDec
=
function
(
hex
)
{
return
parseInt
(
hex
,
16
).
toString
();
...
...
@@ -93,7 +95,7 @@ var setupInputTypes = function () {
/// If the value is floating point, round it down
/// @returns right-aligned byte representation of int
var
formatInt
=
function
(
value
)
{
var
padding
=
32
*
2
;
var
padding
=
ETH_PADDING
*
2
;
if
(
value
instanceof
BigNumber
||
typeof
value
===
'number'
)
{
if
(
typeof
value
===
'number'
)
value
=
new
BigNumber
(
value
);
...
...
@@ -115,7 +117,7 @@ var setupInputTypes = function () {
/// Formats input value to byte representation of string
/// @returns left-algined byte representation of string
var
formatString
=
function
(
value
)
{
return
web3
.
fromAscii
(
value
,
32
).
substr
(
2
);
return
web3
.
fromAscii
(
value
,
ETH_PADDING
).
substr
(
2
);
};
/// Formats input value to byte representation of bool
...
...
@@ -152,7 +154,7 @@ var toAbiInput = function (json, methodName, params) {
}
var
method
=
json
[
index
];
var
padding
=
32
*
2
;
var
padding
=
ETH_PADDING
*
2
;
for
(
var
i
=
0
;
i
<
method
.
inputs
.
length
;
i
++
)
{
var
typeMatch
=
false
;
...
...
@@ -241,7 +243,7 @@ var fromAbiOutput = function (json, methodName, output) {
var
result
=
[];
var
method
=
json
[
index
];
var
padding
=
32
*
2
;
var
padding
=
ETH_PADDING
*
2
;
for
(
var
i
=
0
;
i
<
method
.
outputs
.
length
;
i
++
)
{
var
typeMatch
=
false
;
for
(
var
j
=
0
;
j
<
outputTypes
.
length
&&
!
typeMatch
;
j
++
)
{
...
...
dist/ethereum.js.map
View file @
e94da808
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
e94da808
This diff is collapsed.
Click to expand it.
lib/abi.js
View file @
e94da808
...
...
@@ -30,6 +30,8 @@ var web3 = require('./web3'); // jshint ignore:line
BigNumber
.
config
({
ROUNDING_MODE
:
BigNumber
.
ROUND_DOWN
});
var
ETH_PADDING
=
32
;
// TODO: make these be actually accurate instead of falling back onto JS's doubles.
var
hexToDec
=
function
(
hex
)
{
return
parseInt
(
hex
,
16
).
toString
();
...
...
@@ -92,7 +94,7 @@ var setupInputTypes = function () {
/// If the value is floating point, round it down
/// @returns right-aligned byte representation of int
var
formatInt
=
function
(
value
)
{
var
padding
=
32
*
2
;
var
padding
=
ETH_PADDING
*
2
;
if
(
value
instanceof
BigNumber
||
typeof
value
===
'number'
)
{
if
(
typeof
value
===
'number'
)
value
=
new
BigNumber
(
value
);
...
...
@@ -114,7 +116,7 @@ var setupInputTypes = function () {
/// Formats input value to byte representation of string
/// @returns left-algined byte representation of string
var
formatString
=
function
(
value
)
{
return
web3
.
fromAscii
(
value
,
32
).
substr
(
2
);
return
web3
.
fromAscii
(
value
,
ETH_PADDING
).
substr
(
2
);
};
/// Formats input value to byte representation of bool
...
...
@@ -151,7 +153,7 @@ var toAbiInput = function (json, methodName, params) {
}
var
method
=
json
[
index
];
var
padding
=
32
*
2
;
var
padding
=
ETH_PADDING
*
2
;
for
(
var
i
=
0
;
i
<
method
.
inputs
.
length
;
i
++
)
{
var
typeMatch
=
false
;
...
...
@@ -240,7 +242,7 @@ var fromAbiOutput = function (json, methodName, output) {
var
result
=
[];
var
method
=
json
[
index
];
var
padding
=
32
*
2
;
var
padding
=
ETH_PADDING
*
2
;
for
(
var
i
=
0
;
i
<
method
.
outputs
.
length
;
i
++
)
{
var
typeMatch
=
false
;
for
(
var
j
=
0
;
j
<
outputTypes
.
length
&&
!
typeMatch
;
j
++
)
{
...
...
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