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
c966a5c1
Commit
c966a5c1
authored
Nov 14, 2014
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6 from frewsxcv/master
Run JSHint on all code using Travis CI
parents
e84fa8d4
e3998e30
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
21 deletions
+26
-21
.travis.yml
.travis.yml
+7
-0
README.md
README.md
+2
-0
httprpc.js
httprpc.js
+4
-4
main.js
main.js
+11
-15
qt.js
qt.js
+1
-1
websocket.js
websocket.js
+1
-1
No files found.
.travis.yml
0 → 100644
View file @
c966a5c1
language
:
node_js
node_js
:
-
"
0.11"
install
:
-
"
npm
install
jshint"
script
:
-
"
jshint
*.js"
README.md
View file @
c966a5c1
# Ethereum JavaScript API
# Ethereum JavaScript API
[

](https://travis-ci.org/ethereum/ethereum.js)
This is the Ethereum compatible JavaScript API using
`Promise`
s
This is the Ethereum compatible JavaScript API using
`Promise`
s
which implements the
[
Generic JSON RPC
](
https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC
)
spec.
which implements the
[
Generic JSON RPC
](
https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC
)
spec.
...
...
httprpc.js
View file @
c966a5c1
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
method
:
object
.
call
,
method
:
object
.
call
,
params
:
object
.
args
,
params
:
object
.
args
,
id
:
object
.
_id
id
:
object
.
_id
}
}
;
}
;
}
function
formatJsonRpcMessage
(
message
)
{
function
formatJsonRpcMessage
(
message
)
{
var
object
=
JSON
.
parse
(
message
);
var
object
=
JSON
.
parse
(
message
);
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
_id
:
object
.
id
,
_id
:
object
.
id
,
data
:
object
.
result
data
:
object
.
result
};
};
}
;
}
HttpRpcProvider
.
prototype
.
sendRequest
=
function
(
payload
,
cb
)
{
HttpRpcProvider
.
prototype
.
sendRequest
=
function
(
payload
,
cb
)
{
var
data
=
formatJsonRpcObject
(
payload
);
var
data
=
formatJsonRpcObject
(
payload
);
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
if
(
request
.
readyState
===
4
&&
cb
)
{
if
(
request
.
readyState
===
4
&&
cb
)
{
cb
(
request
);
cb
(
request
);
}
}
}
}
;
};
};
HttpRpcProvider
.
prototype
.
send
=
function
(
payload
)
{
HttpRpcProvider
.
prototype
.
send
=
function
(
payload
)
{
...
...
main.js
View file @
c966a5c1
(
function
(
window
)
{
(
function
(
window
)
{
function
isPromise
(
o
)
{
function
isPromise
(
o
)
{
return
o
instanceof
Promise
return
o
instanceof
Promise
;
}
}
function
flattenPromise
(
obj
)
{
function
flattenPromise
(
obj
)
{
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
}
}
return
Promise
.
resolve
(
obj
);
return
Promise
.
resolve
(
obj
);
}
;
}
var
ethMethods
=
function
()
{
var
ethMethods
=
function
()
{
var
blockCall
=
function
(
args
)
{
var
blockCall
=
function
(
args
)
{
...
@@ -171,7 +171,7 @@
...
@@ -171,7 +171,7 @@
}).
catch
(
function
(
err
)
{
}).
catch
(
function
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
});
});
}
}
;
}
}
Object
.
defineProperty
(
obj
,
property
.
name
,
proto
);
Object
.
defineProperty
(
obj
,
property
.
name
,
proto
);
});
});
...
@@ -196,8 +196,8 @@
...
@@ -196,8 +196,8 @@
var
str
=
""
;
var
str
=
""
;
var
i
=
0
,
l
=
hex
.
length
;
var
i
=
0
,
l
=
hex
.
length
;
for
(;
i
<
l
;
i
+=
2
)
{
for
(;
i
<
l
;
i
+=
2
)
{
var
code
=
hex
.
charCodeAt
(
i
)
var
code
=
hex
.
charCodeAt
(
i
)
;
if
(
code
==
0
)
{
if
(
code
==
=
0
)
{
break
;
break
;
}
}
...
@@ -216,22 +216,18 @@
...
@@ -216,22 +216,18 @@
var
hex
=
this
.
toHex
(
str
);
var
hex
=
this
.
toHex
(
str
);
while
(
hex
.
length
<
pad
*
2
)
while
(
hex
.
length
<
pad
*
2
)
hex
+=
"00"
;
hex
+=
"00"
;
return
hex
return
hex
;
},
},
eth
:
{
eth
:
{
prototype
:
Object
(),
watch
:
function
(
params
)
{
watch
:
function
(
params
)
{
return
new
Filter
(
params
,
ethWatch
);
return
new
Filter
(
params
,
ethWatch
);
},
},
},
},
db
:
{
db
:
{},
prototype
:
Object
()
},
shh
:
{
shh
:
{
prototype
:
Object
(),
watch
:
function
(
params
)
{
watch
:
function
(
params
)
{
return
new
Filter
(
params
,
shhWatch
);
return
new
Filter
(
params
,
shhWatch
);
}
}
...
@@ -243,7 +239,7 @@
...
@@ -243,7 +239,7 @@
}
}
web3
.
_events
[
event
][
id
]
=
cb
;
web3
.
_events
[
event
][
id
]
=
cb
;
return
this
return
this
;
},
},
off
:
function
(
event
,
id
)
{
off
:
function
(
event
,
id
)
{
...
@@ -251,7 +247,7 @@
...
@@ -251,7 +247,7 @@
delete
web3
.
_events
[
event
][
id
];
delete
web3
.
_events
[
event
][
id
];
}
}
return
this
return
this
;
},
},
trigger
:
function
(
event
,
id
,
data
)
{
trigger
:
function
(
event
,
id
,
data
)
{
...
@@ -376,7 +372,7 @@
...
@@ -376,7 +372,7 @@
Filter
.
prototype
.
arrived
=
function
(
callback
)
{
Filter
.
prototype
.
arrived
=
function
(
callback
)
{
this
.
changed
(
callback
);
this
.
changed
(
callback
);
}
}
;
Filter
.
prototype
.
changed
=
function
(
callback
)
{
Filter
.
prototype
.
changed
=
function
(
callback
)
{
var
self
=
this
;
var
self
=
this
;
...
@@ -416,7 +412,7 @@
...
@@ -416,7 +412,7 @@
if
(
data
.
_id
)
{
if
(
data
.
_id
)
{
var
cb
=
web3
.
_callbacks
[
data
.
_id
];
var
cb
=
web3
.
_callbacks
[
data
.
_id
];
if
(
cb
)
{
if
(
cb
)
{
cb
.
call
(
this
,
data
.
data
)
cb
.
call
(
this
,
data
.
data
)
;
delete
web3
.
_callbacks
[
data
.
_id
];
delete
web3
.
_callbacks
[
data
.
_id
];
}
}
}
}
...
...
qt.js
View file @
c966a5c1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
self
.
handlers
.
forEach
(
function
(
handler
)
{
self
.
handlers
.
forEach
(
function
(
handler
)
{
handler
.
call
(
self
,
JSON
.
parse
(
message
.
data
));
handler
.
call
(
self
,
JSON
.
parse
(
message
.
data
));
});
});
}
}
;
};
};
QtProvider
.
prototype
.
send
=
function
(
payload
)
{
QtProvider
.
prototype
.
send
=
function
(
payload
)
{
...
...
websocket.js
View file @
c966a5c1
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
var
self
=
this
;
var
self
=
this
;
this
.
ws
.
onmessage
=
function
(
event
)
{
this
.
ws
.
onmessage
=
function
(
event
)
{
for
(
var
i
=
0
;
i
<
self
.
handlers
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
self
.
handlers
.
length
;
i
++
)
{
self
.
handlers
[
i
].
call
(
self
,
JSON
.
parse
(
event
.
data
),
event
)
self
.
handlers
[
i
].
call
(
self
,
JSON
.
parse
(
event
.
data
),
event
)
;
}
}
};
};
...
...
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