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
2ce109eb
Commit
2ce109eb
authored
Jan 17, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '6a383d6ed3fb37cf6739f6ac441652adfdb70463' into ethereumjs
parents
1c4d8f36
823fb299
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
411 additions
and
242 deletions
+411
-242
ethereum.js
dist/ethereum.js
+150
-106
ethereum.js.map
dist/ethereum.js.map
+2
-2
ethereum.min.js
dist/ethereum.min.js
+1
-1
abi.js
lib/abi.js
+150
-106
abi.parsers.js
test/abi.parsers.js
+108
-27
No files found.
dist/ethereum.js
View file @
2ce109eb
This diff is collapsed.
Click to expand it.
dist/ethereum.js.map
View file @
2ce109eb
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
2ce109eb
This diff is collapsed.
Click to expand it.
lib/abi.js
View file @
2ce109eb
This diff is collapsed.
Click to expand it.
test/abi.parsers.js
View file @
2ce109eb
...
@@ -307,8 +307,14 @@ describe('abi', function() {
...
@@ -307,8 +307,14 @@ describe('abi', function() {
var
parser
=
abi
.
inputParser
(
d
);
var
parser
=
abi
.
inputParser
(
d
);
// then
// then
assert
.
equal
(
parser
.
test
(
'hello'
),
"68656c6c6f000000000000000000000000000000000000000000000000000000"
);
assert
.
equal
(
assert
.
equal
(
parser
.
test
(
'world'
),
"776f726c64000000000000000000000000000000000000000000000000000000"
);
parser
.
test
(
'hello'
),
"000000000000000000000000000000000000000000000000000000000000000568656c6c6f000000000000000000000000000000000000000000000000000000"
);
assert
.
equal
(
parser
.
test
(
'world'
),
"0000000000000000000000000000000000000000000000000000000000000005776f726c64000000000000000000000000000000000000000000000000000000"
);
});
});
it
(
'should use proper method name'
,
function
()
{
it
(
'should use proper method name'
,
function
()
{
...
@@ -346,9 +352,34 @@ describe('abi', function() {
...
@@ -346,9 +352,34 @@ describe('abi', function() {
//then
//then
assert
.
equal
(
parser
.
test
(
1
),
"0000000000000000000000000000000000000000000000000000000000000001"
);
assert
.
equal
(
parser
.
test
(
1
),
"0000000000000000000000000000000000000000000000000000000000000001"
);
assert
.
equal
(
parser
.
test2
(
'hello'
),
"68656c6c6f000000000000000000000000000000000000000000000000000000"
);
assert
.
equal
(
parser
.
test2
(
'hello'
),
"000000000000000000000000000000000000000000000000000000000000000568656c6c6f000000000000000000000000000000000000000000000000000000"
);
});
it
(
'should parse input array of ints'
,
function
()
{
// given
var
d
=
clone
(
description
);
d
[
0
].
inputs
=
[
{
type
:
"int[]"
}
];
// when
var
parser
=
abi
.
inputParser
(
d
);
// then
assert
.
equal
(
parser
.
test
([
5
,
6
]),
"0000000000000000000000000000000000000000000000000000000000000002"
+
"0000000000000000000000000000000000000000000000000000000000000005"
+
"0000000000000000000000000000000000000000000000000000000000000006"
);
});
});
});
});
describe
(
'outputParser'
,
function
()
{
describe
(
'outputParser'
,
function
()
{
...
@@ -365,8 +396,18 @@ describe('abi', function() {
...
@@ -365,8 +396,18 @@ describe('abi', function() {
var
parser
=
abi
.
outputParser
(
d
);
var
parser
=
abi
.
outputParser
(
d
);
// then
// then
assert
.
equal
(
parser
.
test
(
"0x68656c6c6f000000000000000000000000000000000000000000000000000000"
)[
0
],
'hello'
);
assert
.
equal
(
assert
.
equal
(
parser
.
test
(
"0x776f726c64000000000000000000000000000000000000000000000000000000"
)[
0
],
'world'
);
parser
.
test
(
"0x"
+
"0000000000000000000000000000000000000000000000000000000000000005"
+
"68656c6c6f000000000000000000000000000000000000000000000000000000"
)[
0
],
'hello'
);
assert
.
equal
(
parser
.
test
(
"0x"
+
"0000000000000000000000000000000000000000000000000000000000000005"
+
"776f726c64000000000000000000000000000000000000000000000000000000"
)[
0
],
'world'
);
});
});
...
@@ -613,12 +654,21 @@ describe('abi', function() {
...
@@ -613,12 +654,21 @@ describe('abi', function() {
// then
// then
assert
.
equal
(
assert
.
equal
(
parser
.
test
(
"0x68656c6c6f000000000000000000000000000000000000000000000000000000776f726c64000000000000000000000000000000000000000000000000000000"
)[
0
],
parser
.
test
(
"0x"
+
"0000000000000000000000000000000000000000000000000000000000000005"
+
"0000000000000000000000000000000000000000000000000000000000000005"
+
"68656c6c6f000000000000000000000000000000000000000000000000000000"
+
"776f726c64000000000000000000000000000000000000000000000000000000"
)[
0
],
'hello'
'hello'
);
);
assert
.
equal
(
assert
.
equal
(
parser
.
test
(
"0x68656c6c6f000000000000000000000000000000000000000000000000000000776f726c64000000000000000000000000000000000000000000000000000000"
)[
1
],
parser
.
test
(
"0x"
+
'world'
);
"0000000000000000000000000000000000000000000000000000000000000005"
+
"0000000000000000000000000000000000000000000000000000000000000005"
+
"68656c6c6f000000000000000000000000000000000000000000000000000000"
+
"776f726c64000000000000000000000000000000000000000000000000000000"
)[
1
],
'world'
);
});
});
...
@@ -658,7 +708,38 @@ describe('abi', function() {
...
@@ -658,7 +708,38 @@ describe('abi', function() {
//then
//then
assert
.
equal
(
parser
.
test
(
"0000000000000000000000000000000000000000000000000000000000000001"
)[
0
],
1
);
assert
.
equal
(
parser
.
test
(
"0000000000000000000000000000000000000000000000000000000000000001"
)[
0
],
1
);
assert
.
equal
(
parser
.
test2
(
"0x68656c6c6f000000000000000000000000000000000000000000000000000000"
)[
0
],
"hello"
);
assert
.
equal
(
parser
.
test2
(
"0x"
+
"0000000000000000000000000000000000000000000000000000000000000005"
+
"68656c6c6f000000000000000000000000000000000000000000000000000000"
)[
0
],
"hello"
);
});
it
(
'should parse output array'
,
function
()
{
// given
var
d
=
clone
(
description
);
d
[
0
].
outputs
=
[
{
type
:
'int[]'
}
];
// when
var
parser
=
abi
.
outputParser
(
d
);
// then
assert
.
equal
(
parser
.
test
(
"0x"
+
"0000000000000000000000000000000000000000000000000000000000000002"
+
"0000000000000000000000000000000000000000000000000000000000000005"
+
"0000000000000000000000000000000000000000000000000000000000000006"
)[
0
][
0
],
5
);
assert
.
equal
(
parser
.
test
(
"0x"
+
"0000000000000000000000000000000000000000000000000000000000000002"
+
"0000000000000000000000000000000000000000000000000000000000000005"
+
"0000000000000000000000000000000000000000000000000000000000000006"
)[
0
][
1
],
6
);
});
});
...
...
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