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
61e8ae2f
Commit
61e8ae2f
authored
Jan 28, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
events init
parent
2544d2c9
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
5 deletions
+66
-5
ethereum.js
dist/ethereum.js
+36
-1
ethereum.js.map
dist/ethereum.js.map
+3
-3
ethereum.min.js
dist/ethereum.min.js
+1
-1
contract.js
lib/contract.js
+26
-0
No files found.
dist/ethereum.js
View file @
61e8ae2f
...
@@ -74,6 +74,14 @@ var filterFunctions = function (json) {
...
@@ -74,6 +74,14 @@ var filterFunctions = function (json) {
});
});
};
};
/// Filters all events form input abi
/// @returns abi array with filtered objects of type 'event'
var
filterEvents
=
function
(
json
)
{
return
json
.
filter
(
function
(
current
)
{
return
current
.
type
===
'event'
;
});
};
/// @param string string to be padded
/// @param string string to be padded
/// @param number of characters that result string should have
/// @param number of characters that result string should have
/// @param sign, by default 0
/// @param sign, by default 0
...
@@ -415,7 +423,8 @@ module.exports = {
...
@@ -415,7 +423,8 @@ module.exports = {
methodDisplayName
:
methodDisplayName
,
methodDisplayName
:
methodDisplayName
,
methodTypeName
:
methodTypeName
,
methodTypeName
:
methodTypeName
,
getMethodWithName
:
getMethodWithName
,
getMethodWithName
:
getMethodWithName
,
filterFunctions
:
filterFunctions
filterFunctions
:
filterFunctions
,
filterEvents
:
filterEvents
};
};
...
@@ -507,6 +516,7 @@ var contract = function (address, desc) {
...
@@ -507,6 +516,7 @@ var contract = function (address, desc) {
});
});
// create contract functions
abi
.
filterFunctions
(
desc
).
forEach
(
function
(
method
)
{
abi
.
filterFunctions
(
desc
).
forEach
(
function
(
method
)
{
var
displayName
=
abi
.
methodDisplayName
(
method
.
name
);
var
displayName
=
abi
.
methodDisplayName
(
method
.
name
);
...
@@ -561,6 +571,31 @@ var contract = function (address, desc) {
...
@@ -561,6 +571,31 @@ var contract = function (address, desc) {
});
});
// create contract events
abi
.
filterEvents
(
desc
).
forEach
(
function
(
event
)
{
// TODO: rename these methods, cause they are used not only for methods
var
displayName
=
abi
.
methodDisplayName
(
event
.
name
);
var
typeName
=
abi
.
methodTypeName
(
event
.
name
);
var
impl
=
function
(
options
)
{
var
o
=
options
||
{};
o
.
address
=
o
.
address
||
address
;
o
.
topics
=
o
.
topics
||
[];
o
.
topics
.
push
(
abi
.
methodSignature
(
event
.
name
));
return
web3
.
eth
.
watch
(
o
);
};
if
(
result
[
displayName
]
===
undefined
)
{
result
[
displayName
]
=
impl
;
}
result
[
displayName
][
typeName
]
=
impl
;
});
return
result
;
return
result
;
};
};
...
...
dist/ethereum.js.map
View file @
61e8ae2f
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
61e8ae2f
This diff is collapsed.
Click to expand it.
lib/contract.js
View file @
61e8ae2f
...
@@ -85,6 +85,7 @@ var contract = function (address, desc) {
...
@@ -85,6 +85,7 @@ var contract = function (address, desc) {
});
});
// create contract functions
abi
.
filterFunctions
(
desc
).
forEach
(
function
(
method
)
{
abi
.
filterFunctions
(
desc
).
forEach
(
function
(
method
)
{
var
displayName
=
abi
.
methodDisplayName
(
method
.
name
);
var
displayName
=
abi
.
methodDisplayName
(
method
.
name
);
...
@@ -139,6 +140,31 @@ var contract = function (address, desc) {
...
@@ -139,6 +140,31 @@ var contract = function (address, desc) {
});
});
// create contract events
abi
.
filterEvents
(
desc
).
forEach
(
function
(
event
)
{
// TODO: rename these methods, cause they are used not only for methods
var
displayName
=
abi
.
methodDisplayName
(
event
.
name
);
var
typeName
=
abi
.
methodTypeName
(
event
.
name
);
var
impl
=
function
(
options
)
{
var
o
=
options
||
{};
o
.
address
=
o
.
address
||
address
;
o
.
topics
=
o
.
topics
||
[];
o
.
topics
.
push
(
abi
.
methodSignature
(
event
.
name
));
return
web3
.
eth
.
watch
(
o
);
};
if
(
result
[
displayName
]
===
undefined
)
{
result
[
displayName
]
=
impl
;
}
result
[
displayName
][
typeName
]
=
impl
;
});
return
result
;
return
result
;
};
};
...
...
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