Merge branch 'master' into auth-bft
This commit is contained in:
commit
cc284dd86f
@ -401,7 +401,7 @@ test-darwin:
|
|||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
script:
|
script:
|
||||||
- export RUST_BACKTRACE=1
|
- export RUST_BACKTRACE=1
|
||||||
- ./test.sh $CARGOFLAGS --no-release
|
- ./test.sh $CARGOFLAGS
|
||||||
tags:
|
tags:
|
||||||
- osx
|
- osx
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
@ -428,7 +428,7 @@ test-rust-stable:
|
|||||||
script:
|
script:
|
||||||
- export RUST_BACKTRACE=1
|
- export RUST_BACKTRACE=1
|
||||||
- echo $JS_FILES_MODIFIED
|
- echo $JS_FILES_MODIFIED
|
||||||
- if [ "$JS_FILES_MODIFIED" = 0 ]; then echo "skip js test"&./test.sh $CARGOFLAGS --no-release; else echo "skip rust test"&./js/scripts/lint.sh&./js/scripts/test.sh&./js/scripts/build.sh; fi
|
- if [ "$JS_FILES_MODIFIED" = 0 ]; then echo "skip js test"&./test.sh $CARGOFLAGS; else echo "skip rust test"&./js/scripts/lint.sh&./js/scripts/test.sh&./js/scripts/build.sh; fi
|
||||||
tags:
|
tags:
|
||||||
- rust
|
- rust
|
||||||
- rust-stable
|
- rust-stable
|
||||||
@ -457,7 +457,7 @@ test-rust-beta:
|
|||||||
script:
|
script:
|
||||||
- export RUST_BACKTRACE=1
|
- export RUST_BACKTRACE=1
|
||||||
- echo $JS_FILES_MODIFIED
|
- echo $JS_FILES_MODIFIED
|
||||||
- ./test.sh $CARGOFLAGS --no-release
|
- ./test.sh $CARGOFLAGS
|
||||||
tags:
|
tags:
|
||||||
- rust
|
- rust
|
||||||
- rust-beta
|
- rust-beta
|
||||||
@ -471,7 +471,7 @@ test-rust-nightly:
|
|||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
script:
|
script:
|
||||||
- export RUST_BACKTRACE=1
|
- export RUST_BACKTRACE=1
|
||||||
- ./test.sh $CARGOFLAGS --no-release
|
- ./test.sh $CARGOFLAGS
|
||||||
tags:
|
tags:
|
||||||
- rust
|
- rust
|
||||||
- rust-nightly
|
- rust-nightly
|
||||||
|
@ -16,7 +16,7 @@ git:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- rust: stable
|
- rust: stable
|
||||||
env: RUN_TESTS="true" TEST_OPTIONS="--no-release"
|
env: RUN_TESTS="true" TEST_OPTIONS=""
|
||||||
- rust: stable
|
- rust: stable
|
||||||
env: RUN_COVERAGE="true"
|
env: RUN_COVERAGE="true"
|
||||||
- rust: stable
|
- rust: stable
|
||||||
@ -71,8 +71,7 @@ install:
|
|||||||
script:
|
script:
|
||||||
- if [ "$RUN_TESTS" = "true" ]; then
|
- if [ "$RUN_TESTS" = "true" ]; then
|
||||||
./js/scripts/lint.sh &&
|
./js/scripts/lint.sh &&
|
||||||
./js/scripts/test.sh &&
|
travis_wait 40 ./test.sh $TEST_OPTIONS;
|
||||||
./test.sh $TEST_OPTIONS --verbose;
|
|
||||||
fi
|
fi
|
||||||
- if [ "$RUN_COVERAGE" = "true" ]; then ./scripts/cov.sh "$KCOV_CMD"; fi
|
- if [ "$RUN_COVERAGE" = "true" ]; then ./scripts/cov.sh "$KCOV_CMD"; fi
|
||||||
|
|
||||||
|
90
Cargo.lock
generated
90
Cargo.lock
generated
@ -10,18 +10,18 @@ dependencies = [
|
|||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.5.0",
|
"ethcore 1.5.0",
|
||||||
"ethcore-dapps 1.5.0",
|
"ethcore-dapps 1.5.0",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"ethcore-hash-fetch 1.5.0",
|
"ethcore-hash-fetch 1.5.0",
|
||||||
"ethcore-io 1.5.0",
|
"ethcore-io 1.5.0",
|
||||||
"ethcore-ipc 1.4.0",
|
"ethcore-ipc 1.5.0",
|
||||||
"ethcore-ipc-codegen 1.4.0",
|
"ethcore-ipc-codegen 1.5.0",
|
||||||
"ethcore-ipc-hypervisor 1.2.0",
|
"ethcore-ipc-hypervisor 1.2.0",
|
||||||
"ethcore-ipc-nano 1.4.0",
|
"ethcore-ipc-nano 1.5.0",
|
||||||
"ethcore-ipc-tests 0.1.0",
|
"ethcore-ipc-tests 0.1.0",
|
||||||
"ethcore-logger 1.5.0",
|
"ethcore-logger 1.5.0",
|
||||||
"ethcore-rpc 1.5.0",
|
"ethcore-rpc 1.5.0",
|
||||||
"ethcore-signer 1.5.0",
|
"ethcore-signer 1.5.0",
|
||||||
"ethcore-stratum 1.4.0",
|
"ethcore-stratum 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
"ethsync 1.5.0",
|
"ethsync 1.5.0",
|
||||||
"fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -273,7 +273,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethash"
|
name = "ethash"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -291,18 +291,18 @@ dependencies = [
|
|||||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.4.0",
|
"ethash 1.5.0",
|
||||||
"ethcore-bloom-journal 0.1.0",
|
"ethcore-bloom-journal 0.1.0",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"ethcore-io 1.5.0",
|
"ethcore-io 1.5.0",
|
||||||
"ethcore-ipc 1.4.0",
|
"ethcore-ipc 1.5.0",
|
||||||
"ethcore-ipc-codegen 1.4.0",
|
"ethcore-ipc-codegen 1.5.0",
|
||||||
"ethcore-ipc-nano 1.4.0",
|
"ethcore-ipc-nano 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.2.0",
|
"ethkey 0.2.0",
|
||||||
"ethstore 0.1.0",
|
"ethstore 0.1.0",
|
||||||
"evmjit 1.4.0",
|
"evmjit 1.5.0",
|
||||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
|
"hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -343,7 +343,7 @@ version = "1.5.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"ethcore-hash-fetch 1.5.0",
|
"ethcore-hash-fetch 1.5.0",
|
||||||
"ethcore-rpc 1.5.0",
|
"ethcore-rpc 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
@ -356,7 +356,7 @@ dependencies = [
|
|||||||
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mime_guess 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mime_guess 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-ui 1.4.0",
|
"parity-ui 1.5.0",
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -370,7 +370,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethcore-devtools"
|
name = "ethcore-devtools"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -400,9 +400,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethcore-ipc"
|
name = "ethcore-ipc"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
||||||
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -410,7 +410,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethcore-ipc-codegen"
|
name = "ethcore-ipc-codegen"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quasi 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quasi 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -423,9 +423,9 @@ dependencies = [
|
|||||||
name = "ethcore-ipc-hypervisor"
|
name = "ethcore-ipc-hypervisor"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethcore-ipc 1.4.0",
|
"ethcore-ipc 1.5.0",
|
||||||
"ethcore-ipc-codegen 1.4.0",
|
"ethcore-ipc-codegen 1.5.0",
|
||||||
"ethcore-ipc-nano 1.4.0",
|
"ethcore-ipc-nano 1.5.0",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
||||||
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -434,9 +434,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethcore-ipc-nano"
|
name = "ethcore-ipc-nano"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethcore-ipc 1.4.0",
|
"ethcore-ipc 1.5.0",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
||||||
@ -446,10 +446,10 @@ dependencies = [
|
|||||||
name = "ethcore-ipc-tests"
|
name = "ethcore-ipc-tests"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"ethcore-ipc 1.4.0",
|
"ethcore-ipc 1.5.0",
|
||||||
"ethcore-ipc-codegen 1.4.0",
|
"ethcore-ipc-codegen 1.5.0",
|
||||||
"ethcore-ipc-nano 1.4.0",
|
"ethcore-ipc-nano 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
"nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git)",
|
||||||
@ -475,7 +475,7 @@ version = "1.5.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"ethcore-io 1.5.0",
|
"ethcore-io 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
"ethcrypto 0.1.0",
|
"ethcrypto 0.1.0",
|
||||||
@ -499,11 +499,11 @@ name = "ethcore-rpc"
|
|||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.4.0",
|
"ethash 1.5.0",
|
||||||
"ethcore 1.5.0",
|
"ethcore 1.5.0",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"ethcore-io 1.5.0",
|
"ethcore-io 1.5.0",
|
||||||
"ethcore-ipc 1.4.0",
|
"ethcore-ipc 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
"ethcrypto 0.1.0",
|
"ethcrypto 0.1.0",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
@ -530,14 +530,14 @@ version = "1.5.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"ethcore-io 1.5.0",
|
"ethcore-io 1.5.0",
|
||||||
"ethcore-rpc 1.5.0",
|
"ethcore-rpc 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-ui 1.4.0",
|
"parity-ui 1.5.0",
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ws 0.5.3 (git+https://github.com/ethcore/ws-rs.git?branch=mio-upstream-stable)",
|
"ws 0.5.3 (git+https://github.com/ethcore/ws-rs.git?branch=mio-upstream-stable)",
|
||||||
@ -545,13 +545,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethcore-stratum"
|
name = "ethcore-stratum"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"ethcore-ipc 1.4.0",
|
"ethcore-ipc 1.5.0",
|
||||||
"ethcore-ipc-codegen 1.4.0",
|
"ethcore-ipc-codegen 1.5.0",
|
||||||
"ethcore-ipc-nano 1.4.0",
|
"ethcore-ipc-nano 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
"jsonrpc-core 4.0.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||||
"jsonrpc-tcp-server 0.1.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
"jsonrpc-tcp-server 0.1.0 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||||
@ -573,7 +573,7 @@ dependencies = [
|
|||||||
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
|
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
|
||||||
"ethcore-bigint 0.1.2",
|
"ethcore-bigint 0.1.2",
|
||||||
"ethcore-bloom-journal 0.1.0",
|
"ethcore-bloom-journal 0.1.0",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.5.0",
|
||||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"itertools 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -661,9 +661,9 @@ dependencies = [
|
|||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.5.0",
|
"ethcore 1.5.0",
|
||||||
"ethcore-io 1.5.0",
|
"ethcore-io 1.5.0",
|
||||||
"ethcore-ipc 1.4.0",
|
"ethcore-ipc 1.5.0",
|
||||||
"ethcore-ipc-codegen 1.4.0",
|
"ethcore-ipc-codegen 1.5.0",
|
||||||
"ethcore-ipc-nano 1.4.0",
|
"ethcore-ipc-nano 1.5.0",
|
||||||
"ethcore-network 1.5.0",
|
"ethcore-network 1.5.0",
|
||||||
"ethcore-util 1.5.0",
|
"ethcore-util 1.5.0",
|
||||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -677,7 +677,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "evmjit"
|
name = "evmjit"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1254,7 +1254,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parity-ui"
|
name = "parity-ui"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-ui-dev 1.4.0",
|
"parity-ui-dev 1.4.0",
|
||||||
"parity-ui-precompiled 1.4.0 (git+https://github.com/ethcore/js-precompiled.git)",
|
"parity-ui-precompiled 1.4.0 (git+https://github.com/ethcore/js-precompiled.git)",
|
||||||
@ -1271,7 +1271,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "parity-ui-precompiled"
|
name = "parity-ui-precompiled"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
source = "git+https://github.com/ethcore/js-precompiled.git#c3e0b5772f508d9261e8b10141edcad2e8212005"
|
source = "git+https://github.com/ethcore/js-precompiled.git#a59b62ecec8773715d1db7e070bbbe5443eb7378"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -88,4 +88,4 @@ name = "parity"
|
|||||||
[profile.release]
|
[profile.release]
|
||||||
debug = false
|
debug = false
|
||||||
lto = false
|
lto = false
|
||||||
|
panic = "abort"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
description = "Base Package for all Parity built-in dapps"
|
description = "Base Package for all Parity built-in dapps"
|
||||||
name = "parity-dapps-glue"
|
name = "parity-dapps-glue"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["Ethcore <admin@ethcore.io"]
|
authors = ["Ethcore <admin@ethcore.io"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
@ -3,7 +3,7 @@ description = "Ethcore Parity UI"
|
|||||||
homepage = "http://ethcore.io"
|
homepage = "http://ethcore.io"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
name = "parity-ui"
|
name = "parity-ui"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
authors = ["Ethcore <admin@ethcore.io>"]
|
authors = ["Ethcore <admin@ethcore.io>"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -3,7 +3,7 @@ description = "Ethcore Database"
|
|||||||
homepage = "http://ethcore.io"
|
homepage = "http://ethcore.io"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
name = "ethcore-db"
|
name = "ethcore-db"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
authors = ["Ethcore <admin@ethcore.io>"]
|
authors = ["Ethcore <admin@ethcore.io>"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ description = "Ethcore development/test/build tools"
|
|||||||
homepage = "http://ethcore.io"
|
homepage = "http://ethcore.io"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
name = "ethcore-devtools"
|
name = "ethcore-devtools"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
authors = ["Ethcore <admin@ethcore.io>"]
|
authors = ["Ethcore <admin@ethcore.io>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ethash"
|
name = "ethash"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
authors = ["arkpar <arkadiy@ethcore.io"]
|
authors = ["arkpar <arkadiy@ethcore.io"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -194,6 +194,11 @@ impl AccountProvider {
|
|||||||
Ok(self.address_book.write().set_meta(account, meta))
|
Ok(self.address_book.write().set_meta(account, meta))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Removes and address from the addressbook
|
||||||
|
pub fn remove_address(&self, addr: Address) -> Result<(), Error> {
|
||||||
|
Ok(self.address_book.write().remove(addr))
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns each account along with name and meta.
|
/// Returns each account along with name and meta.
|
||||||
pub fn accounts_info(&self) -> Result<HashMap<Address, AccountMeta>, Error> {
|
pub fn accounts_info(&self) -> Result<HashMap<Address, AccountMeta>, Error> {
|
||||||
let r: HashMap<Address, AccountMeta> = try!(self.sstore.accounts())
|
let r: HashMap<Address, AccountMeta> = try!(self.sstore.accounts())
|
||||||
|
@ -74,6 +74,12 @@ impl AddressBook {
|
|||||||
}
|
}
|
||||||
self.save();
|
self.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Removes an entry
|
||||||
|
pub fn remove(&mut self, a: Address) {
|
||||||
|
self.cache.remove(&a);
|
||||||
|
self.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Dapps user settings
|
/// Dapps user settings
|
||||||
@ -244,4 +250,22 @@ mod tests {
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_remove_address() {
|
||||||
|
let temp = RandomTempPath::create_dir();
|
||||||
|
let path = temp.as_str().to_owned();
|
||||||
|
let mut b = AddressBook::new(path.clone());
|
||||||
|
|
||||||
|
b.set_name(1.into(), "One".to_owned());
|
||||||
|
b.set_name(2.into(), "Two".to_owned());
|
||||||
|
b.set_name(3.into(), "Three".to_owned());
|
||||||
|
b.remove(2.into());
|
||||||
|
|
||||||
|
let b = AddressBook::new(path);
|
||||||
|
assert_eq!(b.get(), hash_map![
|
||||||
|
1.into() => AccountMeta{name: "One".to_owned(), meta: "{}".to_owned(), uuid: None},
|
||||||
|
3.into() => AccountMeta{name: "Three".to_owned(), meta: "{}".to_owned(), uuid: None}
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "evmjit"
|
name = "evmjit"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
authors = ["debris <marek.kotewicz@gmail.com>"]
|
authors = ["debris <marek.kotewicz@gmail.com>"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ethcore-ipc-codegen"
|
name = "ethcore-ipc-codegen"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
authors = ["Nikolay Volf"]
|
authors = ["Nikolay Volf"]
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
description = "Macros to auto-generate implementations for ipc call"
|
description = "Macros to auto-generate implementations for ipc call"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ethcore-ipc-nano"
|
name = "ethcore-ipc-nano"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
authors = ["Nikolay Volf <nikolay@ethcore.io>"]
|
authors = ["Nikolay Volf <nikolay@ethcore.io>"]
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ethcore-ipc"
|
name = "ethcore-ipc"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
authors = ["Nikolay Volf <nikvolf@gmail.com>"]
|
authors = ["Nikolay Volf <nikvolf@gmail.com>"]
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "parity.js",
|
"name": "parity.js",
|
||||||
"version": "0.2.96",
|
"version": "0.2.99",
|
||||||
"main": "release/index.js",
|
"main": "release/index.js",
|
||||||
"jsnext:main": "src/index.js",
|
"jsnext:main": "src/index.js",
|
||||||
"author": "Parity Team <admin@parity.io>",
|
"author": "Parity Team <admin@parity.io>",
|
||||||
|
@ -34,11 +34,18 @@ git fetch origin 2>$GITLOG
|
|||||||
git checkout -b $BRANCH
|
git checkout -b $BRANCH
|
||||||
|
|
||||||
echo "*** Committing compiled files for $UTCDATE"
|
echo "*** Committing compiled files for $UTCDATE"
|
||||||
|
mv build ../build.new
|
||||||
git add .
|
git add .
|
||||||
git commit -m "$UTCDATE"
|
git commit -m "$UTCDATE [update]"
|
||||||
|
git merge origin/$BRANCH -X ours --commit -m "$UTCDATE [merge]"
|
||||||
|
git rm -r build
|
||||||
|
rm -rf build
|
||||||
|
git commit -m "$UTCDATE [cleanup]"
|
||||||
|
mv ../build.new build
|
||||||
|
git add .
|
||||||
|
git commit -m "$UTCDATE [release]"
|
||||||
|
|
||||||
echo "*** Merging remote"
|
echo "*** Merging remote"
|
||||||
git merge origin/$BRANCH -X ours --commit -m "$UTCDATE [release]"
|
|
||||||
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG
|
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG
|
||||||
PRECOMPILED_HASH=`git rev-parse HEAD`
|
PRECOMPILED_HASH=`git rev-parse HEAD`
|
||||||
|
|
||||||
|
1
js/scripts/test.js
Normal file
1
js/scripts/test.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
// test script 4
|
@ -112,11 +112,15 @@ export function inNumber10 (number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function inNumber16 (number) {
|
export function inNumber16 (number) {
|
||||||
if (isInstanceOf(number, BigNumber)) {
|
const bn = isInstanceOf(number, BigNumber)
|
||||||
return inHex(number.toString(16));
|
? number
|
||||||
|
: (new BigNumber(number || 0));
|
||||||
|
|
||||||
|
if (!bn.isInteger()) {
|
||||||
|
throw new Error(`[format/input::inNumber16] the given number is not an integer: ${bn.toFormat()}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return inHex((new BigNumber(number || 0)).toString(16));
|
return inHex(bn.toString(16));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function inOptions (options) {
|
export function inOptions (options) {
|
||||||
@ -130,6 +134,9 @@ export function inOptions (options) {
|
|||||||
|
|
||||||
case 'gas':
|
case 'gas':
|
||||||
case 'gasPrice':
|
case 'gasPrice':
|
||||||
|
options[key] = inNumber16((new BigNumber(options[key])).round());
|
||||||
|
break;
|
||||||
|
|
||||||
case 'value':
|
case 'value':
|
||||||
case 'nonce':
|
case 'nonce':
|
||||||
options[key] = inNumber16(options[key]);
|
options[key] = inNumber16(options[key]);
|
||||||
|
@ -128,6 +128,11 @@ export default class Parity {
|
|||||||
.execute('parity_killAccount', inAddress(account), password);
|
.execute('parity_killAccount', inAddress(account), password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeAddress (address) {
|
||||||
|
return this._transport
|
||||||
|
.execute('parity_removeAddress', inAddress(address));
|
||||||
|
}
|
||||||
|
|
||||||
listGethAccounts () {
|
listGethAccounts () {
|
||||||
return this._transport
|
return this._transport
|
||||||
.execute('parity_listGethAccounts')
|
.execute('parity_listGethAccounts')
|
||||||
|
@ -68,6 +68,7 @@ export default class Personal {
|
|||||||
this._accountsInfo();
|
this._accountsInfo();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case 'parity_removeAddress':
|
||||||
case 'parity_setAccountName':
|
case 'parity_setAccountName':
|
||||||
case 'parity_setAccountMeta':
|
case 'parity_setAccountMeta':
|
||||||
this._accountsInfo();
|
this._accountsInfo();
|
||||||
|
File diff suppressed because one or more lines are too long
@ -94,7 +94,6 @@ export default class Application extends Component {
|
|||||||
tokenregInstance,
|
tokenregInstance,
|
||||||
accounts: Object
|
accounts: Object
|
||||||
.keys(accountsInfo)
|
.keys(accountsInfo)
|
||||||
.filter((address) => !accountsInfo[address].meta.deleted)
|
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
return (accountsInfo[b].uuid || '').localeCompare(accountsInfo[a].uuid || '');
|
return (accountsInfo[b].uuid || '').localeCompare(accountsInfo[a].uuid || '');
|
||||||
})
|
})
|
||||||
|
@ -24,7 +24,6 @@ export const fetch = () => (dispatch) => {
|
|||||||
.then((accountsInfo) => {
|
.then((accountsInfo) => {
|
||||||
const addresses = Object
|
const addresses = Object
|
||||||
.keys(accountsInfo)
|
.keys(accountsInfo)
|
||||||
.filter((address) => accountsInfo[address] && !accountsInfo[address].meta.deleted)
|
|
||||||
.map((address) => ({
|
.map((address) => ({
|
||||||
...accountsInfo[address],
|
...accountsInfo[address],
|
||||||
address,
|
address,
|
||||||
|
@ -256,6 +256,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
removeAddress: {
|
||||||
|
desc: 'Removes an address from the addressbook',
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
type: Address,
|
||||||
|
desc: 'The address to remove'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
returns: {
|
||||||
|
type: Boolean,
|
||||||
|
desc: 'true on success'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
listGethAccounts: {
|
listGethAccounts: {
|
||||||
desc: 'Returns a list of the accounts available from Geth',
|
desc: 'Returns a list of the accounts available from Geth',
|
||||||
params: [],
|
params: [],
|
||||||
|
@ -102,7 +102,7 @@ export default class AddAddress extends Component {
|
|||||||
if (!addressError) {
|
if (!addressError) {
|
||||||
const contact = contacts[address];
|
const contact = contacts[address];
|
||||||
|
|
||||||
if (contact && !contact.meta.deleted) {
|
if (contact) {
|
||||||
addressError = ERRORS.duplicateAddress;
|
addressError = ERRORS.duplicateAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ export default class AddContract extends Component {
|
|||||||
if (!addressError) {
|
if (!addressError) {
|
||||||
const contract = contracts[address];
|
const contract = contracts[address];
|
||||||
|
|
||||||
if (contract && !contract.meta.deleted) {
|
if (contract) {
|
||||||
addressError = ERRORS.duplicateAddress;
|
addressError = ERRORS.duplicateAddress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,15 +117,17 @@ export default class WalletDetails extends Component {
|
|||||||
onChange={ this.onRequiredChange }
|
onChange={ this.onRequiredChange }
|
||||||
param={ parseAbiType('uint') }
|
param={ parseAbiType('uint') }
|
||||||
min={ 1 }
|
min={ 1 }
|
||||||
|
max={ wallet.owners.length + 1 }
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TypedInput
|
<TypedInput
|
||||||
label='wallet day limit'
|
label='wallet day limit'
|
||||||
hint='number of days to wait for other owners confirmation'
|
hint='amount of ETH spendable without confirmations'
|
||||||
value={ wallet.daylimit }
|
value={ wallet.daylimit }
|
||||||
error={ errors.daylimit }
|
error={ errors.daylimit }
|
||||||
onChange={ this.onDaylimitChange }
|
onChange={ this.onDaylimitChange }
|
||||||
param={ parseAbiType('uint') }
|
param={ parseAbiType('uint') }
|
||||||
|
isEth
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
|
|
||||||
import { CompletedStep, IdentityIcon, CopyToClipboard } from '~/ui';
|
import { CompletedStep, IdentityIcon, CopyToClipboard } from '~/ui';
|
||||||
|
import { fromWei } from '~/api/util/wei';
|
||||||
|
|
||||||
import styles from '../createWallet.css';
|
import styles from '../createWallet.css';
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ export default class WalletInfo extends Component {
|
|||||||
<code>{ required }</code> owners are required to confirm a transaction.
|
<code>{ required }</code> owners are required to confirm a transaction.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The daily limit is set to <code>{ daylimit }</code>.
|
The daily limit is set to <code>{ fromWei(daylimit).toFormat() }</code> ETH.
|
||||||
</p>
|
</p>
|
||||||
</CompletedStep>
|
</CompletedStep>
|
||||||
);
|
);
|
||||||
|
@ -43,7 +43,13 @@ export default class WalletType extends Component {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: 'Multi-Sig wallet', key: 'MULTISIG',
|
label: 'Multi-Sig wallet', key: 'MULTISIG',
|
||||||
description: 'A standard multi-signature Wallet'
|
description: (
|
||||||
|
<span>
|
||||||
|
<span>Create/Deploy a </span>
|
||||||
|
<a href='https://github.com/ethereum/dapp-bin/blob/master/wallet/wallet.sol' target='_blank'>standard multi-signature </a>
|
||||||
|
<span> Wallet</span>
|
||||||
|
</span>
|
||||||
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Watch a wallet', key: 'WATCH',
|
label: 'Watch a wallet', key: 'WATCH',
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import { observable, computed, action, transaction } from 'mobx';
|
import { observable, computed, action, transaction } from 'mobx';
|
||||||
|
|
||||||
import { validateUint, validateAddress, validateName } from '../../util/validation';
|
import { validateUint, validateAddress, validateName } from '~/util/validation';
|
||||||
import { ERROR_CODES } from '~/api/transport/error';
|
import { ERROR_CODES } from '~/api/transport/error';
|
||||||
|
|
||||||
import Contract from '~/api/contract';
|
import Contract from '~/api/contract';
|
||||||
|
@ -23,7 +23,7 @@ import { bytesToHex } from '~/api/util/format';
|
|||||||
import Contract from '~/api/contract';
|
import Contract from '~/api/contract';
|
||||||
import ERRORS from './errors';
|
import ERRORS from './errors';
|
||||||
import { ERROR_CODES } from '~/api/transport/error';
|
import { ERROR_CODES } from '~/api/transport/error';
|
||||||
import { DEFAULT_GAS, DEFAULT_GASPRICE, MAX_GAS_ESTIMATION } from '../../util/constants';
|
import { DEFAULT_GAS, DEFAULT_GASPRICE, MAX_GAS_ESTIMATION } from '~/util/constants';
|
||||||
|
|
||||||
const TITLES = {
|
const TITLES = {
|
||||||
transfer: 'transfer details',
|
transfer: 'transfer details',
|
||||||
@ -116,7 +116,6 @@ export default class TransferStore {
|
|||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
const { account, balance, gasLimit, senders, onClose, newError, sendersBalances } = props;
|
const { account, balance, gasLimit, senders, onClose, newError, sendersBalances } = props;
|
||||||
|
|
||||||
this.account = account;
|
this.account = account;
|
||||||
this.balance = balance;
|
this.balance = balance;
|
||||||
this.gasLimit = gasLimit;
|
this.gasLimit = gasLimit;
|
||||||
@ -412,34 +411,38 @@ export default class TransferStore {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { gas, gasPrice, tag, valueAll, isEth } = this;
|
const { gas, gasPrice, tag, valueAll, isEth, isWallet } = this;
|
||||||
|
|
||||||
const gasTotal = new BigNumber(gasPrice || 0).mul(new BigNumber(gas || 0));
|
const gasTotal = new BigNumber(gasPrice || 0).mul(new BigNumber(gas || 0));
|
||||||
|
|
||||||
const availableEth = new BigNumber(balance.tokens[0].value);
|
const availableEth = new BigNumber(balance.tokens[0].value);
|
||||||
|
|
||||||
const senderBalance = this.balance.tokens.find((b) => tag === b.token.tag);
|
const senderBalance = this.balance.tokens.find((b) => tag === b.token.tag);
|
||||||
const available = new BigNumber(senderBalance.value);
|
|
||||||
const format = new BigNumber(senderBalance.token.format || 1);
|
const format = new BigNumber(senderBalance.token.format || 1);
|
||||||
|
const available = isWallet
|
||||||
|
? this.api.util.fromWei(new BigNumber(senderBalance.value))
|
||||||
|
: (new BigNumber(senderBalance.value)).div(format);
|
||||||
|
|
||||||
let { value, valueError } = this;
|
let { value, valueError } = this;
|
||||||
let totalEth = gasTotal;
|
let totalEth = gasTotal;
|
||||||
let totalError = null;
|
let totalError = null;
|
||||||
|
|
||||||
if (valueAll) {
|
if (valueAll) {
|
||||||
if (isEth) {
|
if (isEth && !isWallet) {
|
||||||
const bn = this.api.util.fromWei(availableEth.minus(gasTotal));
|
const bn = this.api.util.fromWei(availableEth.minus(gasTotal));
|
||||||
value = (bn.lt(0) ? new BigNumber(0.0) : bn).toString();
|
value = (bn.lt(0) ? new BigNumber(0.0) : bn).toString();
|
||||||
|
} else if (isEth) {
|
||||||
|
value = (available.lt(0) ? new BigNumber(0.0) : available).toString();
|
||||||
} else {
|
} else {
|
||||||
value = available.div(format).toString();
|
value = available.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEth) {
|
if (isEth && !isWallet) {
|
||||||
totalEth = totalEth.plus(this.api.util.toWei(value || 0));
|
totalEth = totalEth.plus(this.api.util.toWei(value || 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new BigNumber(value || 0).gt(available.div(format))) {
|
if (new BigNumber(value || 0).gt(available)) {
|
||||||
valueError = ERRORS.largeAmount;
|
valueError = ERRORS.largeAmount;
|
||||||
} else if (valueError === ERRORS.largeAmount) {
|
} else if (valueError === ERRORS.largeAmount) {
|
||||||
valueError = null;
|
valueError = null;
|
||||||
|
@ -139,8 +139,8 @@ class Transfer extends Component {
|
|||||||
? (
|
? (
|
||||||
<div>
|
<div>
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<div>
|
||||||
This transaction needs confirmation from other owners.
|
<p>This transaction needs confirmation from other owners.</p>
|
||||||
<Input
|
<Input
|
||||||
style={ { width: '50%', margin: '0 auto' } }
|
style={ { width: '50%', margin: '0 auto' } }
|
||||||
value={ this.store.operation }
|
value={ this.store.operation }
|
||||||
@ -148,7 +148,7 @@ class Transfer extends Component {
|
|||||||
readOnly
|
readOnly
|
||||||
allowCopy
|
allowCopy
|
||||||
/>
|
/>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
: null
|
: null
|
||||||
@ -298,7 +298,6 @@ function mapStateToProps (initState, initProps) {
|
|||||||
return (state) => {
|
return (state) => {
|
||||||
const { gasLimit } = state.nodeStatus;
|
const { gasLimit } = state.nodeStatus;
|
||||||
const sendersBalances = senders ? pick(state.balances.balances, Object.keys(senders)) : null;
|
const sendersBalances = senders ? pick(state.balances.balances, Object.keys(senders)) : null;
|
||||||
|
|
||||||
return { gasLimit, wallet, senders, sendersBalances };
|
return { gasLimit, wallet, senders, sendersBalances };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
17
js/src/modals/WalletSettings/index.js
Normal file
17
js/src/modals/WalletSettings/index.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
export default from './walletSettings';
|
63
js/src/modals/WalletSettings/walletSettings.css
Normal file
63
js/src/modals/WalletSettings/walletSettings.css
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/* Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
/* This file is part of Parity.
|
||||||
|
/*
|
||||||
|
/* Parity is free software: you can redistribute it and/or modify
|
||||||
|
/* it under the terms of the GNU General Public License as published by
|
||||||
|
/* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
/* (at your option) any later version.
|
||||||
|
/*
|
||||||
|
/* Parity is distributed in the hope that it will be useful,
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
/* GNU General Public License for more details.
|
||||||
|
/*
|
||||||
|
/* You should have received a copy of the GNU General Public License
|
||||||
|
/* along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.splitInput {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
margin: 0 0.25em;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.change {
|
||||||
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
|
padding: 0.75em 1.75em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
|
||||||
|
&.add {
|
||||||
|
background-color: rgba(139, 195, 74, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.remove {
|
||||||
|
background-color: rgba(244, 67, 54, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
margin-left: -1em;
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.eth:after {
|
||||||
|
content: 'ETH';
|
||||||
|
font-size: 0.75em;
|
||||||
|
margin-left: 0.125em;
|
||||||
|
}
|
||||||
|
|
321
js/src/modals/WalletSettings/walletSettings.js
Normal file
321
js/src/modals/WalletSettings/walletSettings.js
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import React, { Component, PropTypes } from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { observer } from 'mobx-react';
|
||||||
|
import { pick } from 'lodash';
|
||||||
|
|
||||||
|
import ActionDone from 'material-ui/svg-icons/action/done';
|
||||||
|
import ContentClear from 'material-ui/svg-icons/content/clear';
|
||||||
|
import NavigationArrowForward from 'material-ui/svg-icons/navigation/arrow-forward';
|
||||||
|
import { parseAbiType } from '~/util/abi';
|
||||||
|
|
||||||
|
import { Button, Modal, TxHash, BusyStep, Form, TypedInput, InputAddress, AddressSelect } from '~/ui';
|
||||||
|
import { fromWei } from '~/api/util/wei';
|
||||||
|
|
||||||
|
import WalletSettingsStore from './walletSettingsStore.js';
|
||||||
|
import styles from './walletSettings.css';
|
||||||
|
|
||||||
|
@observer
|
||||||
|
class WalletSettings extends Component {
|
||||||
|
static contextTypes = {
|
||||||
|
api: PropTypes.object.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
accounts: PropTypes.object.isRequired,
|
||||||
|
wallet: PropTypes.object.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
senders: PropTypes.object.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
store = new WalletSettingsStore(this.context.api, this.props.wallet);
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { stage, steps, waiting, rejected } = this.store;
|
||||||
|
|
||||||
|
if (rejected) {
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
visible
|
||||||
|
title='rejected'
|
||||||
|
actions={ this.renderDialogActions() }
|
||||||
|
>
|
||||||
|
<BusyStep
|
||||||
|
title='The modifications have been rejected'
|
||||||
|
state='The wallet settings will not be modified. You can safely close this window.'
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
visible
|
||||||
|
actions={ this.renderDialogActions() }
|
||||||
|
current={ stage }
|
||||||
|
steps={ steps.map((s) => s.title) }
|
||||||
|
waiting={ waiting }
|
||||||
|
>
|
||||||
|
{ this.renderPage() }
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderPage () {
|
||||||
|
const { step } = this.store;
|
||||||
|
|
||||||
|
switch (step) {
|
||||||
|
case 'SENDING':
|
||||||
|
return (
|
||||||
|
<BusyStep
|
||||||
|
title='The modifications are currently being sent'
|
||||||
|
state={ this.store.deployState }
|
||||||
|
>
|
||||||
|
{
|
||||||
|
this.store.requests.map((req) => {
|
||||||
|
const key = req.id;
|
||||||
|
|
||||||
|
if (req.txhash) {
|
||||||
|
return (<TxHash key={ key } hash={ req.txhash } />);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.rejected) {
|
||||||
|
return (<p key={ key }>The transaction #{parseInt(key, 16)} has been rejected</p>);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</BusyStep>
|
||||||
|
);
|
||||||
|
|
||||||
|
case 'CONFIRMATION':
|
||||||
|
const { changes } = this.store;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>You are about to make the following modifications</p>
|
||||||
|
<div>
|
||||||
|
{ this.renderChanges(changes) }
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
default:
|
||||||
|
case 'EDIT':
|
||||||
|
const { wallet, errors } = this.store;
|
||||||
|
const { accounts, senders } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Form>
|
||||||
|
<p>
|
||||||
|
In order to edit this contract's settings, at
|
||||||
|
least { this.store.initialWallet.require.toNumber() } owners have to
|
||||||
|
send the very same modifications.
|
||||||
|
Otherwise, no modification will be taken into account...
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<AddressSelect
|
||||||
|
label='from account (wallet owner)'
|
||||||
|
hint='send modifications as this owner'
|
||||||
|
value={ wallet.sender }
|
||||||
|
error={ errors.sender }
|
||||||
|
onChange={ this.store.onSenderChange }
|
||||||
|
accounts={ senders }
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TypedInput
|
||||||
|
label='other wallet owners'
|
||||||
|
value={ wallet.owners.slice() }
|
||||||
|
onChange={ this.store.onOwnersChange }
|
||||||
|
accounts={ accounts }
|
||||||
|
param={ parseAbiType('address[]') }
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className={ styles.splitInput }>
|
||||||
|
<TypedInput
|
||||||
|
label='required owners'
|
||||||
|
hint='number of required owners to accept a transaction'
|
||||||
|
value={ wallet.require }
|
||||||
|
error={ errors.require }
|
||||||
|
onChange={ this.store.onRequireChange }
|
||||||
|
param={ parseAbiType('uint') }
|
||||||
|
min={ 1 }
|
||||||
|
max={ wallet.owners.length }
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TypedInput
|
||||||
|
label='wallet day limit'
|
||||||
|
hint='amount of ETH spendable without confirmations'
|
||||||
|
value={ wallet.dailylimit }
|
||||||
|
error={ errors.dailylimit }
|
||||||
|
onChange={ this.store.onDailylimitChange }
|
||||||
|
param={ parseAbiType('uint') }
|
||||||
|
isEth
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderChanges (changes) {
|
||||||
|
return changes.map((change, index) => (
|
||||||
|
<div key={ `${change.type}_${index}` }>
|
||||||
|
{ this.renderChange(change) }
|
||||||
|
</div>
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
renderChange (change) {
|
||||||
|
const { accounts } = this.props;
|
||||||
|
|
||||||
|
switch (change.type) {
|
||||||
|
case 'dailylimit':
|
||||||
|
return (
|
||||||
|
<div className={ styles.change }>
|
||||||
|
<div className={ styles.label }>Change Daily Limit</div>
|
||||||
|
<div>
|
||||||
|
<span> from </span>
|
||||||
|
<code> { fromWei(change.initial).toFormat() }</code>
|
||||||
|
<span className={ styles.eth } />
|
||||||
|
<span> to </span>
|
||||||
|
<code> { fromWei(change.value).toFormat() }</code>
|
||||||
|
<span className={ styles.eth } />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
case 'require':
|
||||||
|
return (
|
||||||
|
<div className={ styles.change }>
|
||||||
|
<div className={ styles.label }>Change Required Owners</div>
|
||||||
|
<div>
|
||||||
|
<span> from </span>
|
||||||
|
<code> { change.initial.toNumber() }</code>
|
||||||
|
<span> to </span>
|
||||||
|
<code> { change.value.toNumber() }</code>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
case 'add_owner':
|
||||||
|
return (
|
||||||
|
<div className={ [ styles.change, styles.add ].join(' ') }>
|
||||||
|
<div className={ styles.label }>Add Owner</div>
|
||||||
|
<div>
|
||||||
|
<InputAddress
|
||||||
|
disabled
|
||||||
|
value={ change.value }
|
||||||
|
accounts={ accounts }
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
case 'remove_owner':
|
||||||
|
return (
|
||||||
|
<div className={ [ styles.change, styles.remove ].join(' ') }>
|
||||||
|
<div className={ styles.label }>Remove Owner</div>
|
||||||
|
<div>
|
||||||
|
<InputAddress
|
||||||
|
disabled
|
||||||
|
value={ change.value }
|
||||||
|
accounts={ accounts }
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDialogActions () {
|
||||||
|
const { onClose } = this.props;
|
||||||
|
const { step, hasErrors, rejected, onNext, send, done } = this.store;
|
||||||
|
|
||||||
|
const cancelBtn = (
|
||||||
|
<Button
|
||||||
|
icon={ <ContentClear /> }
|
||||||
|
label='Cancel'
|
||||||
|
onClick={ onClose }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
const closeBtn = (
|
||||||
|
<Button
|
||||||
|
icon={ <ContentClear /> }
|
||||||
|
label='Close'
|
||||||
|
onClick={ onClose }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
const sendingBtn = (
|
||||||
|
<Button
|
||||||
|
icon={ <ActionDone /> }
|
||||||
|
label='Sending...'
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
const nextBtn = (
|
||||||
|
<Button
|
||||||
|
icon={ <NavigationArrowForward /> }
|
||||||
|
label='Next'
|
||||||
|
onClick={ onNext }
|
||||||
|
disabled={ hasErrors }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
const sendBtn = (
|
||||||
|
<Button
|
||||||
|
icon={ <NavigationArrowForward /> }
|
||||||
|
label='Send'
|
||||||
|
onClick={ send }
|
||||||
|
disabled={ hasErrors }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (rejected) {
|
||||||
|
return [ closeBtn ];
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (step) {
|
||||||
|
case 'SENDING':
|
||||||
|
return done ? [ closeBtn ] : [ closeBtn, sendingBtn ];
|
||||||
|
|
||||||
|
case 'CONFIRMATION':
|
||||||
|
return [ cancelBtn, sendBtn ];
|
||||||
|
|
||||||
|
default:
|
||||||
|
case 'TYPE':
|
||||||
|
return [ cancelBtn, nextBtn ];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function mapStateToProps (initState, initProps) {
|
||||||
|
const { accountsInfo, accounts } = initState.personal;
|
||||||
|
const { owners } = initProps.wallet;
|
||||||
|
|
||||||
|
const senders = pick(accounts, owners);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
return { accounts: accountsInfo, senders };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(mapStateToProps)(WalletSettings);
|
306
js/src/modals/WalletSettings/walletSettingsStore.js
Normal file
306
js/src/modals/WalletSettings/walletSettingsStore.js
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import { observable, computed, action, transaction } from 'mobx';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
|
||||||
|
import { validateUint, validateAddress } from '~/util/validation';
|
||||||
|
import { DEFAULT_GAS, MAX_GAS_ESTIMATION } from '~/util/constants';
|
||||||
|
import { ERROR_CODES } from '~/api/transport/error';
|
||||||
|
|
||||||
|
const STEPS = {
|
||||||
|
EDIT: { title: 'wallet settings' },
|
||||||
|
CONFIRMATION: { title: 'confirmation' },
|
||||||
|
SENDING: { title: 'sending transaction', waiting: true }
|
||||||
|
};
|
||||||
|
|
||||||
|
export default class WalletSettingsStore {
|
||||||
|
@observable step = null;
|
||||||
|
@observable requests = [];
|
||||||
|
@observable deployState = '';
|
||||||
|
@observable done = false;
|
||||||
|
|
||||||
|
@observable wallet = {
|
||||||
|
owners: null,
|
||||||
|
require: null,
|
||||||
|
dailylimit: null,
|
||||||
|
sender: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
@observable errors = {
|
||||||
|
owners: null,
|
||||||
|
require: null,
|
||||||
|
dailylimit: null,
|
||||||
|
sender: null
|
||||||
|
};
|
||||||
|
|
||||||
|
@computed get stage () {
|
||||||
|
return this.stepsKeys.findIndex((k) => k === this.step);
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed get hasErrors () {
|
||||||
|
return !!Object.keys(this.errors).find((key) => !!this.errors[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed get stepsKeys () {
|
||||||
|
return this.steps.map((s) => s.key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed get steps () {
|
||||||
|
return Object
|
||||||
|
.keys(STEPS)
|
||||||
|
.map((key) => {
|
||||||
|
return {
|
||||||
|
...STEPS[key],
|
||||||
|
key
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed get waiting () {
|
||||||
|
this.steps
|
||||||
|
.map((s, idx) => ({ idx, waiting: s.waiting }))
|
||||||
|
.filter((s) => s.waiting)
|
||||||
|
.map((s) => s.idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
get changes () {
|
||||||
|
const changes = [];
|
||||||
|
|
||||||
|
const prevDailylimit = new BigNumber(this.initialWallet.dailylimit);
|
||||||
|
const nextDailylimit = new BigNumber(this.wallet.dailylimit);
|
||||||
|
|
||||||
|
const prevRequire = new BigNumber(this.initialWallet.require);
|
||||||
|
const nextRequire = new BigNumber(this.wallet.require);
|
||||||
|
|
||||||
|
if (!prevDailylimit.equals(nextDailylimit)) {
|
||||||
|
changes.push({
|
||||||
|
type: 'dailylimit',
|
||||||
|
initial: prevDailylimit,
|
||||||
|
value: nextDailylimit
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prevRequire.equals(nextRequire)) {
|
||||||
|
changes.push({
|
||||||
|
type: 'require',
|
||||||
|
initial: prevRequire,
|
||||||
|
value: nextRequire
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const prevOwners = this.initialWallet.owners;
|
||||||
|
const nextOwners = this.wallet.owners;
|
||||||
|
|
||||||
|
const ownersToRemove = prevOwners.filter((owner) => !nextOwners.includes(owner));
|
||||||
|
const ownersToAdd = nextOwners.filter((owner) => !prevOwners.includes(owner));
|
||||||
|
|
||||||
|
ownersToRemove.forEach((owner) => {
|
||||||
|
changes.push({
|
||||||
|
type: 'remove_owner',
|
||||||
|
value: owner
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
ownersToAdd.forEach((owner) => {
|
||||||
|
changes.push({
|
||||||
|
type: 'add_owner',
|
||||||
|
value: owner
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return changes;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor (api, wallet) {
|
||||||
|
this.api = api;
|
||||||
|
this.step = this.stepsKeys[0];
|
||||||
|
|
||||||
|
this.walletInstance = wallet.instance;
|
||||||
|
|
||||||
|
this.initialWallet = {
|
||||||
|
address: wallet.address,
|
||||||
|
owners: wallet.owners,
|
||||||
|
require: wallet.require,
|
||||||
|
dailylimit: wallet.dailylimit.limit
|
||||||
|
};
|
||||||
|
|
||||||
|
transaction(() => {
|
||||||
|
this.wallet.owners = wallet.owners;
|
||||||
|
this.wallet.require = wallet.require;
|
||||||
|
this.wallet.dailylimit = wallet.dailylimit.limit;
|
||||||
|
|
||||||
|
this.validateWallet(this.wallet);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@action onNext = () => {
|
||||||
|
const stepIndex = this.stepsKeys.findIndex((k) => k === this.step) + 1;
|
||||||
|
this.step = this.stepsKeys[stepIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
@action onChange = (_wallet) => {
|
||||||
|
const newWallet = Object.assign({}, this.wallet, _wallet);
|
||||||
|
this.validateWallet(newWallet);
|
||||||
|
}
|
||||||
|
|
||||||
|
@action onOwnersChange = (owners) => {
|
||||||
|
this.onChange({ owners });
|
||||||
|
}
|
||||||
|
|
||||||
|
@action onRequireChange = (require) => {
|
||||||
|
this.onChange({ require });
|
||||||
|
}
|
||||||
|
|
||||||
|
@action onSenderChange = (_, sender) => {
|
||||||
|
this.onChange({ sender });
|
||||||
|
}
|
||||||
|
|
||||||
|
@action onDailylimitChange = (dailylimit) => {
|
||||||
|
this.onChange({ dailylimit });
|
||||||
|
}
|
||||||
|
|
||||||
|
@action send = () => {
|
||||||
|
const changes = this.changes;
|
||||||
|
const walletInstance = this.walletInstance;
|
||||||
|
this.step = 'SENDING';
|
||||||
|
|
||||||
|
this.onTransactionsState('postTransaction');
|
||||||
|
Promise
|
||||||
|
.all(changes.map((change) => this.sendChange(change, walletInstance)))
|
||||||
|
.then((requestIds) => {
|
||||||
|
this.onTransactionsState('checkRequest');
|
||||||
|
this.requests = requestIds.map((id) => ({ id, rejected: false, txhash: null }));
|
||||||
|
|
||||||
|
return Promise
|
||||||
|
.all(requestIds.map((id) => {
|
||||||
|
return this.api
|
||||||
|
.pollMethod('parity_checkRequest', id)
|
||||||
|
.then((txhash) => {
|
||||||
|
const index = this.requests.findIndex((r) => r.id === id);
|
||||||
|
this.requests[index].txhash = txhash;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
if (e.code === ERROR_CODES.REQUEST_REJECTED) {
|
||||||
|
const index = this.requests.findIndex((r) => r.id === id);
|
||||||
|
this.requests[index].rejected = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.done = true;
|
||||||
|
this.onTransactionsState('completed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@action sendChange = (change, walletInstance) => {
|
||||||
|
const { method, values } = this.getChangeMethod(change, walletInstance);
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
from: this.wallet.sender,
|
||||||
|
to: this.initialWallet.address,
|
||||||
|
gas: MAX_GAS_ESTIMATION
|
||||||
|
};
|
||||||
|
|
||||||
|
return method
|
||||||
|
.estimateGas(options, values)
|
||||||
|
.then((gasEst) => {
|
||||||
|
let gas = gasEst;
|
||||||
|
|
||||||
|
if (gas.gt(DEFAULT_GAS)) {
|
||||||
|
gas = gas.mul(1.2);
|
||||||
|
}
|
||||||
|
options.gas = gas;
|
||||||
|
|
||||||
|
return method.postTransaction(options, values);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getChangeMethod = (change, walletInstance) => {
|
||||||
|
if (change.type === 'require') {
|
||||||
|
return {
|
||||||
|
method: walletInstance.changeRequirement,
|
||||||
|
values: [ change.value ]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (change.type === 'dailylimit') {
|
||||||
|
return {
|
||||||
|
method: walletInstance.setDailyLimit,
|
||||||
|
values: [ change.value ]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (change.type === 'add_owner') {
|
||||||
|
return {
|
||||||
|
method: walletInstance.addOwner,
|
||||||
|
values: [ change.value ]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (change.type === 'remove_owner') {
|
||||||
|
return {
|
||||||
|
method: walletInstance.removeOwner,
|
||||||
|
values: [ change.value ]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@action onTransactionsState = (state) => {
|
||||||
|
switch (state) {
|
||||||
|
case 'estimateGas':
|
||||||
|
case 'postTransaction':
|
||||||
|
this.deployState = 'Preparing transaction for network transmission';
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 'checkRequest':
|
||||||
|
this.deployState = 'Waiting for confirmation of the transaction in the Parity Secure Signer';
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 'completed':
|
||||||
|
this.deployState = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@action validateWallet = (_wallet) => {
|
||||||
|
const senderValidation = validateAddress(_wallet.sender);
|
||||||
|
const requireValidation = validateUint(_wallet.require);
|
||||||
|
const dailylimitValidation = validateUint(_wallet.dailylimit);
|
||||||
|
|
||||||
|
const errors = {
|
||||||
|
sender: senderValidation.addressError,
|
||||||
|
require: requireValidation.valueError,
|
||||||
|
dailylimit: dailylimitValidation.valueError
|
||||||
|
};
|
||||||
|
|
||||||
|
const wallet = {
|
||||||
|
..._wallet,
|
||||||
|
sender: senderValidation.address,
|
||||||
|
require: requireValidation.value,
|
||||||
|
dailylimit: dailylimitValidation.value
|
||||||
|
};
|
||||||
|
|
||||||
|
transaction(() => {
|
||||||
|
this.wallet = wallet;
|
||||||
|
this.errors = errors;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -29,6 +29,7 @@ import Transfer from './Transfer';
|
|||||||
import PasswordManager from './PasswordManager';
|
import PasswordManager from './PasswordManager';
|
||||||
import SaveContract from './SaveContract';
|
import SaveContract from './SaveContract';
|
||||||
import LoadContract from './LoadContract';
|
import LoadContract from './LoadContract';
|
||||||
|
import WalletSettings from './WalletSettings';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AddAddress,
|
AddAddress,
|
||||||
@ -45,5 +46,6 @@ export {
|
|||||||
Transfer,
|
Transfer,
|
||||||
PasswordManager,
|
PasswordManager,
|
||||||
LoadContract,
|
LoadContract,
|
||||||
SaveContract
|
SaveContract,
|
||||||
|
WalletSettings
|
||||||
};
|
};
|
||||||
|
@ -23,6 +23,7 @@ export default class Personal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start () {
|
start () {
|
||||||
|
this._removeDeleted();
|
||||||
this._subscribeAccountsInfo();
|
this._subscribeAccountsInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,4 +41,29 @@ export default class Personal {
|
|||||||
console.log('personal._subscribeAccountsInfo', 'subscriptionId', subscriptionId);
|
console.log('personal._subscribeAccountsInfo', 'subscriptionId', subscriptionId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_removeDeleted () {
|
||||||
|
this._api.parity
|
||||||
|
.accountsInfo()
|
||||||
|
.then((accountsInfo) => {
|
||||||
|
return Promise.all(
|
||||||
|
Object
|
||||||
|
.keys(accountsInfo)
|
||||||
|
.filter((address) => {
|
||||||
|
const account = accountsInfo[address];
|
||||||
|
|
||||||
|
return !account.uuid && account.meta.deleted;
|
||||||
|
})
|
||||||
|
.map((address) => this._api.parity.removeAddress(address))
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.then((results) => {
|
||||||
|
if (results.length) {
|
||||||
|
console.log(`Removed ${results.length} previously marked addresses`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.warn('removeDeleted', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ export function personalAccountsInfo (accountsInfo) {
|
|||||||
|
|
||||||
Object.keys(accountsInfo || {})
|
Object.keys(accountsInfo || {})
|
||||||
.map((address) => Object.assign({}, accountsInfo[address], { address }))
|
.map((address) => Object.assign({}, accountsInfo[address], { address }))
|
||||||
.filter((account) => !account.meta.deleted)
|
.filter((account) => account.uuid || !account.meta.deleted)
|
||||||
.forEach((account) => {
|
.forEach((account) => {
|
||||||
if (account.uuid) {
|
if (account.uuid) {
|
||||||
accounts[account.address] = account;
|
accounts[account.address] = account;
|
||||||
|
@ -228,7 +228,7 @@ function fetchWalletInfo (contract, update, getState) {
|
|||||||
const owners = ownersUpdate && ownersUpdate.value || null;
|
const owners = ownersUpdate && ownersUpdate.value || null;
|
||||||
const transactions = transactionsUpdate && transactionsUpdate.value || null;
|
const transactions = transactionsUpdate && transactionsUpdate.value || null;
|
||||||
|
|
||||||
return fetchWalletConfirmations(contract, owners, transactions, getState)
|
return fetchWalletConfirmations(contract, update[UPDATE_CONFIRMATIONS], owners, transactions, getState)
|
||||||
.then((update) => {
|
.then((update) => {
|
||||||
updates.push(update);
|
updates.push(update);
|
||||||
return updates;
|
return updates;
|
||||||
@ -292,17 +292,37 @@ function fetchWalletDailylimit (contract) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchWalletConfirmations (contract, _owners = null, _transactions = null, getState) {
|
function fetchWalletConfirmations (contract, _operations, _owners = null, _transactions = null, getState) {
|
||||||
const walletInstance = contract.instance;
|
const walletInstance = contract.instance;
|
||||||
|
|
||||||
const wallet = getState().wallet.wallets[contract.address];
|
const wallet = getState().wallet.wallets[contract.address];
|
||||||
|
|
||||||
const owners = _owners || (wallet && wallet.owners) || null;
|
const owners = _owners || (wallet && wallet.owners) || null;
|
||||||
const transactions = _transactions || (wallet && wallet.transactions) || null;
|
const transactions = _transactions || (wallet && wallet.transactions) || null;
|
||||||
|
// Full load if no operations given, or if the one given aren't loaded yet
|
||||||
|
const fullLoad = !Array.isArray(_operations) || _operations
|
||||||
|
.filter((op) => !wallet.confirmations.find((conf) => conf.operation === op))
|
||||||
|
.length > 0;
|
||||||
|
|
||||||
return walletInstance
|
let promise;
|
||||||
|
|
||||||
|
if (fullLoad) {
|
||||||
|
promise = walletInstance
|
||||||
.ConfirmationNeeded
|
.ConfirmationNeeded
|
||||||
.getAllLogs()
|
.getAllLogs()
|
||||||
|
.then((logs) => {
|
||||||
|
return logs.map((log) => ({
|
||||||
|
initiator: log.params.initiator.value,
|
||||||
|
to: log.params.to.value,
|
||||||
|
data: log.params.data.value,
|
||||||
|
value: log.params.value.value,
|
||||||
|
operation: bytesToHex(log.params.operation.value),
|
||||||
|
transactionIndex: log.transactionIndex,
|
||||||
|
transactionHash: log.transactionHash,
|
||||||
|
blockNumber: log.blockNumber,
|
||||||
|
confirmedBy: []
|
||||||
|
}));
|
||||||
|
})
|
||||||
.then((logs) => {
|
.then((logs) => {
|
||||||
return logs.sort((logA, logB) => {
|
return logs.sort((logA, logB) => {
|
||||||
const comp = logA.blockNumber.comparedTo(logB.blockNumber);
|
const comp = logA.blockNumber.comparedTo(logB.blockNumber);
|
||||||
@ -314,23 +334,13 @@ function fetchWalletConfirmations (contract, _owners = null, _transactions = nul
|
|||||||
return logA.transactionIndex.comparedTo(logB.transactionIndex);
|
return logA.transactionIndex.comparedTo(logB.transactionIndex);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then((logs) => {
|
|
||||||
return logs.map((log) => ({
|
|
||||||
initiator: log.params.initiator.value,
|
|
||||||
to: log.params.to.value,
|
|
||||||
data: log.params.data.value,
|
|
||||||
value: log.params.value.value,
|
|
||||||
operation: bytesToHex(log.params.operation.value),
|
|
||||||
transactionHash: log.transactionHash,
|
|
||||||
blockNumber: log.blockNumber,
|
|
||||||
confirmedBy: []
|
|
||||||
}));
|
|
||||||
})
|
|
||||||
.then((confirmations) => {
|
.then((confirmations) => {
|
||||||
if (confirmations.length === 0) {
|
if (confirmations.length === 0) {
|
||||||
return confirmations;
|
return confirmations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only fetch confirmations for operations not
|
||||||
|
// yet confirmed (ie. not yet a transaction)
|
||||||
if (transactions) {
|
if (transactions) {
|
||||||
const operations = transactions
|
const operations = transactions
|
||||||
.filter((t) => t.operation)
|
.filter((t) => t.operation)
|
||||||
@ -342,27 +352,53 @@ function fetchWalletConfirmations (contract, _owners = null, _transactions = nul
|
|||||||
}
|
}
|
||||||
|
|
||||||
return confirmations;
|
return confirmations;
|
||||||
})
|
});
|
||||||
|
} else {
|
||||||
|
const { confirmations } = wallet;
|
||||||
|
const nextConfirmations = confirmations
|
||||||
|
.filter((conf) => _operations.includes(conf.operation));
|
||||||
|
|
||||||
|
promise = Promise.resolve(nextConfirmations);
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise
|
||||||
.then((confirmations) => {
|
.then((confirmations) => {
|
||||||
if (confirmations.length === 0) {
|
if (confirmations.length === 0) {
|
||||||
return confirmations;
|
return confirmations;
|
||||||
}
|
}
|
||||||
|
|
||||||
const operations = confirmations.map((conf) => conf.operation);
|
const uniqConfirmations = Object.values(
|
||||||
|
confirmations.reduce((confirmations, confirmation) => {
|
||||||
|
confirmations[confirmation.operation] = confirmation;
|
||||||
|
return confirmations;
|
||||||
|
}, {})
|
||||||
|
);
|
||||||
|
|
||||||
|
const operations = uniqConfirmations.map((conf) => conf.operation);
|
||||||
|
|
||||||
return Promise
|
return Promise
|
||||||
.all(operations.map((op) => fetchOperationConfirmations(contract, op, owners)))
|
.all(operations.map((op) => fetchOperationConfirmations(contract, op, owners)))
|
||||||
.then((confirmedBys) => {
|
.then((confirmedBys) => {
|
||||||
confirmations.forEach((_, index) => {
|
uniqConfirmations.forEach((_, index) => {
|
||||||
confirmations[index].confirmedBy = confirmedBys[index];
|
uniqConfirmations[index].confirmedBy = confirmedBys[index];
|
||||||
});
|
});
|
||||||
|
|
||||||
return confirmations;
|
return uniqConfirmations;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then((confirmations) => {
|
.then((confirmations) => {
|
||||||
|
const prevConfirmations = wallet.confirmations || [];
|
||||||
|
const nextConfirmations = prevConfirmations
|
||||||
|
.filter((conA) => !confirmations.find((conB) => conB.operation === conA.operation))
|
||||||
|
.concat(confirmations)
|
||||||
|
.map((conf) => ({
|
||||||
|
...conf,
|
||||||
|
pending: false
|
||||||
|
}));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
key: UPDATE_CONFIRMATIONS,
|
key: UPDATE_CONFIRMATIONS,
|
||||||
value: confirmations
|
value: nextConfirmations
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -417,7 +453,10 @@ function parseLogs (logs) {
|
|||||||
logs.forEach((log) => {
|
logs.forEach((log) => {
|
||||||
const { address, topics } = log;
|
const { address, topics } = log;
|
||||||
const eventSignature = toHex(topics[0]);
|
const eventSignature = toHex(topics[0]);
|
||||||
const prev = updates[address] || { address };
|
const prev = updates[address] || {
|
||||||
|
[ UPDATE_DAILYLIMIT ]: true,
|
||||||
|
address
|
||||||
|
};
|
||||||
|
|
||||||
switch (eventSignature) {
|
switch (eventSignature) {
|
||||||
case signatures.OwnerChanged:
|
case signatures.OwnerChanged:
|
||||||
@ -436,16 +475,18 @@ function parseLogs (logs) {
|
|||||||
};
|
};
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case signatures.ConfirmationNeeded:
|
||||||
case signatures.Confirmation:
|
case signatures.Confirmation:
|
||||||
case signatures.Revoke:
|
case signatures.Revoke:
|
||||||
const operation = log.params.operation.value;
|
const operation = bytesToHex(log.params.operation.value);
|
||||||
|
|
||||||
updates[address] = {
|
updates[address] = {
|
||||||
...prev,
|
...prev,
|
||||||
[ UPDATE_CONFIRMATIONS ]: uniq(
|
[ UPDATE_CONFIRMATIONS ]: uniq(
|
||||||
(prev.operations || []).concat(operation)
|
(prev[UPDATE_CONFIRMATIONS] || []).concat(operation)
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case signatures.Deposit:
|
case signatures.Deposit:
|
||||||
@ -456,17 +497,6 @@ function parseLogs (logs) {
|
|||||||
[ UPDATE_TRANSACTIONS ]: true
|
[ UPDATE_TRANSACTIONS ]: true
|
||||||
};
|
};
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case signatures.ConfirmationNeeded:
|
|
||||||
const op = log.params.operation.value;
|
|
||||||
|
|
||||||
updates[address] = {
|
|
||||||
...prev,
|
|
||||||
[ UPDATE_CONFIRMATIONS ]: uniq(
|
|
||||||
(prev.operations || []).concat(op)
|
|
||||||
)
|
|
||||||
};
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,5 +20,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.data {
|
.data {
|
||||||
|
flex: 1;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,13 @@ class CopyToClipboard extends Component {
|
|||||||
|
|
||||||
onCopy = () => {
|
onCopy = () => {
|
||||||
const { data, onCopy, cooldown, showSnackbar } = this.props;
|
const { data, onCopy, cooldown, showSnackbar } = this.props;
|
||||||
const message = (<div>copied <code className={ styles.data }>{ data }</code> to clipboard</div>);
|
const message = (
|
||||||
|
<div className={ styles.container }>
|
||||||
|
<span>copied </span>
|
||||||
|
<code className={ styles.data }> { data } </code>
|
||||||
|
<span> to clipboard</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
copied: true,
|
copied: true,
|
||||||
|
@ -170,7 +170,7 @@ export default class AddressSelect extends Component {
|
|||||||
handleFilter = (searchText, name, item) => {
|
handleFilter = (searchText, name, item) => {
|
||||||
const { address } = item;
|
const { address } = item;
|
||||||
const entry = this.state.entries[address];
|
const entry = this.state.entries[address];
|
||||||
const lowCaseSearch = searchText.toLowerCase();
|
const lowCaseSearch = (searchText || '').toLowerCase();
|
||||||
|
|
||||||
return [entry.name, entry.address]
|
return [entry.name, entry.address]
|
||||||
.some(text => text.toLowerCase().indexOf(lowCaseSearch) !== -1);
|
.some(text => text.toLowerCase().indexOf(lowCaseSearch) !== -1);
|
||||||
|
@ -53,7 +53,6 @@ class InputAddress extends Component {
|
|||||||
const { small, allowCopy, hideUnderline, onSubmit, accountsInfo, tokens } = this.props;
|
const { small, allowCopy, hideUnderline, onSubmit, accountsInfo, tokens } = this.props;
|
||||||
|
|
||||||
const account = accountsInfo[value] || tokens[value];
|
const account = accountsInfo[value] || tokens[value];
|
||||||
const hasAccount = account && !(account.meta && account.meta.deleted);
|
|
||||||
|
|
||||||
const icon = this.renderIcon();
|
const icon = this.renderIcon();
|
||||||
|
|
||||||
@ -74,7 +73,7 @@ class InputAddress extends Component {
|
|||||||
label={ label }
|
label={ label }
|
||||||
hint={ hint }
|
hint={ hint }
|
||||||
error={ error }
|
error={ error }
|
||||||
value={ text && hasAccount ? account.name : value }
|
value={ text && account ? account.name : value }
|
||||||
onChange={ this.handleInputChange }
|
onChange={ this.handleInputChange }
|
||||||
onSubmit={ onSubmit }
|
onSubmit={ onSubmit }
|
||||||
allowCopy={ allowCopy && (disabled ? value : false) }
|
allowCopy={ allowCopy && (disabled ? value : false) }
|
||||||
|
@ -29,3 +29,30 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ethInput {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: flex-end;
|
||||||
|
|
||||||
|
.input {
|
||||||
|
flex: 1;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.label {
|
||||||
|
position: absolute;
|
||||||
|
right: 1.5em;
|
||||||
|
bottom: 1em;
|
||||||
|
font-size: 0.85em;
|
||||||
|
margin-left: 0.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle {
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -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/>.
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { MenuItem } from 'material-ui';
|
import { MenuItem, Toggle } from 'material-ui';
|
||||||
import { range } from 'lodash';
|
import { range } from 'lodash';
|
||||||
|
|
||||||
import IconButton from 'material-ui/IconButton';
|
import IconButton from 'material-ui/IconButton';
|
||||||
@ -26,7 +26,8 @@ import Input from '~/ui/Form/Input';
|
|||||||
import InputAddressSelect from '~/ui/Form/InputAddressSelect';
|
import InputAddressSelect from '~/ui/Form/InputAddressSelect';
|
||||||
import Select from '~/ui/Form/Select';
|
import Select from '~/ui/Form/Select';
|
||||||
|
|
||||||
import { ABI_TYPES } from '../../../util/abi';
|
import { ABI_TYPES } from '~/util/abi';
|
||||||
|
import { fromWei, toWei } from '~/api/util/wei';
|
||||||
|
|
||||||
import styles from './typedInput.css';
|
import styles from './typedInput.css';
|
||||||
|
|
||||||
@ -42,16 +43,29 @@ export default class TypedInput extends Component {
|
|||||||
label: PropTypes.string,
|
label: PropTypes.string,
|
||||||
hint: PropTypes.string,
|
hint: PropTypes.string,
|
||||||
min: PropTypes.number,
|
min: PropTypes.number,
|
||||||
max: PropTypes.number
|
max: PropTypes.number,
|
||||||
|
isEth: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
min: null,
|
min: null,
|
||||||
max: null
|
max: null,
|
||||||
|
isEth: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
state = {
|
||||||
|
isEth: true,
|
||||||
|
ethValue: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount () {
|
||||||
|
if (this.props.isEth && this.props.value) {
|
||||||
|
this.setState({ ethValue: fromWei(this.props.value) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { param } = this.props;
|
const { param, isEth } = this.props;
|
||||||
const { type } = param;
|
const { type } = param;
|
||||||
|
|
||||||
if (type === ABI_TYPES.ARRAY) {
|
if (type === ABI_TYPES.ARRAY) {
|
||||||
@ -87,6 +101,10 @@ export default class TypedInput extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isEth) {
|
||||||
|
return this.renderEth();
|
||||||
|
}
|
||||||
|
|
||||||
return this.renderType(type);
|
return this.renderType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,16 +175,43 @@ export default class TypedInput extends Component {
|
|||||||
return this.renderDefault();
|
return this.renderDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
renderNumber () {
|
renderEth () {
|
||||||
const { label, value, error, param, hint, min, max } = this.props;
|
const { ethValue } = this.state;
|
||||||
|
|
||||||
|
const value = ethValue && typeof ethValue.toNumber === 'function'
|
||||||
|
? ethValue.toNumber()
|
||||||
|
: ethValue;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={ styles.ethInput }>
|
||||||
|
<div className={ styles.input }>
|
||||||
|
{ this.renderNumber(value, this.onEthValueChange) }
|
||||||
|
{ this.state.isEth ? (<div className={ styles.label }>ETH</div>) : null }
|
||||||
|
</div>
|
||||||
|
<div className={ styles.toggle }>
|
||||||
|
<Toggle
|
||||||
|
toggled={ this.state.isEth }
|
||||||
|
onToggle={ this.onEthTypeChange }
|
||||||
|
style={ { width: 46 } }
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNumber (value = this.props.value, onChange = this.onChange) {
|
||||||
|
const { label, error, param, hint, min, max } = this.props;
|
||||||
|
const realValue = value && typeof value.toNumber === 'function'
|
||||||
|
? value.toNumber()
|
||||||
|
: value;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
label={ label }
|
label={ label }
|
||||||
hint={ hint }
|
hint={ hint }
|
||||||
value={ value }
|
value={ realValue }
|
||||||
error={ error }
|
error={ error }
|
||||||
onChange={ this.onChange }
|
onChange={ onChange }
|
||||||
type='number'
|
type='number'
|
||||||
min={ min !== null ? min : (param.signed ? null : 0) }
|
min={ min !== null ? min : (param.signed ? null : 0) }
|
||||||
max={ max !== null ? max : null }
|
max={ max !== null ? max : null }
|
||||||
@ -236,6 +281,28 @@ export default class TypedInput extends Component {
|
|||||||
this.props.onChange(value === 'true');
|
this.props.onChange(value === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onEthTypeChange = () => {
|
||||||
|
const { isEth, ethValue } = this.state;
|
||||||
|
|
||||||
|
if (ethValue === '' || ethValue === undefined) {
|
||||||
|
return this.setState({ isEth: !isEth });
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = isEth ? toWei(ethValue) : fromWei(ethValue);
|
||||||
|
this.setState({ isEth: !isEth, ethValue: value }, () => {
|
||||||
|
this.onEthValueChange(null, value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onEthValueChange = (event, value) => {
|
||||||
|
const realValue = this.state.isEth && value !== '' && value !== undefined
|
||||||
|
? toWei(value)
|
||||||
|
: value;
|
||||||
|
|
||||||
|
this.setState({ ethValue: value });
|
||||||
|
this.props.onChange(realValue);
|
||||||
|
}
|
||||||
|
|
||||||
onChange = (event, value) => {
|
onChange = (event, value) => {
|
||||||
this.props.onChange(value);
|
this.props.onChange(value);
|
||||||
}
|
}
|
||||||
|
@ -37,17 +37,16 @@ class IdentityName extends Component {
|
|||||||
render () {
|
render () {
|
||||||
const { address, accountsInfo, tokens, empty, name, shorten, unknown, className } = this.props;
|
const { address, accountsInfo, tokens, empty, name, shorten, unknown, className } = this.props;
|
||||||
const account = accountsInfo[address] || tokens[address];
|
const account = accountsInfo[address] || tokens[address];
|
||||||
const hasAccount = account && (!account.meta || !account.meta.deleted);
|
|
||||||
|
|
||||||
if (!hasAccount && empty) {
|
if (!account && empty) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const addressFallback = shorten ? (<ShortenedHash data={ address } />) : address;
|
const addressFallback = shorten ? (<ShortenedHash data={ address } />) : address;
|
||||||
const fallback = unknown ? defaultName : addressFallback;
|
const fallback = unknown ? defaultName : addressFallback;
|
||||||
const isUuid = hasAccount && account.name === account.uuid;
|
const isUuid = account && account.name === account.uuid;
|
||||||
const displayName = (name && name.toUpperCase().trim()) ||
|
const displayName = (name && name.toUpperCase().trim()) ||
|
||||||
(hasAccount && !isUuid
|
(account && !isUuid
|
||||||
? account.name.toUpperCase().trim()
|
? account.name.toUpperCase().trim()
|
||||||
: fallback);
|
: fallback);
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ export function validateUint (value) {
|
|||||||
const bn = new BigNumber(value);
|
const bn = new BigNumber(value);
|
||||||
if (bn.lt(0)) {
|
if (bn.lt(0)) {
|
||||||
valueError = ERRORS.negativeNumber;
|
valueError = ERRORS.negativeNumber;
|
||||||
} else if (bn.toString().indexOf('.') !== -1) {
|
} else if (!bn.isInteger()) {
|
||||||
valueError = ERRORS.decimalNumber;
|
valueError = ERRORS.decimalNumber;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -24,6 +24,7 @@ import styles from './list.css';
|
|||||||
export default class List extends Component {
|
export default class List extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
accounts: PropTypes.object,
|
accounts: PropTypes.object,
|
||||||
|
walletsOwners: PropTypes.object,
|
||||||
balances: PropTypes.object,
|
balances: PropTypes.object,
|
||||||
link: PropTypes.string,
|
link: PropTypes.string,
|
||||||
search: PropTypes.array,
|
search: PropTypes.array,
|
||||||
@ -42,7 +43,7 @@ export default class List extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderAccounts () {
|
renderAccounts () {
|
||||||
const { accounts, balances, link, empty, handleAddSearchToken } = this.props;
|
const { accounts, balances, link, empty, handleAddSearchToken, walletsOwners } = this.props;
|
||||||
|
|
||||||
if (empty) {
|
if (empty) {
|
||||||
return (
|
return (
|
||||||
@ -60,6 +61,8 @@ export default class List extends Component {
|
|||||||
const account = accounts[address] || {};
|
const account = accounts[address] || {};
|
||||||
const balance = balances[address] || {};
|
const balance = balances[address] || {};
|
||||||
|
|
||||||
|
const owners = walletsOwners && walletsOwners[address] || null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={ styles.item }
|
className={ styles.item }
|
||||||
@ -68,6 +71,7 @@ export default class List extends Component {
|
|||||||
link={ link }
|
link={ link }
|
||||||
account={ account }
|
account={ account }
|
||||||
balance={ balance }
|
balance={ balance }
|
||||||
|
owners={ owners }
|
||||||
handleAddSearchToken={ handleAddSearchToken } />
|
handleAddSearchToken={ handleAddSearchToken } />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -17,8 +17,12 @@
|
|||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
|
import ReactTooltip from 'react-tooltip';
|
||||||
|
|
||||||
import { Balance, Container, ContainerTitle, IdentityIcon, IdentityName, Tags, Input } from '~/ui';
|
import { Balance, Container, ContainerTitle, IdentityIcon, IdentityName, Tags, Input } from '~/ui';
|
||||||
|
import { nullableProptype } from '~/util/proptypes';
|
||||||
|
|
||||||
|
import styles from '../accounts.css';
|
||||||
|
|
||||||
export default class Summary extends Component {
|
export default class Summary extends Component {
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
@ -31,7 +35,8 @@ export default class Summary extends Component {
|
|||||||
link: PropTypes.string,
|
link: PropTypes.string,
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
noLink: PropTypes.bool,
|
noLink: PropTypes.bool,
|
||||||
handleAddSearchToken: PropTypes.func
|
handleAddSearchToken: PropTypes.func,
|
||||||
|
owners: nullableProptype(PropTypes.array)
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
@ -100,11 +105,41 @@ export default class Summary extends Component {
|
|||||||
title={ this.renderLink() }
|
title={ this.renderLink() }
|
||||||
byline={ addressComponent } />
|
byline={ addressComponent } />
|
||||||
|
|
||||||
|
{ this.renderOwners() }
|
||||||
{ this.renderBalance() }
|
{ this.renderBalance() }
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderOwners () {
|
||||||
|
const { owners } = this.props;
|
||||||
|
|
||||||
|
if (!owners || owners.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={ styles.owners }>
|
||||||
|
{
|
||||||
|
owners.map((owner) => (
|
||||||
|
<div key={ owner.address }>
|
||||||
|
<div
|
||||||
|
data-tip
|
||||||
|
data-for={ `owner_${owner.address}` }
|
||||||
|
data-effect='solid'
|
||||||
|
>
|
||||||
|
<IdentityIcon address={ owner.address } button />
|
||||||
|
</div>
|
||||||
|
<ReactTooltip id={ `owner_${owner.address}` }>
|
||||||
|
<strong>{ owner.name } </strong><small> (owner)</small>
|
||||||
|
</ReactTooltip>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
renderLink () {
|
renderLink () {
|
||||||
const { link, noLink, account, name } = this.props;
|
const { link, noLink, account, name } = this.props;
|
||||||
|
|
||||||
|
@ -22,6 +22,12 @@
|
|||||||
left: 7em;
|
left: 7em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.owners {
|
||||||
|
margin-top: 1em;
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: -0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
.toolbar {
|
.toolbar {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ class Accounts extends Component {
|
|||||||
accounts: PropTypes.object.isRequired,
|
accounts: PropTypes.object.isRequired,
|
||||||
hasAccounts: PropTypes.bool.isRequired,
|
hasAccounts: PropTypes.bool.isRequired,
|
||||||
wallets: PropTypes.object.isRequired,
|
wallets: PropTypes.object.isRequired,
|
||||||
|
walletsOwners: PropTypes.object.isRequired,
|
||||||
hasWallets: PropTypes.bool.isRequired,
|
hasWallets: PropTypes.bool.isRequired,
|
||||||
|
|
||||||
balances: PropTypes.object
|
balances: PropTypes.object
|
||||||
@ -137,9 +138,13 @@ class Accounts extends Component {
|
|||||||
return this.renderLoading(this.props.wallets);
|
return this.renderLoading(this.props.wallets);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { wallets, hasWallets, balances } = this.props;
|
const { wallets, hasWallets, balances, walletsOwners } = this.props;
|
||||||
const { searchValues, sortOrder } = this.state;
|
const { searchValues, sortOrder } = this.state;
|
||||||
|
|
||||||
|
if (!wallets || Object.keys(wallets).length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
link='wallet'
|
link='wallet'
|
||||||
@ -149,6 +154,7 @@ class Accounts extends Component {
|
|||||||
empty={ !hasWallets }
|
empty={ !hasWallets }
|
||||||
order={ sortOrder }
|
order={ sortOrder }
|
||||||
handleAddSearchToken={ this.onAddSearchToken }
|
handleAddSearchToken={ this.onAddSearchToken }
|
||||||
|
walletsOwners={ walletsOwners }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -281,13 +287,29 @@ class Accounts extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
const { accounts, hasAccounts, wallets, hasWallets } = state.personal;
|
const { accounts, hasAccounts, wallets, hasWallets, accountsInfo } = state.personal;
|
||||||
const { balances } = state.balances;
|
const { balances } = state.balances;
|
||||||
|
const walletsInfo = state.wallet.wallets;
|
||||||
|
|
||||||
|
const walletsOwners = Object
|
||||||
|
.keys(walletsInfo)
|
||||||
|
.map((wallet) => ({
|
||||||
|
owners: walletsInfo[wallet].owners.map((owner) => ({
|
||||||
|
address: owner,
|
||||||
|
name: accountsInfo[owner] && accountsInfo[owner].name || owner
|
||||||
|
})),
|
||||||
|
address: wallet
|
||||||
|
}))
|
||||||
|
.reduce((walletsOwners, wallet) => {
|
||||||
|
walletsOwners[wallet.address] = wallet.owners;
|
||||||
|
return walletsOwners;
|
||||||
|
}, {});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
accounts,
|
accounts,
|
||||||
hasAccounts,
|
hasAccounts,
|
||||||
wallets,
|
wallets,
|
||||||
|
walletsOwners,
|
||||||
hasWallets,
|
hasWallets,
|
||||||
balances
|
balances
|
||||||
};
|
};
|
||||||
|
@ -80,10 +80,8 @@ class Delete extends Component {
|
|||||||
const { api, router } = this.context;
|
const { api, router } = this.context;
|
||||||
const { account, route, newError } = this.props;
|
const { account, route, newError } = this.props;
|
||||||
|
|
||||||
account.meta.deleted = true;
|
|
||||||
|
|
||||||
api.parity
|
api.parity
|
||||||
.setAccountMeta(account.address, account.meta)
|
.removeAddress(account.address)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
router.push(route);
|
router.push(route);
|
||||||
this.closeDeleteDialog();
|
this.closeDeleteDialog();
|
||||||
|
@ -121,7 +121,7 @@ class Address extends Component {
|
|||||||
return (
|
return (
|
||||||
<Actionbar
|
<Actionbar
|
||||||
title='Address Information'
|
title='Address Information'
|
||||||
buttons={ !contact || contact.meta.deleted ? [] : buttons } />
|
buttons={ !contact ? [] : buttons } />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class Contract extends Component {
|
|||||||
return (
|
return (
|
||||||
<Actionbar
|
<Actionbar
|
||||||
title='Contract Information'
|
title='Contract Information'
|
||||||
buttons={ !account || account.meta.deleted ? [] : buttons } />
|
buttons={ !account ? [] : buttons } />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,12 +60,14 @@ class WalletConfirmations extends Component {
|
|||||||
}
|
}
|
||||||
renderConfirmations () {
|
renderConfirmations () {
|
||||||
const { confirmations, ...others } = this.props;
|
const { confirmations, ...others } = this.props;
|
||||||
|
const realConfirmations = confirmations && confirmations
|
||||||
|
.filter((conf) => conf.confirmedBy.length > 0);
|
||||||
|
|
||||||
if (!confirmations) {
|
if (!realConfirmations) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (confirmations.length === 0) {
|
if (realConfirmations.length === 0) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>No transactions needs confirmation right now.</p>
|
<p>No transactions needs confirmation right now.</p>
|
||||||
@ -73,7 +75,8 @@ class WalletConfirmations extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return confirmations.map((confirmation) => (
|
return realConfirmations
|
||||||
|
.map((confirmation) => (
|
||||||
<WalletConfirmation
|
<WalletConfirmation
|
||||||
key={ confirmation.operation }
|
key={ confirmation.operation }
|
||||||
confirmation={ confirmation }
|
confirmation={ confirmation }
|
||||||
@ -320,6 +323,7 @@ class WalletConfirmation extends Component {
|
|||||||
const { address, isTest } = this.props;
|
const { address, isTest } = this.props;
|
||||||
const { operation, transactionHash, blockNumber, value, to, data } = confirmation;
|
const { operation, transactionHash, blockNumber, value, to, data } = confirmation;
|
||||||
|
|
||||||
|
if (value && to && data) {
|
||||||
return (
|
return (
|
||||||
<TxRow
|
<TxRow
|
||||||
className={ className }
|
className={ className }
|
||||||
@ -339,6 +343,18 @@ class WalletConfirmation extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<tr
|
||||||
|
key={ operation }
|
||||||
|
className={ className }
|
||||||
|
>
|
||||||
|
<td colSpan={ 5 }>
|
||||||
|
<code>{ operation }</code>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
renderConfirmedBy (confirmation, className) {
|
renderConfirmedBy (confirmation, className) {
|
||||||
const { operation, confirmedBy } = confirmation;
|
const { operation, confirmedBy } = confirmation;
|
||||||
|
|
||||||
|
@ -22,9 +22,10 @@ import moment from 'moment';
|
|||||||
import ContentCreate from 'material-ui/svg-icons/content/create';
|
import ContentCreate from 'material-ui/svg-icons/content/create';
|
||||||
import ActionDelete from 'material-ui/svg-icons/action/delete';
|
import ActionDelete from 'material-ui/svg-icons/action/delete';
|
||||||
import ContentSend from 'material-ui/svg-icons/content/send';
|
import ContentSend from 'material-ui/svg-icons/content/send';
|
||||||
|
import SettingsIcon from 'material-ui/svg-icons/action/settings';
|
||||||
|
|
||||||
import { nullableProptype } from '~/util/proptypes';
|
import { nullableProptype } from '~/util/proptypes';
|
||||||
import { EditMeta, Transfer } from '~/modals';
|
import { EditMeta, Transfer, WalletSettings } from '~/modals';
|
||||||
import { Actionbar, Button, Page, Loading } from '~/ui';
|
import { Actionbar, Button, Page, Loading } from '~/ui';
|
||||||
|
|
||||||
import Delete from '../Address/Delete';
|
import Delete from '../Address/Delete';
|
||||||
@ -74,6 +75,7 @@ class Wallet extends Component {
|
|||||||
|
|
||||||
state = {
|
state = {
|
||||||
showEditDialog: false,
|
showEditDialog: false,
|
||||||
|
showSettingsDialog: false,
|
||||||
showTransferDialog: false,
|
showTransferDialog: false,
|
||||||
showDeleteDialog: false
|
showDeleteDialog: false
|
||||||
};
|
};
|
||||||
@ -115,6 +117,7 @@ class Wallet extends Component {
|
|||||||
return (
|
return (
|
||||||
<div className={ styles.wallet }>
|
<div className={ styles.wallet }>
|
||||||
{ this.renderEditDialog(wallet) }
|
{ this.renderEditDialog(wallet) }
|
||||||
|
{ this.renderSettingsDialog() }
|
||||||
{ this.renderTransferDialog() }
|
{ this.renderTransferDialog() }
|
||||||
{ this.renderDeleteDialog(wallet) }
|
{ this.renderDeleteDialog(wallet) }
|
||||||
{ this.renderActionbar() }
|
{ this.renderActionbar() }
|
||||||
@ -212,13 +215,18 @@ class Wallet extends Component {
|
|||||||
<Button
|
<Button
|
||||||
key='delete'
|
key='delete'
|
||||||
icon={ <ActionDelete /> }
|
icon={ <ActionDelete /> }
|
||||||
label='delete wallet'
|
label='delete'
|
||||||
onClick={ this.showDeleteDialog } />,
|
onClick={ this.showDeleteDialog } />,
|
||||||
<Button
|
<Button
|
||||||
key='editmeta'
|
key='editmeta'
|
||||||
icon={ <ContentCreate /> }
|
icon={ <ContentCreate /> }
|
||||||
label='edit'
|
label='edit'
|
||||||
onClick={ this.onEditClick } />
|
onClick={ this.onEditClick } />,
|
||||||
|
<Button
|
||||||
|
key='settings'
|
||||||
|
icon={ <SettingsIcon /> }
|
||||||
|
label='settings'
|
||||||
|
onClick={ this.onSettingsClick } />
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -250,11 +258,27 @@ class Wallet extends Component {
|
|||||||
return (
|
return (
|
||||||
<EditMeta
|
<EditMeta
|
||||||
account={ wallet }
|
account={ wallet }
|
||||||
keys={ ['description', 'passwordHint'] }
|
keys={ ['description'] }
|
||||||
onClose={ this.onEditClick } />
|
onClose={ this.onEditClick } />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderSettingsDialog () {
|
||||||
|
const { wallet } = this.props;
|
||||||
|
const { showSettingsDialog } = this.state;
|
||||||
|
|
||||||
|
if (!showSettingsDialog) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<WalletSettings
|
||||||
|
wallet={ wallet }
|
||||||
|
onClose={ this.onSettingsClick }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
renderTransferDialog () {
|
renderTransferDialog () {
|
||||||
const { showTransferDialog } = this.state;
|
const { showTransferDialog } = this.state;
|
||||||
|
|
||||||
@ -281,6 +305,12 @@ class Wallet extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSettingsClick = () => {
|
||||||
|
this.setState({
|
||||||
|
showSettingsDialog: !this.state.showSettingsDialog
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onTransferClick = () => {
|
onTransferClick = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showTransferDialog: !this.state.showTransferDialog
|
showTransferDialog: !this.state.showTransferDialog
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
description = "Rpc test client."
|
description = "Rpc test client."
|
||||||
name = "rpctest"
|
name = "rpctest"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["Ethcore <admin@ethcore.io>"]
|
authors = ["Ethcore <admin@ethcore.io>"]
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ impl<C: 'static> ParityAccounts for ParityAccountsClient<C> where C: MiningBlock
|
|||||||
let info = try!(store.accounts_info().map_err(|e| errors::account("Could not fetch account info.", e)));
|
let info = try!(store.accounts_info().map_err(|e| errors::account("Could not fetch account info.", e)));
|
||||||
let other = store.addresses_info().expect("addresses_info always returns Ok; qed");
|
let other = store.addresses_info().expect("addresses_info always returns Ok; qed");
|
||||||
|
|
||||||
Ok(info.into_iter().chain(other.into_iter()).map(|(a, v)| {
|
Ok(other.into_iter().chain(info.into_iter()).map(|(a, v)| {
|
||||||
let m = map![
|
let m = map![
|
||||||
"name".to_owned() => to_value(&v.name),
|
"name".to_owned() => to_value(&v.name),
|
||||||
"meta".to_owned() => to_value(&v.meta),
|
"meta".to_owned() => to_value(&v.meta),
|
||||||
@ -126,6 +126,16 @@ impl<C: 'static> ParityAccounts for ParityAccountsClient<C> where C: MiningBlock
|
|||||||
.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> {
|
||||||
|
try!(self.active());
|
||||||
|
let store = take_weak!(self.accounts);
|
||||||
|
let addr: Address = addr.into();
|
||||||
|
|
||||||
|
store.remove_address(addr)
|
||||||
|
.expect("remove_address always returns Ok; qed");
|
||||||
|
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, Error> {
|
||||||
try!(self.active());
|
try!(self.active());
|
||||||
let store = take_weak!(self.accounts);
|
let store = take_weak!(self.accounts);
|
||||||
|
@ -152,3 +152,32 @@ fn should_be_able_to_kill_account() {
|
|||||||
let accounts = tester.accounts.accounts().unwrap();
|
let accounts = tester.accounts.accounts().unwrap();
|
||||||
assert_eq!(accounts.len(), 0);
|
assert_eq!(accounts.len(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_be_able_to_remove_address() {
|
||||||
|
let tester = setup();
|
||||||
|
|
||||||
|
// add an address
|
||||||
|
let request = r#"{"jsonrpc": "2.0", "method": "parity_setAccountName", "params": ["0x000baba1000baba2000baba3000baba4000baba5", "Test"], "id": 1}"#;
|
||||||
|
let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#;
|
||||||
|
let res = tester.io.handle_request_sync(&request);
|
||||||
|
assert_eq!(res, Some(response.into()));
|
||||||
|
|
||||||
|
// verify it exists
|
||||||
|
let request = r#"{"jsonrpc": "2.0", "method": "parity_accountsInfo", "params": [], "id": 2}"#;
|
||||||
|
let res = tester.io.handle_request_sync(request);
|
||||||
|
let response = r#"{"jsonrpc":"2.0","result":{"0x000baba1000baba2000baba3000baba4000baba5":{"meta":"{}","name":"Test","uuid":null}},"id":2}"#;
|
||||||
|
assert_eq!(res, Some(response.into()));
|
||||||
|
|
||||||
|
// remove the address
|
||||||
|
let request = r#"{"jsonrpc": "2.0", "method": "parity_removeAddress", "params": ["0x000baba1000baba2000baba3000baba4000baba5"], "id": 3}"#;
|
||||||
|
let response = r#"{"jsonrpc":"2.0","result":true,"id":3}"#;
|
||||||
|
let res = tester.io.handle_request_sync(&request);
|
||||||
|
assert_eq!(res, Some(response.into()));
|
||||||
|
|
||||||
|
// verify empty
|
||||||
|
let request = r#"{"jsonrpc": "2.0", "method": "parity_accountsInfo", "params": [], "id": 4}"#;
|
||||||
|
let res = tester.io.handle_request_sync(request);
|
||||||
|
let response = r#"{"jsonrpc":"2.0","result":{},"id":4}"#;
|
||||||
|
assert_eq!(res, Some(response.into()));
|
||||||
|
}
|
||||||
|
@ -58,6 +58,11 @@ build_rpc_trait! {
|
|||||||
#[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, Error>;
|
||||||
|
|
||||||
|
/// Permanently deletes an address from the addressbook
|
||||||
|
/// Arguments: `address`
|
||||||
|
#[rpc(name = "parity_removeAddress")]
|
||||||
|
fn remove_address(&self, H160) -> Result<bool, Error>;
|
||||||
|
|
||||||
/// 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, Error>;
|
||||||
@ -83,4 +88,3 @@ build_rpc_trait! {
|
|||||||
fn geth_accounts(&self) -> Result<Vec<H160>, Error>;
|
fn geth_accounts(&self) -> Result<Vec<H160>, Error>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
description = "Ethcore stratum lib"
|
description = "Ethcore stratum lib"
|
||||||
name = "ethcore-stratum"
|
name = "ethcore-stratum"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["Ethcore <admin@ethcore.io>"]
|
authors = ["Ethcore <admin@ethcore.io>"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
Loading…
Reference in New Issue
Block a user