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
472ad432
Commit
472ad432
authored
Jan 14, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more comments
parent
603c7902
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
10 deletions
+26
-10
ethereum.js
dist/ethereum.js
+12
-4
ethereum.js.map
dist/ethereum.js.map
+2
-2
abi.js
lib/abi.js
+12
-4
No files found.
dist/ethereum.js
View file @
472ad432
...
@@ -83,6 +83,8 @@ var namedType = function (name) {
...
@@ -83,6 +83,8 @@ var namedType = function (name) {
/// @returns an array of input formatters
/// @returns an array of input formatters
var
setupInputTypes
=
function
()
{
var
setupInputTypes
=
function
()
{
/// Formats input value to byte representation of int
/// @returns right-aligned byte representation of int
var
formatInt
=
function
(
value
)
{
var
formatInt
=
function
(
value
)
{
var
padding
=
32
*
2
;
var
padding
=
32
*
2
;
if
(
typeof
value
===
'number'
)
if
(
typeof
value
===
'number'
)
...
@@ -96,10 +98,14 @@ var setupInputTypes = function () {
...
@@ -96,10 +98,14 @@ var setupInputTypes = function () {
return
padLeft
(
value
,
padding
);
return
padLeft
(
value
,
padding
);
};
};
/// Formats input value to byte representation of string
/// @returns left-algined byte representation of string
var
formatString
=
function
(
value
)
{
var
formatString
=
function
(
value
)
{
return
web3
.
fromAscii
(
value
,
32
).
substr
(
2
);
return
web3
.
fromAscii
(
value
,
32
).
substr
(
2
);
};
};
/// Formats input value to byte representation of bool
/// @returns right-aligned byte representation bool
var
formatBool
=
function
(
value
)
{
var
formatBool
=
function
(
value
)
{
return
'000000000000000000000000000000000000000000000000000000000000000'
+
(
value
?
'1'
:
'0'
);
return
'000000000000000000000000000000000000000000000000000000000000000'
+
(
value
?
'1'
:
'0'
);
};
};
...
@@ -153,26 +159,28 @@ var toAbiInput = function (json, methodName, params) {
...
@@ -153,26 +159,28 @@ var toAbiInput = function (json, methodName, params) {
/// @returns an array of output formatters
/// @returns an array of output formatters
var
setupOutputTypes
=
function
()
{
var
setupOutputTypes
=
function
()
{
/// @returns input bytes formatted to int
/// Formats input right-aligned input bytes to int
/// @returns right-aligned input bytes formatted to int
var
formatInt
=
function
(
value
)
{
var
formatInt
=
function
(
value
)
{
return
value
.
length
<=
8
?
+
parseInt
(
value
,
16
)
:
hexToDec
(
value
);
return
value
.
length
<=
8
?
+
parseInt
(
value
,
16
)
:
hexToDec
(
value
);
};
};
/// @returns input bytes formatted to hex
/// @returns
right-aligned
input bytes formatted to hex
var
formatHash
=
function
(
value
)
{
var
formatHash
=
function
(
value
)
{
return
"0x"
+
value
;
return
"0x"
+
value
;
};
};
/// @returns input bytes formatted to bool
/// @returns
right-aligned
input bytes formatted to bool
var
formatBool
=
function
(
value
)
{
var
formatBool
=
function
(
value
)
{
return
value
===
'0000000000000000000000000000000000000000000000000000000000000001'
?
true
:
false
;
return
value
===
'0000000000000000000000000000000000000000000000000000000000000001'
?
true
:
false
;
};
};
/// @returns input bytes formatted to ascii string
/// @returns
left-aligned
input bytes formatted to ascii string
var
formatString
=
function
(
value
)
{
var
formatString
=
function
(
value
)
{
return
web3
.
toAscii
(
value
);
return
web3
.
toAscii
(
value
);
};
};
/// @returns right-aligned input bytes formatted to address
var
formatAddress
=
function
(
value
)
{
var
formatAddress
=
function
(
value
)
{
return
"0x"
+
value
.
slice
(
value
.
length
-
40
,
value
.
length
);
return
"0x"
+
value
.
slice
(
value
.
length
-
40
,
value
.
length
);
};
};
...
...
dist/ethereum.js.map
View file @
472ad432
This diff is collapsed.
Click to expand it.
lib/abi.js
View file @
472ad432
...
@@ -82,6 +82,8 @@ var namedType = function (name) {
...
@@ -82,6 +82,8 @@ var namedType = function (name) {
/// @returns an array of input formatters
/// @returns an array of input formatters
var
setupInputTypes
=
function
()
{
var
setupInputTypes
=
function
()
{
/// Formats input value to byte representation of int
/// @returns right-aligned byte representation of int
var
formatInt
=
function
(
value
)
{
var
formatInt
=
function
(
value
)
{
var
padding
=
32
*
2
;
var
padding
=
32
*
2
;
if
(
typeof
value
===
'number'
)
if
(
typeof
value
===
'number'
)
...
@@ -95,10 +97,14 @@ var setupInputTypes = function () {
...
@@ -95,10 +97,14 @@ var setupInputTypes = function () {
return
padLeft
(
value
,
padding
);
return
padLeft
(
value
,
padding
);
};
};
/// Formats input value to byte representation of string
/// @returns left-algined byte representation of string
var
formatString
=
function
(
value
)
{
var
formatString
=
function
(
value
)
{
return
web3
.
fromAscii
(
value
,
32
).
substr
(
2
);
return
web3
.
fromAscii
(
value
,
32
).
substr
(
2
);
};
};
/// Formats input value to byte representation of bool
/// @returns right-aligned byte representation bool
var
formatBool
=
function
(
value
)
{
var
formatBool
=
function
(
value
)
{
return
'000000000000000000000000000000000000000000000000000000000000000'
+
(
value
?
'1'
:
'0'
);
return
'000000000000000000000000000000000000000000000000000000000000000'
+
(
value
?
'1'
:
'0'
);
};
};
...
@@ -152,26 +158,28 @@ var toAbiInput = function (json, methodName, params) {
...
@@ -152,26 +158,28 @@ var toAbiInput = function (json, methodName, params) {
/// @returns an array of output formatters
/// @returns an array of output formatters
var
setupOutputTypes
=
function
()
{
var
setupOutputTypes
=
function
()
{
/// @returns input bytes formatted to int
/// Formats input right-aligned input bytes to int
/// @returns right-aligned input bytes formatted to int
var
formatInt
=
function
(
value
)
{
var
formatInt
=
function
(
value
)
{
return
value
.
length
<=
8
?
+
parseInt
(
value
,
16
)
:
hexToDec
(
value
);
return
value
.
length
<=
8
?
+
parseInt
(
value
,
16
)
:
hexToDec
(
value
);
};
};
/// @returns input bytes formatted to hex
/// @returns
right-aligned
input bytes formatted to hex
var
formatHash
=
function
(
value
)
{
var
formatHash
=
function
(
value
)
{
return
"0x"
+
value
;
return
"0x"
+
value
;
};
};
/// @returns input bytes formatted to bool
/// @returns
right-aligned
input bytes formatted to bool
var
formatBool
=
function
(
value
)
{
var
formatBool
=
function
(
value
)
{
return
value
===
'0000000000000000000000000000000000000000000000000000000000000001'
?
true
:
false
;
return
value
===
'0000000000000000000000000000000000000000000000000000000000000001'
?
true
:
false
;
};
};
/// @returns input bytes formatted to ascii string
/// @returns
left-aligned
input bytes formatted to ascii string
var
formatString
=
function
(
value
)
{
var
formatString
=
function
(
value
)
{
return
web3
.
toAscii
(
value
);
return
web3
.
toAscii
(
value
);
};
};
/// @returns right-aligned input bytes formatted to address
var
formatAddress
=
function
(
value
)
{
var
formatAddress
=
function
(
value
)
{
return
"0x"
+
value
.
slice
(
value
.
length
-
40
,
value
.
length
);
return
"0x"
+
value
.
slice
(
value
.
length
-
40
,
value
.
length
);
};
};
...
...
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