Merge pull request #7051 from paritytech/td-jsonrpc-bump

Bump JSON-RPC version
This commit is contained in:
Marek Kotewicz 2017-11-14 15:43:26 +01:00 committed by GitHub
commit 5a76d35ca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 683 additions and 700 deletions

95
Cargo.lock generated
View File

@ -710,9 +710,9 @@ dependencies = [
"ethcore-logger 1.9.0", "ethcore-logger 1.9.0",
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"hash 0.1.0", "hash 0.1.0",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-tcp-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-tcp-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1237,7 +1237,7 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-core" name = "jsonrpc-core"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1249,11 +1249,11 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-http-server" name = "jsonrpc-http-server"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"hyper 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1262,10 +1262,10 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-ipc-server" name = "jsonrpc-ipc-server"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-tokio-ipc 0.1.5 (git+https://github.com/nikvolf/parity-tokio-ipc)", "parity-tokio-ipc 0.1.5 (git+https://github.com/nikvolf/parity-tokio-ipc)",
"tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1274,19 +1274,19 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-macros" name = "jsonrpc-macros"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "jsonrpc-pubsub" name = "jsonrpc-pubsub"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1294,11 +1294,11 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-server-utils" name = "jsonrpc-server-utils"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"globset 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "globset 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1307,10 +1307,10 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-tcp-server" name = "jsonrpc-tcp-server"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1319,10 +1319,11 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-ws-server" name = "jsonrpc-ws-server"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8#cf6f3481760f6ee8fbef7a987954ffc720ff4acf" source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9#8f921ed65cda3fba0ce55d31ed62c7f0c3b32966"
dependencies = [ dependencies = [
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1924,7 +1925,7 @@ dependencies = [
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
"isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"journaldb 0.1.0", "journaldb 0.1.0",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"kvdb 0.1.0", "kvdb 0.1.0",
"kvdb-rocksdb 0.1.0", "kvdb-rocksdb 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1978,8 +1979,8 @@ dependencies = [
"futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"hash 0.1.0", "hash 0.1.0",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2057,8 +2058,8 @@ dependencies = [
"ethcore-bigint 0.2.1", "ethcore-bigint 0.2.1",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-util 1.9.0", "ethcore-util 1.9.0",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.0", "rlp 0.2.0",
"unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2125,12 +2126,12 @@ dependencies = [
"hardware-wallet 1.9.0", "hardware-wallet 1.9.0",
"hash 0.1.0", "hash 0.1.0",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-ipc-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-ipc-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"kvdb-memorydb 0.1.0", "kvdb-memorydb 0.1.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"macros 0.1.0", "macros 0.1.0",
@ -2162,8 +2163,8 @@ version = "1.4.0"
dependencies = [ dependencies = [
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"hash 0.1.0", "hash 0.1.0",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-rpc 1.9.0", "parity-rpc 1.9.0",
@ -2272,9 +2273,9 @@ dependencies = [
"ethcrypto 0.1.0", "ethcrypto 0.1.0",
"ethkey 0.2.0", "ethkey 0.2.0",
"hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)", "jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ordered-float 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3585,14 +3586,14 @@ dependencies = [
"checksum isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fa500db770a99afe2a0f2229be2a3d09c7ed9d7e4e8440bf71253141994e240f" "checksum isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fa500db770a99afe2a0f2229be2a3d09c7ed9d7e4e8440bf71253141994e240f"
"checksum itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4833d6978da405305126af4ac88569b5d71ff758581ce5a987dbfa3755f694fc" "checksum itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4833d6978da405305126af4ac88569b5d71ff758581ce5a987dbfa3755f694fc"
"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
"checksum jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-http-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-ipc-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-ipc-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-tcp-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-tcp-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)" = "<none>" "checksum jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.9)" = "<none>"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"

View File

@ -31,7 +31,7 @@ futures-cpupool = "0.1"
fdlimit = "0.1" fdlimit = "0.1"
ws2_32-sys = "0.2" ws2_32-sys = "0.2"
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" } ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
ethsync = { path = "sync" } ethsync = { path = "sync" }
ethcore = { path = "ethcore" } ethcore = { path = "ethcore" }
ethcore-util = { path = "util" } ethcore-util = { path = "util" }

View File

@ -25,8 +25,8 @@ unicase = "1.4"
zip = { version = "0.1", default-features = false } zip = { version = "0.1", default-features = false }
itertools = "0.5" itertools = "0.5"
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore-bigint = { path = "../util/bigint" } ethcore-bigint = { path = "../util/bigint" }

View File

@ -18,7 +18,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::BoxFuture; use futures::Future;
use hyper; use hyper;
#[derive(Debug, PartialEq, Default, Clone)] #[derive(Debug, PartialEq, Default, Clone)]
@ -47,7 +47,7 @@ pub struct EndpointInfo {
} }
pub type Endpoints = BTreeMap<String, Box<Endpoint>>; pub type Endpoints = BTreeMap<String, Box<Endpoint>>;
pub type Response = BoxFuture<hyper::Response, hyper::Error>; pub type Response = Box<Future<Item=hyper::Response, Error=hyper::Error> + Send>;
pub type Request = hyper::Request; pub type Request = hyper::Request;
pub trait Endpoint : Send + Sync { pub trait Endpoint : Send + Sync {

View File

@ -24,7 +24,6 @@ use fetch::{self, Fetch};
use futures::sync::oneshot; use futures::sync::oneshot;
use futures::{self, Future}; use futures::{self, Future};
use hyper::{self, Method, StatusCode}; use hyper::{self, Method, StatusCode};
use jsonrpc_core::BoxFuture;
use parking_lot::Mutex; use parking_lot::Mutex;
use endpoint::{self, EndpointPath}; use endpoint::{self, EndpointPath};
@ -212,7 +211,7 @@ impl Errors {
enum FetchState { enum FetchState {
Error(ContentHandler), Error(ContentHandler),
InProgress(BoxFuture<FetchState, ()>), InProgress(Box<Future<Item=FetchState, Error=()> + Send>),
Streaming(hyper::Response), Streaming(hyper::Response),
Done(local::Dapp, endpoint::Response), Done(local::Dapp, endpoint::Response),
Empty, Empty,
@ -289,7 +288,7 @@ impl ContentFetcherHandler {
path: EndpointPath, path: EndpointPath,
errors: Errors, errors: Errors,
installer: H, installer: H,
) -> BoxFuture<FetchState, ()> { ) -> Box<Future<Item=FetchState, Error=()> + Send> {
// Start fetching the content // Start fetching the content
let fetch2 = fetch.clone(); let fetch2 = fetch.clone();
let future = fetch.fetch_with_abort(url, abort.into()).then(move |result| { let future = fetch.fetch_with_abort(url, abort.into()).then(move |result| {

View File

@ -32,7 +32,6 @@ extern crate serde_json;
extern crate unicase; extern crate unicase;
extern crate zip; extern crate zip;
extern crate jsonrpc_core;
extern crate jsonrpc_http_server; extern crate jsonrpc_http_server;
extern crate ethcore_util as util; extern crate ethcore_util as util;
@ -52,10 +51,12 @@ extern crate log;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
#[cfg(test)]
extern crate env_logger;
#[cfg(test)] #[cfg(test)]
extern crate ethcore_devtools as devtools; extern crate ethcore_devtools as devtools;
#[cfg(test)] #[cfg(test)]
extern crate env_logger; extern crate jsonrpc_core;
#[cfg(test)] #[cfg(test)]
extern crate parity_reactor; extern crate parity_reactor;

View File

@ -14,8 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::env; use std::{env, io, str};
use std::str;
use std::net::SocketAddr; use std::net::SocketAddr;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::Arc; use std::sync::Arc;
@ -187,7 +186,7 @@ impl<T: Fetch> ServerBuilder<T> {
/// Asynchronously start server with no authentication, /// Asynchronously start server with no authentication,
/// returns result with `Server` handle on success or an error. /// returns result with `Server` handle on success or an error.
pub fn start_unsecured_http(self, addr: &SocketAddr, io: IoHandler) -> Result<Server, http::Error> { pub fn start_unsecured_http(self, addr: &SocketAddr, io: IoHandler) -> io::Result<Server> {
let fetch = self.fetch_client(); let fetch = self.fetch_client();
Server::start_http( Server::start_http(
addr, addr,
@ -234,7 +233,7 @@ impl Server {
remote: Remote, remote: Remote,
fetch: F, fetch: F,
serve_ui: bool, serve_ui: bool,
) -> Result<Server, http::Error> { ) -> io::Result<Server> {
let health = NodeHealth::new( let health = NodeHealth::new(
sync_status.clone(), sync_status.clone(),
TimeChecker::new::<String>(&[], CpuPool::new(1)), TimeChecker::new::<String>(&[], CpuPool::new(1)),

View File

@ -10,8 +10,8 @@ ethcore = { path = "../ethcore" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore-bigint = { path = "../util/bigint" } ethcore-bigint = { path = "../util/bigint" }
ethcore-bytes = { path = "../util/bytes" } ethcore-bytes = { path = "../util/bytes" }
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
rlp = { path = "../util/rlp" } rlp = { path = "../util/rlp" }
cid = "0.2" cid = "0.2"
multihash = "0.6" multihash = "0.6"

View File

@ -22,7 +22,6 @@ use ethcore::client::{Client, BlockChainClient, BlockId};
use ethcore::transaction::{Transaction, Action}; use ethcore::transaction::{Transaction, Action};
use ethsync::LightSync; use ethsync::LightSync;
use futures::{future, IntoFuture, Future}; use futures::{future, IntoFuture, Future};
use jsonrpc_core::BoxFuture;
use hash_fetch::fetch::Client as FetchClient; use hash_fetch::fetch::Client as FetchClient;
use hash_fetch::urlhint::ContractClient; use hash_fetch::urlhint::ContractClient;
use helpers::replace_home; use helpers::replace_home;
@ -80,7 +79,7 @@ impl ContractClient for FullRegistrar {
}) })
} }
fn call(&self, address: Address, data: Bytes) -> BoxFuture<Bytes, String> { fn call(&self, address: Address, data: Bytes) -> Box<Future<Item=Bytes, Error=String> + Send> {
Box::new(self.client.call_contract(BlockId::Latest, address, data) Box::new(self.client.call_contract(BlockId::Latest, address, data)
.into_future()) .into_future())
} }
@ -105,7 +104,7 @@ impl<T: LightChainClient + 'static> ContractClient for LightRegistrar<T> {
}) })
} }
fn call(&self, address: Address, data: Bytes) -> BoxFuture<Bytes, String> { fn call(&self, address: Address, data: Bytes) -> Box<Future<Item=Bytes, Error=String> + Send> {
let header = self.client.best_block_header(); let header = self.client.best_block_header();
let env_info = self.client.env_info(BlockId::Hash(header.hash())) let env_info = self.client.env_info(BlockId::Hash(header.hash()))
.ok_or_else(|| format!("Cannot fetch env info for header {}", header.hash())); .ok_or_else(|| format!("Cannot fetch env info for header {}", header.hash()));

View File

@ -246,7 +246,7 @@ pub fn new_ws<D: rpc_apis::Dependencies>(
match start_result { match start_result {
Ok(server) => Ok(Some(server)), Ok(server) => Ok(Some(server)),
Err(rpc::ws::Error::Io(ref err)) if err.kind() == io::ErrorKind::AddrInUse => Err( Err(rpc::ws::Error(rpc::ws::ErrorKind::Io(ref err), _)) if err.kind() == io::ErrorKind::AddrInUse => Err(
format!("WebSockets address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --ws-port and --ws-interface options.", url) format!("WebSockets address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --ws-port and --ws-interface options.", url)
), ),
Err(e) => Err(format!("WebSockets error: {:?}", e)), Err(e) => Err(format!("WebSockets error: {:?}", e)),
@ -286,7 +286,7 @@ pub fn new_http<D: rpc_apis::Dependencies>(
match start_result { match start_result {
Ok(server) => Ok(Some(server)), Ok(server) => Ok(Some(server)),
Err(rpc::HttpServerError::Io(ref err)) if err.kind() == io::ErrorKind::AddrInUse => Err( Err(ref err) if err.kind() == io::ErrorKind::AddrInUse => Err(
format!("{} address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --{}-port and --{}-interface options.", id, url, options, options) format!("{} address {} is already in use, make sure that another instance of an Ethereum client is not running or change the address using the --{}-port and --{}-interface options.", id, url, options, options)
), ),
Err(e) => Err(format!("{} error: {:?}", id, e)), Err(e) => Err(format!("{} error: {:?}", id, e)),

View File

@ -28,12 +28,12 @@ tokio-timer = "0.1"
transient-hashmap = "0.4" transient-hashmap = "0.4"
itertools = "0.5" itertools = "0.5"
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-ipc-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-ipc-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
ethcore-io = { path = "../util/io" } ethcore-io = { path = "../util/io" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }

View File

@ -117,26 +117,6 @@ use http::tokio_core;
/// RPC HTTP Server instance /// RPC HTTP Server instance
pub type HttpServer = http::Server; pub type HttpServer = http::Server;
/// RPC HTTP Server error
#[derive(Debug)]
pub enum HttpServerError {
/// IO error
Io(::std::io::Error),
/// Other hyper error
Hyper(hyper::Error),
}
impl From<http::Error> for HttpServerError {
fn from(e: http::Error) -> Self {
use self::HttpServerError::*;
match e {
http::Error::Io(io) => Io(io),
http::Error::Other(hyper) => Hyper(hyper),
}
}
}
/// Start http server asynchronously and returns result with `Server` handle on success or an error. /// Start http server asynchronously and returns result with `Server` handle on success or an error.
pub fn start_http<M, S, H, T, R>( pub fn start_http<M, S, H, T, R>(
addr: &SocketAddr, addr: &SocketAddr,
@ -147,7 +127,7 @@ pub fn start_http<M, S, H, T, R>(
extractor: T, extractor: T,
middleware: Option<R>, middleware: Option<R>,
threads: usize, threads: usize,
) -> Result<HttpServer, HttpServerError> where ) -> ::std::io::Result<HttpServer> where
M: jsonrpc_core::Metadata, M: jsonrpc_core::Metadata,
S: jsonrpc_core::Middleware<M>, S: jsonrpc_core::Middleware<M>,
H: Into<jsonrpc_core::MetaIoHandler<M, S>>, H: Into<jsonrpc_core::MetaIoHandler<M, S>>,

View File

@ -42,7 +42,7 @@ use ethcore::transaction::{Action, SignedTransaction, PendingTransaction, Transa
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use crypto::DEFAULT_MAC; use crypto::DEFAULT_MAC;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result, Error};
use jsonrpc_core::futures::{future, Future, Poll, Async}; use jsonrpc_core::futures::{future, Future, Poll, Async};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use v1::helpers::{errors, nonce, TransactionRequest, FilledTransactionRequest, ConfirmationPayload}; use v1::helpers::{errors, nonce, TransactionRequest, FilledTransactionRequest, ConfirmationPayload};
@ -67,18 +67,18 @@ pub trait Dispatcher: Send + Sync + Clone {
/// Fill optional fields of a transaction request, fetching gas price but not nonce. /// Fill optional fields of a transaction request, fetching gas price but not nonce.
fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool) fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool)
-> BoxFuture<FilledTransactionRequest, Error>; -> BoxFuture<FilledTransactionRequest>;
/// Sign the given transaction request without dispatching, fetching appropriate nonce. /// Sign the given transaction request without dispatching, fetching appropriate nonce.
fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith) fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith)
-> BoxFuture<WithToken<SignedTransaction>, Error>; -> BoxFuture<WithToken<SignedTransaction>>;
/// Converts a `SignedTransaction` into `RichRawTransaction` /// Converts a `SignedTransaction` into `RichRawTransaction`
fn enrich(&self, SignedTransaction) -> RpcRichRawTransaction; fn enrich(&self, SignedTransaction) -> RpcRichRawTransaction;
/// "Dispatch" a local transaction. /// "Dispatch" a local transaction.
fn dispatch_transaction(&self, signed_transaction: PendingTransaction) fn dispatch_transaction(&self, signed_transaction: PendingTransaction)
-> Result<H256, Error>; -> Result<H256>;
} }
/// A dispatcher which uses references to a client and miner in order to sign /// A dispatcher which uses references to a client and miner in order to sign
@ -122,7 +122,7 @@ impl<C: MiningBlockChainClient, M: MinerService> FullDispatcher<C, M> {
} }
/// Imports transaction to the miner's queue. /// Imports transaction to the miner's queue.
pub fn dispatch_transaction(client: &C, miner: &M, signed_transaction: PendingTransaction) -> Result<H256, Error> { pub fn dispatch_transaction(client: &C, miner: &M, signed_transaction: PendingTransaction) -> Result<H256> {
let hash = signed_transaction.transaction.hash(); let hash = signed_transaction.transaction.hash();
miner.import_own_transaction(client, signed_transaction) miner.import_own_transaction(client, signed_transaction)
@ -133,7 +133,7 @@ impl<C: MiningBlockChainClient, M: MinerService> FullDispatcher<C, M> {
impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C, M> { impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C, M> {
fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool) fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool)
-> BoxFuture<FilledTransactionRequest, Error> -> BoxFuture<FilledTransactionRequest>
{ {
let request = request; let request = request;
let from = request.from.unwrap_or(default_sender); let from = request.from.unwrap_or(default_sender);
@ -157,7 +157,7 @@ impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C
} }
fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith) fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith)
-> BoxFuture<WithToken<SignedTransaction>, Error> -> BoxFuture<WithToken<SignedTransaction>>
{ {
let chain_id = self.client.signing_chain_id(); let chain_id = self.client.signing_chain_id();
@ -176,7 +176,7 @@ impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C
RpcRichRawTransaction::from_signed(signed_transaction, block_number, self.client.eip86_transition()) RpcRichRawTransaction::from_signed(signed_transaction, block_number, self.client.eip86_transition())
} }
fn dispatch_transaction(&self, signed_transaction: PendingTransaction) -> Result<H256, Error> { fn dispatch_transaction(&self, signed_transaction: PendingTransaction) -> Result<H256> {
Self::dispatch_transaction(&*self.client, &*self.miner, signed_transaction) Self::dispatch_transaction(&*self.client, &*self.miner, signed_transaction)
} }
} }
@ -188,7 +188,7 @@ pub fn fetch_gas_price_corpus(
client: Arc<LightChainClient>, client: Arc<LightChainClient>,
on_demand: Arc<OnDemand>, on_demand: Arc<OnDemand>,
cache: Arc<Mutex<LightDataCache>>, cache: Arc<Mutex<LightDataCache>>,
) -> BoxFuture<Corpus<U256>, Error> { ) -> BoxFuture<Corpus<U256>> {
const GAS_PRICE_SAMPLE_SIZE: usize = 100; const GAS_PRICE_SAMPLE_SIZE: usize = 100;
if let Some(cached) = { cache.lock().gas_price_corpus() } { if let Some(cached) = { cache.lock().gas_price_corpus() } {
@ -284,7 +284,7 @@ impl LightDispatcher {
/// Get a recent gas price corpus. /// Get a recent gas price corpus.
// TODO: this could be `impl Trait`. // TODO: this could be `impl Trait`.
pub fn gas_price_corpus(&self) -> BoxFuture<Corpus<U256>, Error> { pub fn gas_price_corpus(&self) -> BoxFuture<Corpus<U256>> {
fetch_gas_price_corpus( fetch_gas_price_corpus(
self.sync.clone(), self.sync.clone(),
self.client.clone(), self.client.clone(),
@ -294,7 +294,7 @@ impl LightDispatcher {
} }
/// Get an account's next nonce. /// Get an account's next nonce.
pub fn next_nonce(&self, addr: Address) -> BoxFuture<U256, Error> { pub fn next_nonce(&self, addr: Address) -> BoxFuture<U256> {
// fast path where we don't go to network; nonce provided or can be gotten from queue. // fast path where we don't go to network; nonce provided or can be gotten from queue.
let maybe_nonce = self.transaction_queue.read().next_nonce(&addr); let maybe_nonce = self.transaction_queue.read().next_nonce(&addr);
if let Some(nonce) = maybe_nonce { if let Some(nonce) = maybe_nonce {
@ -320,7 +320,7 @@ impl LightDispatcher {
impl Dispatcher for LightDispatcher { impl Dispatcher for LightDispatcher {
fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool) fn fill_optional_fields(&self, request: TransactionRequest, default_sender: Address, force_nonce: bool)
-> BoxFuture<FilledTransactionRequest, Error> -> BoxFuture<FilledTransactionRequest>
{ {
const DEFAULT_GAS_PRICE: U256 = U256([0, 0, 0, 21_000_000]); const DEFAULT_GAS_PRICE: U256 = U256([0, 0, 0, 21_000_000]);
@ -374,7 +374,7 @@ impl Dispatcher for LightDispatcher {
} }
fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith) fn sign(&self, accounts: Arc<AccountProvider>, filled: FilledTransactionRequest, password: SignWith)
-> BoxFuture<WithToken<SignedTransaction>, Error> -> BoxFuture<WithToken<SignedTransaction>>
{ {
let chain_id = self.client.signing_chain_id(); let chain_id = self.client.signing_chain_id();
@ -398,7 +398,7 @@ impl Dispatcher for LightDispatcher {
RpcRichRawTransaction::from_signed(signed_transaction, block_number, self.client.eip86_transition()) RpcRichRawTransaction::from_signed(signed_transaction, block_number, self.client.eip86_transition())
} }
fn dispatch_transaction(&self, signed_transaction: PendingTransaction) -> Result<H256, Error> { fn dispatch_transaction(&self, signed_transaction: PendingTransaction) -> Result<H256> {
let hash = signed_transaction.transaction.hash(); let hash = signed_transaction.transaction.hash();
self.transaction_queue.write().import(signed_transaction) self.transaction_queue.write().import(signed_transaction)
@ -414,7 +414,7 @@ fn sign_transaction(
chain_id: Option<u64>, chain_id: Option<u64>,
nonce: U256, nonce: U256,
password: SignWith, password: SignWith,
) -> Result<WithToken<SignedTransaction>, Error> { ) -> Result<WithToken<SignedTransaction>> {
let t = Transaction { let t = Transaction {
nonce: nonce, nonce: nonce,
action: filled.to.map_or(Action::Create, Action::Call), action: filled.to.map_or(Action::Create, Action::Call),
@ -451,7 +451,7 @@ struct ProspectiveSigner {
reserved: nonce::Reserved, reserved: nonce::Reserved,
password: SignWith, password: SignWith,
state: ProspectiveSignerState, state: ProspectiveSignerState,
prospective: Option<Result<WithToken<SignedTransaction>, Error>>, prospective: Option<Result<WithToken<SignedTransaction>>>,
ready: Option<nonce::Ready>, ready: Option<nonce::Ready>,
} }
@ -485,7 +485,7 @@ impl ProspectiveSigner {
} }
} }
fn sign(&self, nonce: &U256) -> Result<WithToken<SignedTransaction>, Error> { fn sign(&self, nonce: &U256) -> Result<WithToken<SignedTransaction>> {
sign_transaction( sign_transaction(
&*self.accounts, &*self.accounts,
self.filled.clone(), self.filled.clone(),
@ -643,7 +643,7 @@ pub fn execute<D: Dispatcher + 'static>(
accounts: Arc<AccountProvider>, accounts: Arc<AccountProvider>,
payload: ConfirmationPayload, payload: ConfirmationPayload,
pass: SignWith pass: SignWith
) -> BoxFuture<WithToken<ConfirmationResponse>, Error> { ) -> BoxFuture<WithToken<ConfirmationResponse>> {
match payload { match payload {
ConfirmationPayload::SendTransaction(request) => { ConfirmationPayload::SendTransaction(request) => {
let condition = request.condition.clone().map(Into::into); let condition = request.condition.clone().map(Into::into);
@ -694,7 +694,7 @@ pub fn execute<D: Dispatcher + 'static>(
} }
} }
fn signature(accounts: &AccountProvider, address: Address, hash: H256, password: SignWith) -> Result<WithToken<Signature>, Error> { fn signature(accounts: &AccountProvider, address: Address, hash: H256, password: SignWith) -> Result<WithToken<Signature>> {
match password.clone() { match password.clone() {
SignWith::Nothing => accounts.sign(address, None, hash).map(WithToken::No), SignWith::Nothing => accounts.sign(address, None, hash).map(WithToken::No),
SignWith::Password(pass) => accounts.sign(address, Some(pass), hash).map(WithToken::No), SignWith::Password(pass) => accounts.sign(address, Some(pass), hash).map(WithToken::No),
@ -707,7 +707,7 @@ fn signature(accounts: &AccountProvider, address: Address, hash: H256, password:
// obtain a hardware signature from the given account. // obtain a hardware signature from the given account.
fn hardware_signature(accounts: &AccountProvider, address: Address, t: Transaction, chain_id: Option<u64>) fn hardware_signature(accounts: &AccountProvider, address: Address, t: Transaction, chain_id: Option<u64>)
-> Result<SignedTransaction, Error> -> Result<SignedTransaction>
{ {
debug_assert!(accounts.is_hardware_address(&address)); debug_assert!(accounts.is_hardware_address(&address));
@ -726,7 +726,7 @@ fn hardware_signature(accounts: &AccountProvider, address: Address, t: Transacti
}) })
} }
fn decrypt(accounts: &AccountProvider, address: Address, msg: Bytes, password: SignWith) -> Result<WithToken<Bytes>, Error> { fn decrypt(accounts: &AccountProvider, address: Address, msg: Bytes, password: SignWith) -> Result<WithToken<Bytes>> {
match password.clone() { match password.clone() {
SignWith::Nothing => accounts.decrypt(address, None, &DEFAULT_MAC, &msg).map(WithToken::No), SignWith::Nothing => accounts.decrypt(address, None, &DEFAULT_MAC, &msg).map(WithToken::No),
SignWith::Password(pass) => accounts.decrypt(address, Some(pass), &DEFAULT_MAC, &msg).map(WithToken::No), SignWith::Password(pass) => accounts.decrypt(address, Some(pass), &DEFAULT_MAC, &msg).map(WithToken::No),
@ -747,7 +747,7 @@ pub fn default_gas_price<C, M>(client: &C, miner: &M) -> U256 where
/// Convert RPC confirmation payload to signer confirmation payload. /// Convert RPC confirmation payload to signer confirmation payload.
/// May need to resolve in the future to fetch things like gas price. /// May need to resolve in the future to fetch things like gas price.
pub fn from_rpc<D>(payload: RpcConfirmationPayload, default_account: Address, dispatcher: &D) -> BoxFuture<ConfirmationPayload, Error> pub fn from_rpc<D>(payload: RpcConfirmationPayload, default_account: Address, dispatcher: &D) -> BoxFuture<ConfirmationPayload>
where D: Dispatcher where D: Dispatcher
{ {
match payload { match payload {

View File

@ -26,7 +26,7 @@ use ethcore::filter::Filter as EthcoreFilter;
use ethcore::transaction::{Action, Transaction as EthTransaction, SignedTransaction, LocalizedTransaction}; use ethcore::transaction::{Action, Transaction as EthTransaction, SignedTransaction, LocalizedTransaction};
use ethcore::receipt::Receipt; use ethcore::receipt::Receipt;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
@ -87,7 +87,7 @@ pub fn extract_transaction_at_index(block: encoded::Block, index: usize, eip86_t
/// Type alias for convenience. /// Type alias for convenience.
pub type ExecutionResult = Result<Executed, ExecutionError>; pub type ExecutionResult = ::std::result::Result<Executed, ExecutionError>;
// extract the header indicated by the given `HeaderRef` from the given responses. // extract the header indicated by the given `HeaderRef` from the given responses.
// fails only if they do not correspond. // fails only if they do not correspond.
@ -104,7 +104,7 @@ fn extract_header(res: &[OnDemandResponse], header: HeaderRef) -> Option<encoded
impl LightFetch { impl LightFetch {
// push the necessary requests onto the request chain to get the header by the given ID. // push the necessary requests onto the request chain to get the header by the given ID.
// yield a header reference which other requests can use. // yield a header reference which other requests can use.
fn make_header_requests(&self, id: BlockId, reqs: &mut Vec<OnDemandRequest>) -> Result<HeaderRef, Error> { fn make_header_requests(&self, id: BlockId, reqs: &mut Vec<OnDemandRequest>) -> Result<HeaderRef> {
if let Some(h) = self.client.block_header(id) { if let Some(h) = self.client.block_header(id) {
return Ok(h.into()); return Ok(h.into());
} }
@ -138,7 +138,7 @@ impl LightFetch {
} }
/// Get a block header from the on demand service or client, or error. /// Get a block header from the on demand service or client, or error.
pub fn header(&self, id: BlockId) -> BoxFuture<encoded::Header, Error> { pub fn header(&self, id: BlockId) -> BoxFuture<encoded::Header> {
let mut reqs = Vec::new(); let mut reqs = Vec::new();
let header_ref = match self.make_header_requests(id, &mut reqs) { let header_ref = match self.make_header_requests(id, &mut reqs) {
Ok(r) => r, Ok(r) => r,
@ -162,7 +162,7 @@ impl LightFetch {
/// Helper for getting account info at a given block. /// Helper for getting account info at a given block.
/// `None` indicates the account doesn't exist at the given block. /// `None` indicates the account doesn't exist at the given block.
pub fn account(&self, address: Address, id: BlockId) -> BoxFuture<Option<BasicAccount>, Error> { pub fn account(&self, address: Address, id: BlockId) -> BoxFuture<Option<BasicAccount>> {
let mut reqs = Vec::new(); let mut reqs = Vec::new();
let header_ref = match self.make_header_requests(id, &mut reqs) { let header_ref = match self.make_header_requests(id, &mut reqs) {
Ok(r) => r, Ok(r) => r,
@ -188,7 +188,7 @@ impl LightFetch {
} }
/// Helper for getting proved execution. /// Helper for getting proved execution.
pub fn proved_execution(&self, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<ExecutionResult, Error> { pub fn proved_execution(&self, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<ExecutionResult> {
const DEFAULT_GAS_PRICE: u64 = 21_000; const DEFAULT_GAS_PRICE: u64 = 21_000;
// starting gas when gas not provided. // starting gas when gas not provided.
const START_GAS: u64 = 50_000; const START_GAS: u64 = 50_000;
@ -265,7 +265,7 @@ impl LightFetch {
} }
/// Get a block itself. Fails on unknown block ID. /// Get a block itself. Fails on unknown block ID.
pub fn block(&self, id: BlockId) -> BoxFuture<encoded::Block, Error> { pub fn block(&self, id: BlockId) -> BoxFuture<encoded::Block> {
let mut reqs = Vec::new(); let mut reqs = Vec::new();
let header_ref = match self.make_header_requests(id, &mut reqs) { let header_ref = match self.make_header_requests(id, &mut reqs) {
Ok(r) => r, Ok(r) => r,
@ -291,7 +291,7 @@ impl LightFetch {
} }
/// Get the block receipts. Fails on unknown block ID. /// Get the block receipts. Fails on unknown block ID.
pub fn receipts(&self, id: BlockId) -> BoxFuture<Vec<Receipt>, Error> { pub fn receipts(&self, id: BlockId) -> BoxFuture<Vec<Receipt>> {
let mut reqs = Vec::new(); let mut reqs = Vec::new();
let header_ref = match self.make_header_requests(id, &mut reqs) { let header_ref = match self.make_header_requests(id, &mut reqs) {
Ok(r) => r, Ok(r) => r,
@ -317,7 +317,7 @@ impl LightFetch {
} }
/// Get transaction logs /// Get transaction logs
pub fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>, Error> { pub fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>> {
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::futures::stream::{self, Stream}; use jsonrpc_core::futures::stream::{self, Stream};
@ -375,7 +375,7 @@ impl LightFetch {
// Get a transaction by hash. also returns the index in the block. // Get a transaction by hash. also returns the index in the block.
// Only returns transactions in the canonical chain. // Only returns transactions in the canonical chain.
pub fn transaction_by_hash(&self, tx_hash: H256, eip86_transition: u64) pub fn transaction_by_hash(&self, tx_hash: H256, eip86_transition: u64)
-> BoxFuture<Option<(Transaction, usize)>, Error> -> BoxFuture<Option<(Transaction, usize)>>
{ {
let params = (self.sync.clone(), self.on_demand.clone()); let params = (self.sync.clone(), self.on_demand.clone());
let fetcher: Self = self.clone(); let fetcher: Self = self.clone();
@ -445,7 +445,7 @@ struct ExecuteParams {
// has a peer execute the transaction with given params. If `gas_known` is false, // has a peer execute the transaction with given params. If `gas_known` is false,
// this will double the gas on each `OutOfGas` error. // this will double the gas on each `OutOfGas` error.
fn execute_tx(gas_known: bool, params: ExecuteParams) -> BoxFuture<ExecutionResult, Error> { fn execute_tx(gas_known: bool, params: ExecuteParams) -> BoxFuture<ExecutionResult> {
if !gas_known { if !gas_known {
Box::new(future::loop_fn(params, |mut params| { Box::new(future::loop_fn(params, |mut params| {
execute_tx(true, params.clone()).and_then(move |res| { execute_tx(true, params.clone()).and_then(move |res| {

View File

@ -23,7 +23,7 @@ use parking_lot::Mutex;
use jsonrpc_core::futures::future::{self, Either}; use jsonrpc_core::futures::future::{self, Either};
use jsonrpc_core::futures::sync::mpsc; use jsonrpc_core::futures::sync::mpsc;
use jsonrpc_core::futures::{Sink, Future}; use jsonrpc_core::futures::{Sink, Future};
use jsonrpc_core::{self as core, MetaIoHandler, BoxFuture}; use jsonrpc_core::{self as core, MetaIoHandler};
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
use v1::helpers::Subscribers; use v1::helpers::Subscribers;
@ -87,7 +87,7 @@ impl<S: core::Middleware<Metadata>> GenericPollManager<S> {
}).is_some() }).is_some()
} }
pub fn tick(&self) -> BoxFuture<(), ()> { pub fn tick(&self) -> Box<Future<Item=(), Error=()> + Send> {
let mut futures = Vec::new(); let mut futures = Vec::new();
// poll all subscriptions // poll all subscriptions
for (id, subscription) in self.subscribers.iter() { for (id, subscription) in self.subscribers.iter() {

View File

@ -40,7 +40,7 @@ use ethcore::transaction::SignedTransaction;
use ethcore::snapshot::SnapshotService; use ethcore::snapshot::SnapshotService;
use ethsync::{SyncProvider}; use ethsync::{SyncProvider};
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::future; use jsonrpc_core::futures::future;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
@ -139,11 +139,11 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> EthClient<C, SN, S, M, EM> where
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not /// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
/// set. /// set.
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
fn block(&self, id: BlockId, include_txs: bool) -> Result<Option<RichBlock>, Error> { fn block(&self, id: BlockId, include_txs: bool) -> Result<Option<RichBlock>> {
let client = &self.client; let client = &self.client;
match (client.block(id.clone()), client.block_total_difficulty(id)) { match (client.block(id.clone()), client.block_total_difficulty(id)) {
(Some(block), Some(total_difficulty)) => { (Some(block), Some(total_difficulty)) => {
@ -181,14 +181,14 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> EthClient<C, SN, S, M, EM> where
} }
} }
fn transaction(&self, id: TransactionId) -> Result<Option<Transaction>, Error> { fn transaction(&self, id: TransactionId) -> Result<Option<Transaction>> {
match self.client.transaction(id) { match self.client.transaction(id) {
Some(t) => Ok(Some(Transaction::from_localized(t, self.eip86_transition))), Some(t) => Ok(Some(Transaction::from_localized(t, self.eip86_transition))),
None => Ok(None), None => Ok(None),
} }
} }
fn uncle(&self, id: UncleId) -> Result<Option<RichBlock>, Error> { fn uncle(&self, id: UncleId) -> Result<Option<RichBlock>> {
let client = &self.client; let client = &self.client;
let uncle: BlockHeader = match client.uncle(id) { let uncle: BlockHeader = match client.uncle(id) {
Some(hdr) => hdr.decode(), Some(hdr) => hdr.decode(),
@ -232,7 +232,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> EthClient<C, SN, S, M, EM> where
Ok(Some(block)) Ok(Some(block))
} }
fn dapp_accounts(&self, dapp: DappId) -> Result<Vec<H160>, Error> { fn dapp_accounts(&self, dapp: DappId) -> Result<Vec<H160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store store
.note_dapp_used(dapp.clone()) .note_dapp_used(dapp.clone())
@ -260,7 +260,7 @@ pub fn pending_logs<M>(miner: &M, best_block: EthBlockNumber, filter: &EthcoreFi
result result
} }
fn check_known<C>(client: &C, number: BlockNumber) -> Result<(), Error> where C: MiningBlockChainClient { fn check_known<C>(client: &C, number: BlockNumber) -> Result<()> where C: MiningBlockChainClient {
use ethcore::block_status::BlockStatus; use ethcore::block_status::BlockStatus;
match client.block_status(number.into()) { match client.block_status(number.into()) {
@ -281,12 +281,12 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
{ {
type Metadata = Metadata; type Metadata = Metadata;
fn protocol_version(&self) -> Result<String, Error> { fn protocol_version(&self) -> Result<String> {
let version = self.sync.status().protocol_version.to_owned(); let version = self.sync.status().protocol_version.to_owned();
Ok(format!("{}", version)) Ok(format!("{}", version))
} }
fn syncing(&self) -> Result<SyncStatus, Error> { fn syncing(&self) -> Result<SyncStatus> {
use ethcore::snapshot::RestorationStatus; use ethcore::snapshot::RestorationStatus;
let status = self.sync.status(); let status = self.sync.status();
@ -318,7 +318,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
} }
} }
fn author(&self, meta: Metadata) -> Result<RpcH160, Error> { fn author(&self, meta: Metadata) -> Result<RpcH160> {
let dapp = meta.dapp_id(); let dapp = meta.dapp_id();
let mut miner = self.miner.author(); let mut miner = self.miner.author();
@ -329,30 +329,30 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Ok(RpcH160::from(miner)) Ok(RpcH160::from(miner))
} }
fn is_mining(&self) -> Result<bool, Error> { fn is_mining(&self) -> Result<bool> {
Ok(self.miner.is_currently_sealing()) Ok(self.miner.is_currently_sealing())
} }
fn hashrate(&self) -> Result<RpcU256, Error> { fn hashrate(&self) -> Result<RpcU256> {
Ok(RpcU256::from(self.external_miner.hashrate())) Ok(RpcU256::from(self.external_miner.hashrate()))
} }
fn gas_price(&self) -> Result<RpcU256, Error> { fn gas_price(&self) -> Result<RpcU256> {
Ok(RpcU256::from(default_gas_price(&*self.client, &*self.miner))) Ok(RpcU256::from(default_gas_price(&*self.client, &*self.miner)))
} }
fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>, Error> { fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>> {
let dapp = meta.dapp_id(); let dapp = meta.dapp_id();
let accounts = self.dapp_accounts(dapp.into())?; let accounts = self.dapp_accounts(dapp.into())?;
Ok(accounts.into_iter().map(Into::into).collect()) Ok(accounts.into_iter().map(Into::into).collect())
} }
fn block_number(&self) -> Result<RpcU256, Error> { fn block_number(&self) -> Result<RpcU256> {
Ok(RpcU256::from(self.client.chain_info().best_block_number)) Ok(RpcU256::from(self.client.chain_info().best_block_number))
} }
fn balance(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn balance(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
let address = address.into(); let address = address.into();
let id = num.unwrap_or_default(); let id = num.unwrap_or_default();
@ -366,7 +366,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::done(res)) Box::new(future::done(res))
} }
fn storage_at(&self, address: RpcH160, pos: RpcU256, num: Trailing<BlockNumber>) -> BoxFuture<RpcH256, Error> { fn storage_at(&self, address: RpcH160, pos: RpcU256, num: Trailing<BlockNumber>) -> BoxFuture<RpcH256> {
let address: Address = RpcH160::into(address); let address: Address = RpcH160::into(address);
let position: U256 = RpcU256::into(pos); let position: U256 = RpcU256::into(pos);
@ -381,7 +381,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::done(res)) Box::new(future::done(res))
} }
fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
let address: Address = RpcH160::into(address); let address: Address = RpcH160::into(address);
let res = match num.unwrap_or_default() { let res = match num.unwrap_or_default() {
@ -406,12 +406,12 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::done(res)) Box::new(future::done(res))
} }
fn block_transaction_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>, Error> { fn block_transaction_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>> {
Box::new(future::ok(self.client.block(BlockId::Hash(hash.into())) Box::new(future::ok(self.client.block(BlockId::Hash(hash.into()))
.map(|block| block.transactions_count().into()))) .map(|block| block.transactions_count().into())))
} }
fn block_transaction_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>, Error> { fn block_transaction_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>> {
Box::new(future::ok(match num { Box::new(future::ok(match num {
BlockNumber::Pending => Some( BlockNumber::Pending => Some(
self.miner.status().transactions_in_pending_block.into() self.miner.status().transactions_in_pending_block.into()
@ -422,12 +422,12 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
})) }))
} }
fn block_uncles_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>, Error> { fn block_uncles_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>> {
Box::new(future::ok(self.client.block(BlockId::Hash(hash.into())) Box::new(future::ok(self.client.block(BlockId::Hash(hash.into()))
.map(|block| block.uncles_count().into()))) .map(|block| block.uncles_count().into())))
} }
fn block_uncles_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>, Error> { fn block_uncles_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>> {
Box::new(future::ok(match num { Box::new(future::ok(match num {
BlockNumber::Pending => Some(0.into()), BlockNumber::Pending => Some(0.into()),
_ => self.client.block(num.into()) _ => self.client.block(num.into())
@ -436,7 +436,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
})) }))
} }
fn code_at(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<Bytes, Error> { fn code_at(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
let address: Address = RpcH160::into(address); let address: Address = RpcH160::into(address);
let id = num.unwrap_or_default(); let id = num.unwrap_or_default();
@ -450,15 +450,15 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::done(res)) Box::new(future::done(res))
} }
fn block_by_hash(&self, hash: RpcH256, include_txs: bool) -> BoxFuture<Option<RichBlock>, Error> { fn block_by_hash(&self, hash: RpcH256, include_txs: bool) -> BoxFuture<Option<RichBlock>> {
Box::new(future::done(self.block(BlockId::Hash(hash.into()), include_txs))) Box::new(future::done(self.block(BlockId::Hash(hash.into()), include_txs)))
} }
fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture<Option<RichBlock>, Error> { fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture<Option<RichBlock>> {
Box::new(future::done(self.block(num.into(), include_txs))) Box::new(future::done(self.block(num.into(), include_txs)))
} }
fn transaction_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<Transaction>> {
let hash: H256 = hash.into(); let hash: H256 = hash.into();
let block_number = self.client.chain_info().best_block_number; let block_number = self.client.chain_info().best_block_number;
let tx = try_bf!(self.transaction(TransactionId::Hash(hash))).or_else(|| { let tx = try_bf!(self.transaction(TransactionId::Hash(hash))).or_else(|| {
@ -469,19 +469,19 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::ok(tx)) Box::new(future::ok(tx))
} }
fn transaction_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture<Option<Transaction>> {
Box::new(future::done( Box::new(future::done(
self.transaction(TransactionId::Location(BlockId::Hash(hash.into()), index.value())) self.transaction(TransactionId::Location(BlockId::Hash(hash.into()), index.value()))
)) ))
} }
fn transaction_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture<Option<Transaction>> {
Box::new(future::done( Box::new(future::done(
self.transaction(TransactionId::Location(num.into(), index.value())) self.transaction(TransactionId::Location(num.into(), index.value()))
)) ))
} }
fn transaction_receipt(&self, hash: RpcH256) -> BoxFuture<Option<Receipt>, Error> { fn transaction_receipt(&self, hash: RpcH256) -> BoxFuture<Option<Receipt>> {
let best_block = self.client.chain_info().best_block_number; let best_block = self.client.chain_info().best_block_number;
let hash: H256 = hash.into(); let hash: H256 = hash.into();
@ -494,25 +494,25 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
} }
} }
fn uncle_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture<Option<RichBlock>, Error> { fn uncle_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture<Option<RichBlock>> {
Box::new(future::done(self.uncle(UncleId { Box::new(future::done(self.uncle(UncleId {
block: BlockId::Hash(hash.into()), block: BlockId::Hash(hash.into()),
position: index.value() position: index.value()
}))) })))
} }
fn uncle_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture<Option<RichBlock>, Error> { fn uncle_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture<Option<RichBlock>> {
Box::new(future::done(self.uncle(UncleId { Box::new(future::done(self.uncle(UncleId {
block: num.into(), block: num.into(),
position: index.value() position: index.value()
}))) })))
} }
fn compilers(&self) -> Result<Vec<String>, Error> { fn compilers(&self) -> Result<Vec<String>> {
Err(errors::deprecated("Compilation functionality is deprecated.".to_string())) Err(errors::deprecated("Compilation functionality is deprecated.".to_string()))
} }
fn logs(&self, filter: Filter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: Filter) -> BoxFuture<Vec<Log>> {
let include_pending = filter.to_block == Some(BlockNumber::Pending); let include_pending = filter.to_block == Some(BlockNumber::Pending);
let filter: EthcoreFilter = filter.into(); let filter: EthcoreFilter = filter.into();
let mut logs = self.client.logs(filter.clone()) let mut logs = self.client.logs(filter.clone())
@ -531,7 +531,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Box::new(future::ok(logs)) Box::new(future::ok(logs))
} }
fn work(&self, no_new_work_timeout: Trailing<u64>) -> Result<Work, Error> { fn work(&self, no_new_work_timeout: Trailing<u64>) -> Result<Work> {
if !self.miner.can_produce_work_package() { if !self.miner.can_produce_work_package() {
warn!(target: "miner", "Cannot give work package - engine seals internally."); warn!(target: "miner", "Cannot give work package - engine seals internally.");
return Err(errors::no_work_required()) return Err(errors::no_work_required())
@ -585,7 +585,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
}).unwrap_or(Err(errors::internal("No work found.", ""))) }).unwrap_or(Err(errors::internal("No work found.", "")))
} }
fn submit_work(&self, nonce: RpcH64, pow_hash: RpcH256, mix_hash: RpcH256) -> Result<bool, Error> { fn submit_work(&self, nonce: RpcH64, pow_hash: RpcH256, mix_hash: RpcH256) -> Result<bool> {
if !self.miner.can_produce_work_package() { if !self.miner.can_produce_work_package() {
warn!(target: "miner", "Cannot submit work - engine seals internally."); warn!(target: "miner", "Cannot submit work - engine seals internally.");
return Err(errors::no_work_required()) return Err(errors::no_work_required())
@ -600,12 +600,12 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
Ok(self.miner.submit_seal(&*self.client, pow_hash, seal).is_ok()) Ok(self.miner.submit_seal(&*self.client, pow_hash, seal).is_ok())
} }
fn submit_hashrate(&self, rate: RpcU256, id: RpcH256) -> Result<bool, Error> { fn submit_hashrate(&self, rate: RpcU256, id: RpcH256) -> Result<bool> {
self.external_miner.submit_hashrate(rate.into(), id.into()); self.external_miner.submit_hashrate(rate.into(), id.into());
Ok(true) Ok(true)
} }
fn send_raw_transaction(&self, raw: Bytes) -> Result<RpcH256, Error> { fn send_raw_transaction(&self, raw: Bytes) -> Result<RpcH256> {
UntrustedRlp::new(&raw.into_vec()).as_val() UntrustedRlp::new(&raw.into_vec()).as_val()
.map_err(errors::rlp) .map_err(errors::rlp)
.and_then(|tx| SignedTransaction::new(tx).map_err(errors::transaction)) .and_then(|tx| SignedTransaction::new(tx).map_err(errors::transaction))
@ -619,11 +619,11 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
.map(Into::into) .map(Into::into)
} }
fn submit_transaction(&self, raw: Bytes) -> Result<RpcH256, Error> { fn submit_transaction(&self, raw: Bytes) -> Result<RpcH256> {
self.send_raw_transaction(raw) self.send_raw_transaction(raw)
} }
fn call(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes, Error> { fn call(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
let request = CallRequest::into(request); let request = CallRequest::into(request);
let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp())); let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp()));
@ -636,7 +636,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
)) ))
} }
fn estimate_gas(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn estimate_gas(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
let request = CallRequest::into(request); let request = CallRequest::into(request);
let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp())); let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp()));
Box::new(future::done(self.client.estimate_gas(&signed, num.unwrap_or_default().into()) Box::new(future::done(self.client.estimate_gas(&signed, num.unwrap_or_default().into())
@ -645,15 +645,15 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
)) ))
} }
fn compile_lll(&self, _: String) -> Result<Bytes, Error> { fn compile_lll(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of LLL via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of LLL via RPC is deprecated".to_string()))
} }
fn compile_serpent(&self, _: String) -> Result<Bytes, Error> { fn compile_serpent(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of Serpent via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of Serpent via RPC is deprecated".to_string()))
} }
fn compile_solidity(&self, _: String) -> Result<Bytes, Error> { fn compile_solidity(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of Solidity via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of Solidity via RPC is deprecated".to_string()))
} }
} }

View File

@ -25,7 +25,7 @@ use ethcore::client::{BlockChainClient, BlockId};
use bigint::hash::H256; use bigint::hash::H256;
use parking_lot::Mutex; use parking_lot::Mutex;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use v1::traits::EthFilter; use v1::traits::EthFilter;
@ -45,7 +45,7 @@ pub trait Filterable {
fn pending_transactions_hashes(&self, block_number: u64) -> Vec<H256>; fn pending_transactions_hashes(&self, block_number: u64) -> Vec<H256>;
/// Get logs that match the given filter. /// Get logs that match the given filter.
fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>, Error>; fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>>;
/// Get logs from the pending block. /// Get logs from the pending block.
fn pending_logs(&self, block_number: u64, filter: &EthcoreFilter) -> Vec<Log>; fn pending_logs(&self, block_number: u64, filter: &EthcoreFilter) -> Vec<Log>;
@ -88,7 +88,7 @@ impl<C, M> Filterable for EthFilterClient<C, M> where C: BlockChainClient, M: Mi
self.miner.pending_transactions_hashes(best) self.miner.pending_transactions_hashes(best)
} }
fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>> {
Box::new(future::ok(self.client.logs(filter).into_iter().map(Into::into).collect())) Box::new(future::ok(self.client.logs(filter).into_iter().map(Into::into).collect()))
} }
@ -102,20 +102,20 @@ impl<C, M> Filterable for EthFilterClient<C, M> where C: BlockChainClient, M: Mi
impl<T: Filterable + Send + Sync + 'static> EthFilter for T { impl<T: Filterable + Send + Sync + 'static> EthFilter for T {
fn new_filter(&self, filter: Filter) -> Result<RpcU256, Error> { fn new_filter(&self, filter: Filter) -> Result<RpcU256> {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
let block_number = self.best_block_number(); let block_number = self.best_block_number();
let id = polls.create_poll(PollFilter::Logs(block_number, Default::default(), filter)); let id = polls.create_poll(PollFilter::Logs(block_number, Default::default(), filter));
Ok(id.into()) Ok(id.into())
} }
fn new_block_filter(&self) -> Result<RpcU256, Error> { fn new_block_filter(&self) -> Result<RpcU256> {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
let id = polls.create_poll(PollFilter::Block(self.best_block_number())); let id = polls.create_poll(PollFilter::Block(self.best_block_number()));
Ok(id.into()) Ok(id.into())
} }
fn new_pending_transaction_filter(&self) -> Result<RpcU256, Error> { fn new_pending_transaction_filter(&self) -> Result<RpcU256> {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
let best_block = self.best_block_number(); let best_block = self.best_block_number();
let pending_transactions = self.pending_transactions_hashes(best_block); let pending_transactions = self.pending_transactions_hashes(best_block);
@ -123,7 +123,7 @@ impl<T: Filterable + Send + Sync + 'static> EthFilter for T {
Ok(id.into()) Ok(id.into())
} }
fn filter_changes(&self, index: Index) -> BoxFuture<FilterChanges, Error> { fn filter_changes(&self, index: Index) -> BoxFuture<FilterChanges> {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
Box::new(match polls.poll_mut(&index.value()) { Box::new(match polls.poll_mut(&index.value()) {
None => Either::A(future::ok(FilterChanges::Empty)), None => Either::A(future::ok(FilterChanges::Empty)),
@ -209,7 +209,7 @@ impl<T: Filterable + Send + Sync + 'static> EthFilter for T {
}) })
} }
fn filter_logs(&self, index: Index) -> BoxFuture<Vec<Log>, Error> { fn filter_logs(&self, index: Index) -> BoxFuture<Vec<Log>> {
let filter = { let filter = {
let mut polls = self.polls().lock(); let mut polls = self.polls().lock();
@ -240,7 +240,7 @@ impl<T: Filterable + Send + Sync + 'static> EthFilter for T {
) )
} }
fn uninstall_filter(&self, index: Index) -> Result<bool, Error> { fn uninstall_filter(&self, index: Index) -> Result<bool> {
self.polls().lock().remove_poll(&index.value()); self.polls().lock().remove_poll(&index.value());
Ok(true) Ok(true)
} }

View File

@ -19,7 +19,7 @@
use std::sync::Arc; use std::sync::Arc;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result, Error};
use jsonrpc_core::futures::{self, Future, IntoFuture}; use jsonrpc_core::futures::{self, Future, IntoFuture};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use jsonrpc_macros::pubsub::{Sink, Subscriber}; use jsonrpc_macros::pubsub::{Sink, Subscriber};
@ -170,7 +170,7 @@ pub trait LightClient: Send + Sync {
fn block_header(&self, id: BlockId) -> Option<encoded::Header>; fn block_header(&self, id: BlockId) -> Option<encoded::Header>;
/// Fetch logs. /// Fetch logs.
fn logs(&self, filter: EthFilter) -> BoxFuture<Vec<Log>, Error>; fn logs(&self, filter: EthFilter) -> BoxFuture<Vec<Log>>;
} }
impl LightClient for LightFetch { impl LightClient for LightFetch {
@ -178,7 +178,7 @@ impl LightClient for LightFetch {
self.client.block_header(id) self.client.block_header(id)
} }
fn logs(&self, filter: EthFilter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: EthFilter) -> BoxFuture<Vec<Log>> {
LightFetch::logs(self, filter) LightFetch::logs(self, filter)
} }
} }
@ -272,7 +272,7 @@ impl<C: Send + Sync + 'static> EthPubSub for EthPubSubClient<C> {
let _ = subscriber.reject(error); let _ = subscriber.reject(error);
} }
fn unsubscribe(&self, id: SubscriptionId) -> Result<bool, Error> { fn unsubscribe(&self, id: SubscriptionId) -> Result<bool> {
let res = self.heads_subscribers.write().remove(&id).is_some(); let res = self.heads_subscribers.write().remove(&id).is_some();
let res2 = self.logs_subscribers.write().remove(&id).is_some(); let res2 = self.logs_subscribers.write().remove(&id).is_some();

View File

@ -18,7 +18,7 @@
use std::sync::Arc; use std::sync::Arc;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
@ -112,7 +112,7 @@ impl<T: LightChainClient + 'static> EthClient<T> {
} }
// get a "rich" block structure. Fails on unknown block. // get a "rich" block structure. Fails on unknown block.
fn rich_block(&self, id: BlockId, include_txs: bool) -> BoxFuture<RichBlock, Error> { fn rich_block(&self, id: BlockId, include_txs: bool) -> BoxFuture<RichBlock> {
let (on_demand, sync) = (self.on_demand.clone(), self.sync.clone()); let (on_demand, sync) = (self.on_demand.clone(), self.sync.clone());
let (client, engine) = (self.client.clone(), self.client.engine().clone()); let (client, engine) = (self.client.clone(), self.client.engine().clone());
let eip86_transition = self.client.eip86_transition(); let eip86_transition = self.client.eip86_transition();
@ -202,11 +202,11 @@ impl<T: LightChainClient + 'static> EthClient<T> {
impl<T: LightChainClient + 'static> Eth for EthClient<T> { impl<T: LightChainClient + 'static> Eth for EthClient<T> {
type Metadata = Metadata; type Metadata = Metadata;
fn protocol_version(&self) -> Result<String, Error> { fn protocol_version(&self) -> Result<String> {
Ok(format!("{}", ::light::net::MAX_PROTOCOL_VERSION)) Ok(format!("{}", ::light::net::MAX_PROTOCOL_VERSION))
} }
fn syncing(&self) -> Result<SyncStatus, Error> { fn syncing(&self) -> Result<SyncStatus> {
if self.sync.is_major_importing() { if self.sync.is_major_importing() {
let chain_info = self.client.chain_info(); let chain_info = self.client.chain_info();
let current_block = U256::from(chain_info.best_block_number); let current_block = U256::from(chain_info.best_block_number);
@ -225,26 +225,26 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
} }
} }
fn author(&self, _meta: Self::Metadata) -> Result<RpcH160, Error> { fn author(&self, _meta: Self::Metadata) -> Result<RpcH160> {
Ok(Default::default()) Ok(Default::default())
} }
fn is_mining(&self) -> Result<bool, Error> { fn is_mining(&self) -> Result<bool> {
Ok(false) Ok(false)
} }
fn hashrate(&self) -> Result<RpcU256, Error> { fn hashrate(&self) -> Result<RpcU256> {
Ok(Default::default()) Ok(Default::default())
} }
fn gas_price(&self) -> Result<RpcU256, Error> { fn gas_price(&self) -> Result<RpcU256> {
Ok(self.cache.lock().gas_price_corpus() Ok(self.cache.lock().gas_price_corpus()
.and_then(|c| c.median().cloned()) .and_then(|c| c.median().cloned())
.map(RpcU256::from) .map(RpcU256::from)
.unwrap_or_else(Default::default)) .unwrap_or_else(Default::default))
} }
fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>, Error> { fn accounts(&self, meta: Metadata) -> Result<Vec<RpcH160>> {
let dapp: DappId = meta.dapp_id().into(); let dapp: DappId = meta.dapp_id().into();
self.accounts self.accounts
@ -254,33 +254,33 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
.map(|accs| accs.into_iter().map(Into::<RpcH160>::into).collect()) .map(|accs| accs.into_iter().map(Into::<RpcH160>::into).collect())
} }
fn block_number(&self) -> Result<RpcU256, Error> { fn block_number(&self) -> Result<RpcU256> {
Ok(self.client.chain_info().best_block_number.into()) Ok(self.client.chain_info().best_block_number.into())
} }
fn balance(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn balance(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
Box::new(self.fetcher().account(address.into(), num.unwrap_or_default().into()) Box::new(self.fetcher().account(address.into(), num.unwrap_or_default().into())
.map(|acc| acc.map_or(0.into(), |a| a.balance).into())) .map(|acc| acc.map_or(0.into(), |a| a.balance).into()))
} }
fn storage_at(&self, _address: RpcH160, _key: RpcU256, _num: Trailing<BlockNumber>) -> BoxFuture<RpcH256, Error> { fn storage_at(&self, _address: RpcH160, _key: RpcU256, _num: Trailing<BlockNumber>) -> BoxFuture<RpcH256> {
Box::new(future::err(errors::unimplemented(None))) Box::new(future::err(errors::unimplemented(None)))
} }
fn block_by_hash(&self, hash: RpcH256, include_txs: bool) -> BoxFuture<Option<RichBlock>, Error> { fn block_by_hash(&self, hash: RpcH256, include_txs: bool) -> BoxFuture<Option<RichBlock>> {
Box::new(self.rich_block(BlockId::Hash(hash.into()), include_txs).map(Some)) Box::new(self.rich_block(BlockId::Hash(hash.into()), include_txs).map(Some))
} }
fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture<Option<RichBlock>, Error> { fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture<Option<RichBlock>> {
Box::new(self.rich_block(num.into(), include_txs).map(Some)) Box::new(self.rich_block(num.into(), include_txs).map(Some))
} }
fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn transaction_count(&self, address: RpcH160, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
Box::new(self.fetcher().account(address.into(), num.unwrap_or_default().into()) Box::new(self.fetcher().account(address.into(), num.unwrap_or_default().into())
.map(|acc| acc.map_or(0.into(), |a| a.nonce).into())) .map(|acc| acc.map_or(0.into(), |a| a.nonce).into()))
} }
fn block_transaction_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>, Error> { fn block_transaction_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>> {
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone()); let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
Box::new(self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| { Box::new(self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| {
@ -296,7 +296,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn block_transaction_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>, Error> { fn block_transaction_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>> {
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone()); let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
Box::new(self.fetcher().header(num.into()).and_then(move |hdr| { Box::new(self.fetcher().header(num.into()).and_then(move |hdr| {
@ -312,7 +312,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn block_uncles_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>, Error> { fn block_uncles_count_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<RpcU256>> {
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone()); let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
Box::new(self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| { Box::new(self.fetcher().header(BlockId::Hash(hash.into())).and_then(move |hdr| {
@ -328,7 +328,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn block_uncles_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>, Error> { fn block_uncles_count_by_number(&self, num: BlockNumber) -> BoxFuture<Option<RpcU256>> {
let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone()); let (sync, on_demand) = (self.sync.clone(), self.on_demand.clone());
Box::new(self.fetcher().header(num.into()).and_then(move |hdr| { Box::new(self.fetcher().header(num.into()).and_then(move |hdr| {
@ -344,11 +344,11 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn code_at(&self, _address: RpcH160, _num: Trailing<BlockNumber>) -> BoxFuture<Bytes, Error> { fn code_at(&self, _address: RpcH160, _num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
Box::new(future::err(errors::unimplemented(None))) Box::new(future::err(errors::unimplemented(None)))
} }
fn send_raw_transaction(&self, raw: Bytes) -> Result<RpcH256, Error> { fn send_raw_transaction(&self, raw: Bytes) -> Result<RpcH256> {
let best_header = self.client.best_block_header().decode(); let best_header = self.client.best_block_header().decode();
UntrustedRlp::new(&raw.into_vec()).as_val() UntrustedRlp::new(&raw.into_vec()).as_val()
@ -368,11 +368,11 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
.map(Into::into) .map(Into::into)
} }
fn submit_transaction(&self, raw: Bytes) -> Result<RpcH256, Error> { fn submit_transaction(&self, raw: Bytes) -> Result<RpcH256> {
self.send_raw_transaction(raw) self.send_raw_transaction(raw)
} }
fn call(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes, Error> { fn call(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
Box::new(self.fetcher().proved_execution(req, num).and_then(|res| { Box::new(self.fetcher().proved_execution(req, num).and_then(|res| {
match res { match res {
Ok(exec) => Ok(exec.output.into()), Ok(exec) => Ok(exec.output.into()),
@ -381,7 +381,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn estimate_gas(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256, Error> { fn estimate_gas(&self, _meta: Self::Metadata, req: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<RpcU256> {
// TODO: binary chop for more accurate estimates. // TODO: binary chop for more accurate estimates.
Box::new(self.fetcher().proved_execution(req, num).and_then(|res| { Box::new(self.fetcher().proved_execution(req, num).and_then(|res| {
match res { match res {
@ -391,7 +391,7 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn transaction_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_hash(&self, hash: RpcH256) -> BoxFuture<Option<Transaction>> {
let hash = hash.into(); let hash = hash.into();
let eip86 = self.client.eip86_transition(); let eip86 = self.client.eip86_transition();
@ -409,21 +409,21 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
Box::new(self.fetcher().transaction_by_hash(hash, eip86).map(|x| x.map(|(tx, _)| tx))) Box::new(self.fetcher().transaction_by_hash(hash, eip86).map(|x| x.map(|(tx, _)| tx)))
} }
fn transaction_by_block_hash_and_index(&self, hash: RpcH256, idx: Index) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_block_hash_and_index(&self, hash: RpcH256, idx: Index) -> BoxFuture<Option<Transaction>> {
let eip86 = self.client.eip86_transition(); let eip86 = self.client.eip86_transition();
Box::new(self.fetcher().block(BlockId::Hash(hash.into())).map(move |block| { Box::new(self.fetcher().block(BlockId::Hash(hash.into())).map(move |block| {
light_fetch::extract_transaction_at_index(block, idx.value(), eip86) light_fetch::extract_transaction_at_index(block, idx.value(), eip86)
})) }))
} }
fn transaction_by_block_number_and_index(&self, num: BlockNumber, idx: Index) -> BoxFuture<Option<Transaction>, Error> { fn transaction_by_block_number_and_index(&self, num: BlockNumber, idx: Index) -> BoxFuture<Option<Transaction>> {
let eip86 = self.client.eip86_transition(); let eip86 = self.client.eip86_transition();
Box::new(self.fetcher().block(num.into()).map(move |block| { Box::new(self.fetcher().block(num.into()).map(move |block| {
light_fetch::extract_transaction_at_index(block, idx.value(), eip86) light_fetch::extract_transaction_at_index(block, idx.value(), eip86)
})) }))
} }
fn transaction_receipt(&self, hash: RpcH256) -> BoxFuture<Option<Receipt>, Error> { fn transaction_receipt(&self, hash: RpcH256) -> BoxFuture<Option<Receipt>> {
let eip86 = self.client.eip86_transition(); let eip86 = self.client.eip86_transition();
let fetcher = self.fetcher(); let fetcher = self.fetcher();
Box::new(fetcher.transaction_by_hash(hash.clone().into(), eip86).and_then(move |tx| { Box::new(fetcher.transaction_by_hash(hash.clone().into(), eip86).and_then(move |tx| {
@ -454,52 +454,52 @@ impl<T: LightChainClient + 'static> Eth for EthClient<T> {
})) }))
} }
fn uncle_by_block_hash_and_index(&self, hash: RpcH256, idx: Index) -> BoxFuture<Option<RichBlock>, Error> { fn uncle_by_block_hash_and_index(&self, hash: RpcH256, idx: Index) -> BoxFuture<Option<RichBlock>> {
let client = self.client.clone(); let client = self.client.clone();
Box::new(self.fetcher().block(BlockId::Hash(hash.into())).map(move |block| { Box::new(self.fetcher().block(BlockId::Hash(hash.into())).map(move |block| {
extract_uncle_at_index(block, idx, client) extract_uncle_at_index(block, idx, client)
})) }))
} }
fn uncle_by_block_number_and_index(&self, num: BlockNumber, idx: Index) -> BoxFuture<Option<RichBlock>, Error> { fn uncle_by_block_number_and_index(&self, num: BlockNumber, idx: Index) -> BoxFuture<Option<RichBlock>> {
let client = self.client.clone(); let client = self.client.clone();
Box::new(self.fetcher().block(num.into()).map(move |block| { Box::new(self.fetcher().block(num.into()).map(move |block| {
extract_uncle_at_index(block, idx, client) extract_uncle_at_index(block, idx, client)
})) }))
} }
fn compilers(&self) -> Result<Vec<String>, Error> { fn compilers(&self) -> Result<Vec<String>> {
Err(errors::deprecated("Compilation functionality is deprecated.".to_string())) Err(errors::deprecated("Compilation functionality is deprecated.".to_string()))
} }
fn compile_lll(&self, _: String) -> Result<Bytes, Error> { fn compile_lll(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of LLL via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of LLL via RPC is deprecated".to_string()))
} }
fn compile_serpent(&self, _: String) -> Result<Bytes, Error> { fn compile_serpent(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of Serpent via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of Serpent via RPC is deprecated".to_string()))
} }
fn compile_solidity(&self, _: String) -> Result<Bytes, Error> { fn compile_solidity(&self, _: String) -> Result<Bytes> {
Err(errors::deprecated("Compilation of Solidity via RPC is deprecated".to_string())) Err(errors::deprecated("Compilation of Solidity via RPC is deprecated".to_string()))
} }
fn logs(&self, filter: Filter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: Filter) -> BoxFuture<Vec<Log>> {
let limit = filter.limit; let limit = filter.limit;
Box::new(Filterable::logs(self, filter.into()) Box::new(Filterable::logs(self, filter.into())
.map(move|logs| limit_logs(logs, limit))) .map(move|logs| limit_logs(logs, limit)))
} }
fn work(&self, _timeout: Trailing<u64>) -> Result<Work, Error> { fn work(&self, _timeout: Trailing<u64>) -> Result<Work> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn submit_work(&self, _nonce: RpcH64, _pow_hash: RpcH256, _mix_hash: RpcH256) -> Result<bool, Error> { fn submit_work(&self, _nonce: RpcH64, _pow_hash: RpcH256, _mix_hash: RpcH256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn submit_hashrate(&self, _rate: RpcU256, _id: RpcH256) -> Result<bool, Error> { fn submit_hashrate(&self, _rate: RpcU256, _id: RpcH256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
} }
@ -516,7 +516,7 @@ impl<T: LightChainClient + 'static> Filterable for EthClient<T> {
Vec::new() Vec::new()
} }
fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>, Error> { fn logs(&self, filter: EthcoreFilter) -> BoxFuture<Vec<Log>> {
self.fetcher().logs(filter) self.fetcher().logs(filter)
} }

View File

@ -16,7 +16,7 @@
//! Net rpc implementation. //! Net rpc implementation.
use std::sync::Arc; use std::sync::Arc;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use ethsync::LightSyncProvider; use ethsync::LightSyncProvider;
use v1::traits::Net; use v1::traits::Net;
@ -35,15 +35,15 @@ impl<S: ?Sized> NetClient<S> where S: LightSyncProvider {
} }
impl<S: ?Sized + Sync + Send + 'static> Net for NetClient<S> where S: LightSyncProvider { impl<S: ?Sized + Sync + Send + 'static> Net for NetClient<S> where S: LightSyncProvider {
fn version(&self) -> Result<String, Error> { fn version(&self) -> Result<String> {
Ok(format!("{}", self.sync.network_id()).to_owned()) Ok(format!("{}", self.sync.network_id()).to_owned())
} }
fn peer_count(&self) -> Result<String, Error> { fn peer_count(&self) -> Result<String> {
Ok(format!("0x{:x}", self.sync.peer_numbers().connected as u64).to_owned()) Ok(format!("0x{:x}", self.sync.peer_numbers().connected as u64).to_owned())
} }
fn is_listening(&self) -> Result<bool, Error> { fn is_listening(&self) -> Result<bool> {
Ok(true) Ok(true)
} }
} }

View File

@ -30,7 +30,7 @@ use node_health::{NodeHealth, Health};
use light::client::LightChainClient; use light::client::LightChainClient;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_core::futures::Future; use jsonrpc_core::futures::Future;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::helpers::{self, errors, ipfs, SigningQueue, SignerService, NetworkSettings}; use v1::helpers::{self, errors, ipfs, SigningQueue, SignerService, NetworkSettings};
@ -103,7 +103,7 @@ impl ParityClient {
impl Parity for ParityClient { impl Parity for ParityClient {
type Metadata = Metadata; type Metadata = Metadata;
fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>, Error> { fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>> {
let dapp = dapp.unwrap_or_default(); let dapp = dapp.unwrap_or_default();
let store = &self.accounts; let store = &self.accounts;
@ -125,7 +125,7 @@ impl Parity for ParityClient {
) )
} }
fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>, Error> { fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>> {
let store = &self.accounts; let store = &self.accounts;
let info = store.hardware_accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?; let info = store.hardware_accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?;
Ok(info Ok(info
@ -135,12 +135,12 @@ impl Parity for ParityClient {
) )
} }
fn locked_hardware_accounts_info(&self) -> Result<Vec<String>, Error> { fn locked_hardware_accounts_info(&self) -> Result<Vec<String>> {
let store = &self.accounts; let store = &self.accounts;
Ok(store.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))?) Ok(store.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))?)
} }
fn default_account(&self, meta: Self::Metadata) -> Result<H160, Error> { fn default_account(&self, meta: Self::Metadata) -> Result<H160> {
let dapp_id = meta.dapp_id(); let dapp_id = meta.dapp_id();
Ok(self.accounts Ok(self.accounts
.dapp_addresses(dapp_id.into()) .dapp_addresses(dapp_id.into())
@ -150,40 +150,40 @@ impl Parity for ParityClient {
.unwrap_or_default()) .unwrap_or_default())
} }
fn transactions_limit(&self) -> Result<usize, Error> { fn transactions_limit(&self) -> Result<usize> {
Ok(usize::max_value()) Ok(usize::max_value())
} }
fn min_gas_price(&self) -> Result<U256, Error> { fn min_gas_price(&self) -> Result<U256> {
Ok(U256::default()) Ok(U256::default())
} }
fn extra_data(&self) -> Result<Bytes, Error> { fn extra_data(&self) -> Result<Bytes> {
Ok(Bytes::default()) Ok(Bytes::default())
} }
fn gas_floor_target(&self) -> Result<U256, Error> { fn gas_floor_target(&self) -> Result<U256> {
Ok(U256::default()) Ok(U256::default())
} }
fn gas_ceil_target(&self) -> Result<U256, Error> { fn gas_ceil_target(&self) -> Result<U256> {
Ok(U256::default()) Ok(U256::default())
} }
fn dev_logs(&self) -> Result<Vec<String>, Error> { fn dev_logs(&self) -> Result<Vec<String>> {
let logs = self.logger.logs(); let logs = self.logger.logs();
Ok(logs.as_slice().to_owned()) Ok(logs.as_slice().to_owned())
} }
fn dev_logs_levels(&self) -> Result<String, Error> { fn dev_logs_levels(&self) -> Result<String> {
Ok(self.logger.levels().to_owned()) Ok(self.logger.levels().to_owned())
} }
fn net_chain(&self) -> Result<String, Error> { fn net_chain(&self) -> Result<String> {
Ok(self.settings.chain.clone()) Ok(self.settings.chain.clone())
} }
fn net_peers(&self) -> Result<Peers, Error> { fn net_peers(&self) -> Result<Peers> {
let peers = self.light_dispatch.sync.peers().into_iter().map(Into::into).collect(); let peers = self.light_dispatch.sync.peers().into_iter().map(Into::into).collect();
let peer_numbers = self.light_dispatch.sync.peer_numbers(); let peer_numbers = self.light_dispatch.sync.peer_numbers();
@ -195,19 +195,19 @@ impl Parity for ParityClient {
}) })
} }
fn net_port(&self) -> Result<u16, Error> { fn net_port(&self) -> Result<u16> {
Ok(self.settings.network_port) Ok(self.settings.network_port)
} }
fn node_name(&self) -> Result<String, Error> { fn node_name(&self) -> Result<String> {
Ok(self.settings.name.clone()) Ok(self.settings.name.clone())
} }
fn registry_address(&self) -> Result<Option<H160>, Error> { fn registry_address(&self) -> Result<Option<H160>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn rpc_settings(&self) -> Result<RpcSettings, Error> { fn rpc_settings(&self) -> Result<RpcSettings> {
Ok(RpcSettings { Ok(RpcSettings {
enabled: self.settings.rpc_enabled, enabled: self.settings.rpc_enabled,
interface: self.settings.rpc_interface.clone(), interface: self.settings.rpc_interface.clone(),
@ -215,46 +215,46 @@ impl Parity for ParityClient {
}) })
} }
fn default_extra_data(&self) -> Result<Bytes, Error> { fn default_extra_data(&self) -> Result<Bytes> {
Ok(Bytes::new(version_data())) Ok(Bytes::new(version_data()))
} }
fn gas_price_histogram(&self) -> BoxFuture<Histogram, Error> { fn gas_price_histogram(&self) -> BoxFuture<Histogram> {
Box::new(self.light_dispatch.gas_price_corpus() Box::new(self.light_dispatch.gas_price_corpus()
.and_then(|corpus| corpus.histogram(10).ok_or_else(errors::not_enough_data)) .and_then(|corpus| corpus.histogram(10).ok_or_else(errors::not_enough_data))
.map(Into::into)) .map(Into::into))
} }
fn unsigned_transactions_count(&self) -> Result<usize, Error> { fn unsigned_transactions_count(&self) -> Result<usize> {
match self.signer { match self.signer {
None => Err(errors::signer_disabled()), None => Err(errors::signer_disabled()),
Some(ref signer) => Ok(signer.len()), Some(ref signer) => Ok(signer.len()),
} }
} }
fn generate_secret_phrase(&self) -> Result<String, Error> { fn generate_secret_phrase(&self) -> Result<String> {
Ok(random_phrase(12)) Ok(random_phrase(12))
} }
fn phrase_to_address(&self, phrase: String) -> Result<H160, Error> { fn phrase_to_address(&self, phrase: String) -> Result<H160> {
Ok(Brain::new(phrase).generate().unwrap().address().into()) Ok(Brain::new(phrase).generate().unwrap().address().into())
} }
fn list_accounts(&self, _: u64, _: Option<H160>, _: Trailing<BlockNumber>) -> Result<Option<Vec<H160>>, Error> { fn list_accounts(&self, _: u64, _: Option<H160>, _: Trailing<BlockNumber>) -> Result<Option<Vec<H160>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn list_storage_keys(&self, _: H160, _: u64, _: Option<H256>, _: Trailing<BlockNumber>) -> Result<Option<Vec<H256>>, Error> { fn list_storage_keys(&self, _: H160, _: u64, _: Option<H256>, _: Trailing<BlockNumber>) -> Result<Option<Vec<H256>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn encrypt_message(&self, key: H512, phrase: Bytes) -> Result<Bytes, Error> { fn encrypt_message(&self, key: H512, phrase: Bytes) -> Result<Bytes> {
ecies::encrypt(&key.into(), &DEFAULT_MAC, &phrase.0) ecies::encrypt(&key.into(), &DEFAULT_MAC, &phrase.0)
.map_err(errors::encryption) .map_err(errors::encryption)
.map(Into::into) .map(Into::into)
} }
fn pending_transactions(&self) -> Result<Vec<Transaction>, Error> { fn pending_transactions(&self) -> Result<Vec<Transaction>> {
let txq = self.light_dispatch.transaction_queue.read(); let txq = self.light_dispatch.transaction_queue.read();
let chain_info = self.light_dispatch.client.chain_info(); let chain_info = self.light_dispatch.client.chain_info();
Ok( Ok(
@ -265,7 +265,7 @@ impl Parity for ParityClient {
) )
} }
fn future_transactions(&self) -> Result<Vec<Transaction>, Error> { fn future_transactions(&self) -> Result<Vec<Transaction>> {
let txq = self.light_dispatch.transaction_queue.read(); let txq = self.light_dispatch.transaction_queue.read();
let chain_info = self.light_dispatch.client.chain_info(); let chain_info = self.light_dispatch.client.chain_info();
Ok( Ok(
@ -276,7 +276,7 @@ impl Parity for ParityClient {
) )
} }
fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>, Error> { fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>> {
let stats = self.light_dispatch.sync.transactions_stats(); let stats = self.light_dispatch.sync.transactions_stats();
Ok(stats.into_iter() Ok(stats.into_iter()
.map(|(hash, stats)| (hash.into(), stats.into())) .map(|(hash, stats)| (hash.into(), stats.into()))
@ -284,7 +284,7 @@ impl Parity for ParityClient {
) )
} }
fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>, Error> { fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>> {
let mut map = BTreeMap::new(); let mut map = BTreeMap::new();
let chain_info = self.light_dispatch.client.chain_info(); let chain_info = self.light_dispatch.client.chain_info();
let (best_num, best_tm) = (chain_info.best_block_number, chain_info.best_block_timestamp); let (best_num, best_tm) = (chain_info.best_block_number, chain_info.best_block_timestamp);
@ -303,49 +303,49 @@ impl Parity for ParityClient {
Ok(map) Ok(map)
} }
fn dapps_url(&self) -> Result<String, Error> { fn dapps_url(&self) -> Result<String> {
helpers::to_url(&self.dapps_address) helpers::to_url(&self.dapps_address)
.ok_or_else(|| errors::dapps_disabled()) .ok_or_else(|| errors::dapps_disabled())
} }
fn ws_url(&self) -> Result<String, Error> { fn ws_url(&self) -> Result<String> {
helpers::to_url(&self.ws_address) helpers::to_url(&self.ws_address)
.ok_or_else(|| errors::ws_disabled()) .ok_or_else(|| errors::ws_disabled())
} }
fn next_nonce(&self, address: H160) -> BoxFuture<U256, Error> { fn next_nonce(&self, address: H160) -> BoxFuture<U256> {
Box::new(self.light_dispatch.next_nonce(address.into()).map(Into::into)) Box::new(self.light_dispatch.next_nonce(address.into()).map(Into::into))
} }
fn mode(&self) -> Result<String, Error> { fn mode(&self) -> Result<String> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn chain_id(&self) -> Result<Option<U64>, Error> { fn chain_id(&self) -> Result<Option<U64>> {
Ok(self.client.signing_chain_id().map(U64::from)) Ok(self.client.signing_chain_id().map(U64::from))
} }
fn chain(&self) -> Result<String, Error> { fn chain(&self) -> Result<String> {
Ok(self.settings.chain.clone()) Ok(self.settings.chain.clone())
} }
fn enode(&self) -> Result<String, Error> { fn enode(&self) -> Result<String> {
self.light_dispatch.sync.enode().ok_or_else(errors::network_disabled) self.light_dispatch.sync.enode().ok_or_else(errors::network_disabled)
} }
fn consensus_capability(&self) -> Result<ConsensusCapability, Error> { fn consensus_capability(&self) -> Result<ConsensusCapability> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn version_info(&self) -> Result<VersionInfo, Error> { fn version_info(&self) -> Result<VersionInfo> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn releases_info(&self) -> Result<Option<OperationsInfo>, Error> { fn releases_info(&self) -> Result<Option<OperationsInfo>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn chain_status(&self) -> Result<ChainStatus, Error> { fn chain_status(&self) -> Result<ChainStatus> {
let chain_info = self.light_dispatch.client.chain_info(); let chain_info = self.light_dispatch.client.chain_info();
let gap = chain_info.ancient_block_number.map(|x| U256::from(x + 1)) let gap = chain_info.ancient_block_number.map(|x| U256::from(x + 1))
@ -356,7 +356,7 @@ impl Parity for ParityClient {
}) })
} }
fn node_kind(&self) -> Result<::v1::types::NodeKind, Error> { fn node_kind(&self) -> Result<::v1::types::NodeKind> {
use ::v1::types::{NodeKind, Availability, Capability}; use ::v1::types::{NodeKind, Availability, Capability};
Ok(NodeKind { Ok(NodeKind {
@ -365,7 +365,7 @@ impl Parity for ParityClient {
}) })
} }
fn block_header(&self, number: Trailing<BlockNumber>) -> BoxFuture<RichHeader, Error> { fn block_header(&self, number: Trailing<BlockNumber>) -> BoxFuture<RichHeader> {
use ethcore::encoded; use ethcore::encoded;
let engine = self.light_dispatch.client.engine().clone(); let engine = self.light_dispatch.client.engine().clone();
@ -399,15 +399,15 @@ impl Parity for ParityClient {
Box::new(self.fetcher().header(number.unwrap_or_default().into()).map(from_encoded)) Box::new(self.fetcher().header(number.unwrap_or_default().into()).map(from_encoded))
} }
fn ipfs_cid(&self, content: Bytes) -> Result<String, Error> { fn ipfs_cid(&self, content: Bytes) -> Result<String> {
ipfs::cid(content) ipfs::cid(content)
} }
fn call(&self, _meta: Self::Metadata, _requests: Vec<CallRequest>, _block: Trailing<BlockNumber>) -> Result<Vec<Bytes>, Error> { fn call(&self, _meta: Self::Metadata, _requests: Vec<CallRequest>, _block: Trailing<BlockNumber>) -> Result<Vec<Bytes>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn node_health(&self) -> BoxFuture<Health, Error> { fn node_health(&self) -> BoxFuture<Health> {
Box::new(self.health.health() Box::new(self.health.health()
.map_err(|err| errors::internal("Health API failure.", err))) .map_err(|err| errors::internal("Health API failure.", err)))
} }

View File

@ -24,7 +24,7 @@ use ethsync::ManageNetwork;
use fetch::Fetch; use fetch::Fetch;
use hash::keccak_buffer; use hash::keccak_buffer;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_core::futures::Future; use jsonrpc_core::futures::Future;
use v1::helpers::dapps::DappsService; use v1::helpers::dapps::DappsService;
use v1::helpers::errors; use v1::helpers::errors;
@ -50,81 +50,81 @@ impl<F: Fetch> ParitySetClient<F> {
} }
impl<F: Fetch> ParitySet for ParitySetClient<F> { impl<F: Fetch> ParitySet for ParitySetClient<F> {
fn set_min_gas_price(&self, _gas_price: U256) -> Result<bool, Error> { fn set_min_gas_price(&self, _gas_price: U256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_gas_floor_target(&self, _target: U256) -> Result<bool, Error> { fn set_gas_floor_target(&self, _target: U256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_gas_ceil_target(&self, _target: U256) -> Result<bool, Error> { fn set_gas_ceil_target(&self, _target: U256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_extra_data(&self, _extra_data: Bytes) -> Result<bool, Error> { fn set_extra_data(&self, _extra_data: Bytes) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_author(&self, _author: H160) -> Result<bool, Error> { fn set_author(&self, _author: H160) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_engine_signer(&self, _address: H160, _password: String) -> Result<bool, Error> { fn set_engine_signer(&self, _address: H160, _password: String) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_transactions_limit(&self, _limit: usize) -> Result<bool, Error> { fn set_transactions_limit(&self, _limit: usize) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_tx_gas_limit(&self, _limit: U256) -> Result<bool, Error> { fn set_tx_gas_limit(&self, _limit: U256) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn add_reserved_peer(&self, peer: String) -> Result<bool, Error> { fn add_reserved_peer(&self, peer: String) -> Result<bool> {
match self.net.add_reserved_peer(peer) { match self.net.add_reserved_peer(peer) {
Ok(()) => Ok(true), Ok(()) => Ok(true),
Err(e) => Err(errors::invalid_params("Peer address", e)), Err(e) => Err(errors::invalid_params("Peer address", e)),
} }
} }
fn remove_reserved_peer(&self, peer: String) -> Result<bool, Error> { fn remove_reserved_peer(&self, peer: String) -> Result<bool> {
match self.net.remove_reserved_peer(peer) { match self.net.remove_reserved_peer(peer) {
Ok(()) => Ok(true), Ok(()) => Ok(true),
Err(e) => Err(errors::invalid_params("Peer address", e)), Err(e) => Err(errors::invalid_params("Peer address", e)),
} }
} }
fn drop_non_reserved_peers(&self) -> Result<bool, Error> { fn drop_non_reserved_peers(&self) -> Result<bool> {
self.net.deny_unreserved_peers(); self.net.deny_unreserved_peers();
Ok(true) Ok(true)
} }
fn accept_non_reserved_peers(&self) -> Result<bool, Error> { fn accept_non_reserved_peers(&self) -> Result<bool> {
self.net.accept_unreserved_peers(); self.net.accept_unreserved_peers();
Ok(true) Ok(true)
} }
fn start_network(&self) -> Result<bool, Error> { fn start_network(&self) -> Result<bool> {
self.net.start_network(); self.net.start_network();
Ok(true) Ok(true)
} }
fn stop_network(&self) -> Result<bool, Error> { fn stop_network(&self) -> Result<bool> {
self.net.stop_network(); self.net.stop_network();
Ok(true) Ok(true)
} }
fn set_mode(&self, _mode: String) -> Result<bool, Error> { fn set_mode(&self, _mode: String) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn set_spec_name(&self, _spec_name: String) -> Result<bool, Error> { fn set_spec_name(&self, _spec_name: String) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn hash_content(&self, url: String) -> BoxFuture<H256, Error> { fn hash_content(&self, url: String) -> BoxFuture<H256> {
self.fetch.process(self.fetch.fetch(&url).then(move |result| { self.fetch.process(self.fetch.fetch(&url).then(move |result| {
result result
.map_err(errors::fetch) .map_err(errors::fetch)
@ -135,23 +135,23 @@ impl<F: Fetch> ParitySet for ParitySetClient<F> {
})) }))
} }
fn dapps_refresh(&self) -> Result<bool, Error> { fn dapps_refresh(&self) -> Result<bool> {
self.dapps.as_ref().map(|dapps| dapps.refresh_local_dapps()).ok_or_else(errors::dapps_disabled) self.dapps.as_ref().map(|dapps| dapps.refresh_local_dapps()).ok_or_else(errors::dapps_disabled)
} }
fn dapps_list(&self) -> Result<Vec<LocalDapp>, Error> { fn dapps_list(&self) -> Result<Vec<LocalDapp>> {
self.dapps.as_ref().map(|dapps| dapps.list_dapps()).ok_or_else(errors::dapps_disabled) self.dapps.as_ref().map(|dapps| dapps.list_dapps()).ok_or_else(errors::dapps_disabled)
} }
fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>, Error> { fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn execute_upgrade(&self) -> Result<bool, Error> { fn execute_upgrade(&self) -> Result<bool> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn remove_transaction(&self, _hash: H256) -> Result<Option<Transaction>, Error> { fn remove_transaction(&self, _hash: H256) -> Result<Option<Transaction>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
} }

View File

@ -16,7 +16,7 @@
//! Traces api implementation. //! Traces api implementation.
use jsonrpc_core::Error; use jsonrpc_core::Result;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::Metadata; use v1::Metadata;
use v1::traits::Traces; use v1::traits::Traces;
@ -30,35 +30,35 @@ pub struct TracesClient;
impl Traces for TracesClient { impl Traces for TracesClient {
type Metadata = Metadata; type Metadata = Metadata;
fn filter(&self, _filter: TraceFilter) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn filter(&self, _filter: TraceFilter) -> Result<Option<Vec<LocalizedTrace>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn block_traces(&self, _block_number: BlockNumber) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn block_traces(&self, _block_number: BlockNumber) -> Result<Option<Vec<LocalizedTrace>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn transaction_traces(&self, _transaction_hash: H256) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn transaction_traces(&self, _transaction_hash: H256) -> Result<Option<Vec<LocalizedTrace>>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn trace(&self, _transaction_hash: H256, _address: Vec<Index>) -> Result<Option<LocalizedTrace>, Error> { fn trace(&self, _transaction_hash: H256, _address: Vec<Index>) -> Result<Option<LocalizedTrace>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn call(&self, _meta: Self::Metadata, _request: CallRequest, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults, Error> { fn call(&self, _meta: Self::Metadata, _request: CallRequest, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn call_many(&self, _meta: Self::Metadata, _request: Vec<(CallRequest, TraceOptions)>, _block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>, Error> { fn call_many(&self, _meta: Self::Metadata, _request: Vec<(CallRequest, TraceOptions)>, _block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn raw_transaction(&self, _raw_transaction: Bytes, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults, Error> { fn raw_transaction(&self, _raw_transaction: Bytes, _flags: TraceOptions, _block: Trailing<BlockNumber>) -> Result<TraceResults> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
fn replay_transaction(&self, _transaction_hash: H256, _flags: TraceOptions) -> Result<TraceResults, Error> { fn replay_transaction(&self, _transaction_hash: H256, _flags: TraceOptions) -> Result<TraceResults> {
Err(errors::light_unimplemented(None)) Err(errors::light_unimplemented(None))
} }
} }

View File

@ -16,7 +16,7 @@
//! Net rpc implementation. //! Net rpc implementation.
use std::sync::Arc; use std::sync::Arc;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use ethsync::SyncProvider; use ethsync::SyncProvider;
use v1::traits::Net; use v1::traits::Net;
@ -35,15 +35,15 @@ impl<S: ?Sized> NetClient<S> where S: SyncProvider {
} }
impl<S: ?Sized> Net for NetClient<S> where S: SyncProvider + 'static { impl<S: ?Sized> Net for NetClient<S> where S: SyncProvider + 'static {
fn version(&self) -> Result<String, Error> { fn version(&self) -> Result<String> {
Ok(format!("{}", self.sync.status().network_id).to_owned()) Ok(format!("{}", self.sync.status().network_id).to_owned())
} }
fn peer_count(&self) -> Result<String, Error> { fn peer_count(&self) -> Result<String> {
Ok(format!("0x{:x}", self.sync.status().num_peers as u64).to_owned()) Ok(format!("0x{:x}", self.sync.status().num_peers as u64).to_owned())
} }
fn is_listening(&self) -> Result<bool, Error> { fn is_listening(&self) -> Result<bool> {
// right now (11 march 2016), we are always listening for incoming connections // right now (11 march 2016), we are always listening for incoming connections
// //
// (this may not be true now -- 26 september 2016) // (this may not be true now -- 26 september 2016)

View File

@ -35,7 +35,7 @@ use ethcore_logger::RotatingLogger;
use node_health::{NodeHealth, Health}; use node_health::{NodeHealth, Health};
use updater::{Service as UpdateService}; use updater::{Service as UpdateService};
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::helpers::{self, errors, fake_sign, ipfs, SigningQueue, SignerService, NetworkSettings}; use v1::helpers::{self, errors, fake_sign, ipfs, SigningQueue, SignerService, NetworkSettings};
@ -107,7 +107,7 @@ impl<C, M, U> ParityClient<C, M, U> where
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not /// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
/// set. /// set.
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
} }
@ -119,7 +119,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
{ {
type Metadata = Metadata; type Metadata = Metadata;
fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>, Error> { fn accounts_info(&self, dapp: Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>> {
let dapp = dapp.unwrap_or_default(); let dapp = dapp.unwrap_or_default();
let store = self.account_provider()?; let store = self.account_provider()?;
@ -141,7 +141,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>, Error> { fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>> {
let store = self.account_provider()?; let store = self.account_provider()?;
let info = store.hardware_accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?; let info = store.hardware_accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?;
Ok(info Ok(info
@ -151,12 +151,12 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn locked_hardware_accounts_info(&self) -> Result<Vec<String>, Error> { fn locked_hardware_accounts_info(&self) -> Result<Vec<String>> {
let store = self.account_provider()?; let store = self.account_provider()?;
Ok(store.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))?) Ok(store.locked_hardware_accounts().map_err(|e| errors::account("Error communicating with hardware wallet.", e))?)
} }
fn default_account(&self, meta: Self::Metadata) -> Result<H160, Error> { fn default_account(&self, meta: Self::Metadata) -> Result<H160> {
let dapp_id = meta.dapp_id(); let dapp_id = meta.dapp_id();
Ok(self.account_provider()? Ok(self.account_provider()?
@ -166,48 +166,48 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
.unwrap_or_default()) .unwrap_or_default())
} }
fn transactions_limit(&self) -> Result<usize, Error> { fn transactions_limit(&self) -> Result<usize> {
Ok(self.miner.transactions_limit()) Ok(self.miner.transactions_limit())
} }
fn min_gas_price(&self) -> Result<U256, Error> { fn min_gas_price(&self) -> Result<U256> {
Ok(U256::from(self.miner.minimal_gas_price())) Ok(U256::from(self.miner.minimal_gas_price()))
} }
fn extra_data(&self) -> Result<Bytes, Error> { fn extra_data(&self) -> Result<Bytes> {
Ok(Bytes::new(self.miner.extra_data())) Ok(Bytes::new(self.miner.extra_data()))
} }
fn gas_floor_target(&self) -> Result<U256, Error> { fn gas_floor_target(&self) -> Result<U256> {
Ok(U256::from(self.miner.gas_floor_target())) Ok(U256::from(self.miner.gas_floor_target()))
} }
fn gas_ceil_target(&self) -> Result<U256, Error> { fn gas_ceil_target(&self) -> Result<U256> {
Ok(U256::from(self.miner.gas_ceil_target())) Ok(U256::from(self.miner.gas_ceil_target()))
} }
fn dev_logs(&self) -> Result<Vec<String>, Error> { fn dev_logs(&self) -> Result<Vec<String>> {
let logs = self.logger.logs(); let logs = self.logger.logs();
Ok(logs.as_slice().to_owned()) Ok(logs.as_slice().to_owned())
} }
fn dev_logs_levels(&self) -> Result<String, Error> { fn dev_logs_levels(&self) -> Result<String> {
Ok(self.logger.levels().to_owned()) Ok(self.logger.levels().to_owned())
} }
fn net_chain(&self) -> Result<String, Error> { fn net_chain(&self) -> Result<String> {
Ok(self.settings.chain.clone()) Ok(self.settings.chain.clone())
} }
fn chain_id(&self) -> Result<Option<U64>, Error> { fn chain_id(&self) -> Result<Option<U64>> {
Ok(self.client.signing_chain_id().map(U64::from)) Ok(self.client.signing_chain_id().map(U64::from))
} }
fn chain(&self) -> Result<String, Error> { fn chain(&self) -> Result<String> {
Ok(self.client.spec_name()) Ok(self.client.spec_name())
} }
fn net_peers(&self) -> Result<Peers, Error> { fn net_peers(&self) -> Result<Peers> {
let sync_status = self.sync.status(); let sync_status = self.sync.status();
let net_config = self.net.network_config(); let net_config = self.net.network_config();
let peers = self.sync.peers().into_iter().map(Into::into).collect(); let peers = self.sync.peers().into_iter().map(Into::into).collect();
@ -220,15 +220,15 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}) })
} }
fn net_port(&self) -> Result<u16, Error> { fn net_port(&self) -> Result<u16> {
Ok(self.settings.network_port) Ok(self.settings.network_port)
} }
fn node_name(&self) -> Result<String, Error> { fn node_name(&self) -> Result<String> {
Ok(self.settings.name.clone()) Ok(self.settings.name.clone())
} }
fn registry_address(&self) -> Result<Option<H160>, Error> { fn registry_address(&self) -> Result<Option<H160>> {
Ok( Ok(
self.client self.client
.additional_params() .additional_params()
@ -238,7 +238,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn rpc_settings(&self) -> Result<RpcSettings, Error> { fn rpc_settings(&self) -> Result<RpcSettings> {
Ok(RpcSettings { Ok(RpcSettings {
enabled: self.settings.rpc_enabled, enabled: self.settings.rpc_enabled,
interface: self.settings.rpc_interface.clone(), interface: self.settings.rpc_interface.clone(),
@ -246,11 +246,11 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}) })
} }
fn default_extra_data(&self) -> Result<Bytes, Error> { fn default_extra_data(&self) -> Result<Bytes> {
Ok(Bytes::new(version_data())) Ok(Bytes::new(version_data()))
} }
fn gas_price_histogram(&self) -> BoxFuture<Histogram, Error> { fn gas_price_histogram(&self) -> BoxFuture<Histogram> {
Box::new(future::done(self.client Box::new(future::done(self.client
.gas_price_corpus(100) .gas_price_corpus(100)
.histogram(10) .histogram(10)
@ -259,50 +259,50 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
)) ))
} }
fn unsigned_transactions_count(&self) -> Result<usize, Error> { fn unsigned_transactions_count(&self) -> Result<usize> {
match self.signer { match self.signer {
None => Err(errors::signer_disabled()), None => Err(errors::signer_disabled()),
Some(ref signer) => Ok(signer.len()), Some(ref signer) => Ok(signer.len()),
} }
} }
fn generate_secret_phrase(&self) -> Result<String, Error> { fn generate_secret_phrase(&self) -> Result<String> {
Ok(random_phrase(12)) Ok(random_phrase(12))
} }
fn phrase_to_address(&self, phrase: String) -> Result<H160, Error> { fn phrase_to_address(&self, phrase: String) -> Result<H160> {
Ok(Brain::new(phrase).generate().unwrap().address().into()) Ok(Brain::new(phrase).generate().unwrap().address().into())
} }
fn list_accounts(&self, count: u64, after: Option<H160>, block_number: Trailing<BlockNumber>) -> Result<Option<Vec<H160>>, Error> { fn list_accounts(&self, count: u64, after: Option<H160>, block_number: Trailing<BlockNumber>) -> Result<Option<Vec<H160>>> {
Ok(self.client Ok(self.client
.list_accounts(block_number.unwrap_or_default().into(), after.map(Into::into).as_ref(), count) .list_accounts(block_number.unwrap_or_default().into(), after.map(Into::into).as_ref(), count)
.map(|a| a.into_iter().map(Into::into).collect())) .map(|a| a.into_iter().map(Into::into).collect()))
} }
fn list_storage_keys(&self, address: H160, count: u64, after: Option<H256>, block_number: Trailing<BlockNumber>) -> Result<Option<Vec<H256>>, Error> { fn list_storage_keys(&self, address: H160, count: u64, after: Option<H256>, block_number: Trailing<BlockNumber>) -> Result<Option<Vec<H256>>> {
Ok(self.client Ok(self.client
.list_storage(block_number.unwrap_or_default().into(), &address.into(), after.map(Into::into).as_ref(), count) .list_storage(block_number.unwrap_or_default().into(), &address.into(), after.map(Into::into).as_ref(), count)
.map(|a| a.into_iter().map(Into::into).collect())) .map(|a| a.into_iter().map(Into::into).collect()))
} }
fn encrypt_message(&self, key: H512, phrase: Bytes) -> Result<Bytes, Error> { fn encrypt_message(&self, key: H512, phrase: Bytes) -> Result<Bytes> {
ecies::encrypt(&key.into(), &DEFAULT_MAC, &phrase.0) ecies::encrypt(&key.into(), &DEFAULT_MAC, &phrase.0)
.map_err(errors::encryption) .map_err(errors::encryption)
.map(Into::into) .map(Into::into)
} }
fn pending_transactions(&self) -> Result<Vec<Transaction>, Error> { fn pending_transactions(&self) -> Result<Vec<Transaction>> {
let block_number = self.client.chain_info().best_block_number; let block_number = self.client.chain_info().best_block_number;
Ok(self.miner.pending_transactions().into_iter().map(|t| Transaction::from_pending(t, block_number, self.eip86_transition)).collect::<Vec<_>>()) Ok(self.miner.pending_transactions().into_iter().map(|t| Transaction::from_pending(t, block_number, self.eip86_transition)).collect::<Vec<_>>())
} }
fn future_transactions(&self) -> Result<Vec<Transaction>, Error> { fn future_transactions(&self) -> Result<Vec<Transaction>> {
let block_number = self.client.chain_info().best_block_number; let block_number = self.client.chain_info().best_block_number;
Ok(self.miner.future_transactions().into_iter().map(|t| Transaction::from_pending(t, block_number, self.eip86_transition)).collect::<Vec<_>>()) Ok(self.miner.future_transactions().into_iter().map(|t| Transaction::from_pending(t, block_number, self.eip86_transition)).collect::<Vec<_>>())
} }
fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>, Error> { fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>> {
let stats = self.sync.transactions_stats(); let stats = self.sync.transactions_stats();
Ok(stats.into_iter() Ok(stats.into_iter()
.map(|(hash, stats)| (hash.into(), stats.into())) .map(|(hash, stats)| (hash.into(), stats.into()))
@ -310,7 +310,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>, Error> { fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>> {
// Return nothing if accounts are disabled (running as public node) // Return nothing if accounts are disabled (running as public node)
if self.accounts.is_none() { if self.accounts.is_none() {
return Ok(BTreeMap::new()); return Ok(BTreeMap::new());
@ -325,17 +325,17 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
) )
} }
fn dapps_url(&self) -> Result<String, Error> { fn dapps_url(&self) -> Result<String> {
helpers::to_url(&self.dapps_address) helpers::to_url(&self.dapps_address)
.ok_or_else(|| errors::dapps_disabled()) .ok_or_else(|| errors::dapps_disabled())
} }
fn ws_url(&self) -> Result<String, Error> { fn ws_url(&self) -> Result<String> {
helpers::to_url(&self.ws_address) helpers::to_url(&self.ws_address)
.ok_or_else(|| errors::ws_disabled()) .ok_or_else(|| errors::ws_disabled())
} }
fn next_nonce(&self, address: H160) -> BoxFuture<U256, Error> { fn next_nonce(&self, address: H160) -> BoxFuture<U256> {
let address: Address = address.into(); let address: Address = address.into();
Box::new(future::ok(self.miner.last_nonce(&address) Box::new(future::ok(self.miner.last_nonce(&address)
@ -345,7 +345,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
)) ))
} }
fn mode(&self) -> Result<String, Error> { fn mode(&self) -> Result<String> {
Ok(match self.client.mode() { Ok(match self.client.mode() {
Mode::Off => "offline", Mode::Off => "offline",
Mode::Dark(..) => "dark", Mode::Dark(..) => "dark",
@ -354,23 +354,23 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}.into()) }.into())
} }
fn enode(&self) -> Result<String, Error> { fn enode(&self) -> Result<String> {
self.sync.enode().ok_or_else(errors::network_disabled) self.sync.enode().ok_or_else(errors::network_disabled)
} }
fn consensus_capability(&self) -> Result<ConsensusCapability, Error> { fn consensus_capability(&self) -> Result<ConsensusCapability> {
Ok(self.updater.capability().into()) Ok(self.updater.capability().into())
} }
fn version_info(&self) -> Result<VersionInfo, Error> { fn version_info(&self) -> Result<VersionInfo> {
Ok(self.updater.version_info().into()) Ok(self.updater.version_info().into())
} }
fn releases_info(&self) -> Result<Option<OperationsInfo>, Error> { fn releases_info(&self) -> Result<Option<OperationsInfo>> {
Ok(self.updater.info().map(Into::into)) Ok(self.updater.info().map(Into::into))
} }
fn chain_status(&self) -> Result<ChainStatus, Error> { fn chain_status(&self) -> Result<ChainStatus> {
let chain_info = self.client.chain_info(); let chain_info = self.client.chain_info();
let gap = chain_info.ancient_block_number.map(|x| U256::from(x + 1)) let gap = chain_info.ancient_block_number.map(|x| U256::from(x + 1))
@ -381,7 +381,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}) })
} }
fn node_kind(&self) -> Result<::v1::types::NodeKind, Error> { fn node_kind(&self) -> Result<::v1::types::NodeKind> {
use ::v1::types::{NodeKind, Availability, Capability}; use ::v1::types::{NodeKind, Availability, Capability};
let availability = match self.accounts { let availability = match self.accounts {
@ -395,7 +395,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
}) })
} }
fn block_header(&self, number: Trailing<BlockNumber>) -> BoxFuture<RichHeader, Error> { fn block_header(&self, number: Trailing<BlockNumber>) -> BoxFuture<RichHeader> {
const EXTRA_INFO_PROOF: &'static str = "Object exists in in blockchain (fetched earlier), extra_info is always available if object exists; qed"; const EXTRA_INFO_PROOF: &'static str = "Object exists in in blockchain (fetched earlier), extra_info is always available if object exists; qed";
let id: BlockId = number.unwrap_or_default().into(); let id: BlockId = number.unwrap_or_default().into();
@ -410,18 +410,18 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
})) }))
} }
fn ipfs_cid(&self, content: Bytes) -> Result<String, Error> { fn ipfs_cid(&self, content: Bytes) -> Result<String> {
ipfs::cid(content) ipfs::cid(content)
} }
fn call(&self, meta: Self::Metadata, requests: Vec<CallRequest>, block: Trailing<BlockNumber>) -> Result<Vec<Bytes>, Error> { fn call(&self, meta: Self::Metadata, requests: Vec<CallRequest>, block: Trailing<BlockNumber>) -> Result<Vec<Bytes>> {
let requests = requests let requests = requests
.into_iter() .into_iter()
.map(|request| Ok(( .map(|request| Ok((
fake_sign::sign_call(request.into(), meta.is_dapp())?, fake_sign::sign_call(request.into(), meta.is_dapp())?,
Default::default() Default::default()
))) )))
.collect::<Result<Vec<_>, Error>>()?; .collect::<Result<Vec<_>>>()?;
let block = block.unwrap_or_default(); let block = block.unwrap_or_default();
@ -430,7 +430,7 @@ impl<C, M, U> Parity for ParityClient<C, M, U> where
.map_err(errors::call) .map_err(errors::call)
} }
fn node_health(&self) -> BoxFuture<Health, Error> { fn node_health(&self) -> BoxFuture<Health> {
Box::new(self.health.health() Box::new(self.health.health()
.map_err(|err| errors::internal("Health API failure.", err))) .map_err(|err| errors::internal("Health API failure.", err)))
} }

View File

@ -23,7 +23,7 @@ use ethkey::{Brain, Generator, Secret};
use ethstore::KeyFile; use ethstore::KeyFile;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use v1::helpers::errors; use v1::helpers::errors;
use v1::helpers::accounts::unwrap_provider; use v1::helpers::accounts::unwrap_provider;
use v1::traits::ParityAccounts; use v1::traits::ParityAccounts;
@ -44,13 +44,13 @@ impl ParityAccountsClient {
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not /// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
/// set. /// set.
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
} }
impl ParityAccounts for ParityAccountsClient { impl ParityAccounts for ParityAccountsClient {
fn all_accounts_info(&self) -> Result<BTreeMap<RpcH160, ExtAccountInfo>, Error> { fn all_accounts_info(&self) -> Result<BTreeMap<RpcH160, ExtAccountInfo>> {
let store = self.account_provider()?; let store = self.account_provider()?;
let info = store.accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?; let info = store.accounts_info().map_err(|e| errors::account("Could not fetch account info.", e))?;
let other = store.addresses_info(); let other = store.addresses_info();
@ -82,7 +82,7 @@ impl ParityAccounts for ParityAccountsClient {
Ok(accounts) Ok(accounts)
} }
fn new_account_from_phrase(&self, phrase: String, pass: String) -> Result<RpcH160, Error> { fn new_account_from_phrase(&self, phrase: String, pass: String) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
let brain = Brain::new(phrase).generate().unwrap(); let brain = Brain::new(phrase).generate().unwrap();
@ -91,7 +91,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not create account.", e)) .map_err(|e| errors::account("Could not create account.", e))
} }
fn new_account_from_wallet(&self, json: String, pass: String) -> Result<RpcH160, Error> { fn new_account_from_wallet(&self, json: String, pass: String) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.import_presale(json.as_bytes(), &pass) store.import_presale(json.as_bytes(), &pass)
@ -100,7 +100,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not create account.", e)) .map_err(|e| errors::account("Could not create account.", e))
} }
fn new_account_from_secret(&self, secret: RpcH256, pass: String) -> Result<RpcH160, Error> { fn new_account_from_secret(&self, secret: RpcH256, pass: String) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
let secret = Secret::from_unsafe_slice(&secret.0) let secret = Secret::from_unsafe_slice(&secret.0)
@ -110,7 +110,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not create account.", e)) .map_err(|e| errors::account("Could not create account.", e))
} }
fn test_password(&self, account: RpcH160, password: String) -> Result<bool, Error> { fn test_password(&self, account: RpcH160, password: String) -> Result<bool> {
let account: Address = account.into(); let account: Address = account.into();
self.account_provider()? self.account_provider()?
@ -118,7 +118,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not fetch account info.", e)) .map_err(|e| errors::account("Could not fetch account info.", e))
} }
fn change_password(&self, account: RpcH160, password: String, new_password: String) -> Result<bool, Error> { fn change_password(&self, account: RpcH160, password: String, new_password: String) -> Result<bool> {
let account: Address = account.into(); let account: Address = account.into();
self.account_provider()? self.account_provider()?
.change_password(&account, password, new_password) .change_password(&account, password, new_password)
@ -126,7 +126,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not fetch account info.", e)) .map_err(|e| errors::account("Could not fetch account info.", e))
} }
fn kill_account(&self, account: RpcH160, password: String) -> Result<bool, Error> { fn kill_account(&self, account: RpcH160, password: String) -> Result<bool> {
let account: Address = account.into(); let account: Address = account.into();
self.account_provider()? self.account_provider()?
.kill_account(&account, &password) .kill_account(&account, &password)
@ -134,7 +134,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not delete account.", e)) .map_err(|e| errors::account("Could not delete account.", e))
} }
fn remove_address(&self, addr: RpcH160) -> Result<bool, Error> { fn remove_address(&self, addr: RpcH160) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
let addr: Address = addr.into(); let addr: Address = addr.into();
@ -142,7 +142,7 @@ impl ParityAccounts for ParityAccountsClient {
Ok(true) Ok(true)
} }
fn set_account_name(&self, addr: RpcH160, name: String) -> Result<bool, Error> { fn set_account_name(&self, addr: RpcH160, name: String) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
let addr: Address = addr.into(); let addr: Address = addr.into();
@ -151,7 +151,7 @@ impl ParityAccounts for ParityAccountsClient {
Ok(true) Ok(true)
} }
fn set_account_meta(&self, addr: RpcH160, meta: String) -> Result<bool, Error> { fn set_account_meta(&self, addr: RpcH160, meta: String) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
let addr: Address = addr.into(); let addr: Address = addr.into();
@ -160,7 +160,7 @@ impl ParityAccounts for ParityAccountsClient {
Ok(true) Ok(true)
} }
fn set_dapp_addresses(&self, dapp: DappId, addresses: Option<Vec<RpcH160>>) -> Result<bool, Error> { fn set_dapp_addresses(&self, dapp: DappId, addresses: Option<Vec<RpcH160>>) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.set_dapp_addresses(dapp.into(), addresses.map(into_vec)) store.set_dapp_addresses(dapp.into(), addresses.map(into_vec))
@ -168,7 +168,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|_| true) .map(|_| true)
} }
fn dapp_addresses(&self, dapp: DappId) -> Result<Vec<RpcH160>, Error> { fn dapp_addresses(&self, dapp: DappId) -> Result<Vec<RpcH160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.dapp_addresses(dapp.into()) store.dapp_addresses(dapp.into())
@ -176,7 +176,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(into_vec) .map(into_vec)
} }
fn set_dapp_default_address(&self, dapp: DappId, address: RpcH160) -> Result<bool, Error> { fn set_dapp_default_address(&self, dapp: DappId, address: RpcH160) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.set_dapp_default_address(dapp.into(), address.into()) store.set_dapp_default_address(dapp.into(), address.into())
@ -184,7 +184,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|_| true) .map(|_| true)
} }
fn dapp_default_address(&self, dapp: DappId) -> Result<RpcH160, Error> { fn dapp_default_address(&self, dapp: DappId) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.dapp_default_address(dapp.into()) store.dapp_default_address(dapp.into())
@ -192,7 +192,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(Into::into) .map(Into::into)
} }
fn set_new_dapps_addresses(&self, addresses: Option<Vec<RpcH160>>) -> Result<bool, Error> { fn set_new_dapps_addresses(&self, addresses: Option<Vec<RpcH160>>) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
store store
@ -201,7 +201,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|_| true) .map(|_| true)
} }
fn new_dapps_addresses(&self) -> Result<Option<Vec<RpcH160>>, Error> { fn new_dapps_addresses(&self) -> Result<Option<Vec<RpcH160>>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.new_dapps_addresses() store.new_dapps_addresses()
@ -209,7 +209,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|accounts| accounts.map(into_vec)) .map(|accounts| accounts.map(into_vec))
} }
fn set_new_dapps_default_address(&self, address: RpcH160) -> Result<bool, Error> { fn set_new_dapps_default_address(&self, address: RpcH160) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.set_new_dapps_default_address(address.into()) store.set_new_dapps_default_address(address.into())
@ -217,7 +217,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|_| true) .map(|_| true)
} }
fn new_dapps_default_address(&self) -> Result<RpcH160, Error> { fn new_dapps_default_address(&self) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.new_dapps_default_address() store.new_dapps_default_address()
@ -225,7 +225,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(Into::into) .map(Into::into)
} }
fn recent_dapps(&self) -> Result<BTreeMap<DappId, u64>, Error> { fn recent_dapps(&self) -> Result<BTreeMap<DappId, u64>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.recent_dapps() store.recent_dapps()
@ -233,7 +233,7 @@ impl ParityAccounts for ParityAccountsClient {
.map(|map| map.into_iter().map(|(k, v)| (k.into(), v)).collect()) .map(|map| map.into_iter().map(|(k, v)| (k.into(), v)).collect())
} }
fn import_geth_accounts(&self, addresses: Vec<RpcH160>) -> Result<Vec<RpcH160>, Error> { fn import_geth_accounts(&self, addresses: Vec<RpcH160>) -> Result<Vec<RpcH160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store store
@ -242,73 +242,73 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Couldn't import Geth accounts", e)) .map_err(|e| errors::account("Couldn't import Geth accounts", e))
} }
fn geth_accounts(&self) -> Result<Vec<RpcH160>, Error> { fn geth_accounts(&self) -> Result<Vec<RpcH160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
Ok(into_vec(store.list_geth_accounts(false))) Ok(into_vec(store.list_geth_accounts(false)))
} }
fn create_vault(&self, name: String, password: String) -> Result<bool, Error> { fn create_vault(&self, name: String, password: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.create_vault(&name, &password) .create_vault(&name, &password)
.map_err(|e| errors::account("Could not create vault.", e)) .map_err(|e| errors::account("Could not create vault.", e))
.map(|_| true) .map(|_| true)
} }
fn open_vault(&self, name: String, password: String) -> Result<bool, Error> { fn open_vault(&self, name: String, password: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.open_vault(&name, &password) .open_vault(&name, &password)
.map_err(|e| errors::account("Could not open vault.", e)) .map_err(|e| errors::account("Could not open vault.", e))
.map(|_| true) .map(|_| true)
} }
fn close_vault(&self, name: String) -> Result<bool, Error> { fn close_vault(&self, name: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.close_vault(&name) .close_vault(&name)
.map_err(|e| errors::account("Could not close vault.", e)) .map_err(|e| errors::account("Could not close vault.", e))
.map(|_| true) .map(|_| true)
} }
fn list_vaults(&self) -> Result<Vec<String>, Error> { fn list_vaults(&self) -> Result<Vec<String>> {
self.account_provider()? self.account_provider()?
.list_vaults() .list_vaults()
.map_err(|e| errors::account("Could not list vaults.", e)) .map_err(|e| errors::account("Could not list vaults.", e))
} }
fn list_opened_vaults(&self) -> Result<Vec<String>, Error> { fn list_opened_vaults(&self) -> Result<Vec<String>> {
self.account_provider()? self.account_provider()?
.list_opened_vaults() .list_opened_vaults()
.map_err(|e| errors::account("Could not list vaults.", e)) .map_err(|e| errors::account("Could not list vaults.", e))
} }
fn change_vault_password(&self, name: String, new_password: String) -> Result<bool, Error> { fn change_vault_password(&self, name: String, new_password: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.change_vault_password(&name, &new_password) .change_vault_password(&name, &new_password)
.map_err(|e| errors::account("Could not change vault password.", e)) .map_err(|e| errors::account("Could not change vault password.", e))
.map(|_| true) .map(|_| true)
} }
fn change_vault(&self, address: RpcH160, new_vault: String) -> Result<bool, Error> { fn change_vault(&self, address: RpcH160, new_vault: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.change_vault(address.into(), &new_vault) .change_vault(address.into(), &new_vault)
.map_err(|e| errors::account("Could not change vault.", e)) .map_err(|e| errors::account("Could not change vault.", e))
.map(|_| true) .map(|_| true)
} }
fn get_vault_meta(&self, name: String) -> Result<String, Error> { fn get_vault_meta(&self, name: String) -> Result<String> {
self.account_provider()? self.account_provider()?
.get_vault_meta(&name) .get_vault_meta(&name)
.map_err(|e| errors::account("Could not get vault metadata.", e)) .map_err(|e| errors::account("Could not get vault metadata.", e))
} }
fn set_vault_meta(&self, name: String, meta: String) -> Result<bool, Error> { fn set_vault_meta(&self, name: String, meta: String) -> Result<bool> {
self.account_provider()? self.account_provider()?
.set_vault_meta(&name, &meta) .set_vault_meta(&name, &meta)
.map_err(|e| errors::account("Could not update vault metadata.", e)) .map_err(|e| errors::account("Could not update vault metadata.", e))
.map(|_| true) .map(|_| true)
} }
fn derive_key_index(&self, addr: RpcH160, password: String, derivation: DeriveHierarchical, save_as_account: bool) -> Result<RpcH160, Error> { fn derive_key_index(&self, addr: RpcH160, password: String, derivation: DeriveHierarchical, save_as_account: bool) -> Result<RpcH160> {
let addr: Address = addr.into(); let addr: Address = addr.into();
self.account_provider()? self.account_provider()?
.derive_account( .derive_account(
@ -321,7 +321,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not derive account.", e)) .map_err(|e| errors::account("Could not derive account.", e))
} }
fn derive_key_hash(&self, addr: RpcH160, password: String, derivation: DeriveHash, save_as_account: bool) -> Result<RpcH160, Error> { fn derive_key_hash(&self, addr: RpcH160, password: String, derivation: DeriveHash, save_as_account: bool) -> Result<RpcH160> {
let addr: Address = addr.into(); let addr: Address = addr.into();
self.account_provider()? self.account_provider()?
.derive_account( .derive_account(
@ -334,7 +334,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not derive account.", e)) .map_err(|e| errors::account("Could not derive account.", e))
} }
fn export_account(&self, addr: RpcH160, password: String) -> Result<KeyFile, Error> { fn export_account(&self, addr: RpcH160, password: String) -> Result<KeyFile> {
let addr = addr.into(); let addr = addr.into();
self.account_provider()? self.account_provider()?
.export_account( .export_account(
@ -345,7 +345,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not export account.", e)) .map_err(|e| errors::account("Could not export account.", e))
} }
fn sign_message(&self, addr: RpcH160, password: String, message: RpcH256) -> Result<RpcH520, Error> { fn sign_message(&self, addr: RpcH160, password: String, message: RpcH256) -> Result<RpcH520> {
self.account_provider()? self.account_provider()?
.sign( .sign(
addr.into(), addr.into(),
@ -356,7 +356,7 @@ impl ParityAccounts for ParityAccountsClient {
.map_err(|e| errors::account("Could not sign message.", e)) .map_err(|e| errors::account("Could not sign message.", e))
} }
fn hardware_pin_matrix_ack(&self, path: String, pin: String) -> Result<bool, Error> { fn hardware_pin_matrix_ack(&self, path: String, pin: String) -> Result<bool> {
let store = self.account_provider()?; let store = self.account_provider()?;
Ok(store.hardware_pin_matrix_ack(&path, &pin).map_err(|e| errors::account("Error communicating with hardware wallet.", e))?) Ok(store.hardware_pin_matrix_ack(&path, &pin).map_err(|e| errors::account("Error communicating with hardware wallet.", e))?)
} }

View File

@ -26,7 +26,7 @@ use fetch::{self, Fetch};
use hash::keccak_buffer; use hash::keccak_buffer;
use updater::{Service as UpdateService}; use updater::{Service as UpdateService};
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::Future; use jsonrpc_core::futures::Future;
use v1::helpers::dapps::DappsService; use v1::helpers::dapps::DappsService;
use v1::helpers::errors; use v1::helpers::errors;
@ -75,81 +75,81 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
F: Fetch + 'static, F: Fetch + 'static,
{ {
fn set_min_gas_price(&self, gas_price: U256) -> Result<bool, Error> { fn set_min_gas_price(&self, gas_price: U256) -> Result<bool> {
self.miner.set_minimal_gas_price(gas_price.into()); self.miner.set_minimal_gas_price(gas_price.into());
Ok(true) Ok(true)
} }
fn set_gas_floor_target(&self, target: U256) -> Result<bool, Error> { fn set_gas_floor_target(&self, target: U256) -> Result<bool> {
self.miner.set_gas_floor_target(target.into()); self.miner.set_gas_floor_target(target.into());
Ok(true) Ok(true)
} }
fn set_gas_ceil_target(&self, target: U256) -> Result<bool, Error> { fn set_gas_ceil_target(&self, target: U256) -> Result<bool> {
self.miner.set_gas_ceil_target(target.into()); self.miner.set_gas_ceil_target(target.into());
Ok(true) Ok(true)
} }
fn set_extra_data(&self, extra_data: Bytes) -> Result<bool, Error> { fn set_extra_data(&self, extra_data: Bytes) -> Result<bool> {
self.miner.set_extra_data(extra_data.into_vec()); self.miner.set_extra_data(extra_data.into_vec());
Ok(true) Ok(true)
} }
fn set_author(&self, author: H160) -> Result<bool, Error> { fn set_author(&self, author: H160) -> Result<bool> {
self.miner.set_author(author.into()); self.miner.set_author(author.into());
Ok(true) Ok(true)
} }
fn set_engine_signer(&self, address: H160, password: String) -> Result<bool, Error> { fn set_engine_signer(&self, address: H160, password: String) -> Result<bool> {
self.miner.set_engine_signer(address.into(), password).map_err(Into::into).map_err(errors::password)?; self.miner.set_engine_signer(address.into(), password).map_err(Into::into).map_err(errors::password)?;
Ok(true) Ok(true)
} }
fn set_transactions_limit(&self, limit: usize) -> Result<bool, Error> { fn set_transactions_limit(&self, limit: usize) -> Result<bool> {
self.miner.set_transactions_limit(limit); self.miner.set_transactions_limit(limit);
Ok(true) Ok(true)
} }
fn set_tx_gas_limit(&self, limit: U256) -> Result<bool, Error> { fn set_tx_gas_limit(&self, limit: U256) -> Result<bool> {
self.miner.set_tx_gas_limit(limit.into()); self.miner.set_tx_gas_limit(limit.into());
Ok(true) Ok(true)
} }
fn add_reserved_peer(&self, peer: String) -> Result<bool, Error> { fn add_reserved_peer(&self, peer: String) -> Result<bool> {
match self.net.add_reserved_peer(peer) { match self.net.add_reserved_peer(peer) {
Ok(()) => Ok(true), Ok(()) => Ok(true),
Err(e) => Err(errors::invalid_params("Peer address", e)), Err(e) => Err(errors::invalid_params("Peer address", e)),
} }
} }
fn remove_reserved_peer(&self, peer: String) -> Result<bool, Error> { fn remove_reserved_peer(&self, peer: String) -> Result<bool> {
match self.net.remove_reserved_peer(peer) { match self.net.remove_reserved_peer(peer) {
Ok(()) => Ok(true), Ok(()) => Ok(true),
Err(e) => Err(errors::invalid_params("Peer address", e)), Err(e) => Err(errors::invalid_params("Peer address", e)),
} }
} }
fn drop_non_reserved_peers(&self) -> Result<bool, Error> { fn drop_non_reserved_peers(&self) -> Result<bool> {
self.net.deny_unreserved_peers(); self.net.deny_unreserved_peers();
Ok(true) Ok(true)
} }
fn accept_non_reserved_peers(&self) -> Result<bool, Error> { fn accept_non_reserved_peers(&self) -> Result<bool> {
self.net.accept_unreserved_peers(); self.net.accept_unreserved_peers();
Ok(true) Ok(true)
} }
fn start_network(&self) -> Result<bool, Error> { fn start_network(&self) -> Result<bool> {
self.net.start_network(); self.net.start_network();
Ok(true) Ok(true)
} }
fn stop_network(&self) -> Result<bool, Error> { fn stop_network(&self) -> Result<bool> {
self.net.stop_network(); self.net.stop_network();
Ok(true) Ok(true)
} }
fn set_mode(&self, mode: String) -> Result<bool, Error> { fn set_mode(&self, mode: String) -> Result<bool> {
self.client.set_mode(match mode.as_str() { self.client.set_mode(match mode.as_str() {
"offline" => Mode::Off, "offline" => Mode::Off,
"dark" => Mode::Dark(300), "dark" => Mode::Dark(300),
@ -160,12 +160,12 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
Ok(true) Ok(true)
} }
fn set_spec_name(&self, spec_name: String) -> Result<bool, Error> { fn set_spec_name(&self, spec_name: String) -> Result<bool> {
self.client.set_spec_name(spec_name); self.client.set_spec_name(spec_name);
Ok(true) Ok(true)
} }
fn hash_content(&self, url: String) -> BoxFuture<H256, Error> { fn hash_content(&self, url: String) -> BoxFuture<H256> {
self.fetch.process(self.fetch.fetch(&url).then(move |result| { self.fetch.process(self.fetch.fetch(&url).then(move |result| {
result result
.map_err(errors::fetch) .map_err(errors::fetch)
@ -176,23 +176,23 @@ impl<C, M, U, F> ParitySet for ParitySetClient<C, M, U, F> where
})) }))
} }
fn dapps_refresh(&self) -> Result<bool, Error> { fn dapps_refresh(&self) -> Result<bool> {
self.dapps.as_ref().map(|dapps| dapps.refresh_local_dapps()).ok_or_else(errors::dapps_disabled) self.dapps.as_ref().map(|dapps| dapps.refresh_local_dapps()).ok_or_else(errors::dapps_disabled)
} }
fn dapps_list(&self) -> Result<Vec<LocalDapp>, Error> { fn dapps_list(&self) -> Result<Vec<LocalDapp>> {
self.dapps.as_ref().map(|dapps| dapps.list_dapps()).ok_or_else(errors::dapps_disabled) self.dapps.as_ref().map(|dapps| dapps.list_dapps()).ok_or_else(errors::dapps_disabled)
} }
fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>, Error> { fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>> {
Ok(self.updater.upgrade_ready().map(Into::into)) Ok(self.updater.upgrade_ready().map(Into::into))
} }
fn execute_upgrade(&self) -> Result<bool, Error> { fn execute_upgrade(&self) -> Result<bool> {
Ok(self.updater.execute_upgrade()) Ok(self.updater.execute_upgrade())
} }
fn remove_transaction(&self, hash: H256) -> Result<Option<Transaction>, Error> { fn remove_transaction(&self, hash: H256) -> Result<Option<Transaction>> {
let block_number = self.client.chain_info().best_block_number; let block_number = self.client.chain_info().best_block_number;
let hash = hash.into(); let hash = hash.into();

View File

@ -24,7 +24,7 @@ use bigint::prelude::U128;
use util::Address; use util::Address;
use bytes::ToPretty; use bytes::ToPretty;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use v1::helpers::errors; use v1::helpers::errors;
use v1::helpers::dispatch::{Dispatcher, SignWith}; use v1::helpers::dispatch::{Dispatcher, SignWith};
@ -50,7 +50,7 @@ impl<D: Dispatcher> PersonalClient<D> {
} }
} }
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
} }
@ -58,13 +58,13 @@ impl<D: Dispatcher> PersonalClient<D> {
impl<D: Dispatcher + 'static> Personal for PersonalClient<D> { impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn accounts(&self) -> Result<Vec<RpcH160>, Error> { fn accounts(&self) -> Result<Vec<RpcH160>> {
let store = self.account_provider()?; let store = self.account_provider()?;
let accounts = store.accounts().map_err(|e| errors::account("Could not fetch accounts.", e))?; let accounts = store.accounts().map_err(|e| errors::account("Could not fetch accounts.", e))?;
Ok(accounts.into_iter().map(Into::into).collect::<Vec<RpcH160>>()) Ok(accounts.into_iter().map(Into::into).collect::<Vec<RpcH160>>())
} }
fn new_account(&self, pass: String) -> Result<RpcH160, Error> { fn new_account(&self, pass: String) -> Result<RpcH160> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.new_account(&pass) store.new_account(&pass)
@ -72,7 +72,7 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
.map_err(|e| errors::account("Could not create account.", e)) .map_err(|e| errors::account("Could not create account.", e))
} }
fn unlock_account(&self, account: RpcH160, account_pass: String, duration: Option<RpcU128>) -> Result<bool, Error> { fn unlock_account(&self, account: RpcH160, account_pass: String, duration: Option<RpcU128>) -> Result<bool> {
let account: Address = account.into(); let account: Address = account.into();
let store = self.account_provider()?; let store = self.account_provider()?;
let duration = match duration { let duration = match duration {
@ -104,7 +104,7 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
} }
} }
fn send_transaction(&self, meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<RpcH256, Error> { fn send_transaction(&self, meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<RpcH256> {
let dispatcher = self.dispatcher.clone(); let dispatcher = self.dispatcher.clone();
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
@ -137,7 +137,7 @@ impl<D: Dispatcher + 'static> Personal for PersonalClient<D> {
})) }))
} }
fn sign_and_send_transaction(&self, meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<RpcH256, Error> { fn sign_and_send_transaction(&self, meta: Metadata, request: TransactionRequest, password: String) -> BoxFuture<RpcH256> {
warn!("Using deprecated personal_signAndSendTransaction, use personal_sendTransaction instead."); warn!("Using deprecated personal_signAndSendTransaction, use personal_sendTransaction instead.");
self.send_transaction(meta, request, password) self.send_transaction(meta, request, password)
} }

View File

@ -20,7 +20,7 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use parking_lot::RwLock; use parking_lot::RwLock;
use jsonrpc_core::{self as core, Error, MetaIoHandler}; use jsonrpc_core::{self as core, Result, MetaIoHandler};
use jsonrpc_core::futures::{Future, Stream, Sink}; use jsonrpc_core::futures::{Future, Stream, Sink};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use jsonrpc_macros::pubsub::Subscriber; use jsonrpc_macros::pubsub::Subscriber;
@ -94,7 +94,7 @@ impl<S: core::Middleware<Metadata>> PubSub for PubSubClient<S> {
} }
} }
fn parity_unsubscribe(&self, id: SubscriptionId) -> Result<bool, Error> { fn parity_unsubscribe(&self, id: SubscriptionId) -> Result<bool> {
let res = self.poll_manager.write().unsubscribe(&id); let res = self.poll_manager.write().unsubscribe(&id);
Ok(res) Ok(res)
} }

View File

@ -16,7 +16,7 @@
//! RPC generic methods implementation. //! RPC generic methods implementation.
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use v1::traits::Rpc; use v1::traits::Rpc;
/// RPC generic methods implementation. /// RPC generic methods implementation.
@ -39,7 +39,7 @@ impl RpcClient {
} }
impl Rpc for RpcClient { impl Rpc for RpcClient {
fn rpc_modules(&self) -> Result<BTreeMap<String, String>, Error> { fn rpc_modules(&self) -> Result<BTreeMap<String, String>> {
let modules = self.modules.iter() let modules = self.modules.iter()
.fold(BTreeMap::new(), |mut map, (k, v)| { .fold(BTreeMap::new(), |mut map, (k, v)| {
map.insert(k.to_owned(), v.to_owned()); map.insert(k.to_owned(), v.to_owned());
@ -49,7 +49,7 @@ impl Rpc for RpcClient {
Ok(modules) Ok(modules)
} }
fn modules(&self) -> Result<BTreeMap<String, String>, Error> { fn modules(&self) -> Result<BTreeMap<String, String>> {
let modules = self.modules.iter() let modules = self.modules.iter()
.filter(|&(k, _v)| { .filter(|&(k, _v)| {
self.valid_apis.contains(k) self.valid_apis.contains(k)

View File

@ -22,7 +22,7 @@ use crypto::DEFAULT_MAC;
use ethkey::Secret; use ethkey::Secret;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use v1::helpers::errors; use v1::helpers::errors;
use v1::helpers::accounts::unwrap_provider; use v1::helpers::accounts::unwrap_provider;
use v1::helpers::secretstore::{encrypt_document, decrypt_document, decrypt_document_with_shadow}; use v1::helpers::secretstore::{encrypt_document, decrypt_document, decrypt_document_with_shadow};
@ -44,36 +44,36 @@ impl SecretStoreClient {
/// Attempt to get the `Arc<AccountProvider>`, errors if provider was not /// Attempt to get the `Arc<AccountProvider>`, errors if provider was not
/// set. /// set.
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
/// Decrypt public key using account' private key /// Decrypt public key using account' private key
fn decrypt_key(&self, address: H160, password: String, key: Bytes) -> Result<Vec<u8>, Error> { fn decrypt_key(&self, address: H160, password: String, key: Bytes) -> Result<Vec<u8>> {
let store = self.account_provider()?; let store = self.account_provider()?;
store.decrypt(address.into(), Some(password), &DEFAULT_MAC, &key.0) store.decrypt(address.into(), Some(password), &DEFAULT_MAC, &key.0)
.map_err(|e| errors::account("Could not decrypt key.", e)) .map_err(|e| errors::account("Could not decrypt key.", e))
} }
/// Decrypt secret key using account' private key /// Decrypt secret key using account' private key
fn decrypt_secret(&self, address: H160, password: String, key: Bytes) -> Result<Secret, Error> { fn decrypt_secret(&self, address: H160, password: String, key: Bytes) -> Result<Secret> {
self.decrypt_key(address, password, key) self.decrypt_key(address, password, key)
.and_then(|s| Secret::from_unsafe_slice(&s).map_err(|e| errors::account("invalid secret", e))) .and_then(|s| Secret::from_unsafe_slice(&s).map_err(|e| errors::account("invalid secret", e)))
} }
} }
impl SecretStore for SecretStoreClient { impl SecretStore for SecretStoreClient {
fn encrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes, Error> { fn encrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes> {
encrypt_document(self.decrypt_key(address, password, key)?, data.0) encrypt_document(self.decrypt_key(address, password, key)?, data.0)
.map(Into::into) .map(Into::into)
} }
fn decrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes, Error> { fn decrypt(&self, address: H160, password: String, key: Bytes, data: Bytes) -> Result<Bytes> {
decrypt_document(self.decrypt_key(address, password, key)?, data.0) decrypt_document(self.decrypt_key(address, password, key)?, data.0)
.map(Into::into) .map(Into::into)
} }
fn shadow_decrypt(&self, address: H160, password: String, decrypted_secret: H512, common_point: H512, decrypt_shadows: Vec<Bytes>, data: Bytes) -> Result<Bytes, Error> { fn shadow_decrypt(&self, address: H160, password: String, decrypted_secret: H512, common_point: H512, decrypt_shadows: Vec<Bytes>, data: Bytes) -> Result<Bytes> {
let mut shadows = Vec::with_capacity(decrypt_shadows.len()); let mut shadows = Vec::with_capacity(decrypt_shadows.len());
for decrypt_shadow in decrypt_shadows { for decrypt_shadow in decrypt_shadows {
shadows.push(self.decrypt_secret(address.clone(), password.clone(), decrypt_shadow)?); shadows.push(self.decrypt_secret(address.clone(), password.clone(), decrypt_shadow)?);

View File

@ -25,7 +25,7 @@ use parity_reactor::Remote;
use rlp::UntrustedRlp; use rlp::UntrustedRlp;
use parking_lot::Mutex; use parking_lot::Mutex;
use jsonrpc_core::{Error, BoxFuture}; use jsonrpc_core::{Result, BoxFuture, Error};
use jsonrpc_core::futures::{future, Future, IntoFuture}; use jsonrpc_core::futures::{future, Future, IntoFuture};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
@ -78,11 +78,11 @@ impl<D: Dispatcher + 'static> SignerClient<D> {
} }
} }
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
fn confirm_internal<F, T>(&self, id: U256, modification: TransactionModification, f: F) -> BoxFuture<WithToken<ConfirmationResponse>, Error> where fn confirm_internal<F, T>(&self, id: U256, modification: TransactionModification, f: F) -> BoxFuture<WithToken<ConfirmationResponse>> where
F: FnOnce(D, Arc<AccountProvider>, ConfirmationPayload) -> T, F: FnOnce(D, Arc<AccountProvider>, ConfirmationPayload) -> T,
T: IntoFuture<Item=WithToken<ConfirmationResponse>, Error=Error>, T: IntoFuture<Item=WithToken<ConfirmationResponse>, Error=Error>,
T::Future: Send + 'static T::Future: Send + 'static
@ -124,8 +124,8 @@ impl<D: Dispatcher + 'static> SignerClient<D> {
.unwrap_or_else(|| Either::B(future::err(errors::invalid_params("Unknown RequestID", id))))) .unwrap_or_else(|| Either::B(future::err(errors::invalid_params("Unknown RequestID", id)))))
} }
fn verify_transaction<F>(bytes: Bytes, request: FilledTransactionRequest, process: F) -> Result<ConfirmationResponse, Error> where fn verify_transaction<F>(bytes: Bytes, request: FilledTransactionRequest, process: F) -> Result<ConfirmationResponse> where
F: FnOnce(PendingTransaction) -> Result<ConfirmationResponse, Error>, F: FnOnce(PendingTransaction) -> Result<ConfirmationResponse>,
{ {
let signed_transaction = UntrustedRlp::new(&bytes.0).as_val().map_err(errors::rlp)?; let signed_transaction = UntrustedRlp::new(&bytes.0).as_val().map_err(errors::rlp)?;
let signed_transaction = SignedTransaction::new(signed_transaction).map_err(|e| errors::invalid_params("Invalid signature.", e))?; let signed_transaction = SignedTransaction::new(signed_transaction).map_err(|e| errors::invalid_params("Invalid signature.", e))?;
@ -159,7 +159,7 @@ impl<D: Dispatcher + 'static> SignerClient<D> {
impl<D: Dispatcher + 'static> Signer for SignerClient<D> { impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn requests_to_confirm(&self) -> Result<Vec<ConfirmationRequest>, Error> { fn requests_to_confirm(&self) -> Result<Vec<ConfirmationRequest>> {
Ok(self.signer.requests() Ok(self.signer.requests()
.into_iter() .into_iter()
.map(Into::into) .map(Into::into)
@ -170,7 +170,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
// TODO [ToDr] TransactionModification is redundant for some calls // TODO [ToDr] TransactionModification is redundant for some calls
// might be better to replace it in future // might be better to replace it in future
fn confirm_request(&self, id: U256, modification: TransactionModification, pass: String) fn confirm_request(&self, id: U256, modification: TransactionModification, pass: String)
-> BoxFuture<ConfirmationResponse, Error> -> BoxFuture<ConfirmationResponse>
{ {
Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| { Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| {
dispatch::execute(dis, accounts, payload, dispatch::SignWith::Password(pass)) dispatch::execute(dis, accounts, payload, dispatch::SignWith::Password(pass))
@ -178,7 +178,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
} }
fn confirm_request_with_token(&self, id: U256, modification: TransactionModification, token: String) fn confirm_request_with_token(&self, id: U256, modification: TransactionModification, token: String)
-> BoxFuture<ConfirmationResponseWithToken, Error> -> BoxFuture<ConfirmationResponseWithToken>
{ {
Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| { Box::new(self.confirm_internal(id, modification, move |dis, accounts, payload| {
dispatch::execute(dis, accounts, payload, dispatch::SignWith::Token(token)) dispatch::execute(dis, accounts, payload, dispatch::SignWith::Token(token))
@ -191,7 +191,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
})) }))
} }
fn confirm_request_raw(&self, id: U256, bytes: Bytes) -> Result<ConfirmationResponse, Error> { fn confirm_request_raw(&self, id: U256, bytes: Bytes) -> Result<ConfirmationResponse> {
let id = id.into(); let id = id.into();
self.signer.peek(&id).map(|confirmation| { self.signer.peek(&id).map(|confirmation| {
@ -230,17 +230,17 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
}).unwrap_or_else(|| Err(errors::invalid_params("Unknown RequestID", id))) }).unwrap_or_else(|| Err(errors::invalid_params("Unknown RequestID", id)))
} }
fn reject_request(&self, id: U256) -> Result<bool, Error> { fn reject_request(&self, id: U256) -> Result<bool> {
let res = self.signer.request_rejected(id.into()); let res = self.signer.request_rejected(id.into());
Ok(res.is_some()) Ok(res.is_some())
} }
fn generate_token(&self) -> Result<String, Error> { fn generate_token(&self) -> Result<String> {
self.signer.generate_token() self.signer.generate_token()
.map_err(|e| errors::token(e)) .map_err(|e| errors::token(e))
} }
fn generate_web_proxy_token(&self, domain: String) -> Result<String, Error> { fn generate_web_proxy_token(&self, domain: String) -> Result<String> {
Ok(self.signer.generate_web_proxy_access_token(domain.into())) Ok(self.signer.generate_web_proxy_access_token(domain.into()))
} }
@ -248,7 +248,7 @@ impl<D: Dispatcher + 'static> Signer for SignerClient<D> {
self.subscribers.lock().push(sub) self.subscribers.lock().push(sub)
} }
fn unsubscribe_pending(&self, id: SubscriptionId) -> Result<bool, Error> { fn unsubscribe_pending(&self, id: SubscriptionId) -> Result<bool> {
let res = self.subscribers.lock().remove(&id).is_some(); let res = self.subscribers.lock().remove(&id).is_some();
Ok(res) Ok(res)
} }

View File

@ -23,7 +23,7 @@ use parking_lot::Mutex;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result, Error};
use jsonrpc_core::futures::{future, Future, Poll, Async}; use jsonrpc_core::futures::{future, Future, Poll, Async};
use jsonrpc_core::futures::future::Either; use jsonrpc_core::futures::future::Either;
use v1::helpers::{ use v1::helpers::{
@ -109,11 +109,11 @@ impl<D: Dispatcher + 'static> SigningQueueClient<D> {
} }
} }
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
fn dispatch(&self, payload: RpcConfirmationPayload, default_account: DefaultAccount, origin: Origin) -> BoxFuture<DispatchResult, Error> { fn dispatch(&self, payload: RpcConfirmationPayload, default_account: DefaultAccount, origin: Origin) -> BoxFuture<DispatchResult> {
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
let default_account = match default_account { let default_account = match default_account {
DefaultAccount::Provided(acc) => acc, DefaultAccount::Provided(acc) => acc,
@ -143,13 +143,13 @@ impl<D: Dispatcher + 'static> SigningQueueClient<D> {
impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> { impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest, Error> { fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest> {
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
let default_account = accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default(); let default_account = accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default();
Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into)) Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into))
} }
fn post_sign(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>, Error> { fn post_sign(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>> {
let remote = self.remote.clone(); let remote = self.remote.clone();
let confirmations = self.confirmations.clone(); let confirmations = self.confirmations.clone();
@ -166,7 +166,7 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
})) }))
} }
fn post_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>, Error> { fn post_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>> {
let remote = self.remote.clone(); let remote = self.remote.clone();
let confirmations = self.confirmations.clone(); let confirmations = self.confirmations.clone();
@ -180,7 +180,7 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
})) }))
} }
fn check_request(&self, id: RpcU256) -> Result<Option<RpcConfirmationResponse>, Error> { fn check_request(&self, id: RpcU256) -> Result<Option<RpcConfirmationResponse>> {
let id: U256 = id.into(); let id: U256 = id.into();
match self.confirmations.lock().get(&id) { match self.confirmations.lock().get(&id) {
None => Err(errors::request_not_found()), // Request info has been dropped, or even never been there None => Err(errors::request_not_found()), // Request info has been dropped, or even never been there
@ -189,7 +189,7 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
} }
} }
fn decrypt_message(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes, Error> { fn decrypt_message(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes> {
let res = self.dispatch( let res = self.dispatch(
RpcConfirmationPayload::Decrypt((address.clone(), data).into()), RpcConfirmationPayload::Decrypt((address.clone(), data).into()),
address.into(), address.into(),
@ -209,7 +209,7 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningQueueClient<D> {
impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> { impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn sign(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcH520, Error> { fn sign(&self, meta: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcH520> {
let res = self.dispatch( let res = self.dispatch(
RpcConfirmationPayload::EthSignMessage((address.clone(), data).into()), RpcConfirmationPayload::EthSignMessage((address.clone(), data).into()),
address.into(), address.into(),
@ -224,7 +224,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> {
})) }))
} }
fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256, Error> { fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256> {
let res = self.dispatch( let res = self.dispatch(
RpcConfirmationPayload::SendTransaction(request), RpcConfirmationPayload::SendTransaction(request),
meta.dapp_id().into(), meta.dapp_id().into(),
@ -239,7 +239,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningQueueClient<D> {
})) }))
} }
fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction, Error> { fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction> {
let res = self.dispatch( let res = self.dispatch(
RpcConfirmationPayload::SignTransaction(request), RpcConfirmationPayload::SignTransaction(request),
meta.dapp_id().into(), meta.dapp_id().into(),

View File

@ -20,7 +20,7 @@ use std::sync::Arc;
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::{future, Future}; use jsonrpc_core::futures::{future, Future};
use v1::helpers::{errors, DefaultAccount}; use v1::helpers::{errors, DefaultAccount};
use v1::helpers::dispatch::{self, Dispatcher}; use v1::helpers::dispatch::{self, Dispatcher};
@ -52,11 +52,11 @@ impl<D: Dispatcher + 'static> SigningUnsafeClient<D> {
} }
} }
fn account_provider(&self) -> Result<Arc<AccountProvider>, Error> { fn account_provider(&self) -> Result<Arc<AccountProvider>> {
unwrap_provider(&self.accounts) unwrap_provider(&self.accounts)
} }
fn handle(&self, payload: RpcConfirmationPayload, account: DefaultAccount) -> BoxFuture<RpcConfirmationResponse, Error> { fn handle(&self, payload: RpcConfirmationPayload, account: DefaultAccount) -> BoxFuture<RpcConfirmationResponse> {
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
let default = match account { let default = match account {
DefaultAccount::Provided(acc) => acc, DefaultAccount::Provided(acc) => acc,
@ -76,7 +76,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
{ {
type Metadata = Metadata; type Metadata = Metadata;
fn sign(&self, _: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcH520, Error> { fn sign(&self, _: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcH520> {
Box::new(self.handle(RpcConfirmationPayload::EthSignMessage((address.clone(), data).into()), address.into()) Box::new(self.handle(RpcConfirmationPayload::EthSignMessage((address.clone(), data).into()), address.into())
.then(|res| match res { .then(|res| match res {
Ok(RpcConfirmationResponse::Signature(signature)) => Ok(signature), Ok(RpcConfirmationResponse::Signature(signature)) => Ok(signature),
@ -85,7 +85,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
})) }))
} }
fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256, Error> { fn send_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcH256> {
Box::new(self.handle(RpcConfirmationPayload::SendTransaction(request), meta.dapp_id().into()) Box::new(self.handle(RpcConfirmationPayload::SendTransaction(request), meta.dapp_id().into())
.then(|res| match res { .then(|res| match res {
Ok(RpcConfirmationResponse::SendTransaction(hash)) => Ok(hash), Ok(RpcConfirmationResponse::SendTransaction(hash)) => Ok(hash),
@ -94,7 +94,7 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
})) }))
} }
fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction, Error> { fn sign_transaction(&self, meta: Metadata, request: RpcTransactionRequest) -> BoxFuture<RpcRichRawTransaction> {
Box::new(self.handle(RpcConfirmationPayload::SignTransaction(request), meta.dapp_id().into()) Box::new(self.handle(RpcConfirmationPayload::SignTransaction(request), meta.dapp_id().into())
.then(|res| match res { .then(|res| match res {
Ok(RpcConfirmationResponse::SignTransaction(tx)) => Ok(tx), Ok(RpcConfirmationResponse::SignTransaction(tx)) => Ok(tx),
@ -107,13 +107,13 @@ impl<D: Dispatcher + 'static> EthSigning for SigningUnsafeClient<D>
impl<D: Dispatcher + 'static> ParitySigning for SigningUnsafeClient<D> { impl<D: Dispatcher + 'static> ParitySigning for SigningUnsafeClient<D> {
type Metadata = Metadata; type Metadata = Metadata;
fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest, Error> { fn compose_transaction(&self, meta: Metadata, transaction: RpcTransactionRequest) -> BoxFuture<RpcTransactionRequest> {
let accounts = try_bf!(self.account_provider()); let accounts = try_bf!(self.account_provider());
let default_account = accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default(); let default_account = accounts.dapp_default_address(meta.dapp_id().into()).ok().unwrap_or_default();
Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into)) Box::new(self.dispatcher.fill_optional_fields(transaction.into(), default_account, true).map(Into::into))
} }
fn decrypt_message(&self, _: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes, Error> { fn decrypt_message(&self, _: Metadata, address: RpcH160, data: RpcBytes) -> BoxFuture<RpcBytes> {
Box::new(self.handle(RpcConfirmationPayload::Decrypt((address.clone(), data).into()), address.into()) Box::new(self.handle(RpcConfirmationPayload::Decrypt((address.clone(), data).into()), address.into())
.then(|res| match res { .then(|res| match res {
Ok(RpcConfirmationResponse::Decrypt(data)) => Ok(data), Ok(RpcConfirmationResponse::Decrypt(data)) => Ok(data),
@ -122,17 +122,17 @@ impl<D: Dispatcher + 'static> ParitySigning for SigningUnsafeClient<D> {
})) }))
} }
fn post_sign(&self, _: Metadata, _: RpcH160, _: RpcBytes) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>, Error> { fn post_sign(&self, _: Metadata, _: RpcH160, _: RpcBytes) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>> {
// We don't support this in non-signer mode. // We don't support this in non-signer mode.
Box::new(future::err(errors::signer_disabled())) Box::new(future::err(errors::signer_disabled()))
} }
fn post_transaction(&self, _: Metadata, _: RpcTransactionRequest) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>, Error> { fn post_transaction(&self, _: Metadata, _: RpcTransactionRequest) -> BoxFuture<RpcEither<RpcU256, RpcConfirmationResponse>> {
// We don't support this in non-signer mode. // We don't support this in non-signer mode.
Box::new(future::err((errors::signer_disabled()))) Box::new(future::err((errors::signer_disabled())))
} }
fn check_request(&self, _: RpcU256) -> Result<Option<RpcConfirmationResponse>, Error> { fn check_request(&self, _: RpcU256) -> Result<Option<RpcConfirmationResponse>> {
// We don't support this in non-signer mode. // We don't support this in non-signer mode.
Err(errors::signer_disabled()) Err(errors::signer_disabled())
} }

View File

@ -22,7 +22,7 @@ use ethcore::client::{MiningBlockChainClient, CallAnalytics, TransactionId, Trac
use ethcore::transaction::SignedTransaction; use ethcore::transaction::SignedTransaction;
use rlp::UntrustedRlp; use rlp::UntrustedRlp;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::Metadata; use v1::Metadata;
use v1::traits::Traces; use v1::traits::Traces;
@ -54,22 +54,22 @@ impl<C> TracesClient<C> {
impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static { impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
type Metadata = Metadata; type Metadata = Metadata;
fn filter(&self, filter: TraceFilter) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn filter(&self, filter: TraceFilter) -> Result<Option<Vec<LocalizedTrace>>> {
Ok(self.client.filter_traces(filter.into()) Ok(self.client.filter_traces(filter.into())
.map(|traces| traces.into_iter().map(LocalizedTrace::from).collect())) .map(|traces| traces.into_iter().map(LocalizedTrace::from).collect()))
} }
fn block_traces(&self, block_number: BlockNumber) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn block_traces(&self, block_number: BlockNumber) -> Result<Option<Vec<LocalizedTrace>>> {
Ok(self.client.block_traces(block_number.into()) Ok(self.client.block_traces(block_number.into())
.map(|traces| traces.into_iter().map(LocalizedTrace::from).collect())) .map(|traces| traces.into_iter().map(LocalizedTrace::from).collect()))
} }
fn transaction_traces(&self, transaction_hash: H256) -> Result<Option<Vec<LocalizedTrace>>, Error> { fn transaction_traces(&self, transaction_hash: H256) -> Result<Option<Vec<LocalizedTrace>>> {
Ok(self.client.transaction_traces(TransactionId::Hash(transaction_hash.into())) Ok(self.client.transaction_traces(TransactionId::Hash(transaction_hash.into()))
.map(|traces| traces.into_iter().map(LocalizedTrace::from).collect())) .map(|traces| traces.into_iter().map(LocalizedTrace::from).collect()))
} }
fn trace(&self, transaction_hash: H256, address: Vec<Index>) -> Result<Option<LocalizedTrace>, Error> { fn trace(&self, transaction_hash: H256, address: Vec<Index>) -> Result<Option<LocalizedTrace>> {
let id = TraceId { let id = TraceId {
transaction: TransactionId::Hash(transaction_hash.into()), transaction: TransactionId::Hash(transaction_hash.into()),
address: address.into_iter().map(|i| i.value()).collect() address: address.into_iter().map(|i| i.value()).collect()
@ -79,7 +79,7 @@ impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
.map(LocalizedTrace::from)) .map(LocalizedTrace::from))
} }
fn call(&self, meta: Self::Metadata, request: CallRequest, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults, Error> { fn call(&self, meta: Self::Metadata, request: CallRequest, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults> {
let block = block.unwrap_or_default(); let block = block.unwrap_or_default();
let request = CallRequest::into(request); let request = CallRequest::into(request);
@ -90,7 +90,7 @@ impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
.map_err(errors::call) .map_err(errors::call)
} }
fn call_many(&self, meta: Self::Metadata, requests: Vec<(CallRequest, TraceOptions)>, block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>, Error> { fn call_many(&self, meta: Self::Metadata, requests: Vec<(CallRequest, TraceOptions)>, block: Trailing<BlockNumber>) -> Result<Vec<TraceResults>> {
let block = block.unwrap_or_default(); let block = block.unwrap_or_default();
let requests = requests.into_iter() let requests = requests.into_iter()
@ -99,14 +99,14 @@ impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
let signed = fake_sign::sign_call(request, meta.is_dapp())?; let signed = fake_sign::sign_call(request, meta.is_dapp())?;
Ok((signed, to_call_analytics(flags))) Ok((signed, to_call_analytics(flags)))
}) })
.collect::<Result<Vec<_>, Error>>()?; .collect::<Result<Vec<_>>>()?;
self.client.call_many(&requests, block.into()) self.client.call_many(&requests, block.into())
.map(|results| results.into_iter().map(TraceResults::from).collect()) .map(|results| results.into_iter().map(TraceResults::from).collect())
.map_err(errors::call) .map_err(errors::call)
} }
fn raw_transaction(&self, raw_transaction: Bytes, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults, Error> { fn raw_transaction(&self, raw_transaction: Bytes, flags: TraceOptions, block: Trailing<BlockNumber>) -> Result<TraceResults> {
let block = block.unwrap_or_default(); let block = block.unwrap_or_default();
let tx = UntrustedRlp::new(&raw_transaction.into_vec()).as_val().map_err(|e| errors::invalid_params("Transaction is not valid RLP", e))?; let tx = UntrustedRlp::new(&raw_transaction.into_vec()).as_val().map_err(|e| errors::invalid_params("Transaction is not valid RLP", e))?;
@ -117,7 +117,7 @@ impl<C> Traces for TracesClient<C> where C: MiningBlockChainClient + 'static {
.map_err(errors::call) .map_err(errors::call)
} }
fn replay_transaction(&self, transaction_hash: H256, flags: TraceOptions) -> Result<TraceResults, Error> { fn replay_transaction(&self, transaction_hash: H256, flags: TraceOptions) -> Result<TraceResults> {
self.client.replay(TransactionId::Hash(transaction_hash.into()), to_call_analytics(flags)) self.client.replay(TransactionId::Hash(transaction_hash.into()), to_call_analytics(flags))
.map(TraceResults::from) .map(TraceResults::from)
.map_err(errors::call) .map_err(errors::call)

View File

@ -16,7 +16,7 @@
//! Web3 rpc implementation. //! Web3 rpc implementation.
use hash::keccak; use hash::keccak;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use util::version; use util::version;
use v1::traits::Web3; use v1::traits::Web3;
use v1::types::{H256, Bytes}; use v1::types::{H256, Bytes};
@ -30,11 +30,11 @@ impl Web3Client {
} }
impl Web3 for Web3Client { impl Web3 for Web3Client {
fn client_version(&self) -> Result<String, Error> { fn client_version(&self) -> Result<String> {
Ok(version().to_owned().replace("Parity/", "Parity//")) Ok(version().to_owned().replace("Parity/", "Parity//"))
} }
fn sha3(&self, data: Bytes) -> Result<H256, Error> { fn sha3(&self, data: Bytes) -> Result<H256> {
Ok(keccak(&data.0).into()) Ok(keccak(&data.0).into())
} }
} }

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Eth rpc interface. //! Eth rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{Result, BoxFuture};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::types::{RichBlock, BlockNumber, Bytes, CallRequest, Filter, FilterChanges, Index}; use v1::types::{RichBlock, BlockNumber, Bytes, CallRequest, Filter, FilterChanges, Index};
@ -29,151 +29,151 @@ build_rpc_trait! {
/// Returns protocol version encoded as a string (quotes are necessary). /// Returns protocol version encoded as a string (quotes are necessary).
#[rpc(name = "eth_protocolVersion")] #[rpc(name = "eth_protocolVersion")]
fn protocol_version(&self) -> Result<String, Error>; fn protocol_version(&self) -> Result<String>;
/// Returns an object with data about the sync status or false. (wtf?) /// Returns an object with data about the sync status or false. (wtf?)
#[rpc(name = "eth_syncing")] #[rpc(name = "eth_syncing")]
fn syncing(&self) -> Result<SyncStatus, Error>; fn syncing(&self) -> Result<SyncStatus>;
/// Returns the number of hashes per second that the node is mining with. /// Returns the number of hashes per second that the node is mining with.
#[rpc(name = "eth_hashrate")] #[rpc(name = "eth_hashrate")]
fn hashrate(&self) -> Result<U256, Error>; fn hashrate(&self) -> Result<U256>;
/// Returns block author. /// Returns block author.
#[rpc(meta, name = "eth_coinbase")] #[rpc(meta, name = "eth_coinbase")]
fn author(&self, Self::Metadata) -> Result<H160, Error>; fn author(&self, Self::Metadata) -> Result<H160>;
/// Returns true if client is actively mining new blocks. /// Returns true if client is actively mining new blocks.
#[rpc(name = "eth_mining")] #[rpc(name = "eth_mining")]
fn is_mining(&self) -> Result<bool, Error>; fn is_mining(&self) -> Result<bool>;
/// Returns current gas_price. /// Returns current gas_price.
#[rpc(name = "eth_gasPrice")] #[rpc(name = "eth_gasPrice")]
fn gas_price(&self) -> Result<U256, Error>; fn gas_price(&self) -> Result<U256>;
/// Returns accounts list. /// Returns accounts list.
#[rpc(meta, name = "eth_accounts")] #[rpc(meta, name = "eth_accounts")]
fn accounts(&self, Self::Metadata) -> Result<Vec<H160>, Error>; fn accounts(&self, Self::Metadata) -> Result<Vec<H160>>;
/// Returns highest block number. /// Returns highest block number.
#[rpc(name = "eth_blockNumber")] #[rpc(name = "eth_blockNumber")]
fn block_number(&self) -> Result<U256, Error>; fn block_number(&self) -> Result<U256>;
/// Returns balance of the given account. /// Returns balance of the given account.
#[rpc(name = "eth_getBalance")] #[rpc(name = "eth_getBalance")]
fn balance(&self, H160, Trailing<BlockNumber>) -> BoxFuture<U256, Error>; fn balance(&self, H160, Trailing<BlockNumber>) -> BoxFuture<U256>;
/// Returns content of the storage at given address. /// Returns content of the storage at given address.
#[rpc(name = "eth_getStorageAt")] #[rpc(name = "eth_getStorageAt")]
fn storage_at(&self, H160, U256, Trailing<BlockNumber>) -> BoxFuture<H256, Error>; fn storage_at(&self, H160, U256, Trailing<BlockNumber>) -> BoxFuture<H256>;
/// Returns block with given hash. /// Returns block with given hash.
#[rpc(name = "eth_getBlockByHash")] #[rpc(name = "eth_getBlockByHash")]
fn block_by_hash(&self, H256, bool) -> BoxFuture<Option<RichBlock>, Error>; fn block_by_hash(&self, H256, bool) -> BoxFuture<Option<RichBlock>>;
/// Returns block with given number. /// Returns block with given number.
#[rpc(name = "eth_getBlockByNumber")] #[rpc(name = "eth_getBlockByNumber")]
fn block_by_number(&self, BlockNumber, bool) -> BoxFuture<Option<RichBlock>, Error>; fn block_by_number(&self, BlockNumber, bool) -> BoxFuture<Option<RichBlock>>;
/// Returns the number of transactions sent from given address at given time (block number). /// Returns the number of transactions sent from given address at given time (block number).
#[rpc(name = "eth_getTransactionCount")] #[rpc(name = "eth_getTransactionCount")]
fn transaction_count(&self, H160, Trailing<BlockNumber>) -> BoxFuture<U256, Error>; fn transaction_count(&self, H160, Trailing<BlockNumber>) -> BoxFuture<U256>;
/// Returns the number of transactions in a block with given hash. /// Returns the number of transactions in a block with given hash.
#[rpc(name = "eth_getBlockTransactionCountByHash")] #[rpc(name = "eth_getBlockTransactionCountByHash")]
fn block_transaction_count_by_hash(&self, H256) -> BoxFuture<Option<U256>, Error>; fn block_transaction_count_by_hash(&self, H256) -> BoxFuture<Option<U256>>;
/// Returns the number of transactions in a block with given block number. /// Returns the number of transactions in a block with given block number.
#[rpc(name = "eth_getBlockTransactionCountByNumber")] #[rpc(name = "eth_getBlockTransactionCountByNumber")]
fn block_transaction_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>, Error>; fn block_transaction_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>>;
/// Returns the number of uncles in a block with given hash. /// Returns the number of uncles in a block with given hash.
#[rpc(name = "eth_getUncleCountByBlockHash")] #[rpc(name = "eth_getUncleCountByBlockHash")]
fn block_uncles_count_by_hash(&self, H256) -> BoxFuture<Option<U256>, Error>; fn block_uncles_count_by_hash(&self, H256) -> BoxFuture<Option<U256>>;
/// Returns the number of uncles in a block with given block number. /// Returns the number of uncles in a block with given block number.
#[rpc(name = "eth_getUncleCountByBlockNumber")] #[rpc(name = "eth_getUncleCountByBlockNumber")]
fn block_uncles_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>, Error>; fn block_uncles_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>>;
/// Returns the code at given address at given time (block number). /// Returns the code at given address at given time (block number).
#[rpc(name = "eth_getCode")] #[rpc(name = "eth_getCode")]
fn code_at(&self, H160, Trailing<BlockNumber>) -> BoxFuture<Bytes, Error>; fn code_at(&self, H160, Trailing<BlockNumber>) -> BoxFuture<Bytes>;
/// Sends signed transaction, returning its hash. /// Sends signed transaction, returning its hash.
#[rpc(name = "eth_sendRawTransaction")] #[rpc(name = "eth_sendRawTransaction")]
fn send_raw_transaction(&self, Bytes) -> Result<H256, Error>; fn send_raw_transaction(&self, Bytes) -> Result<H256>;
/// @alias of `eth_sendRawTransaction`. /// @alias of `eth_sendRawTransaction`.
#[rpc(name = "eth_submitTransaction")] #[rpc(name = "eth_submitTransaction")]
fn submit_transaction(&self, Bytes) -> Result<H256, Error>; fn submit_transaction(&self, Bytes) -> Result<H256>;
/// Call contract, returning the output data. /// Call contract, returning the output data.
#[rpc(meta, name = "eth_call")] #[rpc(meta, name = "eth_call")]
fn call(&self, Self::Metadata, CallRequest, Trailing<BlockNumber>) -> BoxFuture<Bytes, Error>; fn call(&self, Self::Metadata, CallRequest, Trailing<BlockNumber>) -> BoxFuture<Bytes>;
/// Estimate gas needed for execution of given contract. /// Estimate gas needed for execution of given contract.
#[rpc(meta, name = "eth_estimateGas")] #[rpc(meta, name = "eth_estimateGas")]
fn estimate_gas(&self, Self::Metadata, CallRequest, Trailing<BlockNumber>) -> BoxFuture<U256, Error>; fn estimate_gas(&self, Self::Metadata, CallRequest, Trailing<BlockNumber>) -> BoxFuture<U256>;
/// Get transaction by its hash. /// Get transaction by its hash.
#[rpc(name = "eth_getTransactionByHash")] #[rpc(name = "eth_getTransactionByHash")]
fn transaction_by_hash(&self, H256) -> BoxFuture<Option<Transaction>, Error>; fn transaction_by_hash(&self, H256) -> BoxFuture<Option<Transaction>>;
/// Returns transaction at given block hash and index. /// Returns transaction at given block hash and index.
#[rpc(name = "eth_getTransactionByBlockHashAndIndex")] #[rpc(name = "eth_getTransactionByBlockHashAndIndex")]
fn transaction_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<Transaction>, Error>; fn transaction_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<Transaction>>;
/// Returns transaction by given block number and index. /// Returns transaction by given block number and index.
#[rpc(name = "eth_getTransactionByBlockNumberAndIndex")] #[rpc(name = "eth_getTransactionByBlockNumberAndIndex")]
fn transaction_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<Transaction>, Error>; fn transaction_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<Transaction>>;
/// Returns transaction receipt by transaction hash. /// Returns transaction receipt by transaction hash.
#[rpc(name = "eth_getTransactionReceipt")] #[rpc(name = "eth_getTransactionReceipt")]
fn transaction_receipt(&self, H256) -> BoxFuture<Option<Receipt>, Error>; fn transaction_receipt(&self, H256) -> BoxFuture<Option<Receipt>>;
/// Returns an uncles at given block and index. /// Returns an uncles at given block and index.
#[rpc(name = "eth_getUncleByBlockHashAndIndex")] #[rpc(name = "eth_getUncleByBlockHashAndIndex")]
fn uncle_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<RichBlock>, Error>; fn uncle_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<RichBlock>>;
/// Returns an uncles at given block and index. /// Returns an uncles at given block and index.
#[rpc(name = "eth_getUncleByBlockNumberAndIndex")] #[rpc(name = "eth_getUncleByBlockNumberAndIndex")]
fn uncle_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<RichBlock>, Error>; fn uncle_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<RichBlock>>;
/// Returns available compilers. /// Returns available compilers.
/// @deprecated /// @deprecated
#[rpc(name = "eth_getCompilers")] #[rpc(name = "eth_getCompilers")]
fn compilers(&self) -> Result<Vec<String>, Error>; fn compilers(&self) -> Result<Vec<String>>;
/// Compiles lll code. /// Compiles lll code.
/// @deprecated /// @deprecated
#[rpc(name = "eth_compileLLL")] #[rpc(name = "eth_compileLLL")]
fn compile_lll(&self, String) -> Result<Bytes, Error>; fn compile_lll(&self, String) -> Result<Bytes>;
/// Compiles solidity. /// Compiles solidity.
/// @deprecated /// @deprecated
#[rpc(name = "eth_compileSolidity")] #[rpc(name = "eth_compileSolidity")]
fn compile_solidity(&self, String) -> Result<Bytes, Error>; fn compile_solidity(&self, String) -> Result<Bytes>;
/// Compiles serpent. /// Compiles serpent.
/// @deprecated /// @deprecated
#[rpc(name = "eth_compileSerpent")] #[rpc(name = "eth_compileSerpent")]
fn compile_serpent(&self, String) -> Result<Bytes, Error>; fn compile_serpent(&self, String) -> Result<Bytes>;
/// Returns logs matching given filter object. /// Returns logs matching given filter object.
#[rpc(name = "eth_getLogs")] #[rpc(name = "eth_getLogs")]
fn logs(&self, Filter) -> BoxFuture<Vec<Log>, Error>; fn logs(&self, Filter) -> BoxFuture<Vec<Log>>;
/// Returns the hash of the current block, the seedHash, and the boundary condition to be met. /// Returns the hash of the current block, the seedHash, and the boundary condition to be met.
#[rpc(name = "eth_getWork")] #[rpc(name = "eth_getWork")]
fn work(&self, Trailing<u64>) -> Result<Work, Error>; fn work(&self, Trailing<u64>) -> Result<Work>;
/// Used for submitting a proof-of-work solution. /// Used for submitting a proof-of-work solution.
#[rpc(name = "eth_submitWork")] #[rpc(name = "eth_submitWork")]
fn submit_work(&self, H64, H256, H256) -> Result<bool, Error>; fn submit_work(&self, H64, H256, H256) -> Result<bool>;
/// Used for submitting mining hashrate. /// Used for submitting mining hashrate.
#[rpc(name = "eth_submitHashrate")] #[rpc(name = "eth_submitHashrate")]
fn submit_hashrate(&self, U256, H256) -> Result<bool, Error>; fn submit_hashrate(&self, U256, H256) -> Result<bool>;
} }
} }
@ -183,26 +183,26 @@ build_rpc_trait! {
pub trait EthFilter { pub trait EthFilter {
/// Returns id of new filter. /// Returns id of new filter.
#[rpc(name = "eth_newFilter")] #[rpc(name = "eth_newFilter")]
fn new_filter(&self, Filter) -> Result<U256, Error>; fn new_filter(&self, Filter) -> Result<U256>;
/// Returns id of new block filter. /// Returns id of new block filter.
#[rpc(name = "eth_newBlockFilter")] #[rpc(name = "eth_newBlockFilter")]
fn new_block_filter(&self) -> Result<U256, Error>; fn new_block_filter(&self) -> Result<U256>;
/// Returns id of new block filter. /// Returns id of new block filter.
#[rpc(name = "eth_newPendingTransactionFilter")] #[rpc(name = "eth_newPendingTransactionFilter")]
fn new_pending_transaction_filter(&self) -> Result<U256, Error>; fn new_pending_transaction_filter(&self) -> Result<U256>;
/// Returns filter changes since last poll. /// Returns filter changes since last poll.
#[rpc(name = "eth_getFilterChanges")] #[rpc(name = "eth_getFilterChanges")]
fn filter_changes(&self, Index) -> BoxFuture<FilterChanges, Error>; fn filter_changes(&self, Index) -> BoxFuture<FilterChanges>;
/// Returns all logs matching given filter (in a range 'from' - 'to'). /// Returns all logs matching given filter (in a range 'from' - 'to').
#[rpc(name = "eth_getFilterLogs")] #[rpc(name = "eth_getFilterLogs")]
fn filter_logs(&self, Index) -> BoxFuture<Vec<Log>, Error>; fn filter_logs(&self, Index) -> BoxFuture<Vec<Log>>;
/// Uninstalls filter. /// Uninstalls filter.
#[rpc(name = "eth_uninstallFilter")] #[rpc(name = "eth_uninstallFilter")]
fn uninstall_filter(&self, Index) -> Result<bool, Error>; fn uninstall_filter(&self, Index) -> Result<bool>;
} }
} }

View File

@ -16,7 +16,7 @@
//! Eth PUB-SUB rpc interface. //! Eth PUB-SUB rpc interface.
use jsonrpc_core::Error; use jsonrpc_core::Result;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use jsonrpc_macros::pubsub::Subscriber; use jsonrpc_macros::pubsub::Subscriber;
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
@ -35,7 +35,7 @@ build_rpc_trait! {
/// Unsubscribe from existing Eth subscription. /// Unsubscribe from existing Eth subscription.
#[rpc(name = "eth_unsubscribe")] #[rpc(name = "eth_unsubscribe")]
fn unsubscribe(&self, SubscriptionId) -> Result<bool, Error>; fn unsubscribe(&self, SubscriptionId) -> Result<bool>;
} }
} }
} }

View File

@ -16,7 +16,7 @@
//! Eth rpc interface. //! Eth rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::BoxFuture;
use v1::types::{Bytes, H160, H256, H520, TransactionRequest, RichRawTransaction}; use v1::types::{Bytes, H160, H256, H520, TransactionRequest, RichRawTransaction};
@ -27,18 +27,18 @@ build_rpc_trait! {
/// Signs the hash of data with given address signature. /// Signs the hash of data with given address signature.
#[rpc(meta, name = "eth_sign")] #[rpc(meta, name = "eth_sign")]
fn sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<H520, Error>; fn sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<H520>;
/// Sends transaction; will block waiting for signer to return the /// Sends transaction; will block waiting for signer to return the
/// transaction hash. /// transaction hash.
/// If Signer is disable it will require the account to be unlocked. /// If Signer is disable it will require the account to be unlocked.
#[rpc(meta, name = "eth_sendTransaction")] #[rpc(meta, name = "eth_sendTransaction")]
fn send_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<H256, Error>; fn send_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<H256>;
/// Signs transactions without dispatching it to the network. /// Signs transactions without dispatching it to the network.
/// Returns signed transaction RLP representation and the transaction itself. /// Returns signed transaction RLP representation and the transaction itself.
/// It can be later submitted using `eth_sendRawTransaction/eth_submitTransaction`. /// It can be later submitted using `eth_sendRawTransaction/eth_submitTransaction`.
#[rpc(meta, name = "eth_signTransaction")] #[rpc(meta, name = "eth_signTransaction")]
fn sign_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<RichRawTransaction, Error>; fn sign_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<RichRawTransaction>;
} }
} }

View File

@ -15,22 +15,22 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Net rpc interface. //! Net rpc interface.
use jsonrpc_core::Error; use jsonrpc_core::Result;
build_rpc_trait! { build_rpc_trait! {
/// Net rpc interface. /// Net rpc interface.
pub trait Net { pub trait Net {
/// Returns protocol version. /// Returns protocol version.
#[rpc(name = "net_version")] #[rpc(name = "net_version")]
fn version(&self) -> Result<String, Error>; fn version(&self) -> Result<String>;
/// Returns number of peers connected to node. /// Returns number of peers connected to node.
#[rpc(name = "net_peerCount")] #[rpc(name = "net_peerCount")]
fn peer_count(&self) -> Result<String, Error>; fn peer_count(&self) -> Result<String>;
/// Returns true if client is actively listening for network connections. /// Returns true if client is actively listening for network connections.
/// Otherwise false. /// Otherwise false.
#[rpc(name = "net_listening")] #[rpc(name = "net_listening")]
fn is_listening(&self) -> Result<bool, Error>; fn is_listening(&self) -> Result<bool>;
} }
} }

View File

@ -18,7 +18,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use node_health::Health; use node_health::Health;
@ -38,188 +38,188 @@ build_rpc_trait! {
/// Returns accounts information. /// Returns accounts information.
#[rpc(name = "parity_accountsInfo")] #[rpc(name = "parity_accountsInfo")]
fn accounts_info(&self, Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>, Error>; fn accounts_info(&self, Trailing<DappId>) -> Result<BTreeMap<H160, AccountInfo>>;
/// Returns hardware accounts information. /// Returns hardware accounts information.
#[rpc(name = "parity_hardwareAccountsInfo")] #[rpc(name = "parity_hardwareAccountsInfo")]
fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>, Error>; fn hardware_accounts_info(&self) -> Result<BTreeMap<H160, HwAccountInfo>>;
/// Get a list of paths to locked hardware wallets /// Get a list of paths to locked hardware wallets
#[rpc(name = "parity_lockedHardwareAccountsInfo")] #[rpc(name = "parity_lockedHardwareAccountsInfo")]
fn locked_hardware_accounts_info(&self) -> Result<Vec<String>, Error>; fn locked_hardware_accounts_info(&self) -> Result<Vec<String>>;
/// Returns default account for dapp. /// Returns default account for dapp.
#[rpc(meta, name = "parity_defaultAccount")] #[rpc(meta, name = "parity_defaultAccount")]
fn default_account(&self, Self::Metadata) -> Result<H160, Error>; fn default_account(&self, Self::Metadata) -> Result<H160>;
/// Returns current transactions limit. /// Returns current transactions limit.
#[rpc(name = "parity_transactionsLimit")] #[rpc(name = "parity_transactionsLimit")]
fn transactions_limit(&self) -> Result<usize, Error>; fn transactions_limit(&self) -> Result<usize>;
/// Returns mining extra data. /// Returns mining extra data.
#[rpc(name = "parity_extraData")] #[rpc(name = "parity_extraData")]
fn extra_data(&self) -> Result<Bytes, Error>; fn extra_data(&self) -> Result<Bytes>;
/// Returns mining gas floor target. /// Returns mining gas floor target.
#[rpc(name = "parity_gasFloorTarget")] #[rpc(name = "parity_gasFloorTarget")]
fn gas_floor_target(&self) -> Result<U256, Error>; fn gas_floor_target(&self) -> Result<U256>;
/// Returns mining gas floor cap. /// Returns mining gas floor cap.
#[rpc(name = "parity_gasCeilTarget")] #[rpc(name = "parity_gasCeilTarget")]
fn gas_ceil_target(&self) -> Result<U256, Error>; fn gas_ceil_target(&self) -> Result<U256>;
/// Returns minimal gas price for transaction to be included in queue. /// Returns minimal gas price for transaction to be included in queue.
#[rpc(name = "parity_minGasPrice")] #[rpc(name = "parity_minGasPrice")]
fn min_gas_price(&self) -> Result<U256, Error>; fn min_gas_price(&self) -> Result<U256>;
/// Returns latest logs /// Returns latest logs
#[rpc(name = "parity_devLogs")] #[rpc(name = "parity_devLogs")]
fn dev_logs(&self) -> Result<Vec<String>, Error>; fn dev_logs(&self) -> Result<Vec<String>>;
/// Returns logs levels /// Returns logs levels
#[rpc(name = "parity_devLogsLevels")] #[rpc(name = "parity_devLogsLevels")]
fn dev_logs_levels(&self) -> Result<String, Error>; fn dev_logs_levels(&self) -> Result<String>;
/// Returns chain name - DEPRECATED. Use `parity_chainName` instead. /// Returns chain name - DEPRECATED. Use `parity_chainName` instead.
#[rpc(name = "parity_netChain")] #[rpc(name = "parity_netChain")]
fn net_chain(&self) -> Result<String, Error>; fn net_chain(&self) -> Result<String>;
/// Returns peers details /// Returns peers details
#[rpc(name = "parity_netPeers")] #[rpc(name = "parity_netPeers")]
fn net_peers(&self) -> Result<Peers, Error>; fn net_peers(&self) -> Result<Peers>;
/// Returns network port /// Returns network port
#[rpc(name = "parity_netPort")] #[rpc(name = "parity_netPort")]
fn net_port(&self) -> Result<u16, Error>; fn net_port(&self) -> Result<u16>;
/// Returns rpc settings /// Returns rpc settings
#[rpc(name = "parity_rpcSettings")] #[rpc(name = "parity_rpcSettings")]
fn rpc_settings(&self) -> Result<RpcSettings, Error>; fn rpc_settings(&self) -> Result<RpcSettings>;
/// Returns node name /// Returns node name
#[rpc(name = "parity_nodeName")] #[rpc(name = "parity_nodeName")]
fn node_name(&self) -> Result<String, Error>; fn node_name(&self) -> Result<String>;
/// Returns default extra data /// Returns default extra data
#[rpc(name = "parity_defaultExtraData")] #[rpc(name = "parity_defaultExtraData")]
fn default_extra_data(&self) -> Result<Bytes, Error>; fn default_extra_data(&self) -> Result<Bytes>;
/// Returns distribution of gas price in latest blocks. /// Returns distribution of gas price in latest blocks.
#[rpc(name = "parity_gasPriceHistogram")] #[rpc(name = "parity_gasPriceHistogram")]
fn gas_price_histogram(&self) -> BoxFuture<Histogram, Error>; fn gas_price_histogram(&self) -> BoxFuture<Histogram>;
/// Returns number of unsigned transactions waiting in the signer queue (if signer enabled) /// Returns number of unsigned transactions waiting in the signer queue (if signer enabled)
/// Returns error when signer is disabled /// Returns error when signer is disabled
#[rpc(name = "parity_unsignedTransactionsCount")] #[rpc(name = "parity_unsignedTransactionsCount")]
fn unsigned_transactions_count(&self) -> Result<usize, Error>; fn unsigned_transactions_count(&self) -> Result<usize>;
/// Returns a cryptographically random phrase sufficient for securely seeding a secret key. /// Returns a cryptographically random phrase sufficient for securely seeding a secret key.
#[rpc(name = "parity_generateSecretPhrase")] #[rpc(name = "parity_generateSecretPhrase")]
fn generate_secret_phrase(&self) -> Result<String, Error>; fn generate_secret_phrase(&self) -> Result<String>;
/// Returns whatever address would be derived from the given phrase if it were to seed a brainwallet. /// Returns whatever address would be derived from the given phrase if it were to seed a brainwallet.
#[rpc(name = "parity_phraseToAddress")] #[rpc(name = "parity_phraseToAddress")]
fn phrase_to_address(&self, String) -> Result<H160, Error>; fn phrase_to_address(&self, String) -> Result<H160>;
/// Returns the value of the registrar for this network. /// Returns the value of the registrar for this network.
#[rpc(name = "parity_registryAddress")] #[rpc(name = "parity_registryAddress")]
fn registry_address(&self) -> Result<Option<H160>, Error>; fn registry_address(&self) -> Result<Option<H160>>;
/// Returns all addresses if Fat DB is enabled (`--fat-db`), or null if not. /// Returns all addresses if Fat DB is enabled (`--fat-db`), or null if not.
#[rpc(name = "parity_listAccounts")] #[rpc(name = "parity_listAccounts")]
fn list_accounts(&self, u64, Option<H160>, Trailing<BlockNumber>) -> Result<Option<Vec<H160>>, Error>; fn list_accounts(&self, u64, Option<H160>, Trailing<BlockNumber>) -> Result<Option<Vec<H160>>>;
/// Returns all storage keys of the given address (first parameter) if Fat DB is enabled (`--fat-db`), /// Returns all storage keys of the given address (first parameter) if Fat DB is enabled (`--fat-db`),
/// or null if not. /// or null if not.
#[rpc(name = "parity_listStorageKeys")] #[rpc(name = "parity_listStorageKeys")]
fn list_storage_keys(&self, H160, u64, Option<H256>, Trailing<BlockNumber>) -> Result<Option<Vec<H256>>, Error>; fn list_storage_keys(&self, H160, u64, Option<H256>, Trailing<BlockNumber>) -> Result<Option<Vec<H256>>>;
/// Encrypt some data with a public key under ECIES. /// Encrypt some data with a public key under ECIES.
/// First parameter is the 512-byte destination public key, second is the message. /// First parameter is the 512-byte destination public key, second is the message.
#[rpc(name = "parity_encryptMessage")] #[rpc(name = "parity_encryptMessage")]
fn encrypt_message(&self, H512, Bytes) -> Result<Bytes, Error>; fn encrypt_message(&self, H512, Bytes) -> Result<Bytes>;
/// Returns all pending transactions from transaction queue. /// Returns all pending transactions from transaction queue.
#[rpc(name = "parity_pendingTransactions")] #[rpc(name = "parity_pendingTransactions")]
fn pending_transactions(&self) -> Result<Vec<Transaction>, Error>; fn pending_transactions(&self) -> Result<Vec<Transaction>>;
/// Returns all future transactions from transaction queue. /// Returns all future transactions from transaction queue.
#[rpc(name = "parity_futureTransactions")] #[rpc(name = "parity_futureTransactions")]
fn future_transactions(&self) -> Result<Vec<Transaction>, Error>; fn future_transactions(&self) -> Result<Vec<Transaction>>;
/// Returns propagation statistics on transactions pending in the queue. /// Returns propagation statistics on transactions pending in the queue.
#[rpc(name = "parity_pendingTransactionsStats")] #[rpc(name = "parity_pendingTransactionsStats")]
fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>, Error>; fn pending_transactions_stats(&self) -> Result<BTreeMap<H256, TransactionStats>>;
/// Returns a list of current and past local transactions with status details. /// Returns a list of current and past local transactions with status details.
#[rpc(name = "parity_localTransactions")] #[rpc(name = "parity_localTransactions")]
fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>, Error>; fn local_transactions(&self) -> Result<BTreeMap<H256, LocalTransactionStatus>>;
/// Returns current Dapps Server interface and port or an error if dapps server is disabled. /// Returns current Dapps Server interface and port or an error if dapps server is disabled.
#[rpc(name = "parity_dappsUrl")] #[rpc(name = "parity_dappsUrl")]
fn dapps_url(&self) -> Result<String, Error>; fn dapps_url(&self) -> Result<String>;
/// Returns current WS Server interface and port or an error if ws server is disabled. /// Returns current WS Server interface and port or an error if ws server is disabled.
#[rpc(name = "parity_wsUrl")] #[rpc(name = "parity_wsUrl")]
fn ws_url(&self) -> Result<String, Error>; fn ws_url(&self) -> Result<String>;
/// Returns next nonce for particular sender. Should include all transactions in the queue. /// Returns next nonce for particular sender. Should include all transactions in the queue.
#[rpc(name = "parity_nextNonce")] #[rpc(name = "parity_nextNonce")]
fn next_nonce(&self, H160) -> BoxFuture<U256, Error>; fn next_nonce(&self, H160) -> BoxFuture<U256>;
/// Get the mode. Returns one of: "active", "passive", "dark", "offline". /// Get the mode. Returns one of: "active", "passive", "dark", "offline".
#[rpc(name = "parity_mode")] #[rpc(name = "parity_mode")]
fn mode(&self) -> Result<String, Error>; fn mode(&self) -> Result<String>;
/// Returns the chain ID used for transaction signing at the /// Returns the chain ID used for transaction signing at the
/// current best block. An empty string is returned if not /// current best block. An empty string is returned if not
/// available. /// available.
#[rpc(name = "parity_chainId")] #[rpc(name = "parity_chainId")]
fn chain_id(&self) -> Result<Option<U64>, Error>; fn chain_id(&self) -> Result<Option<U64>>;
/// Get the chain name. Returns one of: "foundation", "kovan", &c. of a filename. /// Get the chain name. Returns one of: "foundation", "kovan", &c. of a filename.
#[rpc(name = "parity_chain")] #[rpc(name = "parity_chain")]
fn chain(&self) -> Result<String, Error>; fn chain(&self) -> Result<String>;
/// Get the enode of this node. /// Get the enode of this node.
#[rpc(name = "parity_enode")] #[rpc(name = "parity_enode")]
fn enode(&self) -> Result<String, Error>; fn enode(&self) -> Result<String>;
/// Returns information on current consensus capability. /// Returns information on current consensus capability.
#[rpc(name = "parity_consensusCapability")] #[rpc(name = "parity_consensusCapability")]
fn consensus_capability(&self) -> Result<ConsensusCapability, Error>; fn consensus_capability(&self) -> Result<ConsensusCapability>;
/// Get our version information in a nice object. /// Get our version information in a nice object.
#[rpc(name = "parity_versionInfo")] #[rpc(name = "parity_versionInfo")]
fn version_info(&self) -> Result<VersionInfo, Error>; fn version_info(&self) -> Result<VersionInfo>;
/// Get information concerning the latest releases if available. /// Get information concerning the latest releases if available.
#[rpc(name = "parity_releasesInfo")] #[rpc(name = "parity_releasesInfo")]
fn releases_info(&self) -> Result<Option<OperationsInfo>, Error>; fn releases_info(&self) -> Result<Option<OperationsInfo>>;
/// Get the current chain status. /// Get the current chain status.
#[rpc(name = "parity_chainStatus")] #[rpc(name = "parity_chainStatus")]
fn chain_status(&self) -> Result<ChainStatus, Error>; fn chain_status(&self) -> Result<ChainStatus>;
/// Get node kind info. /// Get node kind info.
#[rpc(name = "parity_nodeKind")] #[rpc(name = "parity_nodeKind")]
fn node_kind(&self) -> Result<::v1::types::NodeKind, Error>; fn node_kind(&self) -> Result<::v1::types::NodeKind>;
/// Get block header. /// Get block header.
/// Same as `eth_getBlockByNumber` but without uncles and transactions. /// Same as `eth_getBlockByNumber` but without uncles and transactions.
#[rpc(name = "parity_getBlockHeaderByNumber")] #[rpc(name = "parity_getBlockHeaderByNumber")]
fn block_header(&self, Trailing<BlockNumber>) -> BoxFuture<RichHeader, Error>; fn block_header(&self, Trailing<BlockNumber>) -> BoxFuture<RichHeader>;
/// Get IPFS CIDv0 given protobuf encoded bytes. /// Get IPFS CIDv0 given protobuf encoded bytes.
#[rpc(name = "parity_cidV0")] #[rpc(name = "parity_cidV0")]
fn ipfs_cid(&self, Bytes) -> Result<String, Error>; fn ipfs_cid(&self, Bytes) -> Result<String>;
/// Call contract, returning the output data. /// Call contract, returning the output data.
#[rpc(meta, name = "parity_call")] #[rpc(meta, name = "parity_call")]
fn call(&self, Self::Metadata, Vec<CallRequest>, Trailing<BlockNumber>) -> Result<Vec<Bytes>, Error>; fn call(&self, Self::Metadata, Vec<CallRequest>, Trailing<BlockNumber>) -> Result<Vec<Bytes>>;
/// Returns node's health report. /// Returns node's health report.
#[rpc(name = "parity_nodeHealth")] #[rpc(name = "parity_nodeHealth")]
fn node_health(&self) -> BoxFuture<Health, Error>; fn node_health(&self) -> BoxFuture<Health>;
} }
} }

View File

@ -17,7 +17,7 @@
//! Parity Accounts-related rpc interface. //! Parity Accounts-related rpc interface.
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::Error; use jsonrpc_core::Result;
use ethstore::KeyFile; use ethstore::KeyFile;
use v1::types::{H160, H256, H520, DappId, DeriveHash, DeriveHierarchical, ExtAccountInfo}; use v1::types::{H160, H256, H520, DappId, DeriveHash, DeriveHierarchical, ExtAccountInfo};
@ -26,167 +26,167 @@ build_rpc_trait! {
pub trait ParityAccounts { pub trait ParityAccounts {
/// Returns accounts information. /// Returns accounts information.
#[rpc(name = "parity_allAccountsInfo")] #[rpc(name = "parity_allAccountsInfo")]
fn all_accounts_info(&self) -> Result<BTreeMap<H160, ExtAccountInfo>, Error>; fn all_accounts_info(&self) -> Result<BTreeMap<H160, ExtAccountInfo>>;
/// Creates new account from the given phrase using standard brainwallet mechanism. /// Creates new account from the given phrase using standard brainwallet mechanism.
/// Second parameter is password for the new account. /// Second parameter is password for the new account.
#[rpc(name = "parity_newAccountFromPhrase")] #[rpc(name = "parity_newAccountFromPhrase")]
fn new_account_from_phrase(&self, String, String) -> Result<H160, Error>; fn new_account_from_phrase(&self, String, String) -> Result<H160>;
/// Creates new account from the given JSON wallet. /// Creates new account from the given JSON wallet.
/// Second parameter is password for the wallet and the new account. /// Second parameter is password for the wallet and the new account.
#[rpc(name = "parity_newAccountFromWallet")] #[rpc(name = "parity_newAccountFromWallet")]
fn new_account_from_wallet(&self, String, String) -> Result<H160, Error>; fn new_account_from_wallet(&self, String, String) -> Result<H160>;
/// Creates new account from the given raw secret. /// Creates new account from the given raw secret.
/// Second parameter is password for the new account. /// Second parameter is password for the new account.
#[rpc(name = "parity_newAccountFromSecret")] #[rpc(name = "parity_newAccountFromSecret")]
fn new_account_from_secret(&self, H256, String) -> Result<H160, Error>; fn new_account_from_secret(&self, H256, String) -> Result<H160>;
/// Returns true if given `password` would unlock given `account`. /// Returns true if given `password` would unlock given `account`.
/// Arguments: `account`, `password`. /// Arguments: `account`, `password`.
#[rpc(name = "parity_testPassword")] #[rpc(name = "parity_testPassword")]
fn test_password(&self, H160, String) -> Result<bool, Error>; fn test_password(&self, H160, String) -> Result<bool>;
/// Changes an account's password. /// Changes an account's password.
/// Arguments: `account`, `password`, `new_password`. /// Arguments: `account`, `password`, `new_password`.
#[rpc(name = "parity_changePassword")] #[rpc(name = "parity_changePassword")]
fn change_password(&self, H160, String, String) -> Result<bool, Error>; fn change_password(&self, H160, String, String) -> Result<bool>;
/// Permanently deletes an account. /// Permanently deletes an account.
/// Arguments: `account`, `password`. /// Arguments: `account`, `password`.
#[rpc(name = "parity_killAccount")] #[rpc(name = "parity_killAccount")]
fn kill_account(&self, H160, String) -> Result<bool, Error>; fn kill_account(&self, H160, String) -> Result<bool>;
/// Permanently deletes an address from the addressbook /// Permanently deletes an address from the addressbook
/// Arguments: `address` /// Arguments: `address`
#[rpc(name = "parity_removeAddress")] #[rpc(name = "parity_removeAddress")]
fn remove_address(&self, H160) -> Result<bool, Error>; fn remove_address(&self, H160) -> Result<bool>;
/// Set an account's name. /// Set an account's name.
#[rpc(name = "parity_setAccountName")] #[rpc(name = "parity_setAccountName")]
fn set_account_name(&self, H160, String) -> Result<bool, Error>; fn set_account_name(&self, H160, String) -> Result<bool>;
/// Set an account's metadata string. /// Set an account's metadata string.
#[rpc(name = "parity_setAccountMeta")] #[rpc(name = "parity_setAccountMeta")]
fn set_account_meta(&self, H160, String) -> Result<bool, Error>; fn set_account_meta(&self, H160, String) -> Result<bool>;
/// Sets addresses exposed for particular dapp. /// Sets addresses exposed for particular dapp.
/// Setting a non-empty list will also override default account. /// Setting a non-empty list will also override default account.
/// Setting `None` will resets visible account to what's visible for new dapps /// Setting `None` will resets visible account to what's visible for new dapps
/// (does not affect default account though) /// (does not affect default account though)
#[rpc(name = "parity_setDappAddresses")] #[rpc(name = "parity_setDappAddresses")]
fn set_dapp_addresses(&self, DappId, Option<Vec<H160>>) -> Result<bool, Error>; fn set_dapp_addresses(&self, DappId, Option<Vec<H160>>) -> Result<bool>;
/// Gets accounts exposed for particular dapp. /// Gets accounts exposed for particular dapp.
#[rpc(name = "parity_getDappAddresses")] #[rpc(name = "parity_getDappAddresses")]
fn dapp_addresses(&self, DappId) -> Result<Vec<H160>, Error>; fn dapp_addresses(&self, DappId) -> Result<Vec<H160>>;
/// Changes dapp default address. /// Changes dapp default address.
/// Does not affect other accounts exposed for this dapp, but /// Does not affect other accounts exposed for this dapp, but
/// default account will always be retured as the first one. /// default account will always be retured as the first one.
#[rpc(name = "parity_setDappDefaultAddress")] #[rpc(name = "parity_setDappDefaultAddress")]
fn set_dapp_default_address(&self, DappId, H160) -> Result<bool, Error>; fn set_dapp_default_address(&self, DappId, H160) -> Result<bool>;
/// Returns current dapp default address. /// Returns current dapp default address.
/// If not set explicite for the dapp will return global default. /// If not set explicite for the dapp will return global default.
#[rpc(name = "parity_getDappDefaultAddress")] #[rpc(name = "parity_getDappDefaultAddress")]
fn dapp_default_address(&self, DappId) -> Result<H160, Error>; fn dapp_default_address(&self, DappId) -> Result<H160>;
/// Sets accounts exposed for new dapps. /// Sets accounts exposed for new dapps.
/// Setting a non-empty list will also override default account. /// Setting a non-empty list will also override default account.
/// Setting `None` exposes all internal-managed accounts. /// Setting `None` exposes all internal-managed accounts.
/// (does not affect default account though) /// (does not affect default account though)
#[rpc(name = "parity_setNewDappsAddresses")] #[rpc(name = "parity_setNewDappsAddresses")]
fn set_new_dapps_addresses(&self, Option<Vec<H160>>) -> Result<bool, Error>; fn set_new_dapps_addresses(&self, Option<Vec<H160>>) -> Result<bool>;
/// Gets accounts exposed for new dapps. /// Gets accounts exposed for new dapps.
/// `None` means that all accounts are exposes. /// `None` means that all accounts are exposes.
#[rpc(name = "parity_getNewDappsAddresses")] #[rpc(name = "parity_getNewDappsAddresses")]
fn new_dapps_addresses(&self) -> Result<Option<Vec<H160>>, Error>; fn new_dapps_addresses(&self) -> Result<Option<Vec<H160>>>;
/// Changes default address for new dapps (global default address) /// Changes default address for new dapps (global default address)
/// Does not affect other accounts exposed for new dapps, but /// Does not affect other accounts exposed for new dapps, but
/// default account will always be retured as the first one. /// default account will always be retured as the first one.
#[rpc(name = "parity_setNewDappsDefaultAddress")] #[rpc(name = "parity_setNewDappsDefaultAddress")]
fn set_new_dapps_default_address(&self, H160) -> Result<bool, Error>; fn set_new_dapps_default_address(&self, H160) -> Result<bool>;
/// Returns current default address for new dapps (global default address) /// Returns current default address for new dapps (global default address)
/// In case it's not set explicite will return first available account. /// In case it's not set explicite will return first available account.
/// If no accounts are available will return `0x0` /// If no accounts are available will return `0x0`
#[rpc(name = "parity_getNewDappsDefaultAddress")] #[rpc(name = "parity_getNewDappsDefaultAddress")]
fn new_dapps_default_address(&self) -> Result<H160, Error>; fn new_dapps_default_address(&self) -> Result<H160>;
/// Returns identified dapps that recently used RPC /// Returns identified dapps that recently used RPC
/// Includes last usage timestamp. /// Includes last usage timestamp.
#[rpc(name = "parity_listRecentDapps")] #[rpc(name = "parity_listRecentDapps")]
fn recent_dapps(&self) -> Result<BTreeMap<DappId, u64>, Error>; fn recent_dapps(&self) -> Result<BTreeMap<DappId, u64>>;
/// Imports a number of Geth accounts, with the list provided as the argument. /// Imports a number of Geth accounts, with the list provided as the argument.
#[rpc(name = "parity_importGethAccounts")] #[rpc(name = "parity_importGethAccounts")]
fn import_geth_accounts(&self, Vec<H160>) -> Result<Vec<H160>, Error>; fn import_geth_accounts(&self, Vec<H160>) -> Result<Vec<H160>>;
/// Returns the accounts available for importing from Geth. /// Returns the accounts available for importing from Geth.
#[rpc(name = "parity_listGethAccounts")] #[rpc(name = "parity_listGethAccounts")]
fn geth_accounts(&self) -> Result<Vec<H160>, Error>; fn geth_accounts(&self) -> Result<Vec<H160>>;
/// Create new vault. /// Create new vault.
#[rpc(name = "parity_newVault")] #[rpc(name = "parity_newVault")]
fn create_vault(&self, String, String) -> Result<bool, Error>; fn create_vault(&self, String, String) -> Result<bool>;
/// Open existing vault. /// Open existing vault.
#[rpc(name = "parity_openVault")] #[rpc(name = "parity_openVault")]
fn open_vault(&self, String, String) -> Result<bool, Error>; fn open_vault(&self, String, String) -> Result<bool>;
/// Close previously opened vault. /// Close previously opened vault.
#[rpc(name = "parity_closeVault")] #[rpc(name = "parity_closeVault")]
fn close_vault(&self, String) -> Result<bool, Error>; fn close_vault(&self, String) -> Result<bool>;
/// List all vaults. /// List all vaults.
#[rpc(name = "parity_listVaults")] #[rpc(name = "parity_listVaults")]
fn list_vaults(&self) -> Result<Vec<String>, Error>; fn list_vaults(&self) -> Result<Vec<String>>;
/// List all currently opened vaults. /// List all currently opened vaults.
#[rpc(name = "parity_listOpenedVaults")] #[rpc(name = "parity_listOpenedVaults")]
fn list_opened_vaults(&self) -> Result<Vec<String>, Error>; fn list_opened_vaults(&self) -> Result<Vec<String>>;
/// Change vault password. /// Change vault password.
#[rpc(name = "parity_changeVaultPassword")] #[rpc(name = "parity_changeVaultPassword")]
fn change_vault_password(&self, String, String) -> Result<bool, Error>; fn change_vault_password(&self, String, String) -> Result<bool>;
/// Change vault of the given address. /// Change vault of the given address.
#[rpc(name = "parity_changeVault")] #[rpc(name = "parity_changeVault")]
fn change_vault(&self, H160, String) -> Result<bool, Error>; fn change_vault(&self, H160, String) -> Result<bool>;
/// Get vault metadata string. /// Get vault metadata string.
#[rpc(name = "parity_getVaultMeta")] #[rpc(name = "parity_getVaultMeta")]
fn get_vault_meta(&self, String) -> Result<String, Error>; fn get_vault_meta(&self, String) -> Result<String>;
/// Set vault metadata string. /// Set vault metadata string.
#[rpc(name = "parity_setVaultMeta")] #[rpc(name = "parity_setVaultMeta")]
fn set_vault_meta(&self, String, String) -> Result<bool, Error>; fn set_vault_meta(&self, String, String) -> Result<bool>;
/// Derive new address from given account address using specific hash. /// Derive new address from given account address using specific hash.
/// Resulting address can be either saved as a new account (with the same password). /// Resulting address can be either saved as a new account (with the same password).
#[rpc(name = "parity_deriveAddressHash")] #[rpc(name = "parity_deriveAddressHash")]
fn derive_key_hash(&self, H160, String, DeriveHash, bool) -> Result<H160, Error>; fn derive_key_hash(&self, H160, String, DeriveHash, bool) -> Result<H160>;
/// Derive new address from given account address using /// Derive new address from given account address using
/// hierarchical derivation (sequence of 32-bit integer indices). /// hierarchical derivation (sequence of 32-bit integer indices).
/// Resulting address can be either saved as a new account (with the same password). /// Resulting address can be either saved as a new account (with the same password).
#[rpc(name = "parity_deriveAddressIndex")] #[rpc(name = "parity_deriveAddressIndex")]
fn derive_key_index(&self, H160, String, DeriveHierarchical, bool) -> Result<H160, Error>; fn derive_key_index(&self, H160, String, DeriveHierarchical, bool) -> Result<H160>;
/// Exports an account with given address if provided password matches. /// Exports an account with given address if provided password matches.
#[rpc(name = "parity_exportAccount")] #[rpc(name = "parity_exportAccount")]
fn export_account(&self, H160, String) -> Result<KeyFile, Error>; fn export_account(&self, H160, String) -> Result<KeyFile>;
/// Sign raw hash with the key corresponding to address and password. /// Sign raw hash with the key corresponding to address and password.
#[rpc(name = "parity_signMessage")] #[rpc(name = "parity_signMessage")]
fn sign_message(&self, H160, String, H256) -> Result<H520, Error>; fn sign_message(&self, H160, String, H256) -> Result<H520>;
/// Send a PinMatrixAck to a hardware wallet, unlocking it /// Send a PinMatrixAck to a hardware wallet, unlocking it
#[rpc(name = "parity_hardwarePinMatrixAck")] #[rpc(name = "parity_hardwarePinMatrixAck")]
fn hardware_pin_matrix_ack(&self, String, String) -> Result<bool, Error>; fn hardware_pin_matrix_ack(&self, String, String) -> Result<bool>;
} }
} }

View File

@ -16,7 +16,7 @@
//! Parity-specific rpc interface for operations altering the settings. //! Parity-specific rpc interface for operations altering the settings.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction, LocalDapp}; use v1::types::{Bytes, H160, H256, U256, ReleaseInfo, Transaction, LocalDapp};
@ -25,91 +25,91 @@ build_rpc_trait! {
pub trait ParitySet { pub trait ParitySet {
/// Sets new minimal gas price for mined blocks. /// Sets new minimal gas price for mined blocks.
#[rpc(name = "parity_setMinGasPrice")] #[rpc(name = "parity_setMinGasPrice")]
fn set_min_gas_price(&self, U256) -> Result<bool, Error>; fn set_min_gas_price(&self, U256) -> Result<bool>;
/// Sets new gas floor target for mined blocks. /// Sets new gas floor target for mined blocks.
#[rpc(name = "parity_setGasFloorTarget")] #[rpc(name = "parity_setGasFloorTarget")]
fn set_gas_floor_target(&self, U256) -> Result<bool, Error>; fn set_gas_floor_target(&self, U256) -> Result<bool>;
/// Sets new gas ceiling target for mined blocks. /// Sets new gas ceiling target for mined blocks.
#[rpc(name = "parity_setGasCeilTarget")] #[rpc(name = "parity_setGasCeilTarget")]
fn set_gas_ceil_target(&self, U256) -> Result<bool, Error>; fn set_gas_ceil_target(&self, U256) -> Result<bool>;
/// Sets new extra data for mined blocks. /// Sets new extra data for mined blocks.
#[rpc(name = "parity_setExtraData")] #[rpc(name = "parity_setExtraData")]
fn set_extra_data(&self, Bytes) -> Result<bool, Error>; fn set_extra_data(&self, Bytes) -> Result<bool>;
/// Sets new author for mined block. /// Sets new author for mined block.
#[rpc(name = "parity_setAuthor")] #[rpc(name = "parity_setAuthor")]
fn set_author(&self, H160) -> Result<bool, Error>; fn set_author(&self, H160) -> Result<bool>;
/// Sets account for signing consensus messages. /// Sets account for signing consensus messages.
#[rpc(name = "parity_setEngineSigner")] #[rpc(name = "parity_setEngineSigner")]
fn set_engine_signer(&self, H160, String) -> Result<bool, Error>; fn set_engine_signer(&self, H160, String) -> Result<bool>;
/// Sets the limits for transaction queue. /// Sets the limits for transaction queue.
#[rpc(name = "parity_setTransactionsLimit")] #[rpc(name = "parity_setTransactionsLimit")]
fn set_transactions_limit(&self, usize) -> Result<bool, Error>; fn set_transactions_limit(&self, usize) -> Result<bool>;
/// Sets the maximum amount of gas a single transaction may consume. /// Sets the maximum amount of gas a single transaction may consume.
#[rpc(name = "parity_setMaxTransactionGas")] #[rpc(name = "parity_setMaxTransactionGas")]
fn set_tx_gas_limit(&self, U256) -> Result<bool, Error>; fn set_tx_gas_limit(&self, U256) -> Result<bool>;
/// Add a reserved peer. /// Add a reserved peer.
#[rpc(name = "parity_addReservedPeer")] #[rpc(name = "parity_addReservedPeer")]
fn add_reserved_peer(&self, String) -> Result<bool, Error>; fn add_reserved_peer(&self, String) -> Result<bool>;
/// Remove a reserved peer. /// Remove a reserved peer.
#[rpc(name = "parity_removeReservedPeer")] #[rpc(name = "parity_removeReservedPeer")]
fn remove_reserved_peer(&self, String) -> Result<bool, Error>; fn remove_reserved_peer(&self, String) -> Result<bool>;
/// Drop all non-reserved peers. /// Drop all non-reserved peers.
#[rpc(name = "parity_dropNonReservedPeers")] #[rpc(name = "parity_dropNonReservedPeers")]
fn drop_non_reserved_peers(&self) -> Result<bool, Error>; fn drop_non_reserved_peers(&self) -> Result<bool>;
/// Accept non-reserved peers (default behavior) /// Accept non-reserved peers (default behavior)
#[rpc(name = "parity_acceptNonReservedPeers")] #[rpc(name = "parity_acceptNonReservedPeers")]
fn accept_non_reserved_peers(&self) -> Result<bool, Error>; fn accept_non_reserved_peers(&self) -> Result<bool>;
/// Start the network. /// Start the network.
/// ///
/// @deprecated - Use `set_mode("active")` instead. /// @deprecated - Use `set_mode("active")` instead.
#[rpc(name = "parity_startNetwork")] #[rpc(name = "parity_startNetwork")]
fn start_network(&self) -> Result<bool, Error>; fn start_network(&self) -> Result<bool>;
/// Stop the network. /// Stop the network.
/// ///
/// @deprecated - Use `set_mode("offline")` instead. /// @deprecated - Use `set_mode("offline")` instead.
#[rpc(name = "parity_stopNetwork")] #[rpc(name = "parity_stopNetwork")]
fn stop_network(&self) -> Result<bool, Error>; fn stop_network(&self) -> Result<bool>;
/// Set the mode. Argument must be one of: "active", "passive", "dark", "offline". /// Set the mode. Argument must be one of: "active", "passive", "dark", "offline".
#[rpc(name = "parity_setMode")] #[rpc(name = "parity_setMode")]
fn set_mode(&self, String) -> Result<bool, Error>; fn set_mode(&self, String) -> Result<bool>;
/// Set the network spec. Argument must be one of: "foundation", "ropsten", "morden", "kovan", "olympic", "classic", "dev", "expanse", "musicoin" or a filename. /// Set the network spec. Argument must be one of: "foundation", "ropsten", "morden", "kovan", "olympic", "classic", "dev", "expanse", "musicoin" or a filename.
#[rpc(name = "parity_setChain")] #[rpc(name = "parity_setChain")]
fn set_spec_name(&self, String) -> Result<bool, Error>; fn set_spec_name(&self, String) -> Result<bool>;
/// Hash a file content under given URL. /// Hash a file content under given URL.
#[rpc(name = "parity_hashContent")] #[rpc(name = "parity_hashContent")]
fn hash_content(&self, String) -> BoxFuture<H256, Error>; fn hash_content(&self, String) -> BoxFuture<H256>;
/// Returns true if refresh successful, error if unsuccessful or server is disabled. /// Returns true if refresh successful, error if unsuccessful or server is disabled.
#[rpc(name = "parity_dappsRefresh")] #[rpc(name = "parity_dappsRefresh")]
fn dapps_refresh(&self) -> Result<bool, Error>; fn dapps_refresh(&self) -> Result<bool>;
/// Returns a list of local dapps /// Returns a list of local dapps
#[rpc(name = "parity_dappsList")] #[rpc(name = "parity_dappsList")]
fn dapps_list(&self) -> Result<Vec<LocalDapp>, Error>; fn dapps_list(&self) -> Result<Vec<LocalDapp>>;
/// Is there a release ready for install? /// Is there a release ready for install?
#[rpc(name = "parity_upgradeReady")] #[rpc(name = "parity_upgradeReady")]
fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>, Error>; fn upgrade_ready(&self) -> Result<Option<ReleaseInfo>>;
/// Execute a release which is ready according to upgrade_ready(). /// Execute a release which is ready according to upgrade_ready().
#[rpc(name = "parity_executeUpgrade")] #[rpc(name = "parity_executeUpgrade")]
fn execute_upgrade(&self) -> Result<bool, Error>; fn execute_upgrade(&self) -> Result<bool>;
/// Removes transaction from transaction queue. /// Removes transaction from transaction queue.
/// Makes sense only for transactions that were not propagated to other peers yet /// Makes sense only for transactions that were not propagated to other peers yet
@ -118,6 +118,6 @@ build_rpc_trait! {
/// or excessive gas limit that are not accepted by other peers whp. /// or excessive gas limit that are not accepted by other peers whp.
/// Returns `true` when transaction was removed, `false` if it was not found. /// Returns `true` when transaction was removed, `false` if it was not found.
#[rpc(name = "parity_removeTransaction")] #[rpc(name = "parity_removeTransaction")]
fn remove_transaction(&self, H256) -> Result<Option<Transaction>, Error>; fn remove_transaction(&self, H256) -> Result<Option<Transaction>>;
} }
} }

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! ParitySigning rpc interface. //! ParitySigning rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use v1::types::{U256, H160, Bytes, ConfirmationResponse, TransactionRequest, Either}; use v1::types::{U256, H160, Bytes, ConfirmationResponse, TransactionRequest, Either};
@ -27,26 +27,26 @@ build_rpc_trait! {
/// Given partial transaction request produces transaction with all fields filled in. /// Given partial transaction request produces transaction with all fields filled in.
/// Such transaction can be then signed externally. /// Such transaction can be then signed externally.
#[rpc(meta, name = "parity_composeTransaction")] #[rpc(meta, name = "parity_composeTransaction")]
fn compose_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<TransactionRequest, Error>; fn compose_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<TransactionRequest>;
/// Posts sign request asynchronously. /// Posts sign request asynchronously.
/// Will return a confirmation ID for later use with check_transaction. /// Will return a confirmation ID for later use with check_transaction.
#[rpc(meta, name = "parity_postSign")] #[rpc(meta, name = "parity_postSign")]
fn post_sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Either<U256, ConfirmationResponse>, Error>; fn post_sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Either<U256, ConfirmationResponse>>;
/// Posts transaction asynchronously. /// Posts transaction asynchronously.
/// Will return a transaction ID for later use with check_transaction. /// Will return a transaction ID for later use with check_transaction.
#[rpc(meta, name = "parity_postTransaction")] #[rpc(meta, name = "parity_postTransaction")]
fn post_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<Either<U256, ConfirmationResponse>, Error>; fn post_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<Either<U256, ConfirmationResponse>>;
/// Checks the progress of a previously posted request (transaction/sign). /// Checks the progress of a previously posted request (transaction/sign).
/// Should be given a valid send_transaction ID. /// Should be given a valid send_transaction ID.
#[rpc(name = "parity_checkRequest")] #[rpc(name = "parity_checkRequest")]
fn check_request(&self, U256) -> Result<Option<ConfirmationResponse>, Error>; fn check_request(&self, U256) -> Result<Option<ConfirmationResponse>>;
/// Decrypt some ECIES-encrypted message. /// Decrypt some ECIES-encrypted message.
/// First parameter is the address with which it is encrypted, second is the ciphertext. /// First parameter is the address with which it is encrypted, second is the ciphertext.
#[rpc(meta, name = "parity_decryptMessage")] #[rpc(meta, name = "parity_decryptMessage")]
fn decrypt_message(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Bytes, Error>; fn decrypt_message(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Bytes>;
} }
} }

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Personal rpc interface. //! Personal rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use v1::types::{U128, H160, H256, TransactionRequest}; use v1::types::{U128, H160, H256, TransactionRequest};
@ -26,24 +26,24 @@ build_rpc_trait! {
/// Lists all stored accounts /// Lists all stored accounts
#[rpc(name = "personal_listAccounts")] #[rpc(name = "personal_listAccounts")]
fn accounts(&self) -> Result<Vec<H160>, Error>; fn accounts(&self) -> Result<Vec<H160>>;
/// Creates new account (it becomes new current unlocked account) /// Creates new account (it becomes new current unlocked account)
/// Param is the password for the account. /// Param is the password for the account.
#[rpc(name = "personal_newAccount")] #[rpc(name = "personal_newAccount")]
fn new_account(&self, String) -> Result<H160, Error>; fn new_account(&self, String) -> Result<H160>;
/// Unlocks specified account for use (can only be one unlocked account at one moment) /// Unlocks specified account for use (can only be one unlocked account at one moment)
#[rpc(name = "personal_unlockAccount")] #[rpc(name = "personal_unlockAccount")]
fn unlock_account(&self, H160, String, Option<U128>) -> Result<bool, Error>; fn unlock_account(&self, H160, String, Option<U128>) -> Result<bool>;
/// Sends transaction and signs it in single call. The account is not unlocked in such case. /// Sends transaction and signs it in single call. The account is not unlocked in such case.
#[rpc(meta, name = "personal_sendTransaction")] #[rpc(meta, name = "personal_sendTransaction")]
fn send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256, Error>; fn send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256>;
/// @deprecated alias for `personal_sendTransaction`. /// @deprecated alias for `personal_sendTransaction`.
#[rpc(meta, name = "personal_signAndSendTransaction")] #[rpc(meta, name = "personal_signAndSendTransaction")]
fn sign_and_send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256, Error>; fn sign_and_send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256>;
} }
} }

View File

@ -16,7 +16,7 @@
//! Parity-specific PUB-SUB rpc interface. //! Parity-specific PUB-SUB rpc interface.
use jsonrpc_core::{Error, Value, Params}; use jsonrpc_core::{Result, Value, Params};
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use jsonrpc_macros::pubsub::Subscriber; use jsonrpc_macros::pubsub::Subscriber;
@ -33,7 +33,7 @@ build_rpc_trait! {
/// Unsubscribe from existing Parity subscription. /// Unsubscribe from existing Parity subscription.
#[rpc(name = "parity_unsubscribe")] #[rpc(name = "parity_unsubscribe")]
fn parity_unsubscribe(&self, SubscriptionId) -> Result<bool, Error>; fn parity_unsubscribe(&self, SubscriptionId) -> Result<bool>;
} }
} }
} }

View File

@ -18,7 +18,7 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use jsonrpc_core::Error; use jsonrpc_core::Result;
build_rpc_trait! { build_rpc_trait! {
/// RPC Interface. /// RPC Interface.
@ -26,11 +26,11 @@ build_rpc_trait! {
/// Returns supported modules for Geth 1.3.6 /// Returns supported modules for Geth 1.3.6
/// @ignore /// @ignore
#[rpc(name = "modules")] #[rpc(name = "modules")]
fn modules(&self) -> Result<BTreeMap<String, String>, Error>; fn modules(&self) -> Result<BTreeMap<String, String>>;
/// Returns supported modules for Geth 1.4.0 /// Returns supported modules for Geth 1.4.0
/// @ignore /// @ignore
#[rpc(name = "rpc_modules")] #[rpc(name = "rpc_modules")]
fn rpc_modules(&self) -> Result<BTreeMap<String, String>, Error>; fn rpc_modules(&self) -> Result<BTreeMap<String, String>>;
} }
} }

View File

@ -16,7 +16,7 @@
//! SecretStore-specific rpc interface. //! SecretStore-specific rpc interface.
use jsonrpc_core::Error; use jsonrpc_core::Result;
use v1::types::{H160, H512, Bytes}; use v1::types::{H160, H512, Bytes};
@ -26,16 +26,16 @@ build_rpc_trait! {
/// Encrypt data with key, received from secret store. /// Encrypt data with key, received from secret store.
/// Arguments: `account`, `password`, `key`, `data`. /// Arguments: `account`, `password`, `key`, `data`.
#[rpc(name = "secretstore_encrypt")] #[rpc(name = "secretstore_encrypt")]
fn encrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes, Error>; fn encrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes>;
/// Decrypt data with key, received from secret store. /// Decrypt data with key, received from secret store.
/// Arguments: `account`, `password`, `key`, `data`. /// Arguments: `account`, `password`, `key`, `data`.
#[rpc(name = "secretstore_decrypt")] #[rpc(name = "secretstore_decrypt")]
fn decrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes, Error>; fn decrypt(&self, H160, String, Bytes, Bytes) -> Result<Bytes>;
/// Decrypt data with shadow key, received from secret store. /// Decrypt data with shadow key, received from secret store.
/// Arguments: `account`, `password`, `decrypted_secret`, `common_point`, `decrypt_shadows`, `data`. /// Arguments: `account`, `password`, `decrypted_secret`, `common_point`, `decrypt_shadows`, `data`.
#[rpc(name = "secretstore_shadowDecrypt")] #[rpc(name = "secretstore_shadowDecrypt")]
fn shadow_decrypt(&self, H160, String, H512, H512, Vec<Bytes>, Bytes) -> Result<Bytes, Error>; fn shadow_decrypt(&self, H160, String, H512, H512, Vec<Bytes>, Bytes) -> Result<Bytes>;
} }
} }

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Parity Signer-related rpc interface. //! Parity Signer-related rpc interface.
use jsonrpc_core::{BoxFuture, Error}; use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_pubsub::SubscriptionId; use jsonrpc_pubsub::SubscriptionId;
use jsonrpc_macros::pubsub::Subscriber; use jsonrpc_macros::pubsub::Subscriber;
@ -28,31 +28,31 @@ build_rpc_trait! {
/// Returns a list of items to confirm. /// Returns a list of items to confirm.
#[rpc(name = "signer_requestsToConfirm")] #[rpc(name = "signer_requestsToConfirm")]
fn requests_to_confirm(&self) -> Result<Vec<ConfirmationRequest>, Error>; fn requests_to_confirm(&self) -> Result<Vec<ConfirmationRequest>>;
/// Confirm specific request. /// Confirm specific request.
#[rpc(name = "signer_confirmRequest")] #[rpc(name = "signer_confirmRequest")]
fn confirm_request(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponse, Error>; fn confirm_request(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponse>;
/// Confirm specific request with token. /// Confirm specific request with token.
#[rpc(name = "signer_confirmRequestWithToken")] #[rpc(name = "signer_confirmRequestWithToken")]
fn confirm_request_with_token(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponseWithToken, Error>; fn confirm_request_with_token(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponseWithToken>;
/// Confirm specific request with already signed data. /// Confirm specific request with already signed data.
#[rpc(name = "signer_confirmRequestRaw")] #[rpc(name = "signer_confirmRequestRaw")]
fn confirm_request_raw(&self, U256, Bytes) -> Result<ConfirmationResponse, Error>; fn confirm_request_raw(&self, U256, Bytes) -> Result<ConfirmationResponse>;
/// Reject the confirmation request. /// Reject the confirmation request.
#[rpc(name = "signer_rejectRequest")] #[rpc(name = "signer_rejectRequest")]
fn reject_request(&self, U256) -> Result<bool, Error>; fn reject_request(&self, U256) -> Result<bool>;
/// Generates new authorization token. /// Generates new authorization token.
#[rpc(name = "signer_generateAuthorizationToken")] #[rpc(name = "signer_generateAuthorizationToken")]
fn generate_token(&self) -> Result<String, Error>; fn generate_token(&self) -> Result<String>;
/// Generates new web proxy access token for particular domain. /// Generates new web proxy access token for particular domain.
#[rpc(name = "signer_generateWebProxyAccessToken")] #[rpc(name = "signer_generateWebProxyAccessToken")]
fn generate_web_proxy_token(&self, String) -> Result<String, Error>; fn generate_web_proxy_token(&self, String) -> Result<String>;
#[pubsub(name = "signer_pending")] { #[pubsub(name = "signer_pending")] {
/// Subscribe to new pending requests on signer interface. /// Subscribe to new pending requests on signer interface.
@ -61,7 +61,7 @@ build_rpc_trait! {
/// Unsubscribe from pending requests subscription. /// Unsubscribe from pending requests subscription.
#[rpc(name = "signer_unsubscribePending")] #[rpc(name = "signer_unsubscribePending")]
fn unsubscribe_pending(&self, SubscriptionId) -> Result<bool, Error>; fn unsubscribe_pending(&self, SubscriptionId) -> Result<bool>;
} }
} }
} }

View File

@ -16,7 +16,7 @@
//! Traces specific rpc interface. //! Traces specific rpc interface.
use jsonrpc_core::Error; use jsonrpc_core::Result;
use jsonrpc_macros::Trailing; use jsonrpc_macros::Trailing;
use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, H256, TraceOptions}; use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, H256, TraceOptions};
@ -27,34 +27,34 @@ build_rpc_trait! {
/// Returns traces matching given filter. /// Returns traces matching given filter.
#[rpc(name = "trace_filter")] #[rpc(name = "trace_filter")]
fn filter(&self, TraceFilter) -> Result<Option<Vec<LocalizedTrace>>, Error>; fn filter(&self, TraceFilter) -> Result<Option<Vec<LocalizedTrace>>>;
/// Returns transaction trace at given index. /// Returns transaction trace at given index.
#[rpc(name = "trace_get")] #[rpc(name = "trace_get")]
fn trace(&self, H256, Vec<Index>) -> Result<Option<LocalizedTrace>, Error>; fn trace(&self, H256, Vec<Index>) -> Result<Option<LocalizedTrace>>;
/// Returns all traces of given transaction. /// Returns all traces of given transaction.
#[rpc(name = "trace_transaction")] #[rpc(name = "trace_transaction")]
fn transaction_traces(&self, H256) -> Result<Option<Vec<LocalizedTrace>>, Error>; fn transaction_traces(&self, H256) -> Result<Option<Vec<LocalizedTrace>>>;
/// Returns all traces produced at given block. /// Returns all traces produced at given block.
#[rpc(name = "trace_block")] #[rpc(name = "trace_block")]
fn block_traces(&self, BlockNumber) -> Result<Option<Vec<LocalizedTrace>>, Error>; fn block_traces(&self, BlockNumber) -> Result<Option<Vec<LocalizedTrace>>>;
/// Executes the given call and returns a number of possible traces for it. /// Executes the given call and returns a number of possible traces for it.
#[rpc(meta, name = "trace_call")] #[rpc(meta, name = "trace_call")]
fn call(&self, Self::Metadata, CallRequest, TraceOptions, Trailing<BlockNumber>) -> Result<TraceResults, Error>; fn call(&self, Self::Metadata, CallRequest, TraceOptions, Trailing<BlockNumber>) -> Result<TraceResults>;
/// Executes all given calls and returns a number of possible traces for each of it. /// Executes all given calls and returns a number of possible traces for each of it.
#[rpc(meta, name = "trace_callMany")] #[rpc(meta, name = "trace_callMany")]
fn call_many(&self, Self::Metadata, Vec<(CallRequest, TraceOptions)>, Trailing<BlockNumber>) -> Result<Vec<TraceResults>, Error>; fn call_many(&self, Self::Metadata, Vec<(CallRequest, TraceOptions)>, Trailing<BlockNumber>) -> Result<Vec<TraceResults>>;
/// Executes the given raw transaction and returns a number of possible traces for it. /// Executes the given raw transaction and returns a number of possible traces for it.
#[rpc(name = "trace_rawTransaction")] #[rpc(name = "trace_rawTransaction")]
fn raw_transaction(&self, Bytes, TraceOptions, Trailing<BlockNumber>) -> Result<TraceResults, Error>; fn raw_transaction(&self, Bytes, TraceOptions, Trailing<BlockNumber>) -> Result<TraceResults>;
/// Executes the transaction with the given hash and returns a number of possible traces for it. /// Executes the transaction with the given hash and returns a number of possible traces for it.
#[rpc(name = "trace_replayTransaction")] #[rpc(name = "trace_replayTransaction")]
fn replay_transaction(&self, H256, TraceOptions) -> Result<TraceResults, Error>; fn replay_transaction(&self, H256, TraceOptions) -> Result<TraceResults>;
} }
} }

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Web3 rpc interface. //! Web3 rpc interface.
use jsonrpc_core::Error; use jsonrpc_core::Result;
use v1::types::{H256, Bytes}; use v1::types::{H256, Bytes};
@ -24,10 +24,10 @@ build_rpc_trait! {
pub trait Web3 { pub trait Web3 {
/// Returns current client version. /// Returns current client version.
#[rpc(name = "web3_clientVersion")] #[rpc(name = "web3_clientVersion")]
fn client_version(&self) -> Result<String, Error>; fn client_version(&self) -> Result<String>;
/// Returns sha3 of the given data /// Returns sha3 of the given data
#[rpc(name = "web3_sha3")] #[rpc(name = "web3_sha3")]
fn sha3(&self, Bytes) -> Result<H256, Error>; fn sha3(&self, Bytes) -> Result<H256>;
} }
} }

View File

@ -14,7 +14,7 @@ serde_json = "1.0"
url = "1.2.0" url = "1.2.0"
matches = "0.1" matches = "0.1"
parking_lot = "0.4" parking_lot = "0.4"
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
parity-rpc = { path = "../rpc" } parity-rpc = { path = "../rpc" }
hash = { path = "../util/hash" } hash = { path = "../util/hash" }

View File

@ -33,10 +33,12 @@ use serde_json::{
use futures::{Canceled, Complete, Future, oneshot, done}; use futures::{Canceled, Complete, Future, oneshot, done};
use jsonrpc_core::{BoxFuture, Id, Version, Params, Error as JsonRpcError}; use jsonrpc_core::{Id, Version, Params, Error as JsonRpcError};
use jsonrpc_core::request::MethodCall; use jsonrpc_core::request::MethodCall;
use jsonrpc_core::response::{Output, Success, Failure}; use jsonrpc_core::response::{Output, Success, Failure};
use BoxFuture;
/// The actual websocket connection handler, passed into the /// The actual websocket connection handler, passed into the
/// event loop of ws-rs /// event loop of ws-rs
struct RpcHandler { struct RpcHandler {

View File

@ -18,6 +18,8 @@ extern crate log;
#[macro_use] #[macro_use]
extern crate matches; extern crate matches;
/// Boxed future response.
pub type BoxFuture<T, E> = Box<futures::Future<Item=T, Error=E> + Send>;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

View File

@ -4,7 +4,7 @@ use serde;
use serde_json::{Value as JsonValue, to_value}; use serde_json::{Value as JsonValue, to_value};
use std::path::PathBuf; use std::path::PathBuf;
use futures::{Canceled}; use futures::{Canceled};
use jsonrpc_core::BoxFuture; use {BoxFuture};
pub struct SignerRpc { pub struct SignerRpc {
rpc: Rpc, rpc: Rpc,

View File

@ -450,7 +450,7 @@ impl<T> SessionImpl<T> where T: SessionTransport {
data.key_share_common_point = message.common_point.clone().map(Into::into); data.key_share_common_point = message.common_point.clone().map(Into::into);
data.key_share_encrypted_point = message.encrypted_point.clone().map(Into::into); data.key_share_encrypted_point = message.encrypted_point.clone().map(Into::into);
let mut id_numbers = data.id_numbers.as_mut() let id_numbers = data.id_numbers.as_mut()
.expect("common key share data is expected after initialization; id_numers are filled during initialization; qed"); .expect("common key share data is expected after initialization; id_numers are filled during initialization; qed");
for (node, id_number) in &message.id_numbers { for (node, id_number) in &message.id_numbers {
let id_number: Secret = id_number.clone().into(); let id_number: Secret = id_number.clone().into();
@ -1153,7 +1153,7 @@ pub mod tests {
// check that session has completed on all nodes // check that session has completed on all nodes
assert!(ml.nodes.values().all(|n| n.session.is_finished())); assert!(ml.nodes.values().all(|n| n.session.is_finished()));
// check that secret is still the same as before adding the share // check that secret is still the same as before adding the share
check_secret_is_preserved(ml.original_key_pair.clone(), ml.nodes.iter().map(|(k, v)| (k.clone(), v.key_storage.clone())).collect()); check_secret_is_preserved(ml.original_key_pair.clone(), ml.nodes.iter().map(|(k, v)| (k.clone(), v.key_storage.clone())).collect());
} }
@ -1187,7 +1187,7 @@ pub mod tests {
// check that session has completed on all nodes // check that session has completed on all nodes
assert!(ml.nodes.values().all(|n| n.session.is_finished())); assert!(ml.nodes.values().all(|n| n.session.is_finished()));
// check that secret is still the same as before adding the share // check that secret is still the same as before adding the share
check_secret_is_preserved(ml.original_key_pair.clone(), ml.nodes check_secret_is_preserved(ml.original_key_pair.clone(), ml.nodes
.iter() .iter()
@ -1245,7 +1245,7 @@ pub mod tests {
.iter() .iter()
.map(|(k, v)| (k.clone(), v.key_storage.clone())) .map(|(k, v)| (k.clone(), v.key_storage.clone()))
.collect()); .collect());
// check that all oldest nodes have versions A, B, C // check that all oldest nodes have versions A, B, C
// isolated node has version A, C // isolated node has version A, C
// new nodes have versions B, C // new nodes have versions B, C

View File

@ -7,9 +7,9 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
log = "0.3" log = "0.3"
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-tcp-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-tcp-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore-bigint = { path = "../util/bigint" } ethcore-bigint = { path = "../util/bigint" }
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }

View File

@ -26,6 +26,6 @@ smallvec = "0.4"
time = "0.1" time = "0.1"
tiny-keccak = "1.3" tiny-keccak = "1.3"
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-macros = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }
jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.8" } jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.9" }