Merge pull request #377 from ethcore/serdeup0.9
updated jsonrpc modules and serde from 0.8 to 0.9
This commit is contained in:
commit
6632b1dc75
|
@ -58,14 +58,6 @@ dependencies = [
|
|||
"odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aster"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"syntex_syntax 0.44.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base58"
|
||||
version = "0.1.0"
|
||||
|
@ -220,7 +212,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.2.2"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -339,30 +331,29 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.1.1"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "jsonrpc-core"
|
||||
version = "5.0.0"
|
||||
source = "git+https://github.com/ethcore/jsonrpc.git#5eeee0980e4d2682a831c633fa03a8af99e0d68c"
|
||||
version = "6.0.0"
|
||||
source = "git+https://github.com/ethcore/jsonrpc.git#3db845542b40a460c414142b3f76555b78c90a11"
|
||||
dependencies = [
|
||||
"futures 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_codegen 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-core 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsonrpc-http-server"
|
||||
version = "7.0.0"
|
||||
source = "git+https://github.com/ethcore/jsonrpc.git#5eeee0980e4d2682a831c633fa03a8af99e0d68c"
|
||||
version = "6.0.0"
|
||||
source = "git+https://github.com/ethcore/jsonrpc.git#3db845542b40a460c414142b3f76555b78c90a11"
|
||||
dependencies = [
|
||||
"futures 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
|
||||
"jsonrpc-core 5.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-core 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -370,12 +361,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "jsonrpc-macros"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/ethcore/jsonrpc.git#5eeee0980e4d2682a831c633fa03a8af99e0d68c"
|
||||
version = "6.0.0"
|
||||
source = "git+https://github.com/ethcore/jsonrpc.git#3db845542b40a460c414142b3f76555b78c90a11"
|
||||
dependencies = [
|
||||
"futures 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jsonrpc-core 5.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -729,39 +719,16 @@ dependencies = [
|
|||
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quasi"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"syntex_errors 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.44.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quasi_codegen"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aster 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_errors 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.44.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quasi_macros"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quasi_codegen 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.3.15"
|
||||
|
@ -851,9 +818,9 @@ dependencies = [
|
|||
"chain 0.1.0",
|
||||
"db 0.1.0",
|
||||
"ethcore-devtools 1.3.0",
|
||||
"jsonrpc-core 5.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"jsonrpc-http-server 7.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"jsonrpc-macros 0.2.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"jsonrpc-macros 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||
"keys 0.1.0",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"miner 0.1.0",
|
||||
|
@ -862,10 +829,9 @@ dependencies = [
|
|||
"primitives 0.1.0",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"script 0.1.0",
|
||||
"serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_codegen 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serialization 0.1.0",
|
||||
"sync 0.1.0",
|
||||
"test-data 0.1.0",
|
||||
|
@ -922,49 +888,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "0.8.23"
|
||||
version = "0.9.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde_codegen"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aster 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quasi 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quasi_codegen 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quasi_macros 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_codegen_internals 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.44.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_codegen_internals"
|
||||
version = "0.8.9"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"syntex_errors 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.44.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.11.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "0.9.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_codegen_internals 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.11.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "0.8.6"
|
||||
version = "0.9.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_macros"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde_codegen 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1009,6 +962,16 @@ name = "strsim"
|
|||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.11.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync"
|
||||
version = "0.1.0"
|
||||
|
@ -1038,57 +1001,11 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex"
|
||||
version = "0.44.0"
|
||||
name = "synom"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"syntex_errors 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_syntax 0.44.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex_errors"
|
||||
version = "0.44.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_pos 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex_pos"
|
||||
version = "0.44.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syntex_syntax"
|
||||
version = "0.44.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_errors 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syntex_pos 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "term"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1185,7 +1102,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -1256,7 +1173,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
|
||||
"checksum app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7d1c0d48a81bbb13043847f957971f4d87c81542d80ece5e84ba3cba4058fd4"
|
||||
"checksum arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d89f1b0e242270b5b797778af0c8d182a1a2ccac5d8d6fadf414223cc0fab096"
|
||||
"checksum aster 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258989846dd255a1e0eeef92d425d345477c9999433cecc9f0879f4549d5e5c9"
|
||||
"checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83"
|
||||
"checksum bigint 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4987c855cbe118271721d21f16cacdfedfe7dbeb7ea5970e4ae33db06602e3f2"
|
||||
"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"
|
||||
|
@ -1270,7 +1186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum csv 0.14.7 (registry+https://github.com/rust-lang/crates.io-index)" = "266c1815d7ca63a5bd86284043faf91e8c95e943e55ce05dc0ae08e952de18bc"
|
||||
"checksum deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1614659040e711785ed8ea24219140654da1729f3ec8a47a9719d041112fe7bf"
|
||||
"checksum domain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "725459994103308a8476a95d8115280b1359dccc06ca14291df75f37459a9e30"
|
||||
"checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d"
|
||||
"checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90"
|
||||
"checksum elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)" = "<none>"
|
||||
"checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f"
|
||||
"checksum eth-secp256k1 0.5.6 (git+https://github.com/ethcore/rust-secp256k1)" = "<none>"
|
||||
|
@ -1281,10 +1197,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d"
|
||||
"checksum hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)" = "<none>"
|
||||
"checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11"
|
||||
"checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1"
|
||||
"checksum jsonrpc-core 5.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>"
|
||||
"checksum jsonrpc-http-server 7.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>"
|
||||
"checksum jsonrpc-macros 0.2.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>"
|
||||
"checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c"
|
||||
"checksum jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>"
|
||||
"checksum jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>"
|
||||
"checksum jsonrpc-macros 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)" = "<none>"
|
||||
"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 lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b"
|
||||
|
@ -1313,10 +1229,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum owning_ref 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9d52571ddcb42e9c900c901a18d8d67e393df723fcd51dd59c5b1a85d0acb6cc"
|
||||
"checksum parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e1435e7a2a00dfebededd6c6bdbd54008001e94b4a2aadd6aef0dc4c56317621"
|
||||
"checksum parking_lot_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb1b97670a2ffadce7c397fb80a3d687c4f3060140b885621ef1653d0e5d5068"
|
||||
"checksum quasi 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)" = "94a532453b931a4483a5b2e40f0fe04aee35b6bc2c0eeec876f1bd2358a134d3"
|
||||
"checksum quasi_codegen 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb4a9a5410fdbdacbeda8063ddb8add9838dfd4cf50ac486db98abb762d8bd6"
|
||||
"checksum quasi_macros 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "adc2b36285ea5e54e4e267f83896267ff8c5aba4f66b2e7d186ed6d968f3715f"
|
||||
"checksum quick-error 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0aad603e8d7fb67da22dbdf1f4b826ce8829e406124109e73cf1b2454b93a71c"
|
||||
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||
"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d"
|
||||
"checksum rayon 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b6a6e05e0e6b703e9f2ad266eb63f3712e693a17a2702b95a23de14ce8defa9"
|
||||
"checksum rayon 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50c575b58c2b109e2fbc181820cbe177474f35610ff9e357dc75f6bac854ffbf"
|
||||
|
@ -1331,22 +1245,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
|
||||
"checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
|
||||
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
|
||||
"checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8"
|
||||
"checksum serde_codegen 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "da68810d845f8e33a80243c28794650397056cbe7aea4c9c7516f55d1061c94e"
|
||||
"checksum serde_codegen_internals 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1b0115c5c602e81c61b787fb0f0fa76a614f8dbe9100b2b59b7d590155672c80"
|
||||
"checksum serde_json 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "67f7d2e9edc3523a9c8ec8cd6ec481b3a27810aafee3e625d311febd3e656b4c"
|
||||
"checksum serde_macros 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3cf1c01933271e1e72bb788e0499d1bca8af2c09efcc3ddc0b04ff22d080b83"
|
||||
"checksum serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)" = "a702319c807c016e51f672e5c77d6f0b46afddd744b5e437d6b8436b888b458f"
|
||||
"checksum serde_codegen_internals 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d52006899f910528a10631e5b727973fe668f3228109d1707ccf5bad5490b6e"
|
||||
"checksum serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f15ea24bd037b2d64646b4d934fa99c649be66e3f7b29fb595a5543b212b1452"
|
||||
"checksum serde_json 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)" = "dbc45439552eb8fb86907a2c41c1fd0ef97458efb87ff7f878db466eb581824e"
|
||||
"checksum shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72f20b8f3c060374edb8046591ba28f62448c369ccbdc7b02075103fb3a9e38d"
|
||||
"checksum siphasher 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "833011ca526bd88f16778d32c699d325a9ad302fa06381cd66f7be63351d3f6d"
|
||||
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
|
||||
"checksum smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fcc8d19212aacecf95e4a7a2179b26f7aeb9732a915cf01f05b0d3e044865410"
|
||||
"checksum spmc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93bdab61c1a413e591c4d17388ffa859eaff2df27f1e13a5ec8b716700605adf"
|
||||
"checksum strsim 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "67f84c44fbb2f91db7fef94554e6b2ac05909c9c0b0bc23bb98d3a1aebfe7f7c"
|
||||
"checksum syntex 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84f37b94d7ee762bcac58741f73a95465cf87188c3b93f10df9245aff821b2b4"
|
||||
"checksum syntex_errors 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0d95d2141ae79f312a01c6934d9984f9d7f5cfaf0c74aae5fbbc234a6dcb77a"
|
||||
"checksum syntex_pos 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e2cbf0598c5970f2dca122a4e6f7e93bf42f2d0b2dd88c3ea112413152864df"
|
||||
"checksum syntex_syntax 0.44.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5a89ee386d492cdd3855becec489c25797bb91bcbb3c2478c41969b24cb318a2"
|
||||
"checksum term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a"
|
||||
"checksum syn 0.11.9 (registry+https://github.com/rust-lang/crates.io-index)" = "480c834701caba3548aa991e54677281be3a5414a9d09ddbdf4ed74a569a9d19"
|
||||
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
||||
"checksum term_size 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "71662702fe5cd2cf95edd4ad655eea42f24a87a0e44059cbaa4e55260b7bc331"
|
||||
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
|
||||
"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
|
||||
|
@ -1357,7 +1267,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum unicode-normalization 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5e94e9f6961090fcc75180629c4ef33e5310d6ed2c0dd173f4ca63c9043b669e"
|
||||
"checksum unicode-segmentation 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c3bc443ded17b11305ffffe6b37e2076f328a5a8cb6aa877b1b98f77699e98b5"
|
||||
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
|
||||
"checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb"
|
||||
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||
"checksum url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5ba8a749fb4479b043733416c244fa9d1d3af3d7c23804944651c8a448cb87e"
|
||||
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
|
||||
"checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f"
|
||||
|
|
|
@ -2,17 +2,16 @@
|
|||
name = "rpc"
|
||||
version = "0.1.0"
|
||||
authors = ["Ethcore <admin@ethcore.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
serde = "0.8"
|
||||
serde_json = "0.8"
|
||||
serde = "0.9"
|
||||
serde_json = "0.9"
|
||||
rustc-serialize = "0.3"
|
||||
tokio-core = "0.1.1"
|
||||
serde_macros = { version = "0.8.0", optional = true }
|
||||
serde_derive = "0.9"
|
||||
jsonrpc-core = { git = "https://github.com/ethcore/jsonrpc.git" }
|
||||
jsonrpc-macros = { git = "https://github.com/ethcore/jsonrpc.git" }
|
||||
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc.git" }
|
||||
|
@ -30,10 +29,3 @@ miner = { path = "../miner" }
|
|||
verification = { path = "../verification" }
|
||||
script = { path = "../script" }
|
||||
keys = { path = "../keys" }
|
||||
|
||||
[build-dependencies]
|
||||
serde_codegen = { version = "0.8.0", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["serde_codegen"]
|
||||
nightly = ["serde_macros"]
|
||||
|
|
25
rpc/build.rs
25
rpc/build.rs
|
@ -1,25 +0,0 @@
|
|||
#[cfg(not(feature = "serde_macros"))]
|
||||
mod inner {
|
||||
extern crate serde_codegen;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn main() {
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
|
||||
let src = Path::new("src/v1/types/mod.rs.in");
|
||||
let dst = Path::new(&out_dir).join("mod.rs");
|
||||
|
||||
serde_codegen::expand(&src, &dst).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde_macros")]
|
||||
mod inner {
|
||||
pub fn main() {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
inner::main();
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
#![cfg_attr(feature="nightly", plugin(serde_macros))]
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate rustc_serialize;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate jsonrpc_core;
|
||||
#[macro_use]
|
||||
extern crate jsonrpc_macros;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::ops;
|
||||
use std::{ops, fmt};
|
||||
use std::str::FromStr;
|
||||
use serde::{Serialize, Deserialize, Serializer, Deserializer};
|
||||
use serde::de::{Visitor, Unexpected, Expected};
|
||||
use global_script::ScriptAddress;
|
||||
use keys::Address as GlobalAddress;
|
||||
use keys::Network as KeysNetwork;
|
||||
|
@ -24,30 +25,32 @@ impl Address {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn deserialize_from_string<E>(value: &str) -> Result<Address, E> where E: ::serde::de::Error {
|
||||
GlobalAddress::from_str(value)
|
||||
.map_err(|err| E::invalid_value(&format!("error {} parsing address {}", err, value)))
|
||||
.map(|address| Address(address))
|
||||
pub fn deserialize_from_string<E>(value: &str, expected: &Expected) -> Result<Address, E> where E: ::serde::de::Error {
|
||||
GlobalAddress::from_str(value)
|
||||
.map(Address)
|
||||
.map_err(|_| E::invalid_value(Unexpected::Str(value), expected))
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for Address {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
|
||||
serializer.serialize_str(&self.0.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Deserialize for Address {
|
||||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> where D: Deserializer {
|
||||
use serde::de::Visitor;
|
||||
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer {
|
||||
struct AddressVisitor;
|
||||
|
||||
impl Visitor for AddressVisitor {
|
||||
type Value = Address;
|
||||
|
||||
fn visit_str<E>(&mut self, value: &str) -> Result<Address, E> where E: ::serde::de::Error {
|
||||
Address::deserialize_from_string(value)
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("an address")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Address, E> where E: ::serde::de::Error {
|
||||
Address::deserialize_from_string(value, &self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
///! Serializable wrapper around vector of bytes
|
||||
use std::ops;
|
||||
use std::{ops, fmt};
|
||||
use rustc_serialize::hex::{ToHex, FromHex};
|
||||
use serde::{Serialize, Serializer, Deserialize, Deserializer, Error};
|
||||
use serde::de::Visitor;
|
||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
||||
use serde::de::{Visitor, Error};
|
||||
use primitives::bytes::Bytes as GlobalBytes;
|
||||
|
||||
/// Wrapper structure around vector of bytes.
|
||||
|
@ -34,7 +34,7 @@ impl Into<Vec<u8>> for Bytes {
|
|||
}
|
||||
|
||||
impl Serialize for Bytes {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: Serializer {
|
||||
let mut serialized = String::new();
|
||||
serialized.push_str(self.0.to_hex().as_ref());
|
||||
|
@ -43,7 +43,7 @@ impl Serialize for Bytes {
|
|||
}
|
||||
|
||||
impl Deserialize for Bytes {
|
||||
fn deserialize<D>(deserializer: &mut D) -> Result<Bytes, D::Error>
|
||||
fn deserialize<D>(deserializer: D) -> Result<Bytes, D::Error>
|
||||
where D: Deserializer {
|
||||
deserializer.deserialize(BytesVisitor)
|
||||
}
|
||||
|
@ -54,7 +54,11 @@ struct BytesVisitor;
|
|||
impl Visitor for BytesVisitor {
|
||||
type Value = Bytes;
|
||||
|
||||
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: Error {
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("a bytes")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: Error {
|
||||
if value.len() > 0 && value.len() & 1 == 0 {
|
||||
Ok(Bytes::new(try!(FromHex::from_hex(&value).map_err(|_| Error::custom("invalid hex")))))
|
||||
} else {
|
||||
|
@ -62,7 +66,7 @@ impl Visitor for BytesVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: Error {
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: Error {
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ pub struct VerboseBlock {
|
|||
}
|
||||
|
||||
impl Serialize for GetBlockResponse {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
|
||||
match *self {
|
||||
GetBlockResponse::Raw(ref raw_block) => raw_block.serialize(serializer),
|
||||
GetBlockResponse::Verbose(ref verbose_block) => verbose_block.serialize(serializer),
|
||||
|
|
|
@ -3,6 +3,7 @@ use std::str::FromStr;
|
|||
use std::cmp::Ordering;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use serde;
|
||||
use serde::de::Unexpected;
|
||||
use rustc_serialize::hex::{ToHex, FromHex};
|
||||
use primitives::hash::H256 as GlobalH256;
|
||||
use primitives::hash::H160 as GlobalH160;
|
||||
|
@ -85,7 +86,7 @@ macro_rules! impl_hash {
|
|||
}
|
||||
|
||||
impl serde::Serialize for $name {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where S: serde::Serializer {
|
||||
let mut hex = String::new();
|
||||
hex.push_str(&$other::from(self.0.clone()).to_hex());
|
||||
|
@ -94,16 +95,20 @@ macro_rules! impl_hash {
|
|||
}
|
||||
|
||||
impl serde::Deserialize for $name {
|
||||
fn deserialize<D>(deserializer: &mut D) -> Result<$name, D::Error> where D: serde::Deserializer {
|
||||
fn deserialize<D>(deserializer: D) -> Result<$name, D::Error> where D: serde::Deserializer {
|
||||
struct HashVisitor;
|
||||
|
||||
impl serde::de::Visitor for HashVisitor {
|
||||
type Value = $name;
|
||||
|
||||
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: serde::Error {
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("a hash string")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: serde::de::Error {
|
||||
|
||||
if value.len() != $size * 2 {
|
||||
return Err(serde::Error::custom("Invalid length."));
|
||||
return Err(E::invalid_value(Unexpected::Str(value), &self))
|
||||
}
|
||||
|
||||
match value[..].from_hex() {
|
||||
|
@ -112,11 +117,12 @@ macro_rules! impl_hash {
|
|||
result.copy_from_slice(v);
|
||||
Ok($name($other::from(result).take()))
|
||||
},
|
||||
_ => Err(serde::Error::custom("Invalid hex value."))
|
||||
_ => Err(E::invalid_value(Unexpected::Str(value), &self))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: serde::Error {
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: serde::de::Error {
|
||||
self.visit_str(value.as_ref())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,30 @@
|
|||
///! Structures used in RPC communication
|
||||
mod address;
|
||||
mod block;
|
||||
mod block_template;
|
||||
mod block_template_request;
|
||||
mod bytes;
|
||||
mod get_block_response;
|
||||
mod get_tx_out_response;
|
||||
mod get_tx_out_set_info_response;
|
||||
mod hash;
|
||||
mod script;
|
||||
mod transaction;
|
||||
mod uint;
|
||||
mod nodes;
|
||||
|
||||
#[cfg(feature = "serde_macros")]
|
||||
include!("mod.rs.in");
|
||||
|
||||
#[cfg(not(feature = "serde_macros"))]
|
||||
include!(concat!(env!("OUT_DIR"), "/mod.rs"));
|
||||
pub use self::address::Address;
|
||||
pub use self::block::RawBlock;
|
||||
pub use self::block_template::{BlockTemplate, BlockTemplateTransaction};
|
||||
pub use self::block_template_request::{BlockTemplateRequest, BlockTemplateRequestMode};
|
||||
pub use self::bytes::Bytes;
|
||||
pub use self::get_block_response::{GetBlockResponse, VerboseBlock};
|
||||
pub use self::get_tx_out_response::GetTxOutResponse;
|
||||
pub use self::get_tx_out_set_info_response::GetTxOutSetInfoResponse;
|
||||
pub use self::hash::{H160, H256};
|
||||
pub use self::script::ScriptType;
|
||||
pub use self::transaction::{RawTransaction, Transaction, TransactionInput, TransactionOutput,
|
||||
TransactionOutputWithAddress, TransactionOutputWithScriptData, TransactionInputScript,
|
||||
TransactionOutputScript, SignedTransactionInput, GetRawTransactionResponse,
|
||||
SignedTransactionOutput, TransactionOutputs};
|
||||
pub use self::uint::U256;
|
||||
pub use self::nodes::{AddNodeOperation, NodeInfo};
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
mod address;
|
||||
mod block;
|
||||
mod block_template;
|
||||
mod block_template_request;
|
||||
mod bytes;
|
||||
mod get_block_response;
|
||||
mod get_tx_out_response;
|
||||
mod get_tx_out_set_info_response;
|
||||
mod hash;
|
||||
mod script;
|
||||
mod transaction;
|
||||
mod uint;
|
||||
mod nodes;
|
||||
|
||||
pub use self::address::Address;
|
||||
pub use self::block::RawBlock;
|
||||
pub use self::block_template::{BlockTemplate, BlockTemplateTransaction};
|
||||
pub use self::block_template_request::{BlockTemplateRequest, BlockTemplateRequestMode};
|
||||
pub use self::bytes::Bytes;
|
||||
pub use self::get_block_response::{GetBlockResponse, VerboseBlock};
|
||||
pub use self::get_tx_out_response::GetTxOutResponse;
|
||||
pub use self::get_tx_out_set_info_response::GetTxOutSetInfoResponse;
|
||||
pub use self::hash::{H160, H256};
|
||||
pub use self::script::ScriptType;
|
||||
pub use self::transaction::{RawTransaction, Transaction, TransactionInput, TransactionOutput,
|
||||
TransactionOutputWithAddress, TransactionOutputWithScriptData, TransactionInputScript,
|
||||
TransactionOutputScript, SignedTransactionInput, GetRawTransactionResponse,
|
||||
SignedTransactionOutput, TransactionOutputs};
|
||||
pub use self::uint::U256;
|
||||
pub use self::nodes::{AddNodeOperation, NodeInfo};
|
|
@ -1,4 +1,6 @@
|
|||
use std::fmt;
|
||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
||||
use serde::de::Unexpected;
|
||||
use p2p::{Direction, PeerInfo};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -9,7 +11,7 @@ pub enum AddNodeOperation {
|
|||
}
|
||||
|
||||
impl Deserialize for AddNodeOperation {
|
||||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> where D: Deserializer {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer {
|
||||
use serde::de::Visitor;
|
||||
|
||||
struct DummyVisitor;
|
||||
|
@ -17,12 +19,16 @@ impl Deserialize for AddNodeOperation {
|
|||
impl Visitor for DummyVisitor {
|
||||
type Value = AddNodeOperation;
|
||||
|
||||
fn visit_str<E>(&mut self, value: &str) -> Result<AddNodeOperation, E> where E: ::serde::de::Error {
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("a node operation string")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<AddNodeOperation, E> where E: ::serde::de::Error {
|
||||
match value {
|
||||
"add" => Ok(AddNodeOperation::Add),
|
||||
"remove" => Ok(AddNodeOperation::Remove),
|
||||
"onetry" => Ok(AddNodeOperation::OneTry),
|
||||
_ => Err(E::invalid_value(&format!("unknown ScriptType variant: {}", value))),
|
||||
_ => Err(E::invalid_value(Unexpected::Str(value), &self)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +68,7 @@ pub enum NodeInfoAddressConnectionType {
|
|||
}
|
||||
|
||||
impl Serialize for NodeInfoAddressConnectionType {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
|
||||
match *self {
|
||||
NodeInfoAddressConnectionType::Inbound => "inbound".serialize(serializer),
|
||||
NodeInfoAddressConnectionType::Outbound => "outbound".serialize(serializer),
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
use std::fmt;
|
||||
use serde::{Serialize, Deserialize, Serializer, Deserializer};
|
||||
use serde::de::Unexpected;
|
||||
use global_script::ScriptType as GlobalScriptType;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -29,7 +31,7 @@ impl From<GlobalScriptType> for ScriptType {
|
|||
}
|
||||
|
||||
impl Serialize for ScriptType {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
|
||||
match *self {
|
||||
ScriptType::NonStandard => "nonstandard".serialize(serializer),
|
||||
ScriptType::PubKey => "pubkey".serialize(serializer),
|
||||
|
@ -44,7 +46,7 @@ impl Serialize for ScriptType {
|
|||
}
|
||||
|
||||
impl Deserialize for ScriptType {
|
||||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> where D: Deserializer {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer {
|
||||
use serde::de::Visitor;
|
||||
|
||||
struct ScriptTypeVisitor;
|
||||
|
@ -52,7 +54,11 @@ impl Deserialize for ScriptType {
|
|||
impl Visitor for ScriptTypeVisitor {
|
||||
type Value = ScriptType;
|
||||
|
||||
fn visit_str<E>(&mut self, value: &str) -> Result<ScriptType, E> where E: ::serde::de::Error {
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("script type")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> Result<ScriptType, E> where E: ::serde::de::Error {
|
||||
match value {
|
||||
"nonstandard" => Ok(ScriptType::NonStandard),
|
||||
"pubkey" => Ok(ScriptType::PubKey),
|
||||
|
@ -62,7 +68,7 @@ impl Deserialize for ScriptType {
|
|||
"nulldata" => Ok(ScriptType::NullData),
|
||||
"witness_v0_scripthash" => Ok(ScriptType::WitnessScript),
|
||||
"witness_v0_keyhash" => Ok(ScriptType::WitnessKey),
|
||||
_ => Err(E::invalid_value(&format!("unknown ScriptType variant: {}", value))),
|
||||
_ => Err(E::invalid_value(Unexpected::Str(value), &self)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::fmt;
|
||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
||||
|
||||
use serde::ser::SerializeMap;
|
||||
use super::address::Address;
|
||||
use super::bytes::Bytes;
|
||||
use super::hash::H256;
|
||||
|
@ -145,7 +146,7 @@ pub enum GetRawTransactionResponse {
|
|||
}
|
||||
|
||||
impl Serialize for GetRawTransactionResponse {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
|
||||
match *self {
|
||||
GetRawTransactionResponse::Raw(ref raw_transaction) => raw_transaction.serialize(serializer),
|
||||
GetRawTransactionResponse::Verbose(ref verbose_transaction) => verbose_transaction.serialize(serializer),
|
||||
|
@ -160,26 +161,24 @@ impl TransactionOutputs {
|
|||
}
|
||||
|
||||
impl Serialize for TransactionOutputs {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
|
||||
let mut state = try!(serializer.serialize_map(Some(self.len())));
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
|
||||
let mut state = serializer.serialize_map(Some(self.len()))?;
|
||||
for output in &self.outputs {
|
||||
match output {
|
||||
&TransactionOutput::Address(ref address_output) => {
|
||||
try!(serializer.serialize_map_key(&mut state, &address_output.address));
|
||||
try!(serializer.serialize_map_value(&mut state, &address_output.amount));
|
||||
state.serialize_entry(&address_output.address, &address_output.amount)?;
|
||||
},
|
||||
&TransactionOutput::ScriptData(ref script_output) => {
|
||||
try!(serializer.serialize_map_key(&mut state, "data"));
|
||||
try!(serializer.serialize_map_value(&mut state, &script_output.script_data));
|
||||
state.serialize_entry("data", &script_output.script_data)?;
|
||||
},
|
||||
}
|
||||
}
|
||||
serializer.serialize_map_end(state)
|
||||
state.end()
|
||||
}
|
||||
}
|
||||
|
||||
impl Deserialize for TransactionOutputs {
|
||||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> where D: Deserializer {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer {
|
||||
use serde::de::{Visitor, MapVisitor};
|
||||
|
||||
struct TransactionOutputsVisitor;
|
||||
|
@ -187,7 +186,11 @@ impl Deserialize for TransactionOutputs {
|
|||
impl Visitor for TransactionOutputsVisitor {
|
||||
type Value = TransactionOutputs;
|
||||
|
||||
fn visit_map<V>(&mut self, mut visitor: V) -> Result<TransactionOutputs, V::Error> where V: MapVisitor {
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("a transaction output object")
|
||||
}
|
||||
|
||||
fn visit_map<V>(self, mut visitor: V) -> Result<TransactionOutputs, V::Error> where V: MapVisitor {
|
||||
let mut outputs: Vec<TransactionOutput> = Vec::with_capacity(visitor.size_hint().0);
|
||||
|
||||
while let Some(key) = try!(visitor.visit_key::<String>()) {
|
||||
|
@ -197,7 +200,7 @@ impl Deserialize for TransactionOutputs {
|
|||
script_data: value,
|
||||
}));
|
||||
} else {
|
||||
let address = try!(Address::deserialize_from_string(&key));
|
||||
let address = try!(Address::deserialize_from_string(&key, &"an address"));
|
||||
let amount: f64 = try!(visitor.visit_value());
|
||||
outputs.push(TransactionOutput::Address(TransactionOutputWithAddress {
|
||||
address: address,
|
||||
|
@ -206,7 +209,6 @@ impl Deserialize for TransactionOutputs {
|
|||
}
|
||||
}
|
||||
|
||||
try!(visitor.end());
|
||||
Ok(TransactionOutputs {
|
||||
outputs: outputs,
|
||||
})
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use std::fmt;
|
||||
use std::str::FromStr;
|
||||
use serde;
|
||||
use serde::de::Unexpected;
|
||||
use primitives::bigint::{U256 as GlobalU256, Uint};
|
||||
|
||||
macro_rules! impl_uint {
|
||||
|
@ -31,28 +33,32 @@ macro_rules! impl_uint {
|
|||
}
|
||||
|
||||
impl serde::Serialize for $name {
|
||||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: serde::Serializer {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
|
||||
let as_hex = format!("{}", self.0.to_hex());
|
||||
serializer.serialize_str(&as_hex)
|
||||
}
|
||||
}
|
||||
|
||||
impl serde::Deserialize for $name {
|
||||
fn deserialize<D>(deserializer: &mut D) -> Result<$name, D::Error> where D: serde::Deserializer {
|
||||
fn deserialize<D>(deserializer: D) -> Result<$name, D::Error> where D: serde::Deserializer {
|
||||
struct UintVisitor;
|
||||
|
||||
impl serde::de::Visitor for UintVisitor {
|
||||
type Value = $name;
|
||||
|
||||
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: serde::Error {
|
||||
if value.len() > $size * 16 {
|
||||
return Err(serde::Error::custom("Invalid length."));
|
||||
}
|
||||
|
||||
$other::from_str(value).map($name).map_err(|_| serde::Error::custom("Invalid hex value."))
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("an integer represented in hex string")
|
||||
}
|
||||
|
||||
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: serde::Error {
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> where E: serde::de::Error {
|
||||
if value.len() > $size * 16 {
|
||||
return Err(E::invalid_value(Unexpected::Str(value), &self))
|
||||
}
|
||||
|
||||
$other::from_str(value).map($name).map_err(|_| E::invalid_value(Unexpected::Str(value), &self))
|
||||
}
|
||||
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E> where E: serde::de::Error {
|
||||
self.visit_str(&value)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue