From 7dc7a673f0669d064ca651ca1997ef58c0a5092b Mon Sep 17 00:00:00 2001 From: debris Date: Sat, 18 Nov 2017 22:14:57 +0000 Subject: [PATCH 01/22] updated eth-secp256k1 --- Cargo.lock | 22 +++++++++++----------- logger/Cargo.toml | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 044bf2b03..4de28eeb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,7 +38,7 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.3.23" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -430,11 +430,11 @@ dependencies = [ [[package]] name = "eth-secp256k1" -version = "0.5.6" -source = "git+https://github.com/paritytech/rust-secp256k1#b6b67055edc929057e97d64f036c78ad91f58a7f" +version = "0.5.7" +source = "git+https://github.com/paritytech/rust-secp256k1#6370d63adf4e8c91e2eae9225eef4b4e0294c5d0" dependencies = [ - "arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -620,7 +620,7 @@ name = "ethcore-logger" version = "1.9.0" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -725,7 +725,7 @@ dependencies = [ "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)", + "eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)", "ethcore-bigint 0.2.1", "ethcore-bytes 0.1.0", "ethcore-logger 1.9.0", @@ -755,7 +755,7 @@ dependencies = [ name = "ethcrypto" version = "0.1.0" dependencies = [ - "eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)", + "eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)", "ethcore-bigint 0.2.1", "ethkey 0.2.0", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", @@ -780,7 +780,7 @@ name = "ethkey" version = "0.2.0" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)", + "eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)", "ethcore-bigint 0.2.1", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3514,7 +3514,7 @@ dependencies = [ "checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" "checksum app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7d1c0d48a81bbb13043847f957971f4d87c81542d80ece5e84ba3cba4058fd4" -"checksum arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "699e63a93b79d717e8c3b5eb1b28b7780d0d6d9e59a72eb769291c83b0c8dc67" +"checksum arrayvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1c0250693b17316353df525fb088da32a8c18f84eb65d113dde31f5a76ed17b6" "checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0" "checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159" "checksum backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "99f2ce94e22b8e664d95c57fff45b98a966c2252b60691d0b7aeeccd88d70983" @@ -3559,7 +3559,7 @@ dependencies = [ "checksum elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "258ff6a9a94f648d0379dbd79110e057edbb53eb85cc237e33eadf8e5a30df85" "checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" -"checksum eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)" = "" +"checksum eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)" = "" "checksum ethabi 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c819a3adef0413a2519cbd9a19a35dd1c20c7a0110705beaba8aa4aa87eda95f" "checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa" "checksum flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423" diff --git a/logger/Cargo.toml b/logger/Cargo.toml index b3424ada1..a0ed9fbdc 100644 --- a/logger/Cargo.toml +++ b/logger/Cargo.toml @@ -13,5 +13,5 @@ lazy_static = "0.2" regex = "0.2" time = "0.1" parking_lot = "0.4" -arrayvec = "0.3" +arrayvec = "0.4" ansi_term = "0.9" From 4f5d73c945d6209f911bfa01f9cf128505da6426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 20 Nov 2017 11:02:48 +0100 Subject: [PATCH 02/22] Fix no-default-features. --- parity/dapps.rs | 4 +--- test.sh | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/parity/dapps.rs b/parity/dapps.rs index c15b16337..d658f91d3 100644 --- a/parity/dapps.rs +++ b/parity/dapps.rs @@ -194,9 +194,7 @@ mod server { pub struct Middleware; impl RequestMiddleware for Middleware { - fn on_request( - &self, _req: &hyper::server::Request, _control: &hyper::Control - ) -> RequestMiddlewareAction { + fn on_request(&self, _req: hyper::Request) -> RequestMiddlewareAction { unreachable!() } } diff --git a/test.sh b/test.sh index 1613530cb..69204fef2 100755 --- a/test.sh +++ b/test.sh @@ -24,6 +24,10 @@ esac set -e +# Validate chainspecs ./scripts/validate_chainspecs.sh cargo test -j 8 $OPTIONS --features "$FEATURES" --all --exclude evmjit $1 + +# Validate --no-default-features build +cargo check --no-default-features From 3d0616c1ae790ab2fc42394c0729d54a4f0ba68f Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Wed, 15 Nov 2017 12:49:07 +0300 Subject: [PATCH 03/22] Parse payload from panic Impl payload empty str is none Update tests Clean Update wasm-tests --- ethcore/res/wasm-tests | 2 +- ethcore/wasm/src/lib.rs | 1 + ethcore/wasm/src/panic_payload.rs | 169 ++++++++++++++++++++++++++++++ ethcore/wasm/src/runtime.rs | 31 ++++-- ethcore/wasm/src/tests.rs | 40 +++---- 5 files changed, 214 insertions(+), 29 deletions(-) create mode 100644 ethcore/wasm/src/panic_payload.rs diff --git a/ethcore/res/wasm-tests b/ethcore/res/wasm-tests index 9a1fcbf0d..d4920761f 160000 --- a/ethcore/res/wasm-tests +++ b/ethcore/res/wasm-tests @@ -1 +1 @@ -Subproject commit 9a1fcbf0d4e73bea437577e807bc38c7ba243d80 +Subproject commit d4920761f959a785c3ec15cf2848fc75795eb2d4 diff --git a/ethcore/wasm/src/lib.rs b/ethcore/wasm/src/lib.rs index 70601144d..30ce03665 100644 --- a/ethcore/wasm/src/lib.rs +++ b/ethcore/wasm/src/lib.rs @@ -31,6 +31,7 @@ mod result; #[cfg(test)] mod tests; mod env; +mod panic_payload; const DEFAULT_STACK_SPACE: u32 = 5 * 1024 * 1024; diff --git a/ethcore/wasm/src/panic_payload.rs b/ethcore/wasm/src/panic_payload.rs new file mode 100644 index 000000000..e79c13a24 --- /dev/null +++ b/ethcore/wasm/src/panic_payload.rs @@ -0,0 +1,169 @@ +// Copyright 2015-2017 Parity Technologies (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 . + +use byteorder::{LittleEndian, ReadBytesExt}; +use std::io; +use std::io::Read; + +#[derive(Debug, PartialEq, Eq)] +pub struct PanicPayload { + pub msg: Option, + pub file: Option, + pub line: Option, + pub col: Option, +} + +fn read_string(rdr: &mut io::Cursor<&[u8]>) -> io::Result> { + let string_len = rdr.read_u32::()?; + let string = if string_len == 0 { + None + } else { + let mut content = vec![0; string_len as usize]; + rdr.read_exact(&mut content)?; + Some(String::from_utf8_lossy(&content).into_owned()) + }; + Ok(string) +} + +pub fn decode(raw: &[u8]) -> PanicPayload { + let mut rdr = io::Cursor::new(raw); + let msg = read_string(&mut rdr).ok().and_then(|x| x); + let file = read_string(&mut rdr).ok().and_then(|x| x); + let line = rdr.read_u32::().ok(); + let col = rdr.read_u32::().ok(); + PanicPayload { + msg: msg, + file: file, + line: line, + col: col, + } +} + +#[cfg(test)] +mod tests { + use super::*; + use byteorder::WriteBytesExt; + + fn write_u32(payload: &mut Vec, val: u32) { + payload.write_u32::(val).unwrap(); + } + + fn write_bytes(payload: &mut Vec, bytes: &[u8]) { + write_u32(payload, bytes.len() as u32); + payload.extend(bytes); + } + + #[test] + fn it_works() { + let mut raw = Vec::new(); + write_bytes(&mut raw, b"msg"); + write_bytes(&mut raw, b"file"); + write_u32(&mut raw, 1); + write_u32(&mut raw, 2); + + let payload = decode(&raw); + + assert_eq!( + payload, + PanicPayload { + msg: Some("msg".to_string()), + file: Some("file".to_string()), + line: Some(1), + col: Some(2), + } + ); + } + + #[test] + fn only_msg() { + let mut raw = Vec::new(); + write_bytes(&mut raw, b"msg"); + + let payload = decode(&raw); + + assert_eq!( + payload, + PanicPayload { + msg: Some("msg".to_string()), + file: None, + line: None, + col: None, + } + ); + } + + #[test] + fn invalid_utf8() { + let mut raw = Vec::new(); + write_bytes(&mut raw, b"\xF0\x90\x80msg"); + write_bytes(&mut raw, b"file"); + write_u32(&mut raw, 1); + write_u32(&mut raw, 2); + + let payload = decode(&raw); + + assert_eq!( + payload, + PanicPayload { + msg: Some("�msg".to_string()), + file: Some("file".to_string()), + line: Some(1), + col: Some(2), + } + ); + } + + #[test] + fn trailing_data() { + let mut raw = Vec::new(); + write_bytes(&mut raw, b"msg"); + write_bytes(&mut raw, b"file"); + write_u32(&mut raw, 1); + write_u32(&mut raw, 2); + write_u32(&mut raw, 0xdeadbeef); + + let payload = decode(&raw); + + assert_eq!( + payload, + PanicPayload { + msg: Some("msg".to_string()), + file: Some("file".to_string()), + line: Some(1), + col: Some(2), + } + ); + } + + #[test] + fn empty_str_is_none() { + let mut raw = Vec::new(); + write_bytes(&mut raw, b"msg"); + write_bytes(&mut raw, b""); + + let payload = decode(&raw); + + assert_eq!( + payload, + PanicPayload { + msg: Some("msg".to_string()), + file: None, + line: None, + col: None, + } + ); + } +} diff --git a/ethcore/wasm/src/runtime.rs b/ethcore/wasm/src/runtime.rs index e5a6dc910..3dfaffad0 100644 --- a/ethcore/wasm/src/runtime.rs +++ b/ethcore/wasm/src/runtime.rs @@ -21,6 +21,7 @@ use std::sync::Arc; use byteorder::{LittleEndian, ByteOrder}; use vm; +use panic_payload; use parity_wasm::interpreter; use wasm_utils::rules; use bigint::prelude::U256; @@ -626,16 +627,30 @@ impl<'a, 'b> Runtime<'a, 'b> { fn user_panic(&mut self, context: InterpreterCallerContext) -> Result, InterpreterError> { - let msg_len = context.value_stack.pop_as::()? as u32; - let msg_ptr = context.value_stack.pop_as::()? as u32; + let payload_len = context.value_stack.pop_as::()? as u32; + let payload_ptr = context.value_stack.pop_as::()? as u32; - let msg = String::from_utf8(self.memory.get(msg_ptr, msg_len as usize)?) - .map_err(|_| UserTrap::BadUtf8)?; + let raw_payload = self.memory.get(payload_ptr, payload_len as usize)?; + let payload = panic_payload::decode(&raw_payload); + let msg = format!( + "{msg}, {file}:{line}:{col}", + msg = payload + .msg + .as_ref() + .map(String::as_ref) + .unwrap_or(""), + file = payload + .file + .as_ref() + .map(String::as_ref) + .unwrap_or(""), + line = payload.line.unwrap_or(0), + col = payload.col.unwrap_or(0) + ); + trace!(target: "wasm", "Contract custom panic message: {}", msg); - trace!(target: "wasm", "Contract custom panic message: {}", msg); - - Err(UserTrap::Panic(msg).into()) - } + Err(UserTrap::Panic(msg).into()) + } fn block_hash(&mut self, context: InterpreterCallerContext) -> Result, InterpreterError> diff --git a/ethcore/wasm/src/tests.rs b/ethcore/wasm/src/tests.rs index 0a93be11c..9f8b7ddec 100644 --- a/ethcore/wasm/src/tests.rs +++ b/ethcore/wasm/src/tests.rs @@ -180,7 +180,7 @@ fn dispersion() { result, vec![0u8, 0, 125, 11, 197, 7, 255, 8, 19, 0] ); - assert_eq!(gas_left, U256::from(99_469)); + assert_eq!(gas_left, U256::from(96_961)); } #[test] @@ -208,7 +208,7 @@ fn suicide_not() { result, vec![0u8] ); - assert_eq!(gas_left, U256::from(99_724)); + assert_eq!(gas_left, U256::from(97_290)); } #[test] @@ -240,7 +240,7 @@ fn suicide() { }; assert!(ext.suicides.contains(&refund)); - assert_eq!(gas_left, U256::from(99_663)); + assert_eq!(gas_left, U256::from(97_249)); } #[test] @@ -312,7 +312,7 @@ fn call_code() { assert!(ext.calls.contains( &FakeCall { call_type: FakeCallType::Call, - gas: U256::from(98_709), + gas: U256::from(98_713), sender_address: Some(sender), receive_address: Some(receiver), value: None, @@ -324,7 +324,7 @@ fn call_code() { // siphash result let res = LittleEndian::read_u32(&result[..]); assert_eq!(res, 4198595614); - assert_eq!(gas_left, U256::from(93_851)); + assert_eq!(gas_left, U256::from(93_855)); } #[test] @@ -357,7 +357,7 @@ fn call_static() { assert!(ext.calls.contains( &FakeCall { call_type: FakeCallType::Call, - gas: U256::from(98_709), + gas: U256::from(98_713), sender_address: Some(sender), receive_address: Some(receiver), value: None, @@ -370,7 +370,7 @@ fn call_static() { let res = LittleEndian::read_u32(&result[..]); assert_eq!(res, 317632590); - assert_eq!(gas_left, U256::from(93_851)); + assert_eq!(gas_left, U256::from(93_855)); } // Realloc test @@ -393,7 +393,7 @@ fn realloc() { } }; assert_eq!(result, vec![0u8; 2]); - assert_eq!(gas_left, U256::from(99_787)); + assert_eq!(gas_left, U256::from(97_278)); } // Tests that contract's ability to read from a storage @@ -419,7 +419,7 @@ fn storage_read() { }; assert_eq!(Address::from(&result[12..32]), address); - assert_eq!(gas_left, U256::from(99_702)); + assert_eq!(gas_left, U256::from(99_706)); } // Tests keccak calculation @@ -445,7 +445,7 @@ fn keccak() { }; assert_eq!(H256::from_slice(&result), H256::from("68371d7e884c168ae2022c82bd837d51837718a7f7dfb7aa3f753074a35e1d87")); - assert_eq!(gas_left, U256::from(84_520)); + assert_eq!(gas_left, U256::from(82_009)); } // memcpy test. @@ -477,7 +477,7 @@ fn memcpy() { }; assert_eq!(result, test_payload); - assert_eq!(gas_left, U256::from(75_324)); + assert_eq!(gas_left, U256::from(72_773)); } // memmove test. @@ -509,7 +509,7 @@ fn memmove() { }; assert_eq!(result, test_payload); - assert_eq!(gas_left, U256::from(75_324)); + assert_eq!(gas_left, U256::from(72_773)); } // memset test @@ -534,7 +534,7 @@ fn memset() { }; assert_eq!(result, vec![228u8; 8192]); - assert_eq!(gas_left, U256::from(75_324)); + assert_eq!(gas_left, U256::from(72_763)); } macro_rules! reqrep_test { @@ -591,7 +591,7 @@ fn math_add() { U256::from_dec_str("1888888888888888888888888888887").unwrap(), (&result[..]).into() ); - assert_eq!(gas_left, U256::from(98_576)); + assert_eq!(gas_left, U256::from(96_084)); } // multiplication @@ -613,7 +613,7 @@ fn math_mul() { U256::from_dec_str("888888888888888888888888888887111111111111111111111111111112").unwrap(), (&result[..]).into() ); - assert_eq!(gas_left, U256::from(97_726)); + assert_eq!(gas_left, U256::from(95_234)); } // subtraction @@ -635,7 +635,7 @@ fn math_sub() { U256::from_dec_str("111111111111111111111111111111").unwrap(), (&result[..]).into() ); - assert_eq!(gas_left, U256::from(98_568)); + assert_eq!(gas_left, U256::from(96_076)); } // subtraction with overflow @@ -677,7 +677,7 @@ fn math_div() { U256::from_dec_str("1125000").unwrap(), (&result[..]).into() ); - assert_eq!(gas_left, U256::from(91_564)); + assert_eq!(gas_left, U256::from(89_074)); } // This test checks the ability of wasm contract to invoke @@ -765,7 +765,7 @@ fn externs() { "Gas limit requested and returned does not match" ); - assert_eq!(gas_left, U256::from(97_740)); + assert_eq!(gas_left, U256::from(95_291)); } #[test] @@ -791,7 +791,7 @@ fn embedded_keccak() { }; assert_eq!(H256::from_slice(&result), H256::from("68371d7e884c168ae2022c82bd837d51837718a7f7dfb7aa3f753074a35e1d87")); - assert_eq!(gas_left, U256::from(84_520)); + assert_eq!(gas_left, U256::from(82_009)); } /// This test checks the correctness of log extern @@ -826,5 +826,5 @@ fn events() { assert_eq!(&log_entry.data, b"gnihtemos"); assert_eq!(&result, b"gnihtemos"); - assert_eq!(gas_left, U256::from(82_721)); + assert_eq!(gas_left, U256::from(80_199)); } From 6fe361b382a0b7551ccb8fcb09c740936f47bff1 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 20 Nov 2017 12:05:03 +0100 Subject: [PATCH 04/22] Allow localUrl in manifest --- dapps/src/apps/app.rs | 4 ++++ dapps/src/endpoint.rs | 1 + 2 files changed, 5 insertions(+) diff --git a/dapps/src/apps/app.rs b/dapps/src/apps/app.rs index 1d2c9dca6..e22a9e855 100644 --- a/dapps/src/apps/app.rs +++ b/dapps/src/apps/app.rs @@ -26,6 +26,8 @@ pub struct App { pub author: String, #[serde(rename="iconUrl")] pub icon_url: String, + #[serde(rename="localUrl")] + pub local_url: String; } impl App { @@ -38,6 +40,7 @@ impl App { version: info.version.to_owned(), author: info.author.to_owned(), icon_url: info.icon_url.to_owned(), + local_url: info.local_url.to_owned(), } } } @@ -50,6 +53,7 @@ impl Into for App { version: self.version, author: self.author, icon_url: self.icon_url, + local_url: self.local_url, } } } diff --git a/dapps/src/endpoint.rs b/dapps/src/endpoint.rs index 2dbcf209f..3a0b23a04 100644 --- a/dapps/src/endpoint.rs +++ b/dapps/src/endpoint.rs @@ -44,6 +44,7 @@ pub struct EndpointInfo { pub version: String, pub author: String, pub icon_url: String, + pub local_url: String, } pub type Endpoints = BTreeMap>; From d8e86cfe0a63e5b2fa00697a6530b58bd87b33ec Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 20 Nov 2017 13:37:23 +0100 Subject: [PATCH 05/22] Add to all icon_url places --- dapps/js-glue/src/lib.rs.in | 1 + dapps/src/apps/app.rs | 2 +- dapps/src/apps/fetcher/mod.rs | 1 + dapps/src/apps/fs.rs | 1 + dapps/src/page/builtin.rs | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dapps/js-glue/src/lib.rs.in b/dapps/js-glue/src/lib.rs.in index 99a253013..460c6498b 100644 --- a/dapps/js-glue/src/lib.rs.in +++ b/dapps/js-glue/src/lib.rs.in @@ -38,6 +38,7 @@ pub struct Info { pub author: &'static str, pub description: &'static str, pub icon_url: &'static str, + pub local_url: &'static str, } pub trait WebApp : Default + Send + Sync { diff --git a/dapps/src/apps/app.rs b/dapps/src/apps/app.rs index e22a9e855..9ced2438d 100644 --- a/dapps/src/apps/app.rs +++ b/dapps/src/apps/app.rs @@ -27,7 +27,7 @@ pub struct App { #[serde(rename="iconUrl")] pub icon_url: String, #[serde(rename="localUrl")] - pub local_url: String; + pub local_url: String, } impl App { diff --git a/dapps/src/apps/fetcher/mod.rs b/dapps/src/apps/fetcher/mod.rs index effcc19cd..e66c44eb6 100644 --- a/dapps/src/apps/fetcher/mod.rs +++ b/dapps/src/apps/fetcher/mod.rs @@ -306,6 +306,7 @@ mod tests { version: "".into(), author: "".into(), icon_url: "".into(), + local_url: "".into(), }, Default::default(), None); // when diff --git a/dapps/src/apps/fs.rs b/dapps/src/apps/fs.rs index 8be2dcf58..888e32bbf 100644 --- a/dapps/src/apps/fs.rs +++ b/dapps/src/apps/fs.rs @@ -56,6 +56,7 @@ fn read_manifest(name: &str, mut path: PathBuf) -> EndpointInfo { version: "0.0.0".into(), author: "?".into(), icon_url: "icon.png".into(), + local_url: "".into(), } }) } diff --git a/dapps/src/page/builtin.rs b/dapps/src/page/builtin.rs index f1ea50d42..b8c013cb3 100644 --- a/dapps/src/page/builtin.rs +++ b/dapps/src/page/builtin.rs @@ -132,6 +132,7 @@ impl From for EndpointInfo { description: info.description.into(), author: info.author.into(), icon_url: info.icon_url.into(), + local_url: info.local_url.into(), version: info.version.into(), } } From ac722e9e50876aeacbc2311ac3ce766f69ffa755 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 20 Nov 2017 13:37:52 +0100 Subject: [PATCH 06/22] Add appId as needed to local dapps --- js/src/Dapp/dapp.js | 5 ++++- js/src/inject.js | 24 +++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/js/src/Dapp/dapp.js b/js/src/Dapp/dapp.js index 038df7da3..b1b62572a 100644 --- a/js/src/Dapp/dapp.js +++ b/js/src/Dapp/dapp.js @@ -110,7 +110,10 @@ export default class Dapp extends Component { switch (app.type) { case 'local': - src = `${dappsUrl}/${app.id}/`; + console.log('app', app); + src = app.localUrl + ? `${app.localUrl}?appId=${app.id}` + : `${dappsUrl}/${app.id}/`; break; case 'network': diff --git a/js/src/inject.js b/js/src/inject.js index 7610a5ba7..8ffca9008 100644 --- a/js/src/inject.js +++ b/js/src/inject.js @@ -20,11 +20,29 @@ import Web3 from 'web3'; import web3extensions from './web3.extensions'; function initProvider () { - const parts = window.location.pathname.split('/'); - let appId = parts[1]; + const path = window.location.pathname.split('/'); + const qs = ((query) => { + if (!query) { + return {}; + } + + return query.split('&').reduce((result, combined) => { + const [name, value] = combined.split('=', 2); + + result[name] = !name + ? '' + : decodeURIComponent(value.replace(/\+/g, ' ')); + + return result; + }, {}); + })(window.location.search.substr(1)); + + let appId = path[1] || qs.appId; + + console.log('appId', appId, path, qs); if (appId === 'dapps') { - appId = parts[2]; + appId = path[2]; } else if (!Api.util.isHex(appId)) { appId = Api.util.sha3(appId); } From 73dcde65aa8ae23c29ddbe6b56af5af3abb38fea Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 20 Nov 2017 15:11:12 +0100 Subject: [PATCH 07/22] localUrl only from manifest --- dapps/js-glue/src/lib.rs.in | 1 - dapps/src/apps/app.rs | 2 +- dapps/src/apps/fs.rs | 2 +- dapps/src/endpoint.rs | 2 +- dapps/src/page/builtin.rs | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dapps/js-glue/src/lib.rs.in b/dapps/js-glue/src/lib.rs.in index 460c6498b..99a253013 100644 --- a/dapps/js-glue/src/lib.rs.in +++ b/dapps/js-glue/src/lib.rs.in @@ -38,7 +38,6 @@ pub struct Info { pub author: &'static str, pub description: &'static str, pub icon_url: &'static str, - pub local_url: &'static str, } pub trait WebApp : Default + Send + Sync { diff --git a/dapps/src/apps/app.rs b/dapps/src/apps/app.rs index 9ced2438d..3b674aa15 100644 --- a/dapps/src/apps/app.rs +++ b/dapps/src/apps/app.rs @@ -27,7 +27,7 @@ pub struct App { #[serde(rename="iconUrl")] pub icon_url: String, #[serde(rename="localUrl")] - pub local_url: String, + pub local_url: Option, } impl App { diff --git a/dapps/src/apps/fs.rs b/dapps/src/apps/fs.rs index 888e32bbf..c581c2a8a 100644 --- a/dapps/src/apps/fs.rs +++ b/dapps/src/apps/fs.rs @@ -56,7 +56,7 @@ fn read_manifest(name: &str, mut path: PathBuf) -> EndpointInfo { version: "0.0.0".into(), author: "?".into(), icon_url: "icon.png".into(), - local_url: "".into(), + local_url: None, } }) } diff --git a/dapps/src/endpoint.rs b/dapps/src/endpoint.rs index 3a0b23a04..5491b76de 100644 --- a/dapps/src/endpoint.rs +++ b/dapps/src/endpoint.rs @@ -44,7 +44,7 @@ pub struct EndpointInfo { pub version: String, pub author: String, pub icon_url: String, - pub local_url: String, + pub local_url: Option, } pub type Endpoints = BTreeMap>; diff --git a/dapps/src/page/builtin.rs b/dapps/src/page/builtin.rs index b8c013cb3..0e93b1c68 100644 --- a/dapps/src/page/builtin.rs +++ b/dapps/src/page/builtin.rs @@ -132,7 +132,7 @@ impl From for EndpointInfo { description: info.description.into(), author: info.author.into(), icon_url: info.icon_url.into(), - local_url: info.local_url.into(), + local_url: None, version: info.version.into(), } } From 9798e3c45ac802885dc253dee0648d084dbc6435 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Mon, 20 Nov 2017 18:12:31 +0300 Subject: [PATCH 08/22] Update panic_payload.rs --- ethcore/wasm/src/panic_payload.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ethcore/wasm/src/panic_payload.rs b/ethcore/wasm/src/panic_payload.rs index e79c13a24..dc95f53fb 100644 --- a/ethcore/wasm/src/panic_payload.rs +++ b/ethcore/wasm/src/panic_payload.rs @@ -15,8 +15,7 @@ // along with Parity. If not, see . use byteorder::{LittleEndian, ReadBytesExt}; -use std::io; -use std::io::Read; +use std::io::{self, Read}; #[derive(Debug, PartialEq, Eq)] pub struct PanicPayload { From e67b05e632964ef47fd108bfbcb5d3f7a6a9a8d8 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 21 Nov 2017 12:31:34 +0100 Subject: [PATCH 09/22] Use query-string for search parsing --- js/package-lock.json | 35 ++++++++++++++++++++++++++++++++--- js/package.json | 1 + js/src/inject.js | 19 +++---------------- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/js/package-lock.json b/js/package-lock.json index cde7c67f8..f8613fe83 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -3147,6 +3147,11 @@ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, "deep-eql": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", @@ -5942,6 +5947,17 @@ "loose-envify": "1.3.1", "query-string": "4.3.4", "warning": "3.0.0" + }, + "dependencies": { + "query-string": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", + "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "requires": { + "object-assign": "4.1.1", + "strict-uri-encode": "1.1.0" + } + } } }, "hmac-drbg": { @@ -8261,6 +8277,18 @@ "prepend-http": "1.0.4", "query-string": "4.3.4", "sort-keys": "1.1.2" + }, + "dependencies": { + "query-string": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", + "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "dev": true, + "requires": { + "object-assign": "4.1.1", + "strict-uri-encode": "1.1.0" + } + } } }, "npm-run-path": { @@ -9907,10 +9935,11 @@ "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "query-string": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", - "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.0.1.tgz", + "integrity": "sha512-aM+MkQClojlNiKkO09tiN2Fv8jM/L7GWIjG2liWeKljlOdOPNWr+bW3KQ+w5V/uKprpezC7fAsAMsJtJ+2rLKA==", "requires": { + "decode-uri-component": "0.2.0", "object-assign": "4.1.1", "strict-uri-encode": "1.1.0" } diff --git a/js/package.json b/js/package.json index 873720452..bbb992495 100644 --- a/js/package.json +++ b/js/package.json @@ -158,6 +158,7 @@ "lodash.uniq": "4.5.0", "material-ui": "0.16.5", "prop-types": "15.5.10", + "query-string": "5.0.1", "react": "15.6.1", "react-dom": "15.6.1", "react-intl": "2.1.5", diff --git a/js/src/inject.js b/js/src/inject.js index 8ffca9008..49982c8b2 100644 --- a/js/src/inject.js +++ b/js/src/inject.js @@ -15,29 +15,16 @@ // along with Parity. If not, see . import Api from '@parity/api'; +import qs from 'query-string'; import Web3 from 'web3'; import web3extensions from './web3.extensions'; function initProvider () { const path = window.location.pathname.split('/'); - const qs = ((query) => { - if (!query) { - return {}; - } + const query = qs.parse(window.location.search); - return query.split('&').reduce((result, combined) => { - const [name, value] = combined.split('=', 2); - - result[name] = !name - ? '' - : decodeURIComponent(value.replace(/\+/g, ' ')); - - return result; - }, {}); - })(window.location.search.substr(1)); - - let appId = path[1] || qs.appId; + let appId = path[1] || query.appId; console.log('appId', appId, path, qs); From 3e4e00fc6aed047758338a5cb7ffcf12938b7d0f Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Tue, 21 Nov 2017 15:39:34 +0300 Subject: [PATCH 10/22] spaces to tabs. --- ethcore/wasm/src/runtime.rs | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/ethcore/wasm/src/runtime.rs b/ethcore/wasm/src/runtime.rs index 3dfaffad0..3c2bd101e 100644 --- a/ethcore/wasm/src/runtime.rs +++ b/ethcore/wasm/src/runtime.rs @@ -627,30 +627,30 @@ impl<'a, 'b> Runtime<'a, 'b> { fn user_panic(&mut self, context: InterpreterCallerContext) -> Result, InterpreterError> { - let payload_len = context.value_stack.pop_as::()? as u32; - let payload_ptr = context.value_stack.pop_as::()? as u32; + let payload_len = context.value_stack.pop_as::()? as u32; + let payload_ptr = context.value_stack.pop_as::()? as u32; - let raw_payload = self.memory.get(payload_ptr, payload_len as usize)?; - let payload = panic_payload::decode(&raw_payload); - let msg = format!( - "{msg}, {file}:{line}:{col}", - msg = payload - .msg - .as_ref() - .map(String::as_ref) - .unwrap_or(""), - file = payload - .file - .as_ref() - .map(String::as_ref) - .unwrap_or(""), - line = payload.line.unwrap_or(0), - col = payload.col.unwrap_or(0) - ); - trace!(target: "wasm", "Contract custom panic message: {}", msg); + let raw_payload = self.memory.get(payload_ptr, payload_len as usize)?; + let payload = panic_payload::decode(&raw_payload); + let msg = format!( + "{msg}, {file}:{line}:{col}", + msg = payload + .msg + .as_ref() + .map(String::as_ref) + .unwrap_or(""), + file = payload + .file + .as_ref() + .map(String::as_ref) + .unwrap_or(""), + line = payload.line.unwrap_or(0), + col = payload.col.unwrap_or(0) + ); + trace!(target: "wasm", "Contract custom panic message: {}", msg); - Err(UserTrap::Panic(msg).into()) - } + Err(UserTrap::Panic(msg).into()) + } fn block_hash(&mut self, context: InterpreterCallerContext) -> Result, InterpreterError> From 17df58b767b2874b6066e3e6ecfbba0551d69fef Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 21 Nov 2017 15:02:54 +0100 Subject: [PATCH 11/22] Add localUrl to serialization --- parity/dapps.rs | 1 + rpc/src/v1/types/dapps.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/parity/dapps.rs b/parity/dapps.rs index c15b16337..ebd8937eb 100644 --- a/parity/dapps.rs +++ b/parity/dapps.rs @@ -297,6 +297,7 @@ mod server { version: app.version, author: app.author, icon_url: app.icon_url, + local_url: app.local_url, }) .collect() } diff --git a/rpc/src/v1/types/dapps.rs b/rpc/src/v1/types/dapps.rs index fb4a868f0..907a6c2cc 100644 --- a/rpc/src/v1/types/dapps.rs +++ b/rpc/src/v1/types/dapps.rs @@ -31,6 +31,9 @@ pub struct LocalDapp { /// Dapp icon #[serde(rename="iconUrl")] pub icon_url: String, + /// Local development Url + #[serde(rename="localUrl")] + pub local_url: Option, } #[cfg(test)] @@ -40,7 +43,7 @@ mod tests { #[test] fn dapp_serialization() { - let s = r#"{"id":"skeleton","name":"Skeleton","description":"A skeleton dapp","version":"0.1","author":"Parity Technologies Ltd","iconUrl":"title.png"}"#; + let s = r#"{"id":"skeleton","name":"Skeleton","description":"A skeleton dapp","version":"0.1","author":"Parity Technologies Ltd","iconUrl":"title.png","localUrl":"http://localhost:5000"}"#; let dapp = LocalDapp { id: "skeleton".into(), @@ -49,6 +52,7 @@ mod tests { version: "0.1".into(), author: "Parity Technologies Ltd".into(), icon_url: "title.png".into(), + local_url: "http://localhost:5000".into(), }; let serialized = serde_json::to_string(&dapp).unwrap(); From 7564b055725b5521e0ca0a062de996fd999f3e33 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Mon, 20 Nov 2017 16:38:54 +0300 Subject: [PATCH 12/22] Make storage_read/write return nothing --- ethcore/wasm/src/env.rs | 4 ++-- ethcore/wasm/src/runtime.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ethcore/wasm/src/env.rs b/ethcore/wasm/src/env.rs index 1a2f5fd3b..1004f3526 100644 --- a/ethcore/wasm/src/env.rs +++ b/ethcore/wasm/src/env.rs @@ -25,12 +25,12 @@ pub const SIGNATURES: &'static [UserFunctionDescriptor] = &[ Static( "_storage_read", &[I32; 2], - Some(I32), + None, ), Static( "_storage_write", &[I32; 2], - Some(I32), + None, ), Static( "_balance", diff --git a/ethcore/wasm/src/runtime.rs b/ethcore/wasm/src/runtime.rs index 3c2bd101e..0782876b5 100644 --- a/ethcore/wasm/src/runtime.rs +++ b/ethcore/wasm/src/runtime.rs @@ -168,7 +168,7 @@ impl<'a, 'b> Runtime<'a, 'b> { self.ext.set_storage(key, val).map_err(|_| UserTrap::StorageUpdateError)?; - Ok(Some(0i32.into())) + Ok(None) } /// Read from the storage to wasm memory @@ -184,7 +184,7 @@ impl<'a, 'b> Runtime<'a, 'b> { self.memory.set(val_ptr as u32, &*val)?; - Ok(Some(0.into())) + Ok(None) } /// Fetches balance for address From 66b2db01378b005af8d193c176bbd89c58609ab0 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Mon, 20 Nov 2017 17:38:19 +0300 Subject: [PATCH 13/22] Update gas values --- ethcore/wasm/src/tests.rs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/ethcore/wasm/src/tests.rs b/ethcore/wasm/src/tests.rs index 9f8b7ddec..f5738871b 100644 --- a/ethcore/wasm/src/tests.rs +++ b/ethcore/wasm/src/tests.rs @@ -112,7 +112,7 @@ fn logger() { U256::from(1_000_000_000), "Logger sets 0x04 key to the trasferred value" ); - assert_eq!(gas_left, U256::from(19_143)); + assert_eq!(gas_left, U256::from(19_147)); } // This test checks if the contract can allocate memory and pass pointer to the result stream properly. @@ -180,7 +180,7 @@ fn dispersion() { result, vec![0u8, 0, 125, 11, 197, 7, 255, 8, 19, 0] ); - assert_eq!(gas_left, U256::from(96_961)); + assert_eq!(gas_left, U256::from(96_393)); } #[test] @@ -208,7 +208,7 @@ fn suicide_not() { result, vec![0u8] ); - assert_eq!(gas_left, U256::from(97_290)); + assert_eq!(gas_left, U256::from(96_725)); } #[test] @@ -240,7 +240,7 @@ fn suicide() { }; assert!(ext.suicides.contains(&refund)); - assert_eq!(gas_left, U256::from(97_249)); + assert_eq!(gas_left, U256::from(96_687)); } #[test] @@ -270,7 +270,7 @@ fn create() { assert!(ext.calls.contains( &FakeCall { call_type: FakeCallType::Create, - gas: U256::from(65_903), + gas: U256::from(65_899), sender_address: None, receive_address: None, value: Some(1_000_000_000.into()), @@ -278,7 +278,7 @@ fn create() { code_address: None, } )); - assert_eq!(gas_left, U256::from(65_896)); + assert_eq!(gas_left, U256::from(65_892)); } @@ -393,7 +393,7 @@ fn realloc() { } }; assert_eq!(result, vec![0u8; 2]); - assert_eq!(gas_left, U256::from(97_278)); + assert_eq!(gas_left, U256::from(96_723)); } // Tests that contract's ability to read from a storage @@ -419,7 +419,7 @@ fn storage_read() { }; assert_eq!(Address::from(&result[12..32]), address); - assert_eq!(gas_left, U256::from(99_706)); + assert_eq!(gas_left, U256::from(99_767)); } // Tests keccak calculation @@ -445,7 +445,7 @@ fn keccak() { }; assert_eq!(H256::from_slice(&result), H256::from("68371d7e884c168ae2022c82bd837d51837718a7f7dfb7aa3f753074a35e1d87")); - assert_eq!(gas_left, U256::from(82_009)); + assert_eq!(gas_left, U256::from(81_446)); } // memcpy test. @@ -477,7 +477,7 @@ fn memcpy() { }; assert_eq!(result, test_payload); - assert_eq!(gas_left, U256::from(72_773)); + assert_eq!(gas_left, U256::from(72_216)); } // memmove test. @@ -509,7 +509,7 @@ fn memmove() { }; assert_eq!(result, test_payload); - assert_eq!(gas_left, U256::from(72_773)); + assert_eq!(gas_left, U256::from(72_216)); } // memset test @@ -534,7 +534,7 @@ fn memset() { }; assert_eq!(result, vec![228u8; 8192]); - assert_eq!(gas_left, U256::from(72_763)); + assert_eq!(gas_left, U256::from(72_196)); } macro_rules! reqrep_test { @@ -591,7 +591,7 @@ fn math_add() { U256::from_dec_str("1888888888888888888888888888887").unwrap(), (&result[..]).into() ); - assert_eq!(gas_left, U256::from(96_084)); + assert_eq!(gas_left, U256::from(95_524)); } // multiplication @@ -613,7 +613,7 @@ fn math_mul() { U256::from_dec_str("888888888888888888888888888887111111111111111111111111111112").unwrap(), (&result[..]).into() ); - assert_eq!(gas_left, U256::from(95_234)); + assert_eq!(gas_left, U256::from(94_674)); } // subtraction @@ -635,7 +635,7 @@ fn math_sub() { U256::from_dec_str("111111111111111111111111111111").unwrap(), (&result[..]).into() ); - assert_eq!(gas_left, U256::from(96_076)); + assert_eq!(gas_left, U256::from(95_516)); } // subtraction with overflow @@ -677,7 +677,7 @@ fn math_div() { U256::from_dec_str("1125000").unwrap(), (&result[..]).into() ); - assert_eq!(gas_left, U256::from(89_074)); + assert_eq!(gas_left, U256::from(88_514)); } // This test checks the ability of wasm contract to invoke @@ -765,7 +765,7 @@ fn externs() { "Gas limit requested and returned does not match" ); - assert_eq!(gas_left, U256::from(95_291)); + assert_eq!(gas_left, U256::from(94_733)); } #[test] @@ -791,7 +791,7 @@ fn embedded_keccak() { }; assert_eq!(H256::from_slice(&result), H256::from("68371d7e884c168ae2022c82bd837d51837718a7f7dfb7aa3f753074a35e1d87")); - assert_eq!(gas_left, U256::from(82_009)); + assert_eq!(gas_left, U256::from(81_446)); } /// This test checks the correctness of log extern @@ -826,5 +826,5 @@ fn events() { assert_eq!(&log_entry.data, b"gnihtemos"); assert_eq!(&result, b"gnihtemos"); - assert_eq!(gas_left, U256::from(80_199)); + assert_eq!(gas_left, U256::from(79_637)); } From 3716b09b2e56af49314f5112a5521107a6e410a5 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Mon, 20 Nov 2017 18:10:34 +0300 Subject: [PATCH 14/22] Update wasm-tests --- ethcore/res/wasm-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/wasm-tests b/ethcore/res/wasm-tests index d4920761f..e5fcae4e9 160000 --- a/ethcore/res/wasm-tests +++ b/ethcore/res/wasm-tests @@ -1 +1 @@ -Subproject commit d4920761f959a785c3ec15cf2848fc75795eb2d4 +Subproject commit e5fcae4e9c2a570f293a22baa4d78d9f4b391a0f From 20f8943eb31e24fe33d396343e4a2d31333847de Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 21 Nov 2017 15:04:47 +0100 Subject: [PATCH 15/22] Cleanup debug info --- js/src/inject.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/src/inject.js b/js/src/inject.js index 49982c8b2..7bde1233d 100644 --- a/js/src/inject.js +++ b/js/src/inject.js @@ -26,8 +26,6 @@ function initProvider () { let appId = path[1] || query.appId; - console.log('appId', appId, path, qs); - if (appId === 'dapps') { appId = path[2]; } else if (!Api.util.isHex(appId)) { From e7543f656a44a4b86e13d2815739fc5ce5a3296c Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 21 Nov 2017 15:17:05 +0100 Subject: [PATCH 16/22] Remove debug log --- js/src/Dapp/dapp.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/src/Dapp/dapp.js b/js/src/Dapp/dapp.js index b1b62572a..6c5b8f74a 100644 --- a/js/src/Dapp/dapp.js +++ b/js/src/Dapp/dapp.js @@ -110,7 +110,6 @@ export default class Dapp extends Component { switch (app.type) { case 'local': - console.log('app', app); src = app.localUrl ? `${app.localUrl}?appId=${app.id}` : `${dappsUrl}/${app.id}/`; From 570fc56af71f8fde7f22a2558a90f3e365a22324 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Tue, 21 Nov 2017 15:50:38 +0100 Subject: [PATCH 17/22] Optimize & group dapp requests (#7083) * Group similar methods in same grouping * Add a shell_getMethodGroups API * Small code clean changes * Fix bug dapp.name not showing * Additional error handling * Store sources in own map * Remove observable variables where not needed * Refactor code and fix bug dapp not showing on approve --- js/src/DappRequests/README.md | 9 + js/src/DappRequests/Request/request.js | 85 ----- .../RequestGroups/RequestGroups.css | 39 ++ .../RequestGroups/RequestGroups.js | 116 ++++++ .../{Request => RequestGroups}/index.js | 2 +- js/src/DappRequests/dappRequests.css | 17 - js/src/DappRequests/dappRequests.js | 53 +-- .../{filteredRequests.js => methodGroups.js} | 25 +- js/src/DappRequests/store.js | 340 +++++++++--------- js/src/shellMiddleware.js | 41 ++- 10 files changed, 404 insertions(+), 323 deletions(-) create mode 100644 js/src/DappRequests/README.md delete mode 100644 js/src/DappRequests/Request/request.js create mode 100644 js/src/DappRequests/RequestGroups/RequestGroups.css create mode 100644 js/src/DappRequests/RequestGroups/RequestGroups.js rename js/src/DappRequests/{Request => RequestGroups}/index.js (94%) rename js/src/DappRequests/{filteredRequests.js => methodGroups.js} (78%) diff --git a/js/src/DappRequests/README.md b/js/src/DappRequests/README.md new file mode 100644 index 000000000..f4ed60b40 --- /dev/null +++ b/js/src/DappRequests/README.md @@ -0,0 +1,9 @@ +# Terminology used + +To be clear with the terminology used in the code here: + +- a *method* is an allowed JSON-RPC api method or a shell method +- a *methodGroup* is the grouping of similar methods (see `methodGroups.js`) +- a *permission* is a boolean which tells if an app is allowed to call a method or not +- a *request* is when an app prompts the shell to call a method +- a *requestGroup* is an array of *requests* whose methods are in the same *methodGroup* diff --git a/js/src/DappRequests/Request/request.js b/js/src/DappRequests/Request/request.js deleted file mode 100644 index 776fd9089..000000000 --- a/js/src/DappRequests/Request/request.js +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import React from 'react'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; - -import Button from '@parity/ui/lib/Button'; - -import DappsStore from '@parity/shared/lib/mobx/dappsStore'; - -export default function Request ({ appId, className, approveRequest, denyRequest, queueId, request: { from, method } }) { - const _onApprove = () => approveRequest(queueId, false); - const _onApproveAll = () => approveRequest(queueId, true); - const _onReject = () => denyRequest(queueId); - - const app = DappsStore.get().getAppById(appId); - - return ( -
- -
-
-
- ); -} - -Request.propTypes = { - appId: PropTypes.string.isRequired, - className: PropTypes.string, - approveRequest: PropTypes.func.isRequired, - denyRequest: PropTypes.func.isRequired, - queueId: PropTypes.number.isRequired, - request: PropTypes.object.isRequired -}; diff --git a/js/src/DappRequests/RequestGroups/RequestGroups.css b/js/src/DappRequests/RequestGroups/RequestGroups.css new file mode 100644 index 000000000..65335e85e --- /dev/null +++ b/js/src/DappRequests/RequestGroups/RequestGroups.css @@ -0,0 +1,39 @@ +/* Copyright 2015-2017 Parity Technologies (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 . +*/ + +$backgroundOne: #f80; +$backgroundTwo: #e57a00; + +.requestGroups { + background: $backgroundOne; + background: linear-gradient($backgroundOne, $backgroundTwo); + padding: 0.5em; + text-align: right; + color: white; + + > span { + margin-right: 30px; + } + + .requestGroup { + margin-top: 2px; + + .requestGroupTitle { + margin-right: 10px; + } + } +} diff --git a/js/src/DappRequests/RequestGroups/RequestGroups.js b/js/src/DappRequests/RequestGroups/RequestGroups.js new file mode 100644 index 000000000..42328ed2a --- /dev/null +++ b/js/src/DappRequests/RequestGroups/RequestGroups.js @@ -0,0 +1,116 @@ +// Copyright 2015-2017 Parity Technologies (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 . + +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; + +import Popup from 'semantic-ui-react/dist/commonjs/modules/Popup'; +import Button from '@parity/ui/lib/Button'; + +import DappsStore from '@parity/shared/lib/mobx/dappsStore'; + +import styles from './RequestGroups.css'; + +export default class RequestGroups extends PureComponent { + state = { + opened: false + }; + + handleApproveRequestGroup = groupId => { + const { requestGroups, onApproveRequestGroup } = this.props; + + onApproveRequestGroup(Object.values(requestGroups[groupId].map(({ requestId }) => requestId))); + } + + handleRejectRequestGroup = groupId => { + const { requestGroups, onRejectRequestGroup } = this.props; + + onRejectRequestGroup(Object.values(requestGroups[groupId].map(({ requestId }) => requestId))); + } + + renderPopupContent = groupId => { + const { requestGroups } = this.props; + // Get unique list of methods in that request group + const requestedMethods = [...new Set( + Object.values(requestGroups[groupId]) + .map(request => request.data.method || request.data.params[0]) + )]; + + return `Requested methods: ${requestedMethods.join(', ')}`; + } + + render () { + const { + appId, + requestGroups + } = this.props; + + const app = DappsStore.get().getAppById(appId); + + return ( +
+ + {Object.keys(requestGroups).map(groupId => ( +
+ + Permission for{' '} + {groupId} } + content={ this.renderPopupContent(groupId) } + /> + +
+ ))} +
+ ); + } +} + +RequestGroups.propTypes = { + appId: PropTypes.string.isRequired, + className: PropTypes.string, + onApproveRequestGroup: PropTypes.func.isRequired, + onRejectRequestGroup: PropTypes.func.isRequired, + requestGroups: PropTypes.object.isRequired +}; diff --git a/js/src/DappRequests/Request/index.js b/js/src/DappRequests/RequestGroups/index.js similarity index 94% rename from js/src/DappRequests/Request/index.js rename to js/src/DappRequests/RequestGroups/index.js index 20fb91088..af5e54d12 100644 --- a/js/src/DappRequests/Request/index.js +++ b/js/src/DappRequests/RequestGroups/index.js @@ -14,4 +14,4 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -export default from './request'; +export default from './RequestGroups'; diff --git a/js/src/DappRequests/dappRequests.css b/js/src/DappRequests/dappRequests.css index 8d82bfa1b..673a7b33d 100644 --- a/js/src/DappRequests/dappRequests.css +++ b/js/src/DappRequests/dappRequests.css @@ -15,27 +15,10 @@ /* along with Parity. If not, see . */ -$backgroundOne: #f80; -$backgroundTwo: #e57a00; - .requests { - color: white; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; /* sits above sync warning */ - - .request { - align-items: center; - background: $backgroundOne; - background: linear-gradient($backgroundOne, $backgroundTwo); - display: flex; - justify-content: flex-end; - padding: 0.5em; - - > span { - margin-right: 1em; - } - } } diff --git a/js/src/DappRequests/dappRequests.js b/js/src/DappRequests/dappRequests.js index b6acb774e..263063d5e 100644 --- a/js/src/DappRequests/dappRequests.js +++ b/js/src/DappRequests/dappRequests.js @@ -15,36 +15,43 @@ // along with Parity. If not, see . import { observer } from 'mobx-react'; -import React from 'react'; +import React, { PureComponent } from 'react'; -import Request from './Request'; +import RequestGroups from './RequestGroups'; import Store from './store'; import styles from './dappRequests.css'; -function DappRequests () { - const store = Store.get(); +class DappRequests extends PureComponent { + store = Store.get(); - if (!store || !store.hasRequests) { - return null; + handleApproveRequestGroup = requestIds => { + requestIds.forEach(this.store.approveRequest); } - return ( -
- { - store.squashedRequests.map(({ appId, queueId, request: { data } }) => ( - - )) - } -
- ); + handleRejectRequestGroup = requestIds => { + requestIds.forEach(this.store.rejectRequest); + } + + render () { + if (!this.store || !this.store.hasRequests) { + return null; + } + + return ( +
+ {Object.keys(this.store.groupedRequests) + .map(appId => ( + + ))} +
+ ); + } } export default observer(DappRequests); diff --git a/js/src/DappRequests/filteredRequests.js b/js/src/DappRequests/methodGroups.js similarity index 78% rename from js/src/DappRequests/filteredRequests.js rename to js/src/DappRequests/methodGroups.js index 743660428..c37357428 100644 --- a/js/src/DappRequests/filteredRequests.js +++ b/js/src/DappRequests/methodGroups.js @@ -14,21 +14,19 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -export default { +const methodGroups = { shell: { methods: [ 'shell_getApps', 'shell_getFilteredMethods', + 'shell_getMethodGroups', 'shell_getMethodPermissions', 'shell_setAppVisibility', 'shell_setMethodPermissions' ] }, accountsView: { - methods: [ - 'parity_accountsInfo', - 'parity_allAccountsInfo' - ] + methods: ['parity_accountsInfo', 'parity_allAccountsInfo'] }, accountsCreate: { methods: [ @@ -42,10 +40,7 @@ export default { ] }, accountsEdit: { - methods: [ - 'parity_setAccountName', - 'parity_setAccountMeta' - ] + methods: ['parity_setAccountName', 'parity_setAccountMeta'] }, upgrade: { methods: [ @@ -76,3 +71,15 @@ export default { ] } }; + +const methodGroupFromMethod = {}; // Maps method to methodGroup + +// Populate methodGroupFromMethod +Object.keys(methodGroups).forEach(groupId => { + methodGroups[groupId].methods.forEach(method => { + methodGroupFromMethod[method] = groupId; + }); +}); + +export { methodGroupFromMethod }; +export default methodGroups; diff --git a/js/src/DappRequests/store.js b/js/src/DappRequests/store.js index 4c5448a61..5a89ad29a 100644 --- a/js/src/DappRequests/store.js +++ b/js/src/DappRequests/store.js @@ -19,19 +19,17 @@ import store from 'store'; import { sha3 } from '@parity/api/lib/util/sha3'; -import filteredRequests from './filteredRequests'; +import { methodGroupFromMethod } from './methodGroups'; const LS_PERMISSIONS = '_parity::dapps::methods'; -let nextQueueId = 0; - export default class Store { - @observable permissions = {}; - @observable requests = []; - @observable tokens = {}; + @observable requests = {}; // Maps requestId to request middleware = []; - sources = {}; + permissions = {}; // Maps `${method}:${appId}` to true/false + sources = {}; // Maps requestId to a postMessage source + tokens = {}; // Maps token to appId constructor (provider) { this.provider = provider; @@ -41,131 +39,112 @@ export default class Store { } @computed get hasRequests () { - return this.requests.length !== 0; + return Object.keys(this.requests).length !== 0; } - @computed get squashedRequests () { - const duplicates = {}; + @computed get groupedRequests () { + // Group by appId on top level, and by methodGroup on 2nd level + return Object.keys(this.requests).reduce((accumulator, requestId) => { + const { data } = this.requests[requestId]; + const appId = this.tokens[data.token]; + const method = this.getMethodFromRequest(requestId); + const methodGroup = methodGroupFromMethod[method]; // Get the methodGroup the current request belongs to - return this.requests.filter(({ request: { data: { method, token } } }) => { - const section = this.getFilteredSectionName(method); - const id = `${token}:${section}`; + accumulator[appId] = accumulator[appId] || {}; + accumulator[appId][methodGroup] = accumulator[appId][methodGroup] || []; + accumulator[appId][methodGroup].push({ data, requestId }); // Append the requestId field in the request object - if (!duplicates[id]) { - duplicates[id] = true; - return true; - } - - return false; - }); + return accumulator; + }, {}); } - @action createToken = (appId) => { - const token = sha3(`${appId}:${Date.now()}`); + @action queueRequest = (requestId, { data, source }) => { + this.sources[requestId] = source; + // Create a new this.requests object to update mobx store + this.requests = { + ...this.requests, + [requestId]: { data } + }; + }; - this.tokens = Object.assign({}, this.tokens, { - [token]: appId - }); - - return token; - } - - @action removeRequest = (_queueId) => { - this.requests = this.requests.filter(({ queueId }) => queueId !== _queueId); - delete this.sources[_queueId]; - } - - @action queueRequest = (request) => { - const { data, origin, source } = request; + @action approveRequest = requestId => { + const { data } = this.requests[requestId]; + const method = this.getMethodFromRequest(requestId); const appId = this.tokens[data.token]; + const source = this.sources[requestId]; - let queueId = ++nextQueueId; - - this.sources[queueId] = source; - this.requests = this.requests.concat([{ - appId, - queueId, - request: { - data, - origin - } - }]); - } - - @action addTokenPermission = (method, token) => { - const id = `${method}:${this.tokens[token]}`; - - this.permissions = Object.assign({}, this.permissions, { - [id]: true - }); - this.savePermissions(); - } - - @action approveSingleRequest = ({ queueId, request: { data } }) => { - const source = this.sources[queueId]; - - this.removeRequest(queueId); + this.addAppPermission(method, appId); + this.removeRequest(requestId); if (data.api) { this.executePubsubCall(data, source); } else { this.executeMethodCall(data, source); } - } + }; - @action approveRequest = (queueId, approveAll) => { - const queued = this.findRequest(queueId); + @action rejectRequest = requestId => { + const { data } = this.requests[requestId]; + const source = this.sources[requestId]; - if (approveAll) { - const { request: { data: { method, token, params } } } = queued; - - this.getFilteredSection(method || params[0]).methods.forEach((m) => { - this.addTokenPermission(m, token); - this.findMatchingRequests(m, token).forEach(this.approveSingleRequest); - }); - } else { - this.approveSingleRequest(queued); - } - } - - @action rejectRequest = (queueId) => { - const { request: { data } } = this.findRequest(queueId); - const source = this.sources[queueId]; - - this.removeRequest(queueId); + this.removeRequest(requestId); this.rejectMessage(source, data); + }; + + @action removeRequest = requestId => { + delete this.requests[requestId]; + delete this.sources[requestId]; + + // Create a new object to update mobx store + this.requests = { ...this.requests }; + }; + + getPermissionId = (method, appId) => `${method}:${appId}` // Create an id to identify permissions based on method and appId + + getMethodFromRequest = requestId => { + const { data: { method, params } } = this.requests[requestId]; + + return method || params[0]; } - @action rejectMessage = (source, { id, from, method, token }) => { + rejectMessage = (source, { id, from, method, token }) => { if (!source) { return; } - source.postMessage({ - error: `Method ${method} not allowed`, - id, - from: 'shell', - result: null, - to: from, - token - }, '*'); - } + source.postMessage( + { + error: `Method ${method} not allowed`, + id, + from: 'shell', + result: null, + to: from, + token + }, + '*' + ); + }; - @action setPermissions = (_permissions) => { + addAppPermission = (method, appId) => { + this.permissions[this.getPermissionId(method, appId)] = true; + this.savePermissions(); + }; + + setPermissions = _permissions => { const permissions = {}; - Object.keys(_permissions).forEach((id) => { + Object.keys(_permissions).forEach(id => { permissions[id] = !!_permissions[id]; }); - this.permissions = Object.assign({}, this.permissions, permissions); + this.permissions = permissions; this.savePermissions(); return true; - } + }; addMiddleware (middleware) { - if (!middleware || (typeof middleware !== 'function')) { + if (!middleware || typeof middleware !== 'function') { throw new Error('Interceptor middleware does not implement a function'); } @@ -174,114 +153,131 @@ export default class Store { return true; } + createToken = appId => { + const token = sha3(`${appId}:${Date.now()}`); + + this.tokens[token] = appId; + return token; + }; + hasValidToken = (method, appId, token) => { if (!token) { return method === 'shell_requestNewToken'; } return this.tokens[token] === appId; - } + }; hasTokenPermission = (method, token) => { return this.hasAppPermission(method, this.tokens[token]); - } + }; hasAppPermission = (method, appId) => { - return this.permissions[`${method}:${appId}`] || false; - } + return !!this.permissions[this.getPermissionId(method, appId)]; + }; savePermissions = () => { store.set(LS_PERMISSIONS, this.permissions); - } - - findRequest (_queueId) { - return this.requests.find(({ queueId }) => queueId === _queueId); - } - - findMatchingRequests (_method, _token) { - return this.requests.filter(({ request: { data: { method, token, params } } }) => (method === _method || (params && params[0] === _method)) && token === _token); - } + }; _methodCallbackPost = (id, from, source, token) => { return (error, result) => { if (!source) { return; } - - source.postMessage({ - error: error - ? error.message - : null, - id, - from: 'shell', - to: from, - result, - token - }, '*'); + source.postMessage( + { + error: error ? error.message : null, + id, + from: 'shell', + to: from, + result, + token + }, + '*' + ); }; - } + }; executePubsubCall = ({ api, id, from, token, params }, source) => { const callback = this._methodCallbackPost(id, from, source, token); - this.provider - .subscribe(api, callback, params) - .then((result, error) => { - this._methodCallbackPost(id, from, source, token)(null, result); - }); - } + this.provider.subscribe(api, callback, params).then((result, error) => { + this._methodCallbackPost(id, from, source, token)(null, result); + }); + }; executeMethodCall = ({ id, from, method, params, token }, source) => { - const callback = this._methodCallbackPost(id, from, source, token); - const isHandled = this.middleware.find((middleware) => middleware(from, method, params, callback)); + try { + const callback = this._methodCallbackPost(id, from, source, token); + const isHandled = this.middleware.some(middleware => { + try { + return middleware(from, method, params, callback); + } catch (error) { + console.error(`Middleware error handling '${method}'`, error); + } - if (!isHandled) { - this.provider.send(method, params, callback); + return false; + }); + + if (!isHandled) { + this.provider.send(method, params, callback); + } + } catch (error) { + console.error(`Execution error handling '${method}'`, error); } - } + }; - getFilteredSectionName = (method) => { - return Object.keys(filteredRequests).find((key) => { - return filteredRequests[key].methods.includes(method); - }); - } + receiveMessage = ({ data, source }) => { + try { + if (!data) { + return; + } - getFilteredSection = (method) => { - return filteredRequests[this.getFilteredSectionName(method)]; - } + const { from, method, to, token, params, api, subId, id } = data; - receiveMessage = ({ data, origin, source }) => { - if (!data) { - return; + if (to !== 'shell' || !from || from === 'shell') { + return; + } + + if (!this.hasValidToken(method, from, token)) { + this.rejectMessage(source, data); + return; + } + + if ( + (method && + methodGroupFromMethod[method] && + !this.hasTokenPermission(method, token)) || + (api && + methodGroupFromMethod[params[0]] && + !this.hasTokenPermission(method, token)) + ) { + this.queueRequest(id, { // The requestId of a request is the id inside data + data, + source + }); + return; + } + + if (api) { + this.executePubsubCall(data, source); + } else if (subId) { + const unsubscribePromise = subId === '*' + ? this.provider.unsubscribeAll() + : this.provider.unsubscribe(subId); + + unsubscribePromise + .then(v => + this._methodCallbackPost(id, from, source, token)(null, v) + ); + } else { + this.executeMethodCall(data, source); + } + } catch (error) { + console.error('Exception handling data', data, error); } - - const { from, method, to, token, params, api, subId, id } = data; - - if (to !== 'shell' || !from || from === 'shell') { - return; - } - - if (!this.hasValidToken(method, from, token)) { - this.rejectMessage(source, data); - return; - } - - if ((method && this.getFilteredSection(method) && !this.hasTokenPermission(method, token)) || - (api && this.getFilteredSection(params[0]) && !this.hasTokenPermission(method, token))) { - this.queueRequest({ data, origin, source }); - return; - } - - if (api) { - this.executePubsubCall(data, source); - } else if (subId) { - subId === '*' - ? this.provider.unsubscribeAll().then(v => this._methodCallbackPost(id, from, source, token)(null, v)) - : this.provider.unsubscribe(subId).then(v => this._methodCallbackPost(id, from, source, token)(null, v)); - } else { - this.executeMethodCall(data, source); - } - } + }; static instance = null; diff --git a/js/src/shellMiddleware.js b/js/src/shellMiddleware.js index 7bdb9d259..a8f1e31bc 100644 --- a/js/src/shellMiddleware.js +++ b/js/src/shellMiddleware.js @@ -14,13 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +import mobx from 'mobx'; import flatten from 'lodash.flatten'; import { sha3 } from '@parity/api/lib/util/sha3'; import VisibleStore from '@parity/shared/lib/mobx/dappsStore'; import RequestStore from './DappRequests/store'; -import filteredRequests from './DappRequests/filteredRequests'; +import methodGroups from './DappRequests/methodGroups'; export default function execute (appId, method, params, callback) { const visibleStore = VisibleStore.get(); @@ -30,29 +31,35 @@ export default function execute (appId, method, params, callback) { case 'shell_getApps': const [displayAll] = params; - callback(null, displayAll - ? visibleStore.allApps.slice() - : visibleStore.visibleApps.slice() + callback( + null, + displayAll + ? visibleStore.allApps.slice().map(mobx.toJS) + : visibleStore.visibleApps.slice().map(mobx.toJS) ); return true; case 'shell_getFilteredMethods': - callback(null, flatten( - Object - .keys(filteredRequests) - .map((key) => filteredRequests[key].methods) - )); + callback( + null, + flatten(Object.keys(methodGroups).map(key => methodGroups[key].methods)) + ); + return true; + + case 'shell_getMethodGroups': + callback( + null, + methodGroups + ); return true; case 'shell_getMethodPermissions': - callback(null, requestStore.permissions); + callback(null, mobx.toJS(requestStore.permissions)); return true; case 'shell_loadApp': const [_loadId, loadParams] = params; - const loadId = _loadId.substr(0, 2) !== '0x' - ? sha3(_loadId) - : _loadId; + const loadId = _loadId.substr(0, 2) !== '0x' ? sha3(_loadId) : _loadId; const loadUrl = `/${loadId}/${loadParams || ''}`; window.location.hash = loadUrl; @@ -67,9 +74,11 @@ export default function execute (appId, method, params, callback) { case 'shell_setAppVisibility': const [changeId, visibility] = params; - callback(null, visibility - ? visibleStore.showApp(changeId) - : visibleStore.hideApp(changeId) + callback( + null, + visibility + ? visibleStore.showApp(changeId) + : visibleStore.hideApp(changeId) ); return true; From bc17c61d145ada95874a236812b491b0f36e766d Mon Sep 17 00:00:00 2001 From: GitLab Build Bot Date: Tue, 21 Nov 2017 15:14:37 +0000 Subject: [PATCH 18/22] [ci skip] js-precompiled 20171121-150329 --- Cargo.lock | 2 +- js/package-lock.json | 2 +- js/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4de28eeb8..9c7ddd7ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2230,7 +2230,7 @@ dependencies = [ [[package]] name = "parity-ui-precompiled" version = "1.9.0" -source = "git+https://github.com/paritytech/js-precompiled.git#5b3e31509c369f558c8cb90f6f9918e50cdb2501" +source = "git+https://github.com/paritytech/js-precompiled.git#869697f77d549c240df0c5f5fd4e611d09bf61c2" dependencies = [ "parity-dapps-glue 1.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/js/package-lock.json b/js/package-lock.json index cde7c67f8..3f0bb661f 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -1,6 +1,6 @@ { "name": "Parity", - "version": "1.9.10", + "version": "1.9.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/js/package.json b/js/package.json index 873720452..9056ad244 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "Parity", - "version": "1.9.10", + "version": "1.9.11", "main": "src/index.parity.js", "jsnext:main": "src/index.parity.js", "author": "Parity Team ", From fcee1c0ac80b65dcdd3486f69a9006400f86ed52 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 21 Nov 2017 17:38:06 +0100 Subject: [PATCH 19/22] Remove unused and duplicated files in js-old (#7082) * Cleanup v1 build process, application-only * Remove built-in dapps from build (duplicated) * User @parity/api instead of local version * Update references to @parity/abi * Remove unused js-old api/abi folders * Remove duplicated v1 jsonrpc * Cleanup unused routes * Update manifest with wallet image * Update wallet logo * Re-add missing test.sh * Update rpc mocks * Update tests for Providers * Use flex for iframe & status * Additional cleanups (Home screen for embed) * Keep statusbar fixed (and non-overallping with dapps) --- js-old/npm/etherscan/README.md | 34 - js-old/npm/etherscan/package.json | 33 - js-old/npm/jsonrpc/README.md | 5 - js-old/npm/jsonrpc/package.json | 29 - js-old/npm/parity/README.md | 83 - js-old/npm/parity/package.json | 33 - js-old/npm/parity/test/smoke.spec.js | 26 - js-old/npm/shapeshift/README.md | 34 - js-old/npm/shapeshift/package.json | 31 - js-old/npm/test/mocha.config.js | 29 - js-old/npm/test/mocha.opts | 1 - js-old/package.json | 4 +- js-old/scripts/build-rpc-json.js | 70 - js-old/scripts/build-rpc-markdown.js | 328 --- js-old/scripts/dryrun-npm.sh | 36 - js-old/scripts/helpers/log.js | 32 - js-old/scripts/helpers/parsed-rpc-traits.js | 81 - js-old/src/3rdparty/etherscan/account.js | 2 +- js-old/src/abi/README.md | 32 - js-old/src/abi/abi.js | 20 - js-old/src/abi/decoder/bytesTaken.js | 30 - js-old/src/abi/decoder/bytesTaken.spec.js | 29 - js-old/src/abi/decoder/decodeResult.js | 30 - js-old/src/abi/decoder/decodeResult.spec.js | 29 - js-old/src/abi/decoder/decoder.js | 156 -- js-old/src/abi/decoder/decoder.spec.js | 319 --- js-old/src/abi/decoder/index.js | 17 - js-old/src/abi/encoder/encoder.js | 75 - js-old/src/abi/encoder/encoder.spec.js | 291 --- js-old/src/abi/encoder/index.js | 17 - js-old/src/abi/encoder/mediate.js | 142 -- js-old/src/abi/encoder/mediate.spec.js | 105 - js-old/src/abi/index.js | 17 - js-old/src/abi/spec/constructor.js | 36 - js-old/src/abi/spec/constructor.spec.js | 52 - js-old/src/abi/spec/event/decodedLog.js | 30 - js-old/src/abi/spec/event/decodedLog.spec.js | 28 - js-old/src/abi/spec/event/decodedLogParam.js | 45 - .../abi/spec/event/decodedLogParam.spec.js | 42 - js-old/src/abi/spec/event/event.js | 114 - js-old/src/abi/spec/event/event.spec.js | 111 - js-old/src/abi/spec/event/eventParam.js | 41 - js-old/src/abi/spec/event/eventParam.spec.js | 44 - js-old/src/abi/spec/event/index.js | 17 - js-old/src/abi/spec/function.js | 88 - js-old/src/abi/spec/function.spec.js | 101 - js-old/src/abi/spec/index.js | 17 - js-old/src/abi/spec/interface.js | 77 - js-old/src/abi/spec/interface.spec.js | 126 - js-old/src/abi/spec/param.js | 42 - js-old/src/abi/spec/param.spec.js | 47 - js-old/src/abi/spec/paramType/format.js | 80 - js-old/src/abi/spec/paramType/format.spec.js | 228 -- js-old/src/abi/spec/paramType/index.js | 17 - js-old/src/abi/spec/paramType/paramType.js | 52 - .../src/abi/spec/paramType/paramType.spec.js | 87 - js-old/src/abi/spec/paramType/types.js | 19 - js-old/src/abi/token/index.js | 17 - js-old/src/abi/token/token.js | 42 - js-old/src/abi/token/token.spec.js | 75 - js-old/src/abi/util/address.js | 66 - js-old/src/abi/util/address.spec.js | 100 - js-old/src/abi/util/pad.js | 77 - js-old/src/abi/util/pad.spec.js | 124 - js-old/src/abi/util/signature.js | 49 - js-old/src/abi/util/signature.spec.js | 111 - js-old/src/abi/util/slice.js | 31 - js-old/src/abi/util/slice.spec.js | 44 - js-old/src/abi/util/sliceAs.js | 47 - js-old/src/abi/util/sliceAs.spec.js | 55 - js-old/src/abi/util/types.js | 27 - js-old/src/abi/util/types.spec.js | 62 - js-old/src/api/README.md | 146 -- js-old/src/api/api.js | 179 -- js-old/src/api/api.spec.js | 59 - js-old/src/api/contract/contract.js | 561 ----- js-old/src/api/contract/contract.spec.js | 597 ----- js-old/src/api/contract/index.js | 17 - js-old/src/api/format/input.js | 242 -- js-old/src/api/format/input.spec.js | 341 --- js-old/src/api/format/output.js | 414 ---- js-old/src/api/format/output.spec.js | 502 ---- js-old/src/api/index.js | 17 - js-old/src/api/local/accounts/account.js | 116 - js-old/src/api/local/accounts/accounts.js | 229 -- js-old/src/api/local/accounts/index.js | 21 - js-old/src/api/local/ethkey/ethkey.js | 147 -- js-old/src/api/local/ethkey/ethkey.wasm.js | 1 - js-old/src/api/local/ethkey/index.js | 47 - js-old/src/api/local/ethkey/index.spec.js | 58 - js-old/src/api/local/ethkey/worker.js | 138 -- js-old/src/api/local/ethkey/workerPool.js | 105 - js-old/src/api/local/index.js | 17 - .../src/api/local/localAccountsMiddleware.js | 288 --- .../api/local/localAccountsMiddleware.spec.js | 157 -- js-old/src/api/local/transactions.js | 147 -- js-old/src/api/local/transactions.spec.js | 85 - js-old/src/api/pubsub/eth/eth.js | 227 -- js-old/src/api/pubsub/eth/index.js | 16 - js-old/src/api/pubsub/index.js | 16 - js-old/src/api/pubsub/net/index.js | 16 - js-old/src/api/pubsub/net/net.js | 42 - js-old/src/api/pubsub/parity/index.js | 16 - js-old/src/api/pubsub/parity/parity.js | 356 --- js-old/src/api/pubsub/pubsub.js | 50 - js-old/src/api/pubsub/pubsub.spec.js | 613 ----- js-old/src/api/pubsub/pubsubBase.js | 37 - js-old/src/api/rpc/db/db.js | 43 - js-old/src/api/rpc/db/db.spec.js | 38 - js-old/src/api/rpc/db/index.js | 17 - js-old/src/api/rpc/eth/eth.e2e.js | 170 -- js-old/src/api/rpc/eth/eth.js | 321 --- js-old/src/api/rpc/eth/eth.spec.js | 474 ---- js-old/src/api/rpc/eth/index.js | 17 - js-old/src/api/rpc/index.js | 25 - js-old/src/api/rpc/net/index.js | 17 - js-old/src/api/rpc/net/net.e2e.js | 46 - js-old/src/api/rpc/net/net.js | 39 - js-old/src/api/rpc/net/net.spec.js | 36 - js-old/src/api/rpc/parity/index.js | 17 - js-old/src/api/rpc/parity/parity.e2e.js | 79 - js-old/src/api/rpc/parity/parity.js | 578 ----- js-old/src/api/rpc/parity/parity.spec.js | 146 -- js-old/src/api/rpc/personal/index.js | 17 - js-old/src/api/rpc/personal/personal.e2e.js | 53 - js-old/src/api/rpc/personal/personal.js | 46 - js-old/src/api/rpc/personal/personal.spec.js | 75 - js-old/src/api/rpc/shh/index.js | 17 - js-old/src/api/rpc/shh/shh.js | 91 - js-old/src/api/rpc/signer/index.js | 17 - js-old/src/api/rpc/signer/signer.js | 65 - js-old/src/api/rpc/trace/index.js | 17 - js-old/src/api/rpc/trace/trace.e2e.js | 45 - js-old/src/api/rpc/trace/trace.js | 66 - js-old/src/api/rpc/trace/trace.spec.js | 44 - js-old/src/api/rpc/web3/index.js | 17 - js-old/src/api/rpc/web3/web3.e2e.js | 44 - js-old/src/api/rpc/web3/web3.js | 33 - js-old/src/api/rpc/web3/web3.spec.js | 38 - js-old/src/api/subscriptions/eth.js | 63 - js-old/src/api/subscriptions/eth.spec.js | 101 - js-old/src/api/subscriptions/index.js | 19 - js-old/src/api/subscriptions/logging.js | 44 - js-old/src/api/subscriptions/logging.spec.js | 49 - js-old/src/api/subscriptions/manager.js | 137 -- js-old/src/api/subscriptions/manager.spec.js | 134 -- js-old/src/api/subscriptions/personal.js | 135 -- js-old/src/api/subscriptions/personal.spec.js | 156 -- js-old/src/api/subscriptions/signer.js | 91 - js-old/src/api/transport/error.js | 61 - js-old/src/api/transport/http/http.e2e.js | 29 - js-old/src/api/transport/http/http.js | 103 - js-old/src/api/transport/http/http.spec.js | 142 -- js-old/src/api/transport/http/index.js | 17 - js-old/src/api/transport/index.js | 20 - js-old/src/api/transport/jsonRpcBase.js | 145 -- js-old/src/api/transport/jsonRpcBase.spec.js | 88 - js-old/src/api/transport/middleware.js | 44 - js-old/src/api/transport/middleware.spec.js | 62 - js-old/src/api/transport/ws/index.js | 17 - js-old/src/api/transport/ws/ws.e2e.js | 29 - js-old/src/api/transport/ws/ws.js | 387 --- js-old/src/api/transport/ws/ws.spec.js | 116 - js-old/src/api/util/decode.js | 95 - js-old/src/api/util/decode.spec.js | 105 - js-old/src/api/util/encode.js | 69 - js-old/src/api/util/encode.spec.js | 90 - js-old/src/api/util/format.js | 106 - js-old/src/api/util/format.spec.js | 94 - js-old/src/api/util/identity.js | 30 - js-old/src/api/util/index.js | 51 - js-old/src/api/util/sha3.js | 36 - js-old/src/api/util/sha3.spec.js | 46 - js-old/src/api/util/types.js | 60 - js-old/src/api/util/types.spec.js | 118 - js-old/src/api/util/wei.js | 37 - js-old/src/api/util/wei.spec.js | 57 - js-old/src/contracts/badgereg.js | 2 +- js-old/src/contracts/registry.spec.js | 2 +- js-old/src/dapps/chaindeploy.js | 29 - .../chaindeploy/Application/application.css | 78 - .../chaindeploy/Application/application.js | 178 -- .../dapps/chaindeploy/Application/index.js | 17 - .../dapps/chaindeploy/Contract/contract.js | 132 -- .../src/dapps/chaindeploy/Contract/index.js | 17 - js-old/src/dapps/chaindeploy/Dapp/dapp.js | 98 - js-old/src/dapps/chaindeploy/Dapp/index.js | 17 - .../chaindeploy/ListItem/Header/header.js | 45 - .../chaindeploy/ListItem/Header/index.js | 17 - .../dapps/chaindeploy/ListItem/Icon/icon.js | 53 - .../dapps/chaindeploy/ListItem/Icon/index.js | 17 - .../dapps/chaindeploy/ListItem/Row/index.js | 17 - .../src/dapps/chaindeploy/ListItem/Row/row.js | 54 - .../src/dapps/chaindeploy/ListItem/index.js | 20 - .../dapps/chaindeploy/ListItem/listItem.css | 94 - .../dapps/chaindeploy/ListItem/listItem.js | 63 - js-old/src/dapps/chaindeploy/_dapps.js | 43 - .../chaindeploy/contracts/abi/jg-voting.json | 1 - .../dapps/chaindeploy/contracts/badgereg.js | 30 - .../chaindeploy/contracts/code/badgereg.json | 5 - .../chaindeploy/contracts/code/dappreg.json | 5 - .../chaindeploy/contracts/code/gavcoin.json | 5 - .../contracts/code/githubhint.json | 5 - .../chaindeploy/contracts/code/jg-voting.json | 5 - .../chaindeploy/contracts/code/registry.json | 5 - .../contracts/code/signaturereg.json | 5 - .../contracts/code/tokendeploy.json | 5 - .../chaindeploy/contracts/code/tokenreg.json | 5 - .../contracts/code/verifyEmail.json | 5 - .../chaindeploy/contracts/code/verifySms.json | 5 - .../dapps/chaindeploy/contracts/dappreg.js | 30 - .../dapps/chaindeploy/contracts/gavcoin.js | 32 - .../dapps/chaindeploy/contracts/githubhint.js | 30 - .../src/dapps/chaindeploy/contracts/index.js | 52 - .../dapps/chaindeploy/contracts/jg-voting.js | 32 - .../dapps/chaindeploy/contracts/registry.js | 30 - .../chaindeploy/contracts/signaturereg.js | 30 - .../chaindeploy/contracts/tokendeployMgr.js | 30 - .../chaindeploy/contracts/tokendeployReg.js | 28 - .../dapps/chaindeploy/contracts/tokenreg.js | 30 - .../chaindeploy/contracts/verifyEmail.js | 37 - .../dapps/chaindeploy/contracts/verifySms.js | 37 - .../src/dapps/chaindeploy/contracts/wallet.js | 29 - js-old/src/dapps/chaindeploy/dapps/console.js | 33 - js-old/src/dapps/chaindeploy/dapps/dappreg.js | 33 - js-old/src/dapps/chaindeploy/dapps/gavcoin.js | 41 - .../src/dapps/chaindeploy/dapps/githubhint.js | 33 - js-old/src/dapps/chaindeploy/dapps/index.js | 50 - .../src/dapps/chaindeploy/dapps/jg-voting.js | 41 - .../dapps/chaindeploy/dapps/jg-whenblock.js | 39 - js-old/src/dapps/chaindeploy/dapps/localtx.js | 33 - .../src/dapps/chaindeploy/dapps/registry.js | 33 - .../dapps/chaindeploy/dapps/signaturereg.js | 33 - .../dapps/chaindeploy/dapps/tokendeploy.js | 33 - .../src/dapps/chaindeploy/dapps/tokenreg.js | 33 - js-old/src/dapps/chaindeploy/dapps/web.js | 33 - js-old/src/dapps/chaindeploy/parity.js | 21 - js-old/src/dapps/chaindeploy/store.js | 714 ------ js-old/src/dapps/chaindeploy/utils.js | 82 - js-old/src/dapps/console.js | 59 - .../dapps/console/Application/application.css | 65 - .../dapps/console/Application/application.js | 94 - .../console/Application/application.store.js | 42 - js-old/src/dapps/console/Application/index.js | 17 - .../console/Autocomplete/autocomplete.css | 55 - .../console/Autocomplete/autocomplete.js | 96 - .../Autocomplete/autocomplete.store.js | 234 -- .../src/dapps/console/Autocomplete/index.js | 17 - js-old/src/dapps/console/Console/console.css | 58 - js-old/src/dapps/console/Console/console.js | 118 - .../dapps/console/Console/console.store.js | 126 - js-old/src/dapps/console/Console/index.js | 17 - js-old/src/dapps/console/Header/header.css | 51 - js-old/src/dapps/console/Header/header.js | 65 - js-old/src/dapps/console/Header/index.js | 17 - js-old/src/dapps/console/Input/index.js | 17 - js-old/src/dapps/console/Input/input.css | 46 - js-old/src/dapps/console/Input/input.js | 145 -- js-old/src/dapps/console/Input/input.store.js | 124 - js-old/src/dapps/console/Settings/index.js | 17 - .../src/dapps/console/Settings/settings.css | 32 - js-old/src/dapps/console/Settings/settings.js | 70 - .../dapps/console/Settings/settings.store.js | 71 - js-old/src/dapps/console/Snippets/index.js | 17 - .../src/dapps/console/Snippets/snippets.css | 122 - js-old/src/dapps/console/Snippets/snippets.js | 221 -- .../dapps/console/Snippets/snippets.store.js | 249 -- js-old/src/dapps/console/Watches/index.js | 17 - js-old/src/dapps/console/Watches/watches.css | 107 - js-old/src/dapps/console/Watches/watches.js | 186 -- .../dapps/console/Watches/watches.store.js | 148 -- js-old/src/dapps/console/codemirror.css | 36 - js-old/src/dapps/console/parity.js | 331 --- js-old/src/dapps/console/utils.js | 36 - js-old/src/dapps/dappreg.js | 48 - .../dapps/dappreg/Application/application.css | 59 - .../dapps/dappreg/Application/application.js | 69 - js-old/src/dapps/dappreg/Application/index.js | 17 - js-old/src/dapps/dappreg/Button/button.css | 47 - js-old/src/dapps/dappreg/Button/button.js | 55 - js-old/src/dapps/dappreg/Button/index.js | 17 - js-old/src/dapps/dappreg/Card/card.css | 66 - js-old/src/dapps/dappreg/Card/card.js | 99 - js-old/src/dapps/dappreg/Card/index.js | 17 - .../dappreg/CreateDappCard/createDappCard.js | 84 - .../src/dapps/dappreg/CreateDappCard/index.js | 17 - .../src/dapps/dappreg/DappCard/dappCard.css | 22 - js-old/src/dapps/dappreg/DappCard/dappCard.js | 110 - js-old/src/dapps/dappreg/DappCard/index.js | 17 - .../src/dapps/dappreg/DappModal/dappModal.css | 82 - .../src/dapps/dappreg/DappModal/dappModal.js | 423 ---- js-old/src/dapps/dappreg/DappModal/index.js | 17 - js-old/src/dapps/dappreg/Dapps/dapps.css | 38 - js-old/src/dapps/dappreg/Dapps/dapps.js | 73 - js-old/src/dapps/dappreg/Dapps/index.js | 17 - js-old/src/dapps/dappreg/Input/index.js | 17 - js-old/src/dapps/dappreg/Input/input.css | 96 - js-old/src/dapps/dappreg/Input/input.js | 53 - js-old/src/dapps/dappreg/Modal/index.js | 17 - js-old/src/dapps/dappreg/Modal/modal.css | 141 -- js-old/src/dapps/dappreg/Modal/modal.js | 160 -- js-old/src/dapps/dappreg/ModalDelete/index.js | 17 - .../dapps/dappreg/ModalDelete/modalDelete.js | 61 - .../src/dapps/dappreg/ModalRegister/index.js | 17 - .../dappreg/ModalRegister/modalRegister.js | 68 - js-old/src/dapps/dappreg/ModalUpdate/index.js | 17 - .../dapps/dappreg/ModalUpdate/modalUpdate.js | 84 - .../src/dapps/dappreg/SelectAccount/index.js | 17 - .../dappreg/SelectAccount/selectAccount.js | 57 - .../src/dapps/dappreg/Transactions/index.js | 17 - .../dappreg/Transactions/transactions.css | 95 - .../dappreg/Transactions/transactions.js | 136 -- js-old/src/dapps/dappreg/Warning/index.js | 17 - js-old/src/dapps/dappreg/Warning/warning.css | 38 - js-old/src/dapps/dappreg/Warning/warning.js | 55 - js-old/src/dapps/dappreg/_colors.css | 30 - js-old/src/dapps/dappreg/_utils.css | 22 - js-old/src/dapps/dappreg/dappStore.js | 153 -- js-old/src/dapps/dappreg/dappsStore.js | 522 ----- js-old/src/dapps/dappreg/parity.js | 45 - js-old/src/dapps/dappreg/utils.js | 190 -- js-old/src/dapps/dappreg/utils.spec.js | 33 - js-old/src/dapps/githubhint.js | 48 - .../githubhint/Application/application.css | 161 -- .../githubhint/Application/application.js | 521 ----- .../src/dapps/githubhint/Application/index.js | 17 - js-old/src/dapps/githubhint/Button/button.css | 56 - js-old/src/dapps/githubhint/Button/button.js | 53 - js-old/src/dapps/githubhint/Button/index.js | 17 - js-old/src/dapps/githubhint/Events/events.css | 37 - js-old/src/dapps/githubhint/Events/events.js | 52 - js-old/src/dapps/githubhint/Events/index.js | 17 - js-old/src/dapps/githubhint/Loading/index.js | 17 - .../src/dapps/githubhint/Loading/loading.css | 24 - .../src/dapps/githubhint/Loading/loading.js | 29 - js-old/src/dapps/githubhint/parity.js | 21 - js-old/src/dapps/githubhint/services.js | 60 - js-old/src/dapps/index.ejs | 37 - js-old/src/dapps/localtx.js | 48 - .../dapps/localtx/Application/application.css | 43 - .../dapps/localtx/Application/application.js | 212 -- .../localtx/Application/application.spec.js | 32 - js-old/src/dapps/localtx/Application/index.js | 17 - .../localtx/IdentityIcon/identityIcon.css | 23 - .../localtx/IdentityIcon/identityIcon.js | 37 - .../src/dapps/localtx/IdentityIcon/index.js | 17 - js-old/src/dapps/localtx/Transaction/index.js | 17 - .../dapps/localtx/Transaction/transaction.css | 39 - .../dapps/localtx/Transaction/transaction.js | 395 ---- .../localtx/Transaction/transaction.spec.js | 67 - js-old/src/dapps/localtx/parity.js | 21 - js-old/src/dapps/registry.js | 49 - .../src/dapps/registry/Accounts/accounts.css | 24 - .../src/dapps/registry/Accounts/accounts.js | 66 - js-old/src/dapps/registry/Accounts/actions.js | 40 - js-old/src/dapps/registry/Accounts/index.js | 17 - .../registry/Application/application.css | 66 - .../dapps/registry/Application/application.js | 138 -- .../src/dapps/registry/Application/index.js | 17 - js-old/src/dapps/registry/Container.js | 68 - js-old/src/dapps/registry/Events/actions.js | 102 - js-old/src/dapps/registry/Events/events.css | 57 - js-old/src/dapps/registry/Events/events.js | 315 --- js-old/src/dapps/registry/Events/index.js | 17 - js-old/src/dapps/registry/Events/reducers.js | 90 - .../registry/IdentityIcon/identityIcon.css | 23 - .../registry/IdentityIcon/identityIcon.js | 40 - .../src/dapps/registry/IdentityIcon/index.js | 17 - js-old/src/dapps/registry/Lookup/actions.js | 108 - js-old/src/dapps/registry/Lookup/index.js | 17 - js-old/src/dapps/registry/Lookup/lookup.css | 26 - js-old/src/dapps/registry/Lookup/lookup.js | 179 -- js-old/src/dapps/registry/Lookup/reducers.js | 48 - js-old/src/dapps/registry/Names/actions.js | 135 -- js-old/src/dapps/registry/Names/index.js | 17 - js-old/src/dapps/registry/Names/names.css | 46 - js-old/src/dapps/registry/Names/names.js | 191 -- js-old/src/dapps/registry/Names/reducers.js | 75 - js-old/src/dapps/registry/Records/actions.js | 75 - js-old/src/dapps/registry/Records/index.js | 1 - js-old/src/dapps/registry/Records/records.css | 42 - js-old/src/dapps/registry/Records/records.js | 137 -- js-old/src/dapps/registry/Records/reducers.js | 55 - js-old/src/dapps/registry/Reverse/actions.js | 117 - js-old/src/dapps/registry/Reverse/index.js | 1 - js-old/src/dapps/registry/Reverse/reducers.js | 85 - js-old/src/dapps/registry/Reverse/reverse.css | 42 - js-old/src/dapps/registry/Reverse/reverse.js | 162 -- js-old/src/dapps/registry/actions.js | 95 - .../registry/addresses/accounts-reducer.js | 39 - .../src/dapps/registry/addresses/actions.js | 38 - .../registry/addresses/contacts-reducer.js | 32 - js-old/src/dapps/registry/parity.js | 23 - js-old/src/dapps/registry/reducers.js | 63 - js-old/src/dapps/registry/store.js | 22 - js-old/src/dapps/registry/ui/address.css | 41 - js-old/src/dapps/registry/ui/address.js | 120 - js-old/src/dapps/registry/ui/hash.css | 25 - js-old/src/dapps/registry/ui/hash.js | 67 - js-old/src/dapps/registry/ui/image.js | 40 - js-old/src/dapps/registry/util/actions.js | 31 - .../src/dapps/registry/util/etherscan-url.js | 28 - js-old/src/dapps/registry/util/post-tx.js | 30 - js-old/src/dapps/registry/util/registry.js | 37 - js-old/src/dapps/signaturereg.js | 48 - .../signaturereg/Application/application.css | 29 - .../signaturereg/Application/application.js | 121 - .../dapps/signaturereg/Application/index.js | 17 - .../src/dapps/signaturereg/Button/button.css | 43 - .../src/dapps/signaturereg/Button/button.js | 50 - js-old/src/dapps/signaturereg/Button/index.js | 17 - .../src/dapps/signaturereg/Events/events.css | 76 - .../src/dapps/signaturereg/Events/events.js | 84 - js-old/src/dapps/signaturereg/Events/index.js | 17 - .../src/dapps/signaturereg/Header/header.css | 67 - .../src/dapps/signaturereg/Header/header.js | 48 - js-old/src/dapps/signaturereg/Header/index.js | 17 - .../IdentityIcon/identityIcon.css | 23 - .../signaturereg/IdentityIcon/identityIcon.js | 37 - .../dapps/signaturereg/IdentityIcon/index.js | 17 - .../src/dapps/signaturereg/Import/import.css | 151 -- .../src/dapps/signaturereg/Import/import.js | 204 -- js-old/src/dapps/signaturereg/Import/index.js | 17 - .../src/dapps/signaturereg/Loading/index.js | 17 - .../dapps/signaturereg/Loading/loading.css | 24 - .../src/dapps/signaturereg/Loading/loading.js | 29 - js-old/src/dapps/signaturereg/format.js | 40 - js-old/src/dapps/signaturereg/parity.js | 21 - js-old/src/dapps/signaturereg/services.js | 181 -- js-old/src/dapps/static/.gitkeep | 0 js-old/src/dapps/style.css | 48 - js-old/src/dapps/tokendeploy.js | 68 - .../AddressSelect/addressSelect.css | 27 - .../AddressSelect/addressSelect.js | 95 - .../dapps/tokendeploy/AddressSelect/index.js | 17 - .../tokendeploy/Application/Header/header.css | 71 - .../tokendeploy/Application/Header/header.js | 81 - .../tokendeploy/Application/Header/index.js | 17 - .../tokendeploy/Application/Loading/index.js | 17 - .../Application/Loading/loading.css | 24 - .../Application/Loading/loading.js | 29 - .../tokendeploy/Application/application.css | 28 - .../tokendeploy/Application/application.js | 107 - .../dapps/tokendeploy/Application/index.js | 17 - .../dapps/tokendeploy/Application/pages.js | 38 - .../dapps/tokendeploy/Container/container.css | 26 - .../dapps/tokendeploy/Container/container.js | 37 - .../src/dapps/tokendeploy/Container/index.js | 17 - .../Deploy/Deployment/deployment.css | 19 - .../Deploy/Deployment/deployment.js | 321 --- .../tokendeploy/Deploy/Deployment/index.js | 17 - .../dapps/tokendeploy/Deploy/Event/event.css | 69 - .../dapps/tokendeploy/Deploy/Event/event.js | 104 - .../dapps/tokendeploy/Deploy/Event/index.js | 17 - .../tokendeploy/Deploy/Events/events.css | 41 - .../dapps/tokendeploy/Deploy/Events/events.js | 145 -- .../dapps/tokendeploy/Deploy/Events/index.js | 17 - js-old/src/dapps/tokendeploy/Deploy/deploy.js | 31 - js-old/src/dapps/tokendeploy/Deploy/index.js | 17 - .../tokendeploy/IdentityIcon/identityIcon.css | 22 - .../tokendeploy/IdentityIcon/identityIcon.js | 39 - .../dapps/tokendeploy/IdentityIcon/index.js | 17 - .../dapps/tokendeploy/Overview/Owner/index.js | 17 - .../tokendeploy/Overview/Owner/owner.css | 54 - .../dapps/tokendeploy/Overview/Owner/owner.js | 79 - .../dapps/tokendeploy/Overview/Token/index.js | 17 - .../tokendeploy/Overview/Token/token.css | 53 - .../dapps/tokendeploy/Overview/Token/token.js | 68 - .../src/dapps/tokendeploy/Overview/index.js | 17 - .../dapps/tokendeploy/Overview/overview.css | 26 - .../dapps/tokendeploy/Overview/overview.js | 105 - .../dapps/tokendeploy/Transfer/Event/event.js | 106 - .../dapps/tokendeploy/Transfer/Event/index.js | 17 - .../tokendeploy/Transfer/Events/events.js | 151 -- .../tokendeploy/Transfer/Events/index.js | 17 - .../dapps/tokendeploy/Transfer/Send/index.js | 17 - .../dapps/tokendeploy/Transfer/Send/send.css | 19 - .../dapps/tokendeploy/Transfer/Send/send.js | 345 --- .../src/dapps/tokendeploy/Transfer/index.js | 17 - .../dapps/tokendeploy/Transfer/transfer.js | 31 - js-old/src/dapps/tokendeploy/_form.css | 108 - js-old/src/dapps/tokendeploy/_status.css | 36 - js-old/src/dapps/tokendeploy/background.jpg | Bin 127459 -> 0 bytes js-old/src/dapps/tokendeploy/parity.js | 21 - js-old/src/dapps/tokendeploy/services.js | 293 --- js-old/src/dapps/tokenreg.js | 54 - .../AccountSelector/account-selector.css | 25 - .../AccountSelector/account-selector.js | 130 -- .../Accounts/AccountSelector/container.js | 51 - .../Accounts/AccountSelector/index.js | 17 - js-old/src/dapps/tokenreg/Accounts/actions.js | 55 - js-old/src/dapps/tokenreg/Accounts/reducer.js | 57 - .../src/dapps/tokenreg/Actions/Query/index.js | 17 - .../src/dapps/tokenreg/Actions/Query/query.js | 217 -- .../dapps/tokenreg/Actions/Register/index.js | 17 - .../tokenreg/Actions/Register/register.js | 235 -- js-old/src/dapps/tokenreg/Actions/actions.css | 50 - js-old/src/dapps/tokenreg/Actions/actions.js | 179 -- .../src/dapps/tokenreg/Actions/component.js | 119 - .../src/dapps/tokenreg/Actions/container.js | 60 - js-old/src/dapps/tokenreg/Actions/index.js | 17 - js-old/src/dapps/tokenreg/Actions/reducer.js | 155 -- .../tokenreg/Application/application.css | 35 - .../dapps/tokenreg/Application/application.js | 77 - .../src/dapps/tokenreg/Application/index.js | 17 - js-old/src/dapps/tokenreg/Chip/chip.css | 45 - js-old/src/dapps/tokenreg/Chip/chip.js | 72 - js-old/src/dapps/tokenreg/Chip/index.js | 17 - js-old/src/dapps/tokenreg/Container.js | 66 - .../tokenreg/IdentityIcon/identityIcon.css | 23 - .../tokenreg/IdentityIcon/identityIcon.js | 37 - .../src/dapps/tokenreg/IdentityIcon/index.js | 17 - .../dapps/tokenreg/Inputs/Text/container.js | 38 - .../src/dapps/tokenreg/Inputs/Text/index.js | 17 - .../dapps/tokenreg/Inputs/Text/input-text.js | 149 -- js-old/src/dapps/tokenreg/Inputs/inputs.css | 33 - .../src/dapps/tokenreg/Inputs/validation.js | 253 -- js-old/src/dapps/tokenreg/Loading/index.js | 17 - js-old/src/dapps/tokenreg/Loading/loading.css | 23 - js-old/src/dapps/tokenreg/Loading/loading.js | 36 - js-old/src/dapps/tokenreg/Status/actions.js | 185 -- js-old/src/dapps/tokenreg/Status/index.js | 17 - js-old/src/dapps/tokenreg/Status/reducer.js | 63 - js-old/src/dapps/tokenreg/Status/status.css | 42 - js-old/src/dapps/tokenreg/Status/status.js | 45 - .../dapps/tokenreg/Tokens/Token/add-meta.js | 227 -- .../src/dapps/tokenreg/Tokens/Token/index.js | 17 - .../src/dapps/tokenreg/Tokens/Token/token.css | 140 -- .../src/dapps/tokenreg/Tokens/Token/token.js | 399 ---- .../tokenreg/Tokens/Token/tokenContainer.js | 73 - js-old/src/dapps/tokenreg/Tokens/actions.js | 261 --- js-old/src/dapps/tokenreg/Tokens/container.js | 65 - js-old/src/dapps/tokenreg/Tokens/index.js | 17 - js-old/src/dapps/tokenreg/Tokens/reducer.js | 114 - js-old/src/dapps/tokenreg/Tokens/tokens.css | 24 - js-old/src/dapps/tokenreg/Tokens/tokens.js | 52 - js-old/src/dapps/tokenreg/constants.js | 30 - js-old/src/dapps/tokenreg/parity.js | 21 - js-old/src/dapps/tokenreg/reducers.js | 28 - js-old/src/dapps/tokenreg/store.js | 22 - js-old/src/dapps/tokenreg/utils.js | 76 - js-old/src/dev.parity.html | 36 - js-old/src/dev.web3.html | 38 - js-old/src/embed.js | 132 -- js-old/src/error_pages.css | 113 - js-old/src/inject.js | 18 - js-old/src/jsonrpc/.gitignore | 1 - js-old/src/jsonrpc/README.md | 21 - js-old/src/jsonrpc/helpers.js | 92 - js-old/src/jsonrpc/index.js | 37 - js-old/src/jsonrpc/index.spec.js | 49 - js-old/src/jsonrpc/interfaces/db.js | 107 - js-old/src/jsonrpc/interfaces/eth.js | 1319 ----------- js-old/src/jsonrpc/interfaces/net.js | 51 - js-old/src/jsonrpc/interfaces/parity.js | 2070 ----------------- js-old/src/jsonrpc/interfaces/personal.js | 101 - js-old/src/jsonrpc/interfaces/shh.js | 291 --- js-old/src/jsonrpc/interfaces/signer.js | 237 -- js-old/src/jsonrpc/interfaces/trace.js | 376 --- js-old/src/jsonrpc/interfaces/web3.js | 46 - js-old/src/jsonrpc/types.js | 202 -- js-old/src/library.etherscan.js | 33 - js-old/src/library.jsonrpc.js | 19 - js-old/src/library.parity.js | 34 - js-old/src/library.shapeshift.js | 33 - js-old/src/main.js | 6 +- js-old/src/manifest.json | 2 +- .../src/modals/CreateAccount/createAccount.js | 2 +- .../CreateAccount/createAccount.test.js | 2 +- js-old/src/modals/CreateAccount/store.js | 2 +- .../CreateWallet/WalletInfo/walletInfo.js | 2 +- .../modals/CreateWallet/createWalletStore.js | 4 +- .../modals/ExecuteContract/executeContract.js | 2 +- js-old/src/modals/Faucet/store.js | 2 +- js-old/src/modals/FirstRun/firstRun.js | 2 +- js-old/src/modals/Transfer/store.js | 2 +- .../Verification/GatherData/gatherData.js | 2 +- js-old/src/modals/Verification/email-store.js | 4 +- js-old/src/modals/Verification/store.js | 4 +- .../modals/WalletSettings/walletSettings.js | 2 +- js-old/src/parity.js | 31 - js-old/src/redux/providers/balancesActions.js | 2 +- .../certifications/certifiers.monitor.js | 4 +- .../certifications/enhanced-querier.js | 2 +- js-old/src/redux/providers/imagesReducer.js | 2 +- js-old/src/redux/providers/personalActions.js | 2 +- js-old/src/redux/providers/requestsActions.js | 2 +- .../src/redux/providers/signerMiddleware.js | 2 +- js-old/src/redux/providers/tokens.js | 2 +- js-old/src/redux/providers/walletActions.js | 4 +- js-old/src/routes.js | 36 +- js-old/src/ui/Balance/balance.spec.js | 2 +- .../ui/Form/AddressSelect/addressSelect.js | 2 +- .../Form/AddressSelect/addressSelectStore.js | 2 +- .../src/ui/Form/InputAddress/inputAddress.js | 2 +- js-old/src/ui/Form/TypedInput/typedInput.js | 4 +- js-old/src/ui/IdentityIcon/identityIcon.js | 2 +- .../ui/MethodDecoding/methodDecodingStore.js | 4 +- js-old/src/ui/TxList/TxRow/txRow.spec.js | 7 +- js-old/src/ui/TxList/txList.spec.js | 7 +- js-old/src/util/dapps.js | 2 +- js-old/src/util/qrscan.js | 4 +- js-old/src/util/signer.js | 4 +- js-old/src/util/tokens/index.js | 2 +- js-old/src/util/validation.js | 2 +- js-old/src/util/wallets/consensys-wallet.js | 6 +- js-old/src/util/wallets/foundation-wallet.js | 6 +- js-old/src/util/web3.extensions.js | 48 - js-old/src/views/Home/home.css | 5 +- js-old/src/views/Home/home.js | 67 +- js-old/src/views/Settings/Views/defaults.js | 16 +- js-old/src/views/Settings/Views/views.js | 11 - .../Wallet/Confirmations/confirmations.js | 2 +- .../views/Wallet/Transactions/transactions.js | 2 +- .../views/WriteContract/writeContractStore.js | 2 +- js-old/src/views/index.js | 8 +- js-old/src/web3.js | 36 - js-old/test/e2e/ethapi.js | 14 +- js-old/test/mockRpc.js | 2 +- js-old/test/npmJsonRpc.js | 29 - js-old/test/npmParity.js | 45 - js-old/test/types.js | 6 +- js-old/webpack/app.js | 114 +- js-old/webpack/embed.js | 49 - js-old/webpack/npm.js | 137 -- js-old/webpack/shared.js | 7 +- js/assets/parity-logo-black-no-text.png | Bin 0 -> 1777 bytes js/src/Application/application.css | 7 +- js/src/Application/application.js | 10 +- js/src/Dapp/dapp.css | 5 +- js/src/Status/status.css | 21 +- js/src/Status/status.js | 104 +- 632 files changed, 232 insertions(+), 46825 deletions(-) delete mode 100644 js-old/npm/etherscan/README.md delete mode 100644 js-old/npm/etherscan/package.json delete mode 100644 js-old/npm/jsonrpc/README.md delete mode 100644 js-old/npm/jsonrpc/package.json delete mode 100644 js-old/npm/parity/README.md delete mode 100644 js-old/npm/parity/package.json delete mode 100644 js-old/npm/parity/test/smoke.spec.js delete mode 100644 js-old/npm/shapeshift/README.md delete mode 100644 js-old/npm/shapeshift/package.json delete mode 100644 js-old/npm/test/mocha.config.js delete mode 100644 js-old/npm/test/mocha.opts delete mode 100644 js-old/scripts/build-rpc-json.js delete mode 100644 js-old/scripts/build-rpc-markdown.js delete mode 100755 js-old/scripts/dryrun-npm.sh delete mode 100644 js-old/scripts/helpers/log.js delete mode 100644 js-old/scripts/helpers/parsed-rpc-traits.js delete mode 100644 js-old/src/abi/README.md delete mode 100644 js-old/src/abi/abi.js delete mode 100644 js-old/src/abi/decoder/bytesTaken.js delete mode 100644 js-old/src/abi/decoder/bytesTaken.spec.js delete mode 100644 js-old/src/abi/decoder/decodeResult.js delete mode 100644 js-old/src/abi/decoder/decodeResult.spec.js delete mode 100644 js-old/src/abi/decoder/decoder.js delete mode 100644 js-old/src/abi/decoder/decoder.spec.js delete mode 100644 js-old/src/abi/decoder/index.js delete mode 100644 js-old/src/abi/encoder/encoder.js delete mode 100644 js-old/src/abi/encoder/encoder.spec.js delete mode 100644 js-old/src/abi/encoder/index.js delete mode 100644 js-old/src/abi/encoder/mediate.js delete mode 100644 js-old/src/abi/encoder/mediate.spec.js delete mode 100644 js-old/src/abi/index.js delete mode 100644 js-old/src/abi/spec/constructor.js delete mode 100644 js-old/src/abi/spec/constructor.spec.js delete mode 100644 js-old/src/abi/spec/event/decodedLog.js delete mode 100644 js-old/src/abi/spec/event/decodedLog.spec.js delete mode 100644 js-old/src/abi/spec/event/decodedLogParam.js delete mode 100644 js-old/src/abi/spec/event/decodedLogParam.spec.js delete mode 100644 js-old/src/abi/spec/event/event.js delete mode 100644 js-old/src/abi/spec/event/event.spec.js delete mode 100644 js-old/src/abi/spec/event/eventParam.js delete mode 100644 js-old/src/abi/spec/event/eventParam.spec.js delete mode 100644 js-old/src/abi/spec/event/index.js delete mode 100644 js-old/src/abi/spec/function.js delete mode 100644 js-old/src/abi/spec/function.spec.js delete mode 100644 js-old/src/abi/spec/index.js delete mode 100644 js-old/src/abi/spec/interface.js delete mode 100644 js-old/src/abi/spec/interface.spec.js delete mode 100644 js-old/src/abi/spec/param.js delete mode 100644 js-old/src/abi/spec/param.spec.js delete mode 100644 js-old/src/abi/spec/paramType/format.js delete mode 100644 js-old/src/abi/spec/paramType/format.spec.js delete mode 100644 js-old/src/abi/spec/paramType/index.js delete mode 100644 js-old/src/abi/spec/paramType/paramType.js delete mode 100644 js-old/src/abi/spec/paramType/paramType.spec.js delete mode 100644 js-old/src/abi/spec/paramType/types.js delete mode 100644 js-old/src/abi/token/index.js delete mode 100644 js-old/src/abi/token/token.js delete mode 100644 js-old/src/abi/token/token.spec.js delete mode 100644 js-old/src/abi/util/address.js delete mode 100644 js-old/src/abi/util/address.spec.js delete mode 100644 js-old/src/abi/util/pad.js delete mode 100644 js-old/src/abi/util/pad.spec.js delete mode 100644 js-old/src/abi/util/signature.js delete mode 100644 js-old/src/abi/util/signature.spec.js delete mode 100644 js-old/src/abi/util/slice.js delete mode 100644 js-old/src/abi/util/slice.spec.js delete mode 100644 js-old/src/abi/util/sliceAs.js delete mode 100644 js-old/src/abi/util/sliceAs.spec.js delete mode 100644 js-old/src/abi/util/types.js delete mode 100644 js-old/src/abi/util/types.spec.js delete mode 100644 js-old/src/api/README.md delete mode 100644 js-old/src/api/api.js delete mode 100644 js-old/src/api/api.spec.js delete mode 100644 js-old/src/api/contract/contract.js delete mode 100644 js-old/src/api/contract/contract.spec.js delete mode 100644 js-old/src/api/contract/index.js delete mode 100644 js-old/src/api/format/input.js delete mode 100644 js-old/src/api/format/input.spec.js delete mode 100644 js-old/src/api/format/output.js delete mode 100644 js-old/src/api/format/output.spec.js delete mode 100644 js-old/src/api/index.js delete mode 100644 js-old/src/api/local/accounts/account.js delete mode 100644 js-old/src/api/local/accounts/accounts.js delete mode 100644 js-old/src/api/local/accounts/index.js delete mode 100644 js-old/src/api/local/ethkey/ethkey.js delete mode 100644 js-old/src/api/local/ethkey/ethkey.wasm.js delete mode 100644 js-old/src/api/local/ethkey/index.js delete mode 100644 js-old/src/api/local/ethkey/index.spec.js delete mode 100644 js-old/src/api/local/ethkey/worker.js delete mode 100644 js-old/src/api/local/ethkey/workerPool.js delete mode 100644 js-old/src/api/local/index.js delete mode 100644 js-old/src/api/local/localAccountsMiddleware.js delete mode 100644 js-old/src/api/local/localAccountsMiddleware.spec.js delete mode 100644 js-old/src/api/local/transactions.js delete mode 100644 js-old/src/api/local/transactions.spec.js delete mode 100644 js-old/src/api/pubsub/eth/eth.js delete mode 100644 js-old/src/api/pubsub/eth/index.js delete mode 100644 js-old/src/api/pubsub/index.js delete mode 100644 js-old/src/api/pubsub/net/index.js delete mode 100644 js-old/src/api/pubsub/net/net.js delete mode 100644 js-old/src/api/pubsub/parity/index.js delete mode 100644 js-old/src/api/pubsub/parity/parity.js delete mode 100644 js-old/src/api/pubsub/pubsub.js delete mode 100644 js-old/src/api/pubsub/pubsub.spec.js delete mode 100644 js-old/src/api/pubsub/pubsubBase.js delete mode 100644 js-old/src/api/rpc/db/db.js delete mode 100644 js-old/src/api/rpc/db/db.spec.js delete mode 100644 js-old/src/api/rpc/db/index.js delete mode 100644 js-old/src/api/rpc/eth/eth.e2e.js delete mode 100644 js-old/src/api/rpc/eth/eth.js delete mode 100644 js-old/src/api/rpc/eth/eth.spec.js delete mode 100644 js-old/src/api/rpc/eth/index.js delete mode 100644 js-old/src/api/rpc/index.js delete mode 100644 js-old/src/api/rpc/net/index.js delete mode 100644 js-old/src/api/rpc/net/net.e2e.js delete mode 100644 js-old/src/api/rpc/net/net.js delete mode 100644 js-old/src/api/rpc/net/net.spec.js delete mode 100644 js-old/src/api/rpc/parity/index.js delete mode 100644 js-old/src/api/rpc/parity/parity.e2e.js delete mode 100644 js-old/src/api/rpc/parity/parity.js delete mode 100644 js-old/src/api/rpc/parity/parity.spec.js delete mode 100644 js-old/src/api/rpc/personal/index.js delete mode 100644 js-old/src/api/rpc/personal/personal.e2e.js delete mode 100644 js-old/src/api/rpc/personal/personal.js delete mode 100644 js-old/src/api/rpc/personal/personal.spec.js delete mode 100644 js-old/src/api/rpc/shh/index.js delete mode 100644 js-old/src/api/rpc/shh/shh.js delete mode 100644 js-old/src/api/rpc/signer/index.js delete mode 100644 js-old/src/api/rpc/signer/signer.js delete mode 100644 js-old/src/api/rpc/trace/index.js delete mode 100644 js-old/src/api/rpc/trace/trace.e2e.js delete mode 100644 js-old/src/api/rpc/trace/trace.js delete mode 100644 js-old/src/api/rpc/trace/trace.spec.js delete mode 100644 js-old/src/api/rpc/web3/index.js delete mode 100644 js-old/src/api/rpc/web3/web3.e2e.js delete mode 100644 js-old/src/api/rpc/web3/web3.js delete mode 100644 js-old/src/api/rpc/web3/web3.spec.js delete mode 100644 js-old/src/api/subscriptions/eth.js delete mode 100644 js-old/src/api/subscriptions/eth.spec.js delete mode 100644 js-old/src/api/subscriptions/index.js delete mode 100644 js-old/src/api/subscriptions/logging.js delete mode 100644 js-old/src/api/subscriptions/logging.spec.js delete mode 100644 js-old/src/api/subscriptions/manager.js delete mode 100644 js-old/src/api/subscriptions/manager.spec.js delete mode 100644 js-old/src/api/subscriptions/personal.js delete mode 100644 js-old/src/api/subscriptions/personal.spec.js delete mode 100644 js-old/src/api/subscriptions/signer.js delete mode 100644 js-old/src/api/transport/error.js delete mode 100644 js-old/src/api/transport/http/http.e2e.js delete mode 100644 js-old/src/api/transport/http/http.js delete mode 100644 js-old/src/api/transport/http/http.spec.js delete mode 100644 js-old/src/api/transport/http/index.js delete mode 100644 js-old/src/api/transport/index.js delete mode 100644 js-old/src/api/transport/jsonRpcBase.js delete mode 100644 js-old/src/api/transport/jsonRpcBase.spec.js delete mode 100644 js-old/src/api/transport/middleware.js delete mode 100644 js-old/src/api/transport/middleware.spec.js delete mode 100644 js-old/src/api/transport/ws/index.js delete mode 100644 js-old/src/api/transport/ws/ws.e2e.js delete mode 100644 js-old/src/api/transport/ws/ws.js delete mode 100644 js-old/src/api/transport/ws/ws.spec.js delete mode 100644 js-old/src/api/util/decode.js delete mode 100644 js-old/src/api/util/decode.spec.js delete mode 100644 js-old/src/api/util/encode.js delete mode 100644 js-old/src/api/util/encode.spec.js delete mode 100644 js-old/src/api/util/format.js delete mode 100644 js-old/src/api/util/format.spec.js delete mode 100644 js-old/src/api/util/identity.js delete mode 100644 js-old/src/api/util/index.js delete mode 100644 js-old/src/api/util/sha3.js delete mode 100644 js-old/src/api/util/sha3.spec.js delete mode 100644 js-old/src/api/util/types.js delete mode 100644 js-old/src/api/util/types.spec.js delete mode 100644 js-old/src/api/util/wei.js delete mode 100644 js-old/src/api/util/wei.spec.js delete mode 100644 js-old/src/dapps/chaindeploy.js delete mode 100644 js-old/src/dapps/chaindeploy/Application/application.css delete mode 100644 js-old/src/dapps/chaindeploy/Application/application.js delete mode 100644 js-old/src/dapps/chaindeploy/Application/index.js delete mode 100644 js-old/src/dapps/chaindeploy/Contract/contract.js delete mode 100644 js-old/src/dapps/chaindeploy/Contract/index.js delete mode 100644 js-old/src/dapps/chaindeploy/Dapp/dapp.js delete mode 100644 js-old/src/dapps/chaindeploy/Dapp/index.js delete mode 100644 js-old/src/dapps/chaindeploy/ListItem/Header/header.js delete mode 100644 js-old/src/dapps/chaindeploy/ListItem/Header/index.js delete mode 100644 js-old/src/dapps/chaindeploy/ListItem/Icon/icon.js delete mode 100644 js-old/src/dapps/chaindeploy/ListItem/Icon/index.js delete mode 100644 js-old/src/dapps/chaindeploy/ListItem/Row/index.js delete mode 100644 js-old/src/dapps/chaindeploy/ListItem/Row/row.js delete mode 100644 js-old/src/dapps/chaindeploy/ListItem/index.js delete mode 100644 js-old/src/dapps/chaindeploy/ListItem/listItem.css delete mode 100644 js-old/src/dapps/chaindeploy/ListItem/listItem.js delete mode 100644 js-old/src/dapps/chaindeploy/_dapps.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/abi/jg-voting.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/badgereg.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/badgereg.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/dappreg.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/gavcoin.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/githubhint.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/jg-voting.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/registry.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/signaturereg.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/tokendeploy.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/tokenreg.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/verifyEmail.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/code/verifySms.json delete mode 100644 js-old/src/dapps/chaindeploy/contracts/dappreg.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/gavcoin.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/githubhint.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/index.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/jg-voting.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/registry.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/signaturereg.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/tokendeployMgr.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/tokendeployReg.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/tokenreg.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/verifyEmail.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/verifySms.js delete mode 100644 js-old/src/dapps/chaindeploy/contracts/wallet.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/console.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/dappreg.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/gavcoin.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/githubhint.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/index.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/jg-voting.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/jg-whenblock.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/localtx.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/registry.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/signaturereg.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/tokendeploy.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/tokenreg.js delete mode 100644 js-old/src/dapps/chaindeploy/dapps/web.js delete mode 100644 js-old/src/dapps/chaindeploy/parity.js delete mode 100644 js-old/src/dapps/chaindeploy/store.js delete mode 100644 js-old/src/dapps/chaindeploy/utils.js delete mode 100644 js-old/src/dapps/console.js delete mode 100644 js-old/src/dapps/console/Application/application.css delete mode 100644 js-old/src/dapps/console/Application/application.js delete mode 100644 js-old/src/dapps/console/Application/application.store.js delete mode 100644 js-old/src/dapps/console/Application/index.js delete mode 100644 js-old/src/dapps/console/Autocomplete/autocomplete.css delete mode 100644 js-old/src/dapps/console/Autocomplete/autocomplete.js delete mode 100644 js-old/src/dapps/console/Autocomplete/autocomplete.store.js delete mode 100644 js-old/src/dapps/console/Autocomplete/index.js delete mode 100644 js-old/src/dapps/console/Console/console.css delete mode 100644 js-old/src/dapps/console/Console/console.js delete mode 100644 js-old/src/dapps/console/Console/console.store.js delete mode 100644 js-old/src/dapps/console/Console/index.js delete mode 100644 js-old/src/dapps/console/Header/header.css delete mode 100644 js-old/src/dapps/console/Header/header.js delete mode 100644 js-old/src/dapps/console/Header/index.js delete mode 100644 js-old/src/dapps/console/Input/index.js delete mode 100644 js-old/src/dapps/console/Input/input.css delete mode 100644 js-old/src/dapps/console/Input/input.js delete mode 100644 js-old/src/dapps/console/Input/input.store.js delete mode 100644 js-old/src/dapps/console/Settings/index.js delete mode 100644 js-old/src/dapps/console/Settings/settings.css delete mode 100644 js-old/src/dapps/console/Settings/settings.js delete mode 100644 js-old/src/dapps/console/Settings/settings.store.js delete mode 100644 js-old/src/dapps/console/Snippets/index.js delete mode 100644 js-old/src/dapps/console/Snippets/snippets.css delete mode 100644 js-old/src/dapps/console/Snippets/snippets.js delete mode 100644 js-old/src/dapps/console/Snippets/snippets.store.js delete mode 100644 js-old/src/dapps/console/Watches/index.js delete mode 100644 js-old/src/dapps/console/Watches/watches.css delete mode 100644 js-old/src/dapps/console/Watches/watches.js delete mode 100644 js-old/src/dapps/console/Watches/watches.store.js delete mode 100644 js-old/src/dapps/console/codemirror.css delete mode 100644 js-old/src/dapps/console/parity.js delete mode 100644 js-old/src/dapps/console/utils.js delete mode 100644 js-old/src/dapps/dappreg.js delete mode 100644 js-old/src/dapps/dappreg/Application/application.css delete mode 100644 js-old/src/dapps/dappreg/Application/application.js delete mode 100644 js-old/src/dapps/dappreg/Application/index.js delete mode 100644 js-old/src/dapps/dappreg/Button/button.css delete mode 100644 js-old/src/dapps/dappreg/Button/button.js delete mode 100644 js-old/src/dapps/dappreg/Button/index.js delete mode 100644 js-old/src/dapps/dappreg/Card/card.css delete mode 100644 js-old/src/dapps/dappreg/Card/card.js delete mode 100644 js-old/src/dapps/dappreg/Card/index.js delete mode 100644 js-old/src/dapps/dappreg/CreateDappCard/createDappCard.js delete mode 100644 js-old/src/dapps/dappreg/CreateDappCard/index.js delete mode 100644 js-old/src/dapps/dappreg/DappCard/dappCard.css delete mode 100644 js-old/src/dapps/dappreg/DappCard/dappCard.js delete mode 100644 js-old/src/dapps/dappreg/DappCard/index.js delete mode 100644 js-old/src/dapps/dappreg/DappModal/dappModal.css delete mode 100644 js-old/src/dapps/dappreg/DappModal/dappModal.js delete mode 100644 js-old/src/dapps/dappreg/DappModal/index.js delete mode 100644 js-old/src/dapps/dappreg/Dapps/dapps.css delete mode 100644 js-old/src/dapps/dappreg/Dapps/dapps.js delete mode 100644 js-old/src/dapps/dappreg/Dapps/index.js delete mode 100644 js-old/src/dapps/dappreg/Input/index.js delete mode 100644 js-old/src/dapps/dappreg/Input/input.css delete mode 100644 js-old/src/dapps/dappreg/Input/input.js delete mode 100644 js-old/src/dapps/dappreg/Modal/index.js delete mode 100644 js-old/src/dapps/dappreg/Modal/modal.css delete mode 100644 js-old/src/dapps/dappreg/Modal/modal.js delete mode 100644 js-old/src/dapps/dappreg/ModalDelete/index.js delete mode 100644 js-old/src/dapps/dappreg/ModalDelete/modalDelete.js delete mode 100644 js-old/src/dapps/dappreg/ModalRegister/index.js delete mode 100644 js-old/src/dapps/dappreg/ModalRegister/modalRegister.js delete mode 100644 js-old/src/dapps/dappreg/ModalUpdate/index.js delete mode 100644 js-old/src/dapps/dappreg/ModalUpdate/modalUpdate.js delete mode 100644 js-old/src/dapps/dappreg/SelectAccount/index.js delete mode 100644 js-old/src/dapps/dappreg/SelectAccount/selectAccount.js delete mode 100644 js-old/src/dapps/dappreg/Transactions/index.js delete mode 100644 js-old/src/dapps/dappreg/Transactions/transactions.css delete mode 100644 js-old/src/dapps/dappreg/Transactions/transactions.js delete mode 100644 js-old/src/dapps/dappreg/Warning/index.js delete mode 100644 js-old/src/dapps/dappreg/Warning/warning.css delete mode 100644 js-old/src/dapps/dappreg/Warning/warning.js delete mode 100644 js-old/src/dapps/dappreg/_colors.css delete mode 100644 js-old/src/dapps/dappreg/_utils.css delete mode 100644 js-old/src/dapps/dappreg/dappStore.js delete mode 100644 js-old/src/dapps/dappreg/dappsStore.js delete mode 100644 js-old/src/dapps/dappreg/parity.js delete mode 100644 js-old/src/dapps/dappreg/utils.js delete mode 100644 js-old/src/dapps/dappreg/utils.spec.js delete mode 100644 js-old/src/dapps/githubhint.js delete mode 100644 js-old/src/dapps/githubhint/Application/application.css delete mode 100644 js-old/src/dapps/githubhint/Application/application.js delete mode 100644 js-old/src/dapps/githubhint/Application/index.js delete mode 100644 js-old/src/dapps/githubhint/Button/button.css delete mode 100644 js-old/src/dapps/githubhint/Button/button.js delete mode 100644 js-old/src/dapps/githubhint/Button/index.js delete mode 100644 js-old/src/dapps/githubhint/Events/events.css delete mode 100644 js-old/src/dapps/githubhint/Events/events.js delete mode 100644 js-old/src/dapps/githubhint/Events/index.js delete mode 100644 js-old/src/dapps/githubhint/Loading/index.js delete mode 100644 js-old/src/dapps/githubhint/Loading/loading.css delete mode 100644 js-old/src/dapps/githubhint/Loading/loading.js delete mode 100644 js-old/src/dapps/githubhint/parity.js delete mode 100644 js-old/src/dapps/githubhint/services.js delete mode 100644 js-old/src/dapps/index.ejs delete mode 100644 js-old/src/dapps/localtx.js delete mode 100644 js-old/src/dapps/localtx/Application/application.css delete mode 100644 js-old/src/dapps/localtx/Application/application.js delete mode 100644 js-old/src/dapps/localtx/Application/application.spec.js delete mode 100644 js-old/src/dapps/localtx/Application/index.js delete mode 100644 js-old/src/dapps/localtx/IdentityIcon/identityIcon.css delete mode 100644 js-old/src/dapps/localtx/IdentityIcon/identityIcon.js delete mode 100644 js-old/src/dapps/localtx/IdentityIcon/index.js delete mode 100644 js-old/src/dapps/localtx/Transaction/index.js delete mode 100644 js-old/src/dapps/localtx/Transaction/transaction.css delete mode 100644 js-old/src/dapps/localtx/Transaction/transaction.js delete mode 100644 js-old/src/dapps/localtx/Transaction/transaction.spec.js delete mode 100644 js-old/src/dapps/localtx/parity.js delete mode 100644 js-old/src/dapps/registry.js delete mode 100644 js-old/src/dapps/registry/Accounts/accounts.css delete mode 100644 js-old/src/dapps/registry/Accounts/accounts.js delete mode 100644 js-old/src/dapps/registry/Accounts/actions.js delete mode 100644 js-old/src/dapps/registry/Accounts/index.js delete mode 100644 js-old/src/dapps/registry/Application/application.css delete mode 100644 js-old/src/dapps/registry/Application/application.js delete mode 100644 js-old/src/dapps/registry/Application/index.js delete mode 100644 js-old/src/dapps/registry/Container.js delete mode 100644 js-old/src/dapps/registry/Events/actions.js delete mode 100644 js-old/src/dapps/registry/Events/events.css delete mode 100644 js-old/src/dapps/registry/Events/events.js delete mode 100644 js-old/src/dapps/registry/Events/index.js delete mode 100644 js-old/src/dapps/registry/Events/reducers.js delete mode 100644 js-old/src/dapps/registry/IdentityIcon/identityIcon.css delete mode 100644 js-old/src/dapps/registry/IdentityIcon/identityIcon.js delete mode 100644 js-old/src/dapps/registry/IdentityIcon/index.js delete mode 100644 js-old/src/dapps/registry/Lookup/actions.js delete mode 100644 js-old/src/dapps/registry/Lookup/index.js delete mode 100644 js-old/src/dapps/registry/Lookup/lookup.css delete mode 100644 js-old/src/dapps/registry/Lookup/lookup.js delete mode 100644 js-old/src/dapps/registry/Lookup/reducers.js delete mode 100644 js-old/src/dapps/registry/Names/actions.js delete mode 100644 js-old/src/dapps/registry/Names/index.js delete mode 100644 js-old/src/dapps/registry/Names/names.css delete mode 100644 js-old/src/dapps/registry/Names/names.js delete mode 100644 js-old/src/dapps/registry/Names/reducers.js delete mode 100644 js-old/src/dapps/registry/Records/actions.js delete mode 100644 js-old/src/dapps/registry/Records/index.js delete mode 100644 js-old/src/dapps/registry/Records/records.css delete mode 100644 js-old/src/dapps/registry/Records/records.js delete mode 100644 js-old/src/dapps/registry/Records/reducers.js delete mode 100644 js-old/src/dapps/registry/Reverse/actions.js delete mode 100644 js-old/src/dapps/registry/Reverse/index.js delete mode 100644 js-old/src/dapps/registry/Reverse/reducers.js delete mode 100644 js-old/src/dapps/registry/Reverse/reverse.css delete mode 100644 js-old/src/dapps/registry/Reverse/reverse.js delete mode 100644 js-old/src/dapps/registry/actions.js delete mode 100644 js-old/src/dapps/registry/addresses/accounts-reducer.js delete mode 100644 js-old/src/dapps/registry/addresses/actions.js delete mode 100644 js-old/src/dapps/registry/addresses/contacts-reducer.js delete mode 100644 js-old/src/dapps/registry/parity.js delete mode 100644 js-old/src/dapps/registry/reducers.js delete mode 100644 js-old/src/dapps/registry/store.js delete mode 100644 js-old/src/dapps/registry/ui/address.css delete mode 100644 js-old/src/dapps/registry/ui/address.js delete mode 100644 js-old/src/dapps/registry/ui/hash.css delete mode 100644 js-old/src/dapps/registry/ui/hash.js delete mode 100644 js-old/src/dapps/registry/ui/image.js delete mode 100644 js-old/src/dapps/registry/util/actions.js delete mode 100644 js-old/src/dapps/registry/util/etherscan-url.js delete mode 100644 js-old/src/dapps/registry/util/post-tx.js delete mode 100644 js-old/src/dapps/registry/util/registry.js delete mode 100644 js-old/src/dapps/signaturereg.js delete mode 100644 js-old/src/dapps/signaturereg/Application/application.css delete mode 100644 js-old/src/dapps/signaturereg/Application/application.js delete mode 100644 js-old/src/dapps/signaturereg/Application/index.js delete mode 100644 js-old/src/dapps/signaturereg/Button/button.css delete mode 100644 js-old/src/dapps/signaturereg/Button/button.js delete mode 100644 js-old/src/dapps/signaturereg/Button/index.js delete mode 100644 js-old/src/dapps/signaturereg/Events/events.css delete mode 100644 js-old/src/dapps/signaturereg/Events/events.js delete mode 100644 js-old/src/dapps/signaturereg/Events/index.js delete mode 100644 js-old/src/dapps/signaturereg/Header/header.css delete mode 100644 js-old/src/dapps/signaturereg/Header/header.js delete mode 100644 js-old/src/dapps/signaturereg/Header/index.js delete mode 100644 js-old/src/dapps/signaturereg/IdentityIcon/identityIcon.css delete mode 100644 js-old/src/dapps/signaturereg/IdentityIcon/identityIcon.js delete mode 100644 js-old/src/dapps/signaturereg/IdentityIcon/index.js delete mode 100644 js-old/src/dapps/signaturereg/Import/import.css delete mode 100644 js-old/src/dapps/signaturereg/Import/import.js delete mode 100644 js-old/src/dapps/signaturereg/Import/index.js delete mode 100644 js-old/src/dapps/signaturereg/Loading/index.js delete mode 100644 js-old/src/dapps/signaturereg/Loading/loading.css delete mode 100644 js-old/src/dapps/signaturereg/Loading/loading.js delete mode 100644 js-old/src/dapps/signaturereg/format.js delete mode 100644 js-old/src/dapps/signaturereg/parity.js delete mode 100644 js-old/src/dapps/signaturereg/services.js delete mode 100644 js-old/src/dapps/static/.gitkeep delete mode 100644 js-old/src/dapps/style.css delete mode 100644 js-old/src/dapps/tokendeploy.js delete mode 100644 js-old/src/dapps/tokendeploy/AddressSelect/addressSelect.css delete mode 100644 js-old/src/dapps/tokendeploy/AddressSelect/addressSelect.js delete mode 100644 js-old/src/dapps/tokendeploy/AddressSelect/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Application/Header/header.css delete mode 100644 js-old/src/dapps/tokendeploy/Application/Header/header.js delete mode 100644 js-old/src/dapps/tokendeploy/Application/Header/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Application/Loading/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Application/Loading/loading.css delete mode 100644 js-old/src/dapps/tokendeploy/Application/Loading/loading.js delete mode 100644 js-old/src/dapps/tokendeploy/Application/application.css delete mode 100644 js-old/src/dapps/tokendeploy/Application/application.js delete mode 100644 js-old/src/dapps/tokendeploy/Application/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Application/pages.js delete mode 100644 js-old/src/dapps/tokendeploy/Container/container.css delete mode 100644 js-old/src/dapps/tokendeploy/Container/container.js delete mode 100644 js-old/src/dapps/tokendeploy/Container/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/Deployment/deployment.css delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/Deployment/deployment.js delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/Deployment/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/Event/event.css delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/Event/event.js delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/Event/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/Events/events.css delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/Events/events.js delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/Events/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/deploy.js delete mode 100644 js-old/src/dapps/tokendeploy/Deploy/index.js delete mode 100644 js-old/src/dapps/tokendeploy/IdentityIcon/identityIcon.css delete mode 100644 js-old/src/dapps/tokendeploy/IdentityIcon/identityIcon.js delete mode 100644 js-old/src/dapps/tokendeploy/IdentityIcon/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Overview/Owner/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Overview/Owner/owner.css delete mode 100644 js-old/src/dapps/tokendeploy/Overview/Owner/owner.js delete mode 100644 js-old/src/dapps/tokendeploy/Overview/Token/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Overview/Token/token.css delete mode 100644 js-old/src/dapps/tokendeploy/Overview/Token/token.js delete mode 100644 js-old/src/dapps/tokendeploy/Overview/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Overview/overview.css delete mode 100644 js-old/src/dapps/tokendeploy/Overview/overview.js delete mode 100644 js-old/src/dapps/tokendeploy/Transfer/Event/event.js delete mode 100644 js-old/src/dapps/tokendeploy/Transfer/Event/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Transfer/Events/events.js delete mode 100644 js-old/src/dapps/tokendeploy/Transfer/Events/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Transfer/Send/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Transfer/Send/send.css delete mode 100644 js-old/src/dapps/tokendeploy/Transfer/Send/send.js delete mode 100644 js-old/src/dapps/tokendeploy/Transfer/index.js delete mode 100644 js-old/src/dapps/tokendeploy/Transfer/transfer.js delete mode 100644 js-old/src/dapps/tokendeploy/_form.css delete mode 100644 js-old/src/dapps/tokendeploy/_status.css delete mode 100644 js-old/src/dapps/tokendeploy/background.jpg delete mode 100644 js-old/src/dapps/tokendeploy/parity.js delete mode 100644 js-old/src/dapps/tokendeploy/services.js delete mode 100644 js-old/src/dapps/tokenreg.js delete mode 100644 js-old/src/dapps/tokenreg/Accounts/AccountSelector/account-selector.css delete mode 100644 js-old/src/dapps/tokenreg/Accounts/AccountSelector/account-selector.js delete mode 100644 js-old/src/dapps/tokenreg/Accounts/AccountSelector/container.js delete mode 100644 js-old/src/dapps/tokenreg/Accounts/AccountSelector/index.js delete mode 100644 js-old/src/dapps/tokenreg/Accounts/actions.js delete mode 100644 js-old/src/dapps/tokenreg/Accounts/reducer.js delete mode 100644 js-old/src/dapps/tokenreg/Actions/Query/index.js delete mode 100644 js-old/src/dapps/tokenreg/Actions/Query/query.js delete mode 100644 js-old/src/dapps/tokenreg/Actions/Register/index.js delete mode 100644 js-old/src/dapps/tokenreg/Actions/Register/register.js delete mode 100644 js-old/src/dapps/tokenreg/Actions/actions.css delete mode 100644 js-old/src/dapps/tokenreg/Actions/actions.js delete mode 100644 js-old/src/dapps/tokenreg/Actions/component.js delete mode 100644 js-old/src/dapps/tokenreg/Actions/container.js delete mode 100644 js-old/src/dapps/tokenreg/Actions/index.js delete mode 100644 js-old/src/dapps/tokenreg/Actions/reducer.js delete mode 100644 js-old/src/dapps/tokenreg/Application/application.css delete mode 100644 js-old/src/dapps/tokenreg/Application/application.js delete mode 100644 js-old/src/dapps/tokenreg/Application/index.js delete mode 100644 js-old/src/dapps/tokenreg/Chip/chip.css delete mode 100644 js-old/src/dapps/tokenreg/Chip/chip.js delete mode 100644 js-old/src/dapps/tokenreg/Chip/index.js delete mode 100644 js-old/src/dapps/tokenreg/Container.js delete mode 100644 js-old/src/dapps/tokenreg/IdentityIcon/identityIcon.css delete mode 100644 js-old/src/dapps/tokenreg/IdentityIcon/identityIcon.js delete mode 100644 js-old/src/dapps/tokenreg/IdentityIcon/index.js delete mode 100644 js-old/src/dapps/tokenreg/Inputs/Text/container.js delete mode 100644 js-old/src/dapps/tokenreg/Inputs/Text/index.js delete mode 100644 js-old/src/dapps/tokenreg/Inputs/Text/input-text.js delete mode 100644 js-old/src/dapps/tokenreg/Inputs/inputs.css delete mode 100644 js-old/src/dapps/tokenreg/Inputs/validation.js delete mode 100644 js-old/src/dapps/tokenreg/Loading/index.js delete mode 100644 js-old/src/dapps/tokenreg/Loading/loading.css delete mode 100644 js-old/src/dapps/tokenreg/Loading/loading.js delete mode 100644 js-old/src/dapps/tokenreg/Status/actions.js delete mode 100644 js-old/src/dapps/tokenreg/Status/index.js delete mode 100644 js-old/src/dapps/tokenreg/Status/reducer.js delete mode 100644 js-old/src/dapps/tokenreg/Status/status.css delete mode 100644 js-old/src/dapps/tokenreg/Status/status.js delete mode 100644 js-old/src/dapps/tokenreg/Tokens/Token/add-meta.js delete mode 100644 js-old/src/dapps/tokenreg/Tokens/Token/index.js delete mode 100644 js-old/src/dapps/tokenreg/Tokens/Token/token.css delete mode 100644 js-old/src/dapps/tokenreg/Tokens/Token/token.js delete mode 100644 js-old/src/dapps/tokenreg/Tokens/Token/tokenContainer.js delete mode 100644 js-old/src/dapps/tokenreg/Tokens/actions.js delete mode 100644 js-old/src/dapps/tokenreg/Tokens/container.js delete mode 100644 js-old/src/dapps/tokenreg/Tokens/index.js delete mode 100644 js-old/src/dapps/tokenreg/Tokens/reducer.js delete mode 100644 js-old/src/dapps/tokenreg/Tokens/tokens.css delete mode 100644 js-old/src/dapps/tokenreg/Tokens/tokens.js delete mode 100644 js-old/src/dapps/tokenreg/constants.js delete mode 100644 js-old/src/dapps/tokenreg/parity.js delete mode 100644 js-old/src/dapps/tokenreg/reducers.js delete mode 100644 js-old/src/dapps/tokenreg/store.js delete mode 100644 js-old/src/dapps/tokenreg/utils.js delete mode 100644 js-old/src/dev.parity.html delete mode 100644 js-old/src/dev.web3.html delete mode 100644 js-old/src/embed.js delete mode 100644 js-old/src/error_pages.css delete mode 100644 js-old/src/inject.js delete mode 100644 js-old/src/jsonrpc/.gitignore delete mode 100644 js-old/src/jsonrpc/README.md delete mode 100644 js-old/src/jsonrpc/helpers.js delete mode 100644 js-old/src/jsonrpc/index.js delete mode 100644 js-old/src/jsonrpc/index.spec.js delete mode 100644 js-old/src/jsonrpc/interfaces/db.js delete mode 100644 js-old/src/jsonrpc/interfaces/eth.js delete mode 100644 js-old/src/jsonrpc/interfaces/net.js delete mode 100644 js-old/src/jsonrpc/interfaces/parity.js delete mode 100644 js-old/src/jsonrpc/interfaces/personal.js delete mode 100644 js-old/src/jsonrpc/interfaces/shh.js delete mode 100644 js-old/src/jsonrpc/interfaces/signer.js delete mode 100644 js-old/src/jsonrpc/interfaces/trace.js delete mode 100644 js-old/src/jsonrpc/interfaces/web3.js delete mode 100644 js-old/src/jsonrpc/types.js delete mode 100644 js-old/src/library.etherscan.js delete mode 100644 js-old/src/library.jsonrpc.js delete mode 100644 js-old/src/library.parity.js delete mode 100644 js-old/src/library.shapeshift.js delete mode 100644 js-old/src/parity.js delete mode 100644 js-old/src/util/web3.extensions.js delete mode 100644 js-old/src/web3.js delete mode 100644 js-old/test/npmJsonRpc.js delete mode 100644 js-old/test/npmParity.js delete mode 100644 js-old/webpack/embed.js delete mode 100644 js-old/webpack/npm.js create mode 100644 js/assets/parity-logo-black-no-text.png diff --git a/js-old/npm/etherscan/README.md b/js-old/npm/etherscan/README.md deleted file mode 100644 index 730cb7e1d..000000000 --- a/js-old/npm/etherscan/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# @parity/etherscan - -A thin, lightweight promise wrapper for the api.etherscan.io/apis service, exposing a common endpoint for use in JavaScript applications. - -[https://github.com/paritytech/parity/tree/master/js/src/3rdparty/etherscan](https://github.com/paritytech/parity/tree/master/js/src/3rdparty/etherscan) - -## usage - -installation - - -``` -npm install --save @parity/etherscan -``` - -Usage - - -``` -const etherscan = require('@parity/etherscan'); - -// api calls goes here -``` - -## api - -account (exposed on etherscan.account) - - -- `balance(address)` -- `balances(addresses)` (array or addresses) -- `transactions(address, page)` (page offset starts at 0, returns 25) - -stats (exposed on etherscan.stats) - - -- `price()` -- `supply()` diff --git a/js-old/npm/etherscan/package.json b/js-old/npm/etherscan/package.json deleted file mode 100644 index 1aed97171..000000000 --- a/js-old/npm/etherscan/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@parity/etherscan", - "description": "The Parity Promise-based library for interfacing with Etherscan over HTTP", - "version": "0.0.0", - "main": "library.js", - "author": "Parity Team ", - "maintainers": [ - "Jaco Greeff" - ], - "contributors": [], - "license": "GPL-3.0", - "repository": { - "type": "git", - "url": "git+https://github.com/paritytech/parity.git" - }, - "keywords": [ - "Ethereum", - "ABI", - "API", - "RPC", - "Parity", - "Promise" - ], - "scripts": { - }, - "devDependencies": { - "chai": "3.5.0", - "mocha": "3.2.0" - }, - "dependencies": { - "node-fetch": "~1.6.3" - } -} diff --git a/js-old/npm/jsonrpc/README.md b/js-old/npm/jsonrpc/README.md deleted file mode 100644 index e9678864b..000000000 --- a/js-old/npm/jsonrpc/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# @parity/jsonrpc - -JSON and JS interface defintions for RPC calls. - -[https://github.com/paritytech/parity/tree/master/js/src/jsonrpc](https://github.com/paritytech/parity/tree/master/js/src/jsonrpc) diff --git a/js-old/npm/jsonrpc/package.json b/js-old/npm/jsonrpc/package.json deleted file mode 100644 index 90ebe1577..000000000 --- a/js-old/npm/jsonrpc/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@parity/jsonrpc", - "description": "JSON and JS interface defintions for RPC", - "version": "0.0.0", - "main": "library.js", - "author": "Parity Team ", - "maintainers": [ - "Jaco Greeff" - ], - "contributors": [], - "license": "GPL-3.0", - "repository": { - "type": "git", - "url": "git+https://github.com/paritytech/parity.git" - }, - "keywords": [ - "Ethereum", - "ABI", - "API", - "RPC", - "Parity" - ], - "scripts": { - }, - "devDependencies": { - }, - "dependencies": { - } -} diff --git a/js-old/npm/parity/README.md b/js-old/npm/parity/README.md deleted file mode 100644 index 2c5396e2d..000000000 --- a/js-old/npm/parity/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# @parity/parity.js - -Parity.js is a thin, fast, Promise-based wrapper around the Ethereum APIs. - -[https://github.com/paritytech/parity/tree/master/js/src/api](https://github.com/paritytech/parity/tree/master/js/src/api) - -## installation - -Install the package with `npm install --save @parity/parity.js` - -## usage - -### initialisation - -```javascript -// import the actual Api class -import { Api } from '@parity/parity.js'; - -// do the setup -const transport = new Api.Transport.Http('http://localhost:8545'); -const api = new Api(transport); -``` - -### making calls - -perform a call - -```javascript -api.eth - .coinbase() - .then((coinbase) => { - console.log(`The coinbase is ${coinbase}`); - }); -``` - -multiple promises - -```javascript -Promise - .all([ - api.eth.coinbase(), - api.net.listening() - ]) - .then(([coinbase, listening]) => { - // do stuff here - }); -``` - -chaining promises - -```javascript -api.eth - .newFilter({...}) - .then((filterId) => api.eth.getFilterChanges(filterId)) - .then((changes) => { - console.log(changes); - }); -``` - -### contracts - -attach contract - -```javascript -const abi = [{ name: 'callMe', inputs: [{ type: 'bool', ...}, { type: 'string', ...}]}, ...abi...]; -const address = '0x123456...9abc'; -const contract = new api.newContract(abi, address); -``` - -find & call a function - -```javascript -contract.instance - .callMe - .call({ gas: 21000 }, [true, 'someString']) // or estimateGas or postTransaction - .then((result) => { - console.log(`the result was ${result}`); - }); -``` - -## apis - -APIs implement the calls as exposed in the [Ethcore JSON Ethereum RPC](https://github.com/paritytech/ethereum-rpc-json/) definitions. Mapping follows the naming conventions of the originals, i.e. `eth_call` becomes `eth.call`, `personal_accounts` becomes `personal.accounts`, etc. diff --git a/js-old/npm/parity/package.json b/js-old/npm/parity/package.json deleted file mode 100644 index c43da096d..000000000 --- a/js-old/npm/parity/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@parity/parity.js", - "description": "The Parity Promise-based API & ABI library for interfacing with Ethereum over RPC", - "version": "0.0.0", - "main": "library.js", - "author": "Parity Team ", - "maintainers": [ - "Jaco Greeff" - ], - "contributors": [], - "license": "GPL-3.0", - "repository": { - "type": "git", - "url": "git+https://github.com/paritytech/parity.git" - }, - "keywords": [ - "Ethereum", - "ABI", - "API", - "RPC", - "Parity", - "Promise" - ], - "scripts": { - }, - "devDependencies": { - }, - "dependencies": { - "bignumber.js": "~2.3.0", - "js-sha3": "~0.5.2", - "node-fetch": "~1.6.3" - } -} diff --git a/js-old/npm/parity/test/smoke.spec.js b/js-old/npm/parity/test/smoke.spec.js deleted file mode 100644 index fb1ae0d4d..000000000 --- a/js-old/npm/parity/test/smoke.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -const parity = require('../'); - -describe('load the Parity library', function () { - it('should no throw any error', () => { - expect(parity).to.be.ok; - - expect(parity.Api).to.be.ok; - expect(parity.Abi).to.be.ok; - }); -}); diff --git a/js-old/npm/shapeshift/README.md b/js-old/npm/shapeshift/README.md deleted file mode 100644 index 0f9a190ab..000000000 --- a/js-old/npm/shapeshift/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# @parity/shapeshift - -A thin ES6 promise wrapper around the shapeshift.io APIs as documented at https://shapeshift.io/api - -[https://github.com/paritytech/parity/tree/master/js/src/3rdparty/shapeshift](https://github.com/paritytech/parity/tree/master/js/src/3rdparty/shapeshift) - -## usage - -installation - - -``` -npm install --save @parity/shapeshift -``` - -Usage - - -``` -const APIKEY = 'private affiliate key or undefined'; -const shapeshift = require('@parity/shapeshift')(APIKEY); - -// api calls goes here -``` - -## api - -queries - - -- `getCoins()` [https://shapeshift.io/api#api-104](https://shapeshift.io/api#api-104) -- `getMarketInfo(pair)` [https://shapeshift.io/api#api-103](https://shapeshift.io/api#api-103) -- `getStatus(depositAddress)` [https://shapeshift.io/api#api-5](https://shapeshift.io/api#api-5) - -transactions - - -- `shift(toAddress, returnAddress, pair)` [https://shapeshift.io/api#api-7](https://shapeshift.io/api#api-7) diff --git a/js-old/npm/shapeshift/package.json b/js-old/npm/shapeshift/package.json deleted file mode 100644 index 1aa2d38f3..000000000 --- a/js-old/npm/shapeshift/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@parity/shapeshift", - "description": "The Parity Promise-based library for interfacing with ShapeShift over HTTP", - "version": "0.0.0", - "main": "library.js", - "author": "Parity Team ", - "maintainers": [ - "Jaco Greeff" - ], - "contributors": [], - "license": "GPL-3.0", - "repository": { - "type": "git", - "url": "git+https://github.com/paritytech/parity.git" - }, - "keywords": [ - "Ethereum", - "ABI", - "API", - "RPC", - "Parity", - "Promise" - ], - "scripts": { - }, - "devDependencies": { - }, - "dependencies": { - "node-fetch": "~1.6.3" - } -} diff --git a/js-old/npm/test/mocha.config.js b/js-old/npm/test/mocha.config.js deleted file mode 100644 index fc21631b0..000000000 --- a/js-old/npm/test/mocha.config.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -const chai = require('chai'); -// const chaiAsPromised from 'chai-as-promised'; -// const chaiEnzyme from 'chai-enzyme'; -// const sinonChai from 'sinon-chai'; - -// chai.use(chaiAsPromised); -// chai.use(chaiEnzyme()); -// chai.use(sinonChai); - -// expose expect to global so we won't have to manually import & define it in every test -global.expect = chai.expect; - -module.exports = {}; diff --git a/js-old/npm/test/mocha.opts b/js-old/npm/test/mocha.opts deleted file mode 100644 index 0ed8269b4..000000000 --- a/js-old/npm/test/mocha.opts +++ /dev/null @@ -1 +0,0 @@ --r ./test/mocha.config diff --git a/js-old/package.json b/js-old/package.json index 7f406ffe2..2a264a6bc 100644 --- a/js-old/package.json +++ b/js-old/package.json @@ -27,9 +27,8 @@ ], "scripts": { "install": "napa", - "build": "npm run build:lib && npm run build:dll && npm run build:app", + "build": "npm run build:dll && npm run build:app", "build:app": "webpack --config webpack/app", - "build:lib": "webpack --config webpack/libraries", "build:dll": "webpack --config webpack/vendor", "ci:build": "cross-env NODE_ENV=production npm run build", "clean": "rimraf ./.build ./.coverage ./.happypack ./.npmjs ./build ./node_modules/.cache", @@ -135,6 +134,7 @@ "yargs": "6.6.0" }, "dependencies": { + "@parity/abi": "2.1.x", "@parity/api": "2.1.x", "@parity/wordlist": "1.1.x", "base32.js": "0.1.0", diff --git a/js-old/scripts/build-rpc-json.js b/js-old/scripts/build-rpc-json.js deleted file mode 100644 index 740f96aa1..000000000 --- a/js-old/scripts/build-rpc-json.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import fs from 'fs'; -import path from 'path'; -import yargs from 'yargs'; - -import interfaces from '../src/jsonrpc'; - -const argv = yargs.default('output', 'release').argv; - -const INDEX_JSON = path.join(__dirname, `../${argv.output}/index.json`); -const methods = []; - -function formatDescription (obj) { - const optional = obj.optional ? '(optional) ' : ''; - const defaults = obj.default ? `(default: ${obj.default}) ` : ''; - - return `${obj.type.name} - ${optional}${defaults}${obj.desc}`; -} - -function formatType (obj) { - if (obj.type === Object && obj.details) { - const formatted = {}; - - Object.keys(obj.details).sort().forEach((key) => { - formatted[key] = formatType(obj.details[key]); - }); - - return { - desc: formatDescription(obj), - details: formatted - }; - } else if (obj.type && obj.type.name) { - return formatDescription(obj); - } - - return obj; -} - -Object.keys(interfaces).sort().forEach((group) => { - Object.keys(interfaces[group]).sort().forEach((name) => { - const method = interfaces[group][name]; - const deprecated = method.deprecated ? ' (Deprecated and not supported, to be removed in a future version)' : ''; - - methods.push({ - name: `${group}_${name}`, - desc: `${method.desc}${deprecated}`, - params: method.params.map(formatType), - returns: formatType(method.returns), - inputFormatters: method.params.map((param) => param.format || null), - outputFormatter: method.returns.format || null - }); - }); -}); - -fs.writeFileSync(INDEX_JSON, JSON.stringify({ methods: methods }, null, 2), 'utf8'); diff --git a/js-old/scripts/build-rpc-markdown.js b/js-old/scripts/build-rpc-markdown.js deleted file mode 100644 index 7a78e1ce9..000000000 --- a/js-old/scripts/build-rpc-markdown.js +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import fs from 'fs'; -import path from 'path'; -import { isPlainObject } from 'lodash'; - -import { info, warn, error } from './helpers/log'; -import { Dummy } from '../src/jsonrpc/helpers'; -import interfaces from '../src/jsonrpc'; -import rustMethods from './helpers/parsed-rpc-traits'; - -const ROOT_DIR = path.join(__dirname, '../docs'); - -if (!fs.existsSync(ROOT_DIR)) { - fs.mkdirSync(ROOT_DIR); -} - -Object.keys(rustMethods).forEach((group) => { - Object.keys(rustMethods[group]).forEach((method) => { - if (interfaces[group] == null || interfaces[group][method] == null) { - error(`${group}_${method} is defined in Rust traits, but not in js/src/jsonrpc/interfaces`); - } - }); -}); - -function printType (type, obj) { - if (!type) { - throw new Error(`Invalid type in ${JSON.stringify(obj)}`); - } - - return type.print || `\`${type.name}\``; -} - -function formatDescription (obj, prefix = '', indent = '') { - const optional = obj.optional ? '(optional) ' : ''; - const defaults = obj.default ? `(default: \`${obj.default}\`) ` : ''; - - return `${indent}${prefix}${printType(obj.type, obj)} - ${optional}${defaults}${obj.desc}`; -} - -function formatType (obj) { - if (obj == null || obj.type == null) { - return obj; - } - - const details = obj.details || obj.type.details; - - if (details) { - const sub = Object.keys(details).map((key) => { - return formatDescription(details[key], `\`${key}\`: `, ' - '); - }).join('\n'); - - return `${formatDescription(obj)}\n${sub}`; - } else if (obj.type && obj.type.name) { - return formatDescription(obj); - } - - return obj; -} - -const rpcReqTemplate = { - method: 'web3_clientVersion', - params: [], - id: 1, - jsonrpc: '2.0' -}; - -const { isDummy } = Dummy; -const { isArray } = Array; - -// Checks if a field definition has an example, -// or describes an object with fields that recursively have examples of their own, -// or is optional. -function hasExample ({ optional, example, details } = {}) { - if (optional || example !== undefined) { - return true; - } - - if (details !== undefined) { - const values = Object.keys(details).map((key) => details[key]); - - return values.every(hasExample); - } - - return false; -} - -// Remove all optional (trailing) params without examples from an array -function removeOptionalWithoutExamples (arr) { - return arr.filter(({ optional, example, details }) => { - return !optional || example !== undefined || details !== undefined; - }); -} - -// Grabs JSON compatible -function getExample (obj) { - if (isArray(obj)) { - return removeOptionalWithoutExamples(obj).map(getExample); - } - - const { example, details } = obj; - - if (example === undefined && details !== undefined) { - const nested = {}; - - Object.keys(details).forEach((key) => { - nested[key] = getExample(details[key]); - }); - - return nested; - } - - return example; -} - -function stringifyExample (example, dent = '') { - const indent = `${dent} `; - - if (isDummy(example)) { - return example.toString(); - } - - if (isArray(example)) { - const last = example.length - 1; - - // If all elements are dummies, print out a single line. - // Also covers empty arrays. - if (example.every(isDummy)) { - const dummies = example.map(d => d.toString()); - - return `[${dummies.join(', ')}]`; - } - - // For arrays containing just one object or string, don't unwind the array to multiline - if (last === 0 && (isPlainObject(example[0]) || typeof example[0] === 'string')) { - return `[${stringifyExample(example[0], dent)}]`; - } - - const elements = example.map((value, index) => { - const comma = index !== last ? ',' : ''; - const comment = value != null && value._comment ? ` // ${value._comment}` : ''; - - return `${stringifyExample(value, indent)}${comma}${comment}`; - }); - - return `[\n${indent}${elements.join(`\n${indent}`)}\n${dent}]`; - } - - if (isPlainObject(example)) { - const keys = Object.keys(example); - const last = keys.length - 1; - - // print out an empty object - if (last === -1) { - return '{}'; - } - - const elements = keys.map((key, index) => { - const value = example[key]; - const comma = index !== last ? ',' : ''; - const comment = value && value._comment ? ` // ${example[key]._comment}` : ''; - - return `${JSON.stringify(key)}: ${stringifyExample(value, indent)}${comma}${comment}`; - }); - - return `{\n${indent}${elements.join(`\n${indent}`)}\n${dent}}`; - } - - return JSON.stringify(example); -} - -function buildExample (name, method) { - // deprecated, don't care - if (method.deprecated) { - return ''; - } - - const logPostfix = method.subdoc ? ` (${method.subdoc})` : ''; - - const hasReqExample = method.params.every(hasExample); - const hasResExample = hasExample(method.returns); - - if (!hasReqExample && !hasResExample) { - error(`${name} has no examples${logPostfix}`); - - return ''; - } - - const examples = []; - - if (hasReqExample) { - const params = getExample(method.params); - const req = Dummy.stringifyJSON(Object.assign({}, rpcReqTemplate, { method: name, params })); - - examples.push(`Request\n\`\`\`bash\ncurl --data '${req}' -H "Content-Type: application/json" -X POST localhost:8545\n\`\`\``); - } else { - warn(`${name} has a response example but not a request example${logPostfix}`); - } - - if (hasResExample) { - const res = stringifyExample({ - id: 1, - jsonrpc: '2.0', - result: getExample(method.returns) - }); - - examples.push(`Response\n\`\`\`js\n${res}\n\`\`\``); - } else { - if (typeof method.returns === 'string') { - info(`${name} has a request example and only text description for response${logPostfix}`); - } else { - warn(`${name} has a request example but not a response example${logPostfix}`); - } - } - - return `\n\n#### Example\n\n${examples.join('\n\n')}`; -} - -function buildParameters (params) { - if (params.length === 0) { - return ''; - } - - let md = `0. ${params.map(formatType).join('\n0. ')}`; - - if (params.length > 0 && params.every(hasExample) && !isDummy(params[0].example)) { - const example = getExample(params); - - md = `${md}\n\n\`\`\`js\nparams: ${stringifyExample(example)}\n\`\`\``; - } - - return md; -} - -Object.keys(interfaces).sort().forEach((group) => { - const spec = interfaces[group]; - - for (const key in spec) { - const method = spec[key]; - - if (!method || !method.subdoc) { - continue; - } - - const subgroup = `${group}_${method.subdoc}`; - - interfaces[subgroup] = interfaces[subgroup] || {}; - - interfaces[subgroup][key] = method; - delete spec[key]; - } -}); - -Object.keys(interfaces).sort().forEach((group) => { - let preamble = `# The \`${group}\` Module`; - let markdown = `## JSON-RPC methods\n`; - - const spec = interfaces[group]; - - if (spec._preamble) { - preamble = `${preamble}\n\n${spec._preamble}`; - } - - const content = []; - const tocMain = []; - const tocSections = {}; - - // Comparator that will sort by sections first, names second - function methodComparator (a, b) { - const sectionA = spec[a].section || ''; - const sectionB = spec[b].section || ''; - - return sectionA.localeCompare(sectionB) || a.localeCompare(b); - } - - Object.keys(spec).sort(methodComparator).forEach((iname) => { - const method = spec[iname]; - const groupName = group.replace(/_.*$/, ''); - const name = `${groupName}_${iname}`; - - if (method.nodoc || method.deprecated) { - info(`Skipping ${name}: ${method.nodoc || 'Deprecated'}`); - - return; - } - - if (rustMethods[groupName] == null || rustMethods[groupName][iname] == null) { - error(`${name} is defined in js/src/jsonrpc/interfaces, but not in Rust traits`); - } - - const desc = method.desc; - const params = buildParameters(method.params); - const returns = `- ${formatType(method.returns)}`; - const example = buildExample(name, method); - - const { section } = method; - const toc = section ? tocSections[section] = tocSections[section] || [] : tocMain; - - toc.push(`- [${name}](#${name.toLowerCase()})`); - content.push(`### ${name}\n\n${desc}\n\n#### Parameters\n\n${params || 'None'}\n\n#### Returns\n\n${returns || 'None'}${example}`); - }); - - markdown = `${markdown}\n${tocMain.join('\n')}`; - - Object.keys(tocSections).sort().forEach((section) => { - markdown = `${markdown}\n\n#### ${section}\n${tocSections[section].join('\n')}`; - }); - - markdown = `${markdown}\n\n## JSON-RPC API Reference\n\n${content.join('\n\n***\n\n')}\n\n`; - - const mdFile = path.join(ROOT_DIR, `${group}.md`); - - fs.writeFileSync(mdFile, `${preamble}\n\n${markdown}`, 'utf8'); -}); diff --git a/js-old/scripts/dryrun-npm.sh b/js-old/scripts/dryrun-npm.sh deleted file mode 100755 index bf8a151a8..000000000 --- a/js-old/scripts/dryrun-npm.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -set -e - -# variables -PACKAGES=( "parity" "etherscan" "shapeshift" "jsonrpc" ) - -# change into the build directory -BASEDIR=`dirname $0` -cd $BASEDIR/.. - -# build jsonrpc -echo "*** Building JSONRPC .json" -mkdir -p .npmjs/jsonrpc -npm run ci:build:jsonrpc - -# build all packages -echo "*** Building packages for npmjs" -echo "$NPM_TOKEN" >> ~/.npmrc - -for PACKAGE in ${PACKAGES[@]} -do - echo "*** Building $PACKAGE" - LIBRARY=$PACKAGE npm run ci:build:npm - DIRECTORY=.npmjs/$PACKAGE - - cd $DIRECTORY - - echo "*** Publishing $PACKAGE from $DIRECTORY" - echo "npm publish --access public || true" - cd ../.. - -done -cd .. - -# exit with exit code -exit 0 diff --git a/js-old/scripts/helpers/log.js b/js-old/scripts/helpers/log.js deleted file mode 100644 index dc4955649..000000000 --- a/js-old/scripts/helpers/log.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import chalk from 'chalk'; - -// INFO Logging helper -export function info (log) { - console.log(chalk.blue(`INFO:\t${log}`)); -} - -// WARN Logging helper -export function warn (log) { - console.warn(chalk.yellow(`WARN:\t${log}`)); -} - -// ERROR Logging helper -export function error (log) { - console.error(chalk.red(`ERROR:\t${log}`)); -} diff --git a/js-old/scripts/helpers/parsed-rpc-traits.js b/js-old/scripts/helpers/parsed-rpc-traits.js deleted file mode 100644 index 9f2d4ea8a..000000000 --- a/js-old/scripts/helpers/parsed-rpc-traits.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import fs from 'fs'; -import path from 'path'; - -// ```js -// rustMethods['eth']['call'] === true -// ``` -const rustMethods = {}; - -export default rustMethods; - -// Get a list of JSON-RPC from Rust trait source code -function parseMethodsFromRust (source) { - // Matching the custom `rpc` attribute with it's doc comment - const attributePattern = /((?:\s*\/\/\/.*$)*)\s*#\[rpc\(([^)]+)\)]/gm; - const commentPattern = /\s*\/\/\/\s*/g; - const separatorPattern = /\s*,\s*/g; - const assignPattern = /([\S]+)\s*=\s*"([^"]*)"/; - const ignorePattern = /@(ignore|deprecated|unimplemented|alias)\b/i; - - const methods = []; - - source.toString().replace(attributePattern, (match, comment, props) => { - comment = comment.replace(commentPattern, '\n').trim(); - - // Skip deprecated methods - if (ignorePattern.test(comment)) { - return match; - } - - props.split(separatorPattern).forEach((prop) => { - const [, key, value] = prop.split(assignPattern) || []; - - if (key === 'name' && value != null) { - methods.push(value); - } - }); - - return match; - }); - - return methods; -} - -// Get a list of all JSON-RPC methods from all defined traits -function getMethodsFromRustTraits () { - const traitsDir = path.join(__dirname, '../../../rpc/src/v1/traits'); - - return fs.readdirSync(traitsDir) - .filter((name) => name !== 'mod.rs' && /\.rs$/.test(name)) - .map((name) => fs.readFileSync(path.join(traitsDir, name))) - .map(parseMethodsFromRust) - .reduce((a, b) => a.concat(b)); -} - -getMethodsFromRustTraits().sort().forEach((method) => { - const [group, name] = method.split('_'); - - // Skip methods with malformed names - if (group == null || name == null) { - return; - } - - rustMethods[group] = rustMethods[group] || {}; - rustMethods[group][name] = true; -}); diff --git a/js-old/src/3rdparty/etherscan/account.js b/js-old/src/3rdparty/etherscan/account.js index 7a6844759..1012a2727 100644 --- a/js-old/src/3rdparty/etherscan/account.js +++ b/js-old/src/3rdparty/etherscan/account.js @@ -18,7 +18,7 @@ import BigNumber from 'bignumber.js'; const PAGE_SIZE = 25; -import util from '../../api/util'; +import util from '@parity/api/lib/util'; import { call } from './call'; function _call (method, params, test, netVersion) { diff --git a/js-old/src/abi/README.md b/js-old/src/abi/README.md deleted file mode 100644 index 20bc094de..000000000 --- a/js-old/src/abi/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# ethabi-js - -A very early, very POC-type port of [https://github.com/paritytech/ethabi](https://github.com/paritytech/ethabi) to JavaScript - -[![Build Status](https://travis-ci.org/jacogr/ethabi-js.svg?branch=master)](https://travis-ci.org/jacogr/ethabi-js) -[![Coverage Status](https://coveralls.io/repos/github/jacogr/ethabi-js/badge.svg?branch=master)](https://coveralls.io/github/jacogr/ethabi-js?branch=master) -[![Dependency Status](https://david-dm.org/jacogr/ethabi-js.svg)](https://david-dm.org/jacogr/ethabi-js) -[![devDependency Status](https://david-dm.org/jacogr/ethabi-js/dev-status.svg)](https://david-dm.org/jacogr/ethabi-js#info=devDependencies) - -## contributing - -Clone the repo and install dependencies via `npm install`. Tests can be executed via - -- `npm run testOnce` (100% covered unit tests) - -## installation - -Install the package with `npm install --save ethabi-js` from the [npm registry ethabi-js](https://www.npmjs.com/package/ethabi-js) - - -## implementation -### approach - -- this version tries to stay as close to the original Rust version in intent, function names & purpose -- it is a basic port of the Rust version, relying on effectively the same test-suite (expanded where deemed appropriate) -- it is meant as a library to be used in other projects, i.e. [ethapi-js](https://www.npmjs.com/package/ethapi-js) - -### differences to original Rust version - -- internally the library operates on string binary representations as opposed to Vector bytes, lengths are therefore 64 bytes as opposed to 32 bytes -- function names are adapted from the Rust standard snake_case to the JavaScript standard camelCase -- due to the initial library focus, the cli component (as implemented by the original) is not supported nor mplemented diff --git a/js-old/src/abi/abi.js b/js-old/src/abi/abi.js deleted file mode 100644 index 892f531fa..000000000 --- a/js-old/src/abi/abi.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Interface from './spec/interface'; - -export default class Abi extends Interface { -} diff --git a/js-old/src/abi/decoder/bytesTaken.js b/js-old/src/abi/decoder/bytesTaken.js deleted file mode 100644 index dbf766f4b..000000000 --- a/js-old/src/abi/decoder/bytesTaken.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default class BytesTaken { - constructor (bytes, newOffset) { - this._bytes = bytes; - this._newOffset = newOffset; - } - - get bytes () { - return this._bytes; - } - - get newOffset () { - return this._newOffset; - } -} diff --git a/js-old/src/abi/decoder/bytesTaken.spec.js b/js-old/src/abi/decoder/bytesTaken.spec.js deleted file mode 100644 index 9329657e4..000000000 --- a/js-old/src/abi/decoder/bytesTaken.spec.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BytesTaken from './bytesTaken'; - -describe('abi/decoder/BytesTaken', () => { - describe('constructor', () => { - it('sets the bytes of the object', () => { - expect((new BytesTaken(1, 2)).bytes).to.equal(1); - }); - - it('sets the newOffset of the object', () => { - expect((new BytesTaken(3, 4)).newOffset).to.equal(4); - }); - }); -}); diff --git a/js-old/src/abi/decoder/decodeResult.js b/js-old/src/abi/decoder/decodeResult.js deleted file mode 100644 index 5e41da4b6..000000000 --- a/js-old/src/abi/decoder/decodeResult.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default class DecodeResult { - constructor (token, newOffset) { - this._token = token; - this._newOffset = newOffset; - } - - get token () { - return this._token; - } - - get newOffset () { - return this._newOffset; - } -} diff --git a/js-old/src/abi/decoder/decodeResult.spec.js b/js-old/src/abi/decoder/decodeResult.spec.js deleted file mode 100644 index 0c4c81c5c..000000000 --- a/js-old/src/abi/decoder/decodeResult.spec.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import DecodeResult from './decodeResult'; - -describe('abi/decoder/DecodeResult', () => { - describe('constructor', () => { - it('sets the token of the object', () => { - expect((new DecodeResult('token', 2)).token).to.equal('token'); - }); - - it('sets the newOffset of the object', () => { - expect((new DecodeResult('baz', 4)).newOffset).to.equal(4); - }); - }); -}); diff --git a/js-old/src/abi/decoder/decoder.js b/js-old/src/abi/decoder/decoder.js deleted file mode 100644 index 6922c91e8..000000000 --- a/js-old/src/abi/decoder/decoder.js +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import utf8 from 'utf8'; - -import Token from '../token/token'; -import BytesTaken from './bytesTaken'; -import DecodeResult from './decodeResult'; -import ParamType from '../spec/paramType/paramType'; -import { sliceData } from '../util/slice'; -import { asAddress, asBool, asI32, asU32 } from '../util/sliceAs'; -import { isArray, isInstanceOf } from '../util/types'; - -const NULL = '0000000000000000000000000000000000000000000000000000000000000000'; - -export default class Decoder { - static decode (params, data) { - if (!isArray(params)) { - throw new Error('Parameters should be array of ParamType'); - } - - const slices = sliceData(data); - let offset = 0; - - return params.map((param) => { - const result = Decoder.decodeParam(param, slices, offset); - - offset = result.newOffset; - return result.token; - }); - } - - static peek (slices, position) { - if (!slices || !slices[position]) { - return NULL; - } - - return slices[position]; - } - - static takeBytes (slices, position, length) { - const slicesLength = Math.floor((length + 31) / 32); - let bytesStr = ''; - - for (let idx = 0; idx < slicesLength; idx++) { - bytesStr = `${bytesStr}${Decoder.peek(slices, position + idx)}`; - } - - const bytes = (bytesStr.substr(0, length * 2).match(/.{1,2}/g) || []).map((code) => parseInt(code, 16)); - - return new BytesTaken(bytes, position + slicesLength); - } - - static decodeParam (param, slices, offset) { - if (!isInstanceOf(param, ParamType)) { - throw new Error('param should be instanceof ParamType'); - } - - const tokens = []; - let taken; - let lengthOffset; - let length; - let newOffset; - - switch (param.type) { - case 'address': - return new DecodeResult(new Token(param.type, asAddress(Decoder.peek(slices, offset))), offset + 1); - - case 'bool': - return new DecodeResult(new Token(param.type, asBool(Decoder.peek(slices, offset))), offset + 1); - - case 'int': - return new DecodeResult(new Token(param.type, asI32(Decoder.peek(slices, offset))), offset + 1); - - case 'uint': - return new DecodeResult(new Token(param.type, asU32(Decoder.peek(slices, offset))), offset + 1); - - case 'fixedBytes': - taken = Decoder.takeBytes(slices, offset, param.length); - - return new DecodeResult(new Token(param.type, taken.bytes), taken.newOffset); - - case 'bytes': - lengthOffset = asU32(Decoder.peek(slices, offset)).div(32).toNumber(); - length = asU32(Decoder.peek(slices, lengthOffset)).toNumber(); - taken = Decoder.takeBytes(slices, lengthOffset + 1, length); - - return new DecodeResult(new Token(param.type, taken.bytes), offset + 1); - - case 'string': - if (param.indexed) { - taken = Decoder.takeBytes(slices, offset, 32); - - return new DecodeResult(new Token('fixedBytes', taken.bytes), offset + 1); - } - - lengthOffset = asU32(Decoder.peek(slices, offset)).div(32).toNumber(); - length = asU32(Decoder.peek(slices, lengthOffset)).toNumber(); - taken = Decoder.takeBytes(slices, lengthOffset + 1, length); - - const str = taken.bytes.map((code) => String.fromCharCode(code)).join(''); - - let decoded; - - try { - decoded = utf8.decode(str); - } catch (error) { - decoded = str; - } - - return new DecodeResult(new Token(param.type, decoded), offset + 1); - - case 'array': - lengthOffset = asU32(Decoder.peek(slices, offset)).div(32).toNumber(); - length = asU32(Decoder.peek(slices, lengthOffset)).toNumber(); - newOffset = lengthOffset + 1; - - for (let idx = 0; idx < length; idx++) { - const result = Decoder.decodeParam(param.subtype, slices, newOffset); - - newOffset = result.newOffset; - tokens.push(result.token); - } - - return new DecodeResult(new Token(param.type, tokens), offset + 1); - - case 'fixedArray': - newOffset = offset; - - for (let idx = 0; idx < param.length; idx++) { - const result = Decoder.decodeParam(param.subtype, slices, newOffset); - - newOffset = result.newOffset; - tokens.push(result.token); - } - - return new DecodeResult(new Token(param.type, tokens), newOffset); - - default: - throw new Error(`Invalid param type ${param.type} in decodeParam`); - } - } -} diff --git a/js-old/src/abi/decoder/decoder.spec.js b/js-old/src/abi/decoder/decoder.spec.js deleted file mode 100644 index 5065be3a7..000000000 --- a/js-old/src/abi/decoder/decoder.spec.js +++ /dev/null @@ -1,319 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -import Decoder from './decoder'; -import ParamType from '../spec/paramType'; -import Token from '../token'; -import { padU32 } from '../util/pad'; - -describe('abi/decoder/Decoder', () => { - const stringToBytes = function (str) { - return str.match(/.{1,2}/g).map((code) => parseInt(code, 16)); - }; - - const address1 = '0000000000000000000000001111111111111111111111111111111111111111'; - const address2 = '0000000000000000000000002222222222222222222222222222222222222222'; - const address3 = '0000000000000000000000003333333333333333333333333333333333333333'; - const address4 = '0000000000000000000000004444444444444444444444444444444444444444'; - const bool1 = '0000000000000000000000000000000000000000000000000000000000000001'; - const bytes1 = '1234000000000000000000000000000000000000000000000000000000000000'; - const bytes2 = '1000000000000000000000000000000000000000000000000000000000000000'; - const bytes3 = '10000000000000000000000000000000000000000000000000000000000002'; - const bytes4 = '0010000000000000000000000000000000000000000000000000000000000002'; - const int1 = '0111111111111111111111111111111111111111111111111111111111111111'; - const intn = 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85'; - const string1 = '6761766f66796f726b0000000000000000000000000000000000000000000000'; - const string2 = '4665726ee16e64657a0000000000000000000000000000000000000000000000'; - const tokenAddress1 = new Token('address', `0x${address1.slice(-40)}`); - const tokenAddress2 = new Token('address', `0x${address2.slice(-40)}`); - const tokenAddress3 = new Token('address', `0x${address3.slice(-40)}`); - const tokenAddress4 = new Token('address', `0x${address4.slice(-40)}`); - const tokenBool1 = new Token('bool', true); - const tokenFixedBytes1 = new Token('fixedBytes', [0x12, 0x34]); - const tokenBytes1 = new Token('bytes', [0x12, 0x34]); - const tokenBytes2 = new Token('bytes', stringToBytes(bytes2).concat(stringToBytes(bytes2))); - const tokenBytes3 = new Token('bytes', stringToBytes(bytes3)); - const tokenBytes4 = new Token('bytes', stringToBytes(bytes4)); - const tokenInt1 = new Token('int', new BigNumber(int1, 16)); - const tokenIntn = new Token('int', new BigNumber(-123)); - const tokenUint1 = new Token('uint', new BigNumber(int1, 16)); - const tokenUintn = new Token('uint', new BigNumber(intn, 16)); - const tokenString1 = new Token('string', 'gavofyork'); - const tokenString2 = new Token('string', 'Fernández'); - const slices = [ address1, address2, address3, address4 ]; - - describe('peek', () => { - it('returns the slice at the correct position', () => { - expect(Decoder.peek(slices, 1)).to.equal(slices[1]); - }); - - it('returns empty on invalid slices', () => { - expect(Decoder.peek(null, 4)).to.equal('0000000000000000000000000000000000000000000000000000000000000000'); - }); - }); - - describe('takeBytes', () => { - it('returns a single slice', () => { - expect(Decoder.takeBytes(slices, 0, 32).bytes).to.deep.equal(stringToBytes(slices[0])); - }); - - it('returns a single partial slice', () => { - expect(Decoder.takeBytes(slices, 0, 20).bytes).to.deep.equal(stringToBytes(slices[0].substr(0, 40))); - }); - - it('returns multiple slices', () => { - expect(Decoder.takeBytes(slices, 0, 64).bytes).to.deep.equal(stringToBytes(`${slices[0]}${slices[1]}`)); - }); - - it('returns a single offset slice', () => { - expect(Decoder.takeBytes(slices, 1, 32).bytes).to.deep.equal(stringToBytes(slices[1])); - }); - - it('returns multiple offset slices', () => { - expect(Decoder.takeBytes(slices, 1, 64).bytes).to.deep.equal(stringToBytes(`${slices[1]}${slices[2]}`)); - }); - - it('returns the requires length from slices', () => { - expect( - Decoder.takeBytes(slices, 1, 75).bytes - ).to.deep.equal(stringToBytes(`${slices[1]}${slices[2]}${slices[3]}`.substr(0, 150))); - }); - }); - - describe('decodeParam', () => { - it('throws an error on non ParamType param', () => { - expect(() => Decoder.decodeParam({})).to.throw(/ParamType/); - }); - - it('throws an error on invalid param type', () => { - const pt = new ParamType('address'); - - pt._type = 'noMatch'; - - expect(() => Decoder.decodeParam(pt)).to.throw(/noMatch/); - }); - - it('decodes an address', () => { - expect( - Decoder.decodeParam(new ParamType('address'), [address1], 0).token - ).to.deep.equal(tokenAddress1); - }); - - it('decodes a bool', () => { - expect( - Decoder.decodeParam(new ParamType('bool'), [bool1], 0).token - ).to.deep.equal(tokenBool1); - }); - - it('decodes an int', () => { - expect( - Decoder.decodeParam(new ParamType('int'), [int1], 0).token - ).to.deep.equal(tokenInt1); - }); - - it('decodes a negative int', () => { - expect( - Decoder.decodeParam(new ParamType('int'), [intn], 0).token - ).to.deep.equal(tokenIntn); - }); - - it('decodes an uint', () => { - expect( - Decoder.decodeParam(new ParamType('uint'), [int1], 0).token - ).to.deep.equal(tokenUint1); - }); - - it('decodes an uint (negative as int)', () => { - expect( - Decoder.decodeParam(new ParamType('uint'), [intn], 0).token - ).to.deep.equal(tokenUintn); - }); - - it('decodes fixedBytes', () => { - expect( - Decoder.decodeParam(new ParamType('fixedBytes', null, 2), [bytes1], 0).token - ).to.deep.equal(tokenFixedBytes1); - }); - - it('decodes bytes', () => { - expect( - Decoder.decodeParam(new ParamType('bytes'), [padU32(0x20), padU32(2), bytes1], 0).token - ).to.deep.equal(tokenBytes1); - }); - - it('decodes string', () => { - expect( - Decoder.decodeParam(new ParamType('string'), [padU32(0x20), padU32(9), string1], 0).token - ).to.deep.equal(tokenString1); - }); - - it('decodes utf8-invalid string', () => { - expect( - Decoder.decodeParam(new ParamType('string'), [padU32(0x20), padU32(9), string2], 0).token - ).to.deep.equal(tokenString2); - }); - - it('decodes string (indexed)', () => { - expect( - Decoder.decodeParam(new ParamType('string', null, 0, true), [bytes1], 0) - ).to.deep.equal(Decoder.decodeParam(new ParamType('fixedBytes', null, 32, true), [bytes1], 0)); - }); - }); - - describe('decode', () => { - it('throws an error on invalid params', () => { - expect(() => Decoder.decode(null, '123')).to.throw(/array/); - }); - - describe('address', () => { - it('decodes an address', () => { - expect( - Decoder.decode( - [new ParamType('address')], - `${address1}` - ) - ).to.deep.equal([tokenAddress1]); - }); - - it('decodes 2 addresses', () => { - expect( - Decoder.decode( - [new ParamType('address'), new ParamType('address')], - `${address1}${address2}` - ) - ).to.deep.equal([tokenAddress1, tokenAddress2]); - }); - - it('decodes a fixedArray of addresses', () => { - expect( - Decoder.decode( - [new ParamType('fixedArray', new ParamType('address'), 2)], - `${address1}${address2}` - ) - ).to.deep.equal([new Token('fixedArray', [tokenAddress1, tokenAddress2])]); - }); - - it('decodes a dynamic array of addresses', () => { - expect( - Decoder.decode( - [new ParamType('array', new ParamType('address'))], - `${padU32(0x20)}${padU32(2)}${address1}${address2}` - ) - ).to.deep.equal([new Token('array', [tokenAddress1, tokenAddress2])]); - }); - - it('decodes a dynamic array of fixed arrays', () => { - expect( - Decoder.decode( - [new ParamType('array', new ParamType('fixedArray', new ParamType('address'), 2))], - `${padU32(0x20)}${padU32(2)}${address1}${address2}${address3}${address4}` - ) - ).to.deep.equal([ - new Token('array', [ - new Token('fixedArray', [tokenAddress1, tokenAddress2]), - new Token('fixedArray', [tokenAddress3, tokenAddress4]) - ]) - ]); - }); - }); - - describe('int', () => { - it('decodes an int', () => { - expect( - Decoder.decode( - [new ParamType('int')], - `${int1}` - ) - ).to.deep.equal([tokenInt1]); - }); - }); - - describe('uint', () => { - it('decodes an uint', () => { - expect( - Decoder.decode( - [new ParamType('uint')], - `${int1}` - ) - ).to.deep.equal([tokenUint1]); - }); - }); - - describe('fixedBytes', () => { - it('decodes fixedBytes', () => { - expect( - Decoder.decode( - [new ParamType('fixedBytes', null, 2)], - `${bytes1}` - ) - ).to.deep.equal([tokenFixedBytes1]); - }); - }); - - describe('bytes', () => { - it('decodes bytes', () => { - expect( - Decoder.decode( - [new ParamType('bytes')], - `${padU32(0x20)}${padU32(2)}${bytes1}` - ) - ).to.deep.equal([tokenBytes1]); - }); - - it('decodes bytes sequence', () => { - expect( - Decoder.decode( - [new ParamType('bytes')], - `${padU32(0x20)}${padU32(0x40)}${bytes2}${bytes2}` - ) - ).to.deep.equal([tokenBytes2]); - }); - - it('decodes bytes seuence (2)', () => { - expect( - Decoder.decode( - [new ParamType('bytes'), new ParamType('bytes')], - `${padU32(0x40)}${padU32(0x80)}${padU32(0x1f)}${bytes3}00${padU32(0x20)}${bytes4}` - ) - ).to.deep.equal([tokenBytes3, tokenBytes4]); - }); - }); - - describe('bool', () => { - it('decodes a single bool', () => { - expect( - Decoder.decode( - [new ParamType('bool')], - bool1 - ) - ).to.deep.equal([tokenBool1]); - }); - }); - - describe('string', () => { - it('decodes a string', () => { - expect( - Decoder.decode( - [new ParamType('string')], - `${padU32(0x20)}${padU32(9)}${string1}` - ) - ).to.deep.equal([tokenString1]); - }); - }); - }); -}); diff --git a/js-old/src/abi/decoder/index.js b/js-old/src/abi/decoder/index.js deleted file mode 100644 index 2ead31504..000000000 --- a/js-old/src/abi/decoder/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './decoder'; diff --git a/js-old/src/abi/encoder/encoder.js b/js-old/src/abi/encoder/encoder.js deleted file mode 100644 index fa1aa0453..000000000 --- a/js-old/src/abi/encoder/encoder.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { padAddress, padBool, padBytes, padFixedBytes, padU32, padString } from '../util/pad'; -import Mediate from './mediate'; -import Token from '../token/token'; -import { isArray, isInstanceOf } from '../util/types'; - -export default class Encoder { - static encode (tokens) { - if (!isArray(tokens)) { - throw new Error('tokens should be array of Token'); - } - - const mediates = tokens.map((token, index) => Encoder.encodeToken(token, index)); - const inits = mediates - .map((mediate, idx) => mediate.init(Mediate.offsetFor(mediates, idx))) - .join(''); - const closings = mediates - .map((mediate, idx) => mediate.closing(Mediate.offsetFor(mediates, idx))) - .join(''); - - return `${inits}${closings}`; - } - - static encodeToken (token, index = 0) { - if (!isInstanceOf(token, Token)) { - throw new Error('token should be instanceof Token'); - } - - try { - switch (token.type) { - case 'address': - return new Mediate('raw', padAddress(token.value)); - - case 'int': - case 'uint': - return new Mediate('raw', padU32(token.value)); - - case 'bool': - return new Mediate('raw', padBool(token.value)); - - case 'fixedBytes': - return new Mediate('raw', padFixedBytes(token.value)); - - case 'bytes': - return new Mediate('prefixed', padBytes(token.value)); - - case 'string': - return new Mediate('prefixed', padString(token.value)); - - case 'fixedArray': - case 'array': - return new Mediate(token.type, token.value.map((token) => Encoder.encodeToken(token))); - } - } catch (e) { - throw new Error(`Cannot encode token #${index} [${token.type}: ${token.value}]. ${e.message}`); - } - - throw new Error(`Invalid token type ${token.type} in encodeToken`); - } -} diff --git a/js-old/src/abi/encoder/encoder.spec.js b/js-old/src/abi/encoder/encoder.spec.js deleted file mode 100644 index 9a4a24361..000000000 --- a/js-old/src/abi/encoder/encoder.spec.js +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Encoder from './encoder'; -import Token from '../token'; -import { padAddress, padFixedBytes, padU32 } from '../util/pad'; - -describe('abi/encoder/Encoder', () => { - describe('encodeToken', () => { - it('requires token as Token', () => { - expect(() => Encoder.encodeToken()).to.throw(/Token/); - }); - - it('encodes address tokens in Mediate(raw)', () => { - const mediate = Encoder.encodeToken(new Token('address', '123')); - - expect(mediate.type).to.equal('raw'); - expect(mediate.value).to.be.ok; - }); - - it('encodes bool tokens in Mediate(raw)', () => { - const mediatet = Encoder.encodeToken(new Token('bool', true)); - const mediatef = Encoder.encodeToken(new Token('bool', false)); - - expect(mediatet.type).to.equal('raw'); - expect(mediatet.value).to.be.ok; - - expect(mediatef.type).to.equal('raw'); - expect(mediatef.value).to.be.ok; - }); - - it('encodes int tokens in Mediate(raw)', () => { - const mediate = Encoder.encodeToken(new Token('int', '123')); - - expect(mediate.type).to.equal('raw'); - expect(mediate.value).to.be.ok; - }); - - it('encodes uint tokens in Mediate(raw)', () => { - const mediate = Encoder.encodeToken(new Token('uint', '123')); - - expect(mediate.type).to.equal('raw'); - expect(mediate.value).to.be.ok; - }); - - it('encodes fixedBytes tokens in Mediate(raw)', () => { - const mediate = Encoder.encodeToken(new Token('fixedBytes', '123')); - - expect(mediate.type).to.equal('raw'); - expect(mediate.value).to.be.ok; - }); - - it('encodes bytes tokens in Mediate(prefixed)', () => { - const mediate = Encoder.encodeToken(new Token('bytes', '123')); - - expect(mediate.type).to.equal('prefixed'); - expect(mediate.value).to.be.ok; - }); - - it('encodes string tokens in Mediate(prefixed)', () => { - const mediate = Encoder.encodeToken(new Token('string', '123')); - - expect(mediate.type).to.equal('prefixed'); - expect(mediate.value).to.be.ok; - }); - - it('encodes fixedArray tokens in Mediate(fixedArray)', () => { - const mediate = Encoder.encodeToken(new Token('fixedArray', [new Token('uint', '123')])); - - expect(mediate.type).to.equal('fixedArray'); - expect(mediate.value).to.be.ok; - }); - - it('encodes array tokens in Mediate(array)', () => { - const mediate = Encoder.encodeToken(new Token('array', [new Token('uint', '123')])); - - expect(mediate.type).to.equal('array'); - expect(mediate.value).to.be.ok; - }); - - it('throws an Error on invalid tokens', () => { - const token = new Token('address'); - - token._type = 'noMatch'; - - expect(() => Encoder.encodeToken(token)).to.throw(/noMatch/); - }); - }); - - describe('encode', () => { - it('requires tokens array', () => { - expect(() => Encoder.encode()).to.throw(/array/); - }); - - describe('addresses', () => { - const address1 = '1111111111111111111111111111111111111111'; - const address2 = '2222222222222222222222222222222222222222'; - const address3 = '3333333333333333333333333333333333333333'; - const address4 = '4444444444444444444444444444444444444444'; - const encAddress1 = padAddress(address1); - const encAddress2 = padAddress(address2); - const encAddress3 = padAddress(address3); - const encAddress4 = padAddress(address4); - const tokenAddress1 = new Token('address', address1); - const tokenAddress2 = new Token('address', address2); - const tokenAddress3 = new Token('address', address3); - const tokenAddress4 = new Token('address', address4); - - it('encodes an address', () => { - const token = tokenAddress1; - - expect(Encoder.encode([token])).to.equal(encAddress1); - }); - - it('encodes an array of addresses', () => { - const expected = `${padU32(0x20)}${padU32(2)}${encAddress1}${encAddress2}`; - const token = new Token('array', [tokenAddress1, tokenAddress2]); - - expect(Encoder.encode([token])).to.equal(expected); - }); - - it('encodes an fixedArray of addresses', () => { - const expected = `${encAddress1}${encAddress2}`; - const token = new Token('fixedArray', [tokenAddress1, tokenAddress2]); - - expect(Encoder.encode([token])).to.equal(expected); - }); - - it('encodes two addresses', () => { - const expected = `${encAddress1}${encAddress2}`; - const tokens = [tokenAddress1, tokenAddress2]; - - expect(Encoder.encode(tokens)).to.equal(expected); - }); - - it('encodes fixed array of dynamic array addresses', () => { - const tokens1 = new Token('array', [tokenAddress1, tokenAddress2]); - const tokens2 = new Token('array', [tokenAddress3, tokenAddress4]); - const fixed = new Token('fixedArray', [tokens1, tokens2]); - const expected = `${padU32(0x40)}${padU32(0xa0)}${padU32(2)}${encAddress1}${encAddress2}${padU32(2)}${encAddress3}${encAddress4}`; - - expect(Encoder.encode([fixed])).to.equal(expected); - }); - - it('encodes dynamic array of fixed array addresses', () => { - const tokens1 = new Token('fixedArray', [tokenAddress1, tokenAddress2]); - const tokens2 = new Token('fixedArray', [tokenAddress3, tokenAddress4]); - const dynamic = new Token('array', [tokens1, tokens2]); - const expected = `${padU32(0x20)}${padU32(2)}${encAddress1}${encAddress2}${encAddress3}${encAddress4}`; - - expect(Encoder.encode([dynamic])).to.equal(expected); - }); - - it('encodes dynamic array of dynamic array addresses', () => { - const tokens1 = new Token('array', [tokenAddress1]); - const tokens2 = new Token('array', [tokenAddress2]); - const dynamic = new Token('array', [tokens1, tokens2]); - const expected = `${padU32(0x20)}${padU32(2)}${padU32(0x80)}${padU32(0xc0)}${padU32(1)}${encAddress1}${padU32(1)}${encAddress2}`; - - expect(Encoder.encode([dynamic])).to.equal(expected); - }); - - it('encodes dynamic array of dynamic array addresses (2)', () => { - const tokens1 = new Token('array', [tokenAddress1, tokenAddress2]); - const tokens2 = new Token('array', [tokenAddress3, tokenAddress4]); - const dynamic = new Token('array', [tokens1, tokens2]); - const expected = `${padU32(0x20)}${padU32(2)}${padU32(0x80)}${padU32(0xe0)}${padU32(2)}${encAddress1}${encAddress2}${padU32(2)}${encAddress3}${encAddress4}`; - - expect(Encoder.encode([dynamic])).to.equal(expected); - }); - - it('encodes fixed array of fixed array addresses', () => { - const tokens1 = new Token('fixedArray', [tokenAddress1, tokenAddress2]); - const tokens2 = new Token('fixedArray', [tokenAddress3, tokenAddress4]); - const dynamic = new Token('fixedArray', [tokens1, tokens2]); - const expected = `${encAddress1}${encAddress2}${encAddress3}${encAddress4}`; - - expect(Encoder.encode([dynamic])).to.equal(expected); - }); - }); - - describe('bytes', () => { - const bytes1 = '0x1234'; - const bytes2 = '0x10000000000000000000000000000000000000000000000000000000000002'; - const bytes3 = '0x1000000000000000000000000000000000000000000000000000000000000000'; - - it('encodes fixed bytes', () => { - const token = new Token('fixedBytes', bytes1); - - expect(Encoder.encode([token])).to.equal(padFixedBytes(bytes1)); - }); - - it('encodes bytes', () => { - const token = new Token('bytes', bytes1); - - expect(Encoder.encode([token])).to.equal(`${padU32(0x20)}${padU32(2)}${padFixedBytes(bytes1)}`); - }); - - it('encodes bytes (short of boundary)', () => { - const token = new Token('bytes', bytes2); - - expect(Encoder.encode([token])).to.equal(`${padU32(0x20)}${padU32(0x1f)}${padFixedBytes(bytes2)}`); - }); - - it('encodes bytes (two blocks)', () => { - const input = `${bytes3}${bytes3.slice(-64)}`; - const token = new Token('bytes', input); - - expect(Encoder.encode([token])).to.equal(`${padU32(0x20)}${padU32(0x40)}${padFixedBytes(input)}`); - }); - - it('encodes two consecutive bytes', () => { - const in1 = '0x10000000000000000000000000000000000000000000000000000000000002'; - const in2 = '0x0010000000000000000000000000000000000000000000000000000000000002'; - const tokens = [new Token('bytes', in1), new Token('bytes', in2)]; - - expect(Encoder.encode(tokens)).to.equal(`${padU32(0x40)}${padU32(0x80)}${padU32(0x1f)}${padFixedBytes(in1)}${padU32(0x20)}${padFixedBytes(in2)}`); - }); - }); - - describe('string', () => { - it('encodes a string', () => { - const string = 'gavofyork'; - const stringEnc = padFixedBytes('0x6761766f66796f726b'); - const token = new Token('string', string); - - expect(Encoder.encode([token])).to.equal(`${padU32(0x20)}${padU32(string.length.toString(16))}${stringEnc}`); - }); - }); - - describe('uint', () => { - it('encodes a uint', () => { - const token = new Token('uint', 4); - - expect(Encoder.encode([token])).to.equal(padU32(4)); - }); - }); - - describe('int', () => { - it('encodes a int', () => { - const token = new Token('int', 4); - - expect(Encoder.encode([token])).to.equal(padU32(4)); - }); - }); - - describe('bool', () => { - it('encodes a bool (true)', () => { - const token = new Token('bool', true); - - expect(Encoder.encode([token])).to.equal(padU32(1)); - }); - - it('encodes a bool (false)', () => { - const token = new Token('bool', false); - - expect(Encoder.encode([token])).to.equal(padU32(0)); - }); - }); - - describe('comprehensive test', () => { - it('encodes a complex sequence', () => { - const bytes = '0x131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'; - const tokens = [new Token('int', 5), new Token('bytes', bytes), new Token('int', 3), new Token('bytes', bytes)]; - - expect(Encoder.encode(tokens)).to.equal(`${padU32(5)}${padU32(0x80)}${padU32(3)}${padU32(0xe0)}${padU32(0x40)}${bytes.substr(2)}${padU32(0x40)}${bytes.substr(2)}`); - }); - - it('encodes a complex sequence (nested)', () => { - const array = [new Token('int', 5), new Token('int', 6), new Token('int', 7)]; - const tokens = [new Token('int', 1), new Token('string', 'gavofyork'), new Token('int', 2), new Token('int', 3), new Token('int', 4), new Token('array', array)]; - const stringEnc = padFixedBytes('0x6761766f66796f726b'); - - expect(Encoder.encode(tokens)).to.equal(`${padU32(1)}${padU32(0xc0)}${padU32(2)}${padU32(3)}${padU32(4)}${padU32(0x100)}${padU32(9)}${stringEnc}${padU32(3)}${padU32(5)}${padU32(6)}${padU32(7)}`); - }); - }); - }); -}); diff --git a/js-old/src/abi/encoder/index.js b/js-old/src/abi/encoder/index.js deleted file mode 100644 index 5ac3c0a6b..000000000 --- a/js-old/src/abi/encoder/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './encoder'; diff --git a/js-old/src/abi/encoder/mediate.js b/js-old/src/abi/encoder/mediate.js deleted file mode 100644 index 90cc28881..000000000 --- a/js-old/src/abi/encoder/mediate.js +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -const TYPES = ['raw', 'prefixed', 'fixedArray', 'array']; - -import { padU32 } from '../util/pad'; - -export default class Mediate { - constructor (type, value) { - Mediate.validateType(type); - - this._type = type; - this._value = value; - } - - initLength () { - switch (this._type) { - case 'raw': - return this._value.length / 2; - - case 'array': - case 'prefixed': - return 32; - - case 'fixedArray': - return this._value - .reduce((total, mediate) => { - return total + mediate.initLength(); - }, 0); - } - } - - closingLength () { - switch (this._type) { - case 'raw': - return 0; - - case 'prefixed': - return this._value.length / 2; - - case 'array': - return this._value - .reduce((total, mediate) => { - return total + mediate.initLength(); - }, 32); - - case 'fixedArray': - return this._value - .reduce((total, mediate) => { - return total + mediate.initLength() + mediate.closingLength(); - }, 0); - } - } - - init (suffixOffset) { - switch (this._type) { - case 'raw': - return this._value; - - case 'fixedArray': - return this._value - .map((mediate, idx) => mediate.init(Mediate.offsetFor(this._value, idx)).toString(16)) - .join(''); - - case 'prefixed': - case 'array': - return padU32(suffixOffset); - } - } - - closing (offset) { - switch (this._type) { - case 'raw': - return ''; - - case 'prefixed': - return this._value; - - case 'fixedArray': - return this._value - .map((mediate, idx) => mediate.closing(Mediate.offsetFor(this._value, idx)).toString(16)) - .join(''); - - case 'array': - const prefix = padU32(this._value.length); - const inits = this._value - .map((mediate, idx) => mediate.init(offset + Mediate.offsetFor(this._value, idx) + 32).toString(16)) - .join(''); - const closings = this._value - .map((mediate, idx) => mediate.closing(offset + Mediate.offsetFor(this._value, idx)).toString(16)) - .join(''); - - return `${prefix}${inits}${closings}`; - } - } - - get type () { - return this._type; - } - - get value () { - return this._value; - } - - static offsetFor (mediates, position) { - if (position < 0 || position >= mediates.length) { - throw new Error(`Invalid position ${position} specified for Mediate.offsetFor`); - } - - const initLength = mediates - .reduce((total, mediate) => { - return total + mediate.initLength(); - }, 0); - - return mediates - .slice(0, position) - .reduce((total, mediate) => { - return total + mediate.closingLength(); - }, initLength); - } - - static validateType (type) { - if (TYPES.filter((_type) => type === _type).length) { - return true; - } - - throw new Error(`Invalid type ${type} received for Mediate.validateType`); - } -} diff --git a/js-old/src/abi/encoder/mediate.spec.js b/js-old/src/abi/encoder/mediate.spec.js deleted file mode 100644 index ab89909b1..000000000 --- a/js-old/src/abi/encoder/mediate.spec.js +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Mediate from './mediate'; - -describe('abi/encoder/Mediate', () => { - const LONG15 = '1234567890abcdef000000000000000000000000000000000000000000000000'; - const DOUBLE15 = `${LONG15}${LONG15}`; - const ARRAY = [new Mediate('raw', DOUBLE15), new Mediate('raw', LONG15)]; - - describe('validateType', () => { - it('validates raw', () => { - expect(Mediate.validateType('raw')).to.be.true; - }); - - it('validates prefixed', () => { - expect(Mediate.validateType('prefixed')).to.be.true; - }); - - it('validates fixedArray', () => { - expect(Mediate.validateType('fixedArray')).to.be.true; - }); - - it('validates array', () => { - expect(Mediate.validateType('array')).to.be.true; - }); - - it('throws an error on invalid types', () => { - expect(() => Mediate.validateType('noMatch')).to.throw(/noMatch/); - }); - }); - - describe('offsetFor', () => { - it('thows an error when offset < 0', () => { - expect(() => Mediate.offsetFor([1], -1)).to.throw(/Invalid position/); - }); - - it('throws an error when offset >= length', () => { - expect(() => Mediate.offsetFor([1], 1)).to.throw(/Invalid position/); - }); - }); - - describe('constructor', () => { - it('throws an error on invalid types', () => { - expect(() => new Mediate('noMatch', '1')).to.throw(/noMatch/); - }); - - it('sets the type of the object', () => { - expect((new Mediate('raw', '1')).type).to.equal('raw'); - }); - - it('sets the value of the object', () => { - expect((new Mediate('raw', '1')).value).to.equal('1'); - }); - }); - - describe('initLength', () => { - it('returns correct variable byte length for raw', () => { - expect(new Mediate('raw', DOUBLE15).initLength()).to.equal(64); - }); - - it('returns correct fixed byte length for array', () => { - expect(new Mediate('array', [1, 2, 3, 4]).initLength()).to.equal(32); - }); - - it('returns correct fixed byte length for prefixed', () => { - expect(new Mediate('prefixed', 0).initLength()).to.equal(32); - }); - - it('returns correct variable byte length for fixedArray', () => { - expect(new Mediate('fixedArray', ARRAY).initLength()).to.equal(96); - }); - }); - - describe('closingLength', () => { - it('returns 0 byte length for raw', () => { - expect(new Mediate('raw', DOUBLE15).closingLength()).to.equal(0); - }); - - it('returns prefix + size for prefixed', () => { - expect(new Mediate('prefixed', DOUBLE15).closingLength()).to.equal(64); - }); - - it('returns prefix + size for array', () => { - expect(new Mediate('array', ARRAY).closingLength()).to.equal(128); - }); - - it('returns total length for fixedArray', () => { - expect(new Mediate('fixedArray', ARRAY).closingLength()).to.equal(96); - }); - }); -}); diff --git a/js-old/src/abi/index.js b/js-old/src/abi/index.js deleted file mode 100644 index 703ed1c78..000000000 --- a/js-old/src/abi/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './abi'; diff --git a/js-old/src/abi/spec/constructor.js b/js-old/src/abi/spec/constructor.js deleted file mode 100644 index e9b23b593..000000000 --- a/js-old/src/abi/spec/constructor.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Encoder from '../encoder/encoder'; -import Param from './param'; - -export default class Constructor { - constructor (abi) { - this._inputs = Param.toParams(abi.inputs || []); - } - - get inputs () { - return this._inputs; - } - - inputParamTypes () { - return this._inputs.map((input) => input.kind); - } - - encodeCall (tokens) { - return Encoder.encode(tokens); - } -} diff --git a/js-old/src/abi/spec/constructor.spec.js b/js-old/src/abi/spec/constructor.spec.js deleted file mode 100644 index 7c7414bdc..000000000 --- a/js-old/src/abi/spec/constructor.spec.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Constructor from './constructor'; -import Param from './param'; -import Token from '../token'; - -describe('abi/spec/Constructor', () => { - const inputsArr = [{ name: 'boolin', type: 'bool' }, { name: 'stringin', type: 'string' }]; - const bool = new Param('boolin', 'bool'); - const string = new Param('stringin', 'string'); - - const inputs = [bool, string]; - const cr = new Constructor({ inputs: inputsArr }); - - describe('constructor', () => { - it('stores the inputs as received', () => { - expect(cr.inputs).to.deep.equal(inputs); - }); - - it('matches empty inputs with []', () => { - expect(new Constructor({}).inputs).to.deep.equal([]); - }); - }); - - describe('inputParamTypes', () => { - it('retrieves the input types as received', () => { - expect(cr.inputParamTypes()).to.deep.equal([bool.kind, string.kind]); - }); - }); - - describe('encodeCall', () => { - it('encodes correctly', () => { - const result = cr.encodeCall([new Token('bool', true), new Token('string', 'jacogr')]); - - expect(result).to.equal('0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000066a61636f67720000000000000000000000000000000000000000000000000000'); - }); - }); -}); diff --git a/js-old/src/abi/spec/event/decodedLog.js b/js-old/src/abi/spec/event/decodedLog.js deleted file mode 100644 index e398c5a1b..000000000 --- a/js-old/src/abi/spec/event/decodedLog.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default class DecodedLog { - constructor (params, address) { - this._params = params; - this._address = address; - } - - get address () { - return this._address; - } - - get params () { - return this._params; - } -} diff --git a/js-old/src/abi/spec/event/decodedLog.spec.js b/js-old/src/abi/spec/event/decodedLog.spec.js deleted file mode 100644 index f448af011..000000000 --- a/js-old/src/abi/spec/event/decodedLog.spec.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import DecodedLog from './decodedLog'; - -const log = new DecodedLog('someParams', 'someAddress'); - -describe('abi/spec/event/DecodedLog', () => { - describe('constructor', () => { - it('sets internal state', () => { - expect(log.params).to.equal('someParams'); - expect(log.address).to.equal('someAddress'); - }); - }); -}); diff --git a/js-old/src/abi/spec/event/decodedLogParam.js b/js-old/src/abi/spec/event/decodedLogParam.js deleted file mode 100644 index 422fbaac8..000000000 --- a/js-old/src/abi/spec/event/decodedLogParam.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import ParamType from '../paramType/paramType'; -import Token from '../../token/token'; -import { isInstanceOf } from '../../util/types'; - -export default class DecodedLogParam { - constructor (name, kind, token) { - if (!isInstanceOf(kind, ParamType)) { - throw new Error('kind not instanceof ParamType'); - } else if (!isInstanceOf(token, Token)) { - throw new Error('token not instanceof Token'); - } - - this._name = name; - this._kind = kind; - this._token = token; - } - - get name () { - return this._name; - } - - get kind () { - return this._kind; - } - - get token () { - return this._token; - } -} diff --git a/js-old/src/abi/spec/event/decodedLogParam.spec.js b/js-old/src/abi/spec/event/decodedLogParam.spec.js deleted file mode 100644 index 6a7f52044..000000000 --- a/js-old/src/abi/spec/event/decodedLogParam.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import DecodedLogParam from './decodedLogParam'; -import ParamType from '../paramType'; -import Token from '../../token'; - -describe('abi/spec/event/DecodedLogParam', () => { - describe('constructor', () => { - const pt = new ParamType('bool'); - const tk = new Token('bool'); - - it('disallows kind not instanceof ParamType', () => { - expect(() => new DecodedLogParam('test', 'param')).to.throw(/ParamType/); - }); - - it('disallows token not instanceof Token', () => { - expect(() => new DecodedLogParam('test', pt, 'token')).to.throw(/Token/); - }); - - it('stores all parameters received', () => { - const log = new DecodedLogParam('test', pt, tk); - - expect(log.name).to.equal('test'); - expect(log.kind).to.equal(pt); - expect(log.token).to.equal(tk); - }); - }); -}); diff --git a/js-old/src/abi/spec/event/event.js b/js-old/src/abi/spec/event/event.js deleted file mode 100644 index 604f58cb1..000000000 --- a/js-old/src/abi/spec/event/event.js +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Decoder from '../../decoder/decoder'; -import DecodedLog from './decodedLog'; -import DecodedLogParam from './decodedLogParam'; -import EventParam from './eventParam'; -import { asAddress } from '../../util/sliceAs'; -import { eventSignature } from '../../util/signature'; - -export default class Event { - constructor (abi) { - this._inputs = EventParam.toEventParams(abi.inputs || []); - this._anonymous = !!abi.anonymous; - - const { id, name, signature } = eventSignature(abi.name, this.inputParamTypes()); - - this._id = id; - this._name = name; - this._signature = signature; - } - - get name () { - return this._name; - } - - get id () { - return this._id; - } - - get inputs () { - return this._inputs; - } - - get anonymous () { - return this._anonymous; - } - - get signature () { - return this._signature; - } - - inputParamTypes () { - return this._inputs.map((input) => input.kind); - } - - inputParamNames () { - return this._inputs.map((input) => input.name); - } - - indexedParams (indexed) { - return this._inputs.filter((input) => input.indexed === indexed); - } - - decodeLog (topics, data) { - const topicParams = this.indexedParams(true); - const dataParams = this.indexedParams(false); - - let address; - let toSkip; - - if (!this.anonymous) { - address = asAddress(topics[0]); - toSkip = 1; - } else { - toSkip = 0; - } - - const topicTypes = topicParams.map((param) => param.kind); - const flatTopics = topics - .filter((topic, idx) => idx >= toSkip) - .map((topic) => { - return (topic.substr(0, 2) === '0x') - ? topic.substr(2) - : topic; - }).join(''); - const topicTokens = Decoder.decode(topicTypes, flatTopics); - - if (topicTokens.length !== (topics.length - toSkip)) { - throw new Error('Invalid topic data'); - } - - const dataTypes = dataParams.map((param) => param.kind); - const dataTokens = Decoder.decode(dataTypes, data); - - const namedTokens = {}; - - topicParams.forEach((param, idx) => { - namedTokens[param.name || idx] = topicTokens[idx]; - }); - dataParams.forEach((param, idx) => { - namedTokens[param.name || idx] = dataTokens[idx]; - }); - - const inputParamTypes = this.inputParamTypes(); - const decodedParams = this.inputParamNames() - .map((name, idx) => new DecodedLogParam(name, inputParamTypes[idx], namedTokens[name || idx])); - - return new DecodedLog(decodedParams, address); - } -} diff --git a/js-old/src/abi/spec/event/event.spec.js b/js-old/src/abi/spec/event/event.spec.js deleted file mode 100644 index bf47980fc..000000000 --- a/js-old/src/abi/spec/event/event.spec.js +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -import Event from './event'; -import EventParam from './eventParam'; -import DecodedLogParam from './decodedLogParam'; -import ParamType from '../paramType'; -import Token from '../../token'; - -describe('abi/spec/event/Event', () => { - const inputArr = [{ name: 'a', type: 'bool' }, { name: 'b', type: 'uint', indexed: true }]; - const inputs = [new EventParam('a', 'bool', false), new EventParam('b', 'uint', true)]; - const event = new Event({ name: 'test', inputs: inputArr, anonymous: true }); - - describe('constructor', () => { - it('stores the parameters as received', () => { - expect(event.name).to.equal('test'); - expect(event.inputs).to.deep.equal(inputs); - expect(event.anonymous).to.be.true; - }); - - it('matches empty inputs with []', () => { - expect(new Event({ name: 'test' }).inputs).to.deep.equal([]); - }); - - it('sets the event signature', () => { - expect(new Event({ name: 'baz' }).signature) - .to.equal('a7916fac4f538170f7cd12c148552e2cba9fcd72329a2dd5b07a6fa906488ddf'); - }); - }); - - describe('inputParamTypes', () => { - it('returns all the types', () => { - expect(event.inputParamTypes()).to.deep.equal([new ParamType('bool'), new ParamType('uint', null, 256, true)]); - }); - }); - - describe('inputParamNames', () => { - it('returns all the names', () => { - expect(event.inputParamNames()).to.deep.equal(['a', 'b']); - }); - }); - - describe('indexedParams', () => { - it('returns all indexed parameters (indexed)', () => { - expect(event.indexedParams(true)).to.deep.equal([inputs[1]]); - }); - - it('returns all indexed parameters (non-indexed)', () => { - expect(event.indexedParams(false)).to.deep.equal([inputs[0]]); - }); - }); - - describe('decodeLog', () => { - it('decodes an event', () => { - const event = new Event({ - name: 'foo', - inputs: [ - { name: 'a', type: 'int' }, - { name: 'b', type: 'int', indexed: true }, - { name: 'c', type: 'address' }, - { name: 'd', type: 'address', indexed: true } - ] - }); - const decoded = event.decodeLog([ - '0000000000000000000000004444444444444444444444444444444444444444', - '0000000000000000000000000000000000000000000000000000000000000002', - '0000000000000000000000001111111111111111111111111111111111111111' ], - '00000000000000000000000000000000000000000000000000000000000000030000000000000000000000002222222222222222222222222222222222222222'); - - expect(decoded.address).to.equal('0x4444444444444444444444444444444444444444'); - expect(decoded.params).to.deep.equal([ - new DecodedLogParam('a', new ParamType('int', null, 256), new Token('int', new BigNumber(3))), - new DecodedLogParam('b', new ParamType('int', null, 256, true), new Token('int', new BigNumber(2))), - new DecodedLogParam('c', new ParamType('address'), new Token('address', '0x2222222222222222222222222222222222222222')), - new DecodedLogParam('d', new ParamType('address', null, 0, true), new Token('address', '0x1111111111111111111111111111111111111111')) - ]); - }); - - it('decodes an anonymous event', () => { - const event = new Event({ name: 'foo', inputs: [{ name: 'a', type: 'int' }], anonymous: true }); - const decoded = event.decodeLog([], '0000000000000000000000000000000000000000000000000000000000000003'); - - expect(decoded.address).to.not.be.ok; - expect(decoded.params).to.deep.equal([ - new DecodedLogParam('a', new ParamType('int', null, 256), new Token('int', new BigNumber(3))) - ]); - }); - - it('throws on invalid topics', () => { - const event = new Event({ name: 'foo', inputs: [{ name: 'a', type: 'int' }], anonymous: true }); - - expect(() => event.decodeLog(['0000000000000000000000004444444444444444444444444444444444444444'], '0000000000000000000000000000000000000000000000000000000000000003')).to.throw(/Invalid/); - }); - }); -}); diff --git a/js-old/src/abi/spec/event/eventParam.js b/js-old/src/abi/spec/event/eventParam.js deleted file mode 100644 index b49b77814..000000000 --- a/js-old/src/abi/spec/event/eventParam.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { toParamType } from '../paramType/format'; - -export default class EventParam { - constructor (name, type, indexed = false) { - this._name = name; - this._indexed = indexed; - this._kind = toParamType(type, indexed); - } - - get name () { - return this._name; - } - - get kind () { - return this._kind; - } - - get indexed () { - return this._indexed; - } - - static toEventParams (params) { - return params.map((param) => new EventParam(param.name, param.type, param.indexed)); - } -} diff --git a/js-old/src/abi/spec/event/eventParam.spec.js b/js-old/src/abi/spec/event/eventParam.spec.js deleted file mode 100644 index e35ebcebc..000000000 --- a/js-old/src/abi/spec/event/eventParam.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import EventParam from './eventParam'; - -describe('abi/spec/event/EventParam', () => { - describe('constructor', () => { - it('sets the properties', () => { - const param = new EventParam('foo', 'uint', true); - - expect(param.name).to.equal('foo'); - expect(param.kind.type).to.equal('uint'); - expect(param.indexed).to.be.true; - }); - - it('uses defaults for indexed', () => { - expect(new EventParam('foo', 'uint').indexed).to.be.false; - }); - }); - - describe('toEventParams', () => { - it('maps an array of params', () => { - const params = EventParam.toEventParams([{ name: 'foo', type: 'uint' }]); - - expect(params.length).to.equal(1); - expect(params[0].indexed).to.be.false; - expect(params[0].name).to.equal('foo'); - expect(params[0].kind.type).to.equal('uint'); - }); - }); -}); diff --git a/js-old/src/abi/spec/event/index.js b/js-old/src/abi/spec/event/index.js deleted file mode 100644 index 25441954b..000000000 --- a/js-old/src/abi/spec/event/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './event'; diff --git a/js-old/src/abi/spec/function.js b/js-old/src/abi/spec/function.js deleted file mode 100644 index 6010f4e59..000000000 --- a/js-old/src/abi/spec/function.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Decoder from '../decoder/decoder'; -import Encoder from '../encoder/encoder'; -import Param from './param'; -import { methodSignature } from '../util/signature'; - -export default class Func { - constructor (abi) { - this._abi = abi; - this._constant = !!abi.constant; - this._payable = abi.payable; - this._inputs = Param.toParams(abi.inputs || []); - this._outputs = Param.toParams(abi.outputs || []); - - const { id, name, signature } = methodSignature(abi.name, this.inputParamTypes()); - - this._id = id; - this._name = name; - this._signature = signature; - } - - get abi () { - return this._abi; - } - - get constant () { - return this._constant; - } - - get name () { - return this._name; - } - - get id () { - return this._id; - } - - get payable () { - return this._payable; - } - - get inputs () { - return this._inputs; - } - - get outputs () { - return this._outputs; - } - - get signature () { - return this._signature; - } - - inputParamTypes () { - return this._inputs.map((input) => input.kind); - } - - outputParamTypes () { - return this._outputs.map((output) => output.kind); - } - - encodeCall (tokens) { - return `${this._signature}${Encoder.encode(tokens)}`; - } - - decodeInput (data) { - return Decoder.decode(this.inputParamTypes(), data); - } - - decodeOutput (data) { - return Decoder.decode(this.outputParamTypes(), data); - } -} diff --git a/js-old/src/abi/spec/function.spec.js b/js-old/src/abi/spec/function.spec.js deleted file mode 100644 index 436ca7365..000000000 --- a/js-old/src/abi/spec/function.spec.js +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Func from './function'; -import Param from './param'; -import Token from '../token'; - -describe('abi/spec/Function', () => { - const inputsArr = [{ name: 'boolin', type: 'bool' }, { name: 'stringin', type: 'string' }]; - const outputsArr = [{ name: 'output', type: 'uint' }]; - - const uint = new Param('output', 'uint'); - const bool = new Param('boolin', 'bool'); - const string = new Param('stringin', 'string'); - const inputs = [bool, string]; - const outputs = [uint]; - - const func = new Func({ - name: 'test', - inputs: inputsArr, - outputs: outputsArr - }); - - describe('constructor', () => { - it('returns signature correctly if name already contains it', () => { - const func = new Func({ - name: 'test(bool,string)', - inputs: inputsArr, - outputs: outputsArr - }); - - expect(func.name).to.equal('test'); - expect(func.id).to.equal('test(bool,string)'); - expect(func.signature).to.equal('02356205'); - }); - - it('stores the parameters as received', () => { - expect(func.name).to.equal('test'); - expect(func.constant).to.be.false; - expect(func.inputs).to.deep.equal(inputs); - expect(func.outputs).to.deep.equal(outputs); - }); - - it('matches empty inputs with []', () => { - expect(new Func({ name: 'test', outputs: outputsArr }).inputs).to.deep.equal([]); - }); - - it('matches empty outputs with []', () => { - expect(new Func({ name: 'test', inputs: inputsArr }).outputs).to.deep.equal([]); - }); - - it('sets the method signature', () => { - expect(new Func({ name: 'baz' }).signature).to.equal('a7916fac'); - }); - - it('allows constant functions', () => { - expect(new Func({ name: 'baz', constant: true }).constant).to.be.true; - }); - }); - - describe('inputParamTypes', () => { - it('retrieves the input types as received', () => { - expect(func.inputParamTypes()).to.deep.equal([bool.kind, string.kind]); - }); - }); - - describe('outputParamTypes', () => { - it('retrieves the output types as received', () => { - expect(func.outputParamTypes()).to.deep.equal([uint.kind]); - }); - }); - - describe('encodeCall', () => { - it('encodes the call correctly', () => { - const result = func.encodeCall([new Token('bool', true), new Token('string', 'jacogr')]); - - expect(result).to.equal('023562050000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000066a61636f67720000000000000000000000000000000000000000000000000000'); - }); - }); - - describe('decodeOutput', () => { - it('decodes the result correctly', () => { - const result = func.decodeOutput('1111111111111111111111111111111111111111111111111111111111111111'); - - expect(result[0].value.toString(16)).to.equal('1111111111111111111111111111111111111111111111111111111111111111'); - }); - }); -}); diff --git a/js-old/src/abi/spec/index.js b/js-old/src/abi/spec/index.js deleted file mode 100644 index 87852d488..000000000 --- a/js-old/src/abi/spec/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './interface'; diff --git a/js-old/src/abi/spec/interface.js b/js-old/src/abi/spec/interface.js deleted file mode 100644 index b24569525..000000000 --- a/js-old/src/abi/spec/interface.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Constructor from './constructor'; -import Event from './event/event'; -import Func from './function'; -import Token from '../token'; - -export default class Interface { - constructor (abi) { - this._interface = Interface.parseABI(abi); - } - - get interface () { - return this._interface; - } - - get constructors () { - return this._interface.filter((item) => item instanceof Constructor); - } - - get events () { - return this._interface.filter((item) => item instanceof Event); - } - - get functions () { - return this._interface.filter((item) => item instanceof Func); - } - - encodeTokens (paramTypes, values) { - return Interface.encodeTokens(paramTypes, values); - } - - static encodeTokens (paramTypes, values) { - const createToken = function (paramType, value) { - if (paramType.subtype) { - return new Token(paramType.type, value.map((entry) => createToken(paramType.subtype, entry))); - } - - return new Token(paramType.type, value); - }; - - return paramTypes.map((paramType, idx) => createToken(paramType, values[idx])); - } - - static parseABI (abi) { - return abi.map((item) => { - switch (item.type) { - case 'constructor': - return new Constructor(item); - - case 'event': - return new Event(item); - - case 'function': - case 'fallback': - return new Func(item); - - default: - throw new Error(`Unknown ABI type ${item.type}`); - } - }); - } -} diff --git a/js-old/src/abi/spec/interface.spec.js b/js-old/src/abi/spec/interface.spec.js deleted file mode 100644 index ebaa323ed..000000000 --- a/js-old/src/abi/spec/interface.spec.js +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Interface from './interface'; -import ParamType from './paramType'; -import Token from '../token'; - -describe('abi/spec/Interface', () => { - const construct = { - type: 'constructor', - inputs: [] - }; - const event = { - type: 'event', - name: 'Event2', - anonymous: false, - inputs: [{ name: 'a', type: 'uint256', indexed: true }, { name: 'b', type: 'bytes32', indexed: false }] - }; - const func = { - type: 'function', - name: 'foo', - inputs: [{ name: 'a', type: 'uint256' }], - outputs: [] - }; - - describe('parseABI', () => { - it('throws on invalid types', () => { - expect(() => Interface.parseABI([{ type: 'noMatch' }])).to.throw(/noMatch/); - }); - - it('creates constructors', () => { - expect(Interface.parseABI([ construct ])).to.deep.equal([{ _inputs: [] }]); - }); - - it('creates events', () => { - expect(Interface.parseABI([ event ])[0].name).to.equal('Event2'); - }); - - it('creates functions', () => { - expect(Interface.parseABI([ func ])[0].name).to.equal('foo'); - }); - - it('parse complex interfaces', () => { - expect(Interface.parseABI([ construct, event, func ]).length).to.equal(3); - }); - }); - - describe('constructor', () => { - const int = new Interface([ construct, event, func ]); - - it('contains the full interface', () => { - expect(int.interface.length).to.equal(3); - }); - - it('contains the constructors', () => { - expect(int.constructors.length).to.equal(1); - }); - - it('contains the events', () => { - expect(int.events.length).to.equal(1); - }); - - it('contains the functions', () => { - expect(int.functions.length).to.equal(1); - }); - }); - - describe('encodeTokens', () => { - const int = new Interface([ construct, event, func ]); - - it('encodes simple types', () => { - expect( - int.encodeTokens( - [new ParamType('bool'), new ParamType('string'), new ParamType('int'), new ParamType('uint')], - [true, 'gavofyork', -123, 123] - ) - ).to.deep.equal([ - new Token('bool', true), new Token('string', 'gavofyork'), new Token('int', -123), new Token('uint', 123) - ]); - }); - - it('encodes array', () => { - expect( - int.encodeTokens( - [new ParamType('array', new ParamType('bool'))], - [[true, false, true]] - ) - ).to.deep.equal([ - new Token('array', [ - new Token('bool', true), new Token('bool', false), new Token('bool', true) - ]) - ]); - }); - - it('encodes simple with array of array', () => { - expect( - int.encodeTokens( - [ - new ParamType('bool'), - new ParamType('fixedArray', new ParamType('array', new ParamType('uint')), 2) - ], - [true, [[0, 1], [2, 3]]] - ) - ).to.deep.equal([ - new Token('bool', true), - new Token('fixedArray', [ - new Token('array', [new Token('uint', 0), new Token('uint', 1)]), - new Token('array', [new Token('uint', 2), new Token('uint', 3)]) - ]) - ]); - }); - }); -}); diff --git a/js-old/src/abi/spec/param.js b/js-old/src/abi/spec/param.js deleted file mode 100644 index e02b99100..000000000 --- a/js-old/src/abi/spec/param.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { toParamType } from './paramType/format'; - -export default class Param { - constructor (name, type) { - this._name = name; - this._kind = toParamType(type); - } - - get name () { - return this._name; - } - - get kind () { - return this._kind; - } - - static toParams (params) { - return params.map((param) => { - if (param instanceof Param) { - return param; - } - - return new Param(param.name, param.type); - }); - } -} diff --git a/js-old/src/abi/spec/param.spec.js b/js-old/src/abi/spec/param.spec.js deleted file mode 100644 index 0ecdb0319..000000000 --- a/js-old/src/abi/spec/param.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Param from './param'; - -describe('abi/spec/Param', () => { - describe('constructor', () => { - const param = new Param('foo', 'uint'); - - it('sets the properties', () => { - expect(param.name).to.equal('foo'); - expect(param.kind.type).to.equal('uint'); - }); - }); - - describe('toParams', () => { - it('maps an array of params', () => { - const params = Param.toParams([{ name: 'foo', type: 'uint' }]); - - expect(params.length).to.equal(1); - expect(params[0].name).to.equal('foo'); - expect(params[0].kind.type).to.equal('uint'); - }); - - it('converts only if needed', () => { - const _params = Param.toParams([{ name: 'foo', type: 'uint' }]); - const params = Param.toParams(_params); - - expect(params.length).to.equal(1); - expect(params[0].name).to.equal('foo'); - expect(params[0].kind.type).to.equal('uint'); - }); - }); -}); diff --git a/js-old/src/abi/spec/paramType/format.js b/js-old/src/abi/spec/paramType/format.js deleted file mode 100644 index 5aafd5e30..000000000 --- a/js-old/src/abi/spec/paramType/format.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import ParamType from './paramType'; - -export function toParamType (type, indexed) { - if (type[type.length - 1] === ']') { - const last = type.lastIndexOf('['); - const length = type.substr(last + 1, type.length - last - 2); - const subtype = toParamType(type.substr(0, last)); - - if (length.length === 0) { - return new ParamType('array', subtype, 0, indexed); - } - - return new ParamType('fixedArray', subtype, parseInt(length, 10), indexed); - } - - switch (type) { - case 'address': - case 'bool': - case 'bytes': - case 'string': - return new ParamType(type, null, 0, indexed); - - case 'int': - case 'uint': - return new ParamType(type, null, 256, indexed); - - default: - if (type.indexOf('uint') === 0) { - return new ParamType('uint', null, parseInt(type.substr(4), 10), indexed); - } else if (type.indexOf('int') === 0) { - return new ParamType('int', null, parseInt(type.substr(3), 10), indexed); - } else if (type.indexOf('bytes') === 0) { - return new ParamType('fixedBytes', null, parseInt(type.substr(5), 10), indexed); - } - - throw new Error(`Cannot convert ${type} to valid ParamType`); - } -} - -export function fromParamType (paramType) { - switch (paramType.type) { - case 'address': - case 'bool': - case 'bytes': - case 'string': - return paramType.type; - - case 'int': - case 'uint': - return `${paramType.type}${paramType.length}`; - - case 'fixedBytes': - return `bytes${paramType.length}`; - - case 'fixedArray': - return `${fromParamType(paramType.subtype)}[${paramType.length}]`; - - case 'array': - return `${fromParamType(paramType.subtype)}[]`; - - default: - throw new Error(`Cannot convert from ParamType ${paramType.type}`); - } -} diff --git a/js-old/src/abi/spec/paramType/format.spec.js b/js-old/src/abi/spec/paramType/format.spec.js deleted file mode 100644 index cb0004733..000000000 --- a/js-old/src/abi/spec/paramType/format.spec.js +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import ParamType from './paramType'; -import { fromParamType, toParamType } from './format'; - -describe('abi/spec/paramType/format', () => { - describe('fromParamType', () => { - it('errors on invalid types', () => { - expect(() => fromParamType({ type: 'noMatch' })).to.throw(/noMatch/); - }); - - describe('simple types', () => { - it('converts address to address', () => { - const pt = new ParamType('address'); - - expect(fromParamType(pt)).to.equal('address'); - }); - - it('converts bool to bool', () => { - const pt = new ParamType('bool'); - - expect(fromParamType(pt)).to.equal('bool'); - }); - - it('converts bytes to bytes', () => { - const pt = new ParamType('bytes'); - - expect(fromParamType(pt)).to.equal('bytes'); - }); - - it('converts string to string', () => { - const pt = new ParamType('string'); - - expect(fromParamType(pt)).to.equal('string'); - }); - }); - - describe('length types', () => { - it('converts int32 to int32', () => { - const pt = new ParamType('int', null, 32); - - expect(fromParamType(pt)).to.equal('int32'); - }); - - it('converts uint64 to int64', () => { - const pt = new ParamType('uint', null, 64); - - expect(fromParamType(pt)).to.equal('uint64'); - }); - - it('converts fixedBytes8 to bytes8', () => { - const pt = new ParamType('fixedBytes', null, 8); - - expect(fromParamType(pt)).to.equal('bytes8'); - }); - }); - - describe('arrays', () => { - it('converts string[2] to string[2]', () => { - const pt = new ParamType('fixedArray', new ParamType('string'), 2); - - expect(fromParamType(pt)).to.equal('string[2]'); - }); - - it('converts bool[] to bool[]', () => { - const pt = new ParamType('array', new ParamType('bool')); - - expect(fromParamType(pt)).to.equal('bool[]'); - }); - - it('converts bool[][2] to bool[][2]', () => { - const pt = new ParamType('fixedArray', new ParamType('array', new ParamType('bool')), 2); - - expect(fromParamType(pt)).to.equal('bool[][2]'); - }); - - it('converts bool[2][] to bool[2][]', () => { - const pt = new ParamType('array', new ParamType('fixedArray', new ParamType('bool'), 2)); - - expect(fromParamType(pt)).to.equal('bool[2][]'); - }); - }); - }); - - describe('toParamType', () => { - it('errors on invalid types', () => { - expect(() => toParamType('noMatch')).to.throw(/noMatch/); - }); - - describe('simple mapping', () => { - it('converts address to address', () => { - const pt = toParamType('address'); - - expect(pt.type).to.equal('address'); - }); - - it('converts bool to bool', () => { - const pt = toParamType('bool'); - - expect(pt.type).to.equal('bool'); - }); - - it('converts bytes to bytes', () => { - const pt = toParamType('bytes'); - - expect(pt.type).to.equal('bytes'); - }); - - it('converts string to string', () => { - const pt = toParamType('string'); - - expect(pt.type).to.equal('string'); - }); - }); - - describe('number', () => { - it('converts int to int256', () => { - const pt = toParamType('int'); - - expect(pt.type).to.equal('int'); - expect(pt.length).to.equal(256); - }); - - it('converts uint to uint256', () => { - const pt = toParamType('uint'); - - expect(pt.type).to.equal('uint'); - expect(pt.length).to.equal(256); - }); - }); - - describe('sized types', () => { - it('converts int32 to int32', () => { - const pt = toParamType('int32'); - - expect(pt.type).to.equal('int'); - expect(pt.length).to.equal(32); - }); - - it('converts uint16 to uint16', () => { - const pt = toParamType('uint32'); - - expect(pt.type).to.equal('uint'); - expect(pt.length).to.equal(32); - }); - - it('converts bytes8 to fixedBytes8', () => { - const pt = toParamType('bytes8'); - - expect(pt.type).to.equal('fixedBytes'); - expect(pt.length).to.equal(8); - }); - }); - - describe('arrays', () => { - describe('fixed arrays', () => { - it('creates fixed array', () => { - const pt = toParamType('bytes[8]'); - - expect(pt.type).to.equal('fixedArray'); - expect(pt.subtype.type).to.equal('bytes'); - expect(pt.length).to.equal(8); - }); - - it('creates fixed arrays of fixed arrays', () => { - const pt = toParamType('bytes[45][3]'); - - expect(pt.type).to.equal('fixedArray'); - expect(pt.length).to.equal(3); - expect(pt.subtype.type).to.equal('fixedArray'); - expect(pt.subtype.length).to.equal(45); - expect(pt.subtype.subtype.type).to.equal('bytes'); - }); - }); - - describe('dynamic arrays', () => { - it('creates a dynamic array', () => { - const pt = toParamType('bytes[]'); - - expect(pt.type).to.equal('array'); - expect(pt.subtype.type).to.equal('bytes'); - }); - - it('creates a dynamic array of dynamic arrays', () => { - const pt = toParamType('bool[][]'); - - expect(pt.type).to.equal('array'); - expect(pt.subtype.type).to.equal('array'); - expect(pt.subtype.subtype.type).to.equal('bool'); - }); - }); - - describe('mixed arrays', () => { - it('creates a fixed dynamic array', () => { - const pt = toParamType('bool[][3]'); - - expect(pt.type).to.equal('fixedArray'); - expect(pt.length).to.equal(3); - expect(pt.subtype.type).to.equal('array'); - expect(pt.subtype.subtype.type).to.equal('bool'); - }); - - it('creates a dynamic fixed array', () => { - const pt = toParamType('bool[3][]'); - - expect(pt.type).to.equal('array'); - expect(pt.subtype.type).to.equal('fixedArray'); - expect(pt.subtype.length).to.equal(3); - expect(pt.subtype.subtype.type).to.equal('bool'); - }); - }); - }); - }); -}); diff --git a/js-old/src/abi/spec/paramType/index.js b/js-old/src/abi/spec/paramType/index.js deleted file mode 100644 index 123e198e8..000000000 --- a/js-old/src/abi/spec/paramType/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './paramType'; diff --git a/js-old/src/abi/spec/paramType/paramType.js b/js-old/src/abi/spec/paramType/paramType.js deleted file mode 100644 index b65465d94..000000000 --- a/js-old/src/abi/spec/paramType/paramType.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import TYPES from './types'; - -export default class ParamType { - constructor (type, subtype = null, length = 0, indexed = false) { - ParamType.validateType(type); - - this._type = type; - this._subtype = subtype; - this._length = length; - this._indexed = indexed; - } - - get type () { - return this._type; - } - - get subtype () { - return this._subtype; - } - - get length () { - return this._length; - } - - get indexed () { - return this._indexed; - } - - static validateType (type) { - if (TYPES.filter((_type) => type === _type).length) { - return true; - } - - throw new Error(`Invalid type ${type} received for ParamType`); - } -} diff --git a/js-old/src/abi/spec/paramType/paramType.spec.js b/js-old/src/abi/spec/paramType/paramType.spec.js deleted file mode 100644 index dc7114721..000000000 --- a/js-old/src/abi/spec/paramType/paramType.spec.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import ParamType from './paramType'; - -describe('abi/spec/paramType/ParamType', () => { - describe('validateType', () => { - it('validates address', () => { - expect(ParamType.validateType('address')).to.be.true; - }); - - it('validates fixedArray', () => { - expect(ParamType.validateType('fixedArray')).to.be.true; - }); - - it('validates array', () => { - expect(ParamType.validateType('array')).to.be.true; - }); - - it('validates fixedBytes', () => { - expect(ParamType.validateType('fixedBytes')).to.be.true; - }); - - it('validates bytes', () => { - expect(ParamType.validateType('bytes')).to.be.true; - }); - - it('validates bool', () => { - expect(ParamType.validateType('bool')).to.be.true; - }); - - it('validates int', () => { - expect(ParamType.validateType('int')).to.be.true; - }); - - it('validates uint', () => { - expect(ParamType.validateType('uint')).to.be.true; - }); - - it('validates string', () => { - expect(ParamType.validateType('string')).to.be.true; - }); - - it('throws an error on invalid types', () => { - expect(() => ParamType.validateType('noMatch')).to.throw(/noMatch/); - }); - }); - - describe('constructor', () => { - it('throws an error on invalid types', () => { - expect(() => new ParamType('noMatch')).to.throw(/noMatch/); - }); - - it('sets the type of the object', () => { - expect((new ParamType('bool', null, 1)).type).to.equal('bool'); - }); - - it('sets the subtype of the object', () => { - expect((new ParamType('array', 'bool', 1)).subtype).to.equal('bool'); - }); - - it('sets the length of the object', () => { - expect((new ParamType('array', 'bool', 1)).length).to.equal(1); - }); - - it('sets the index of the object', () => { - expect((new ParamType('array', 'bool', 1, true)).indexed).to.be.true; - }); - - it('sets default values where none supplied', () => { - expect(Object.values(new ParamType('string'))).to.deep.equal(['string', null, 0, false]); - }); - }); -}); diff --git a/js-old/src/abi/spec/paramType/types.js b/js-old/src/abi/spec/paramType/types.js deleted file mode 100644 index e9749c588..000000000 --- a/js-old/src/abi/spec/paramType/types.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -const TYPES = ['address', 'bytes', 'int', 'uint', 'bool', 'string', 'array', 'fixedBytes', 'fixedArray']; - -export default TYPES; diff --git a/js-old/src/abi/token/index.js b/js-old/src/abi/token/index.js deleted file mode 100644 index 6a636c3c8..000000000 --- a/js-old/src/abi/token/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './token'; diff --git a/js-old/src/abi/token/token.js b/js-old/src/abi/token/token.js deleted file mode 100644 index 7242248ab..000000000 --- a/js-old/src/abi/token/token.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import TYPES from '../spec/paramType/types'; - -export default class Token { - constructor (type, value) { - Token.validateType(type); - - this._type = type; - this._value = value; - } - - get type () { - return this._type; - } - - get value () { - return this._value; - } - - static validateType (type) { - if (TYPES.filter((_type) => type === _type).length) { - return true; - } - - throw new Error(`Invalid type ${type} received for Token`); - } -} diff --git a/js-old/src/abi/token/token.spec.js b/js-old/src/abi/token/token.spec.js deleted file mode 100644 index cf5fc51bf..000000000 --- a/js-old/src/abi/token/token.spec.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Token from './token'; - -describe('abi/token/token', () => { - describe('validateType', () => { - it('validates address', () => { - expect(Token.validateType('address')).to.be.true; - }); - - it('validates fixedArray', () => { - expect(Token.validateType('fixedArray')).to.be.true; - }); - - it('validates array', () => { - expect(Token.validateType('array')).to.be.true; - }); - - it('validates fixedBytes', () => { - expect(Token.validateType('fixedBytes')).to.be.true; - }); - - it('validates bytes', () => { - expect(Token.validateType('bytes')).to.be.true; - }); - - it('validates bool', () => { - expect(Token.validateType('bool')).to.be.true; - }); - - it('validates int', () => { - expect(Token.validateType('int')).to.be.true; - }); - - it('validates uint', () => { - expect(Token.validateType('uint')).to.be.true; - }); - - it('validates string', () => { - expect(Token.validateType('string')).to.be.true; - }); - - it('throws an error on invalid types', () => { - expect(() => Token.validateType('noMatch')).to.throw(/noMatch/); - }); - }); - - describe('constructor', () => { - it('throws an error on invalid types', () => { - expect(() => new Token('noMatch', '1')).to.throw(/noMatch/); - }); - - it('sets the type of the object', () => { - expect((new Token('bool', '1')).type).to.equal('bool'); - }); - - it('sets the value of the object', () => { - expect((new Token('bool', '1')).value).to.equal('1'); - }); - }); -}); diff --git a/js-old/src/abi/util/address.js b/js-old/src/abi/util/address.js deleted file mode 100644 index c0153ee5d..000000000 --- a/js-old/src/abi/util/address.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { keccak_256 } from 'js-sha3'; // eslint-disable-line camelcase - -export function isChecksumValid (_address) { - const address = _address.replace('0x', ''); - const hash = keccak_256(address.toLowerCase()); - - for (let n = 0; n < 40; n++) { - const char = address[n]; - const isLower = char !== char.toUpperCase(); - const isUpper = char !== char.toLowerCase(); - const hashval = parseInt(hash[n], 16); - - if ((hashval > 7 && isLower) || (hashval <= 7 && isUpper)) { - return false; - } - } - - return true; -} - -export function isAddress (address) { - if (address && address.length === 42) { - if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { - return false; - } else if (/^(0x)?[0-9a-f]{40}$/.test(address) || /^(0x)?[0-9A-F]{40}$/.test(address)) { - return true; - } - - return isChecksumValid(address); - } - - return false; -} - -export function toChecksumAddress (_address) { - const address = (_address || '').toLowerCase(); - - if (!isAddress(address)) { - return ''; - } - - const hash = keccak_256(address.slice(-40)); - let result = '0x'; - - for (let n = 0; n < 40; n++) { - result = `${result}${parseInt(hash[n], 16) > 7 ? address[n + 2].toUpperCase() : address[n + 2]}`; - } - - return result; -} diff --git a/js-old/src/abi/util/address.spec.js b/js-old/src/abi/util/address.spec.js deleted file mode 100644 index 324ba163d..000000000 --- a/js-old/src/abi/util/address.spec.js +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { isChecksumValid, isAddress, toChecksumAddress } from './address'; - -describe('abi/util/address', () => { - const value = '63Cf90D3f0410092FC0fca41846f596223979195'; - const address = `0x${value}`; - const lowercase = `0x${value.toLowerCase()}`; - const uppercase = `0x${value.toUpperCase()}`; - const invalid = '0x' + value.split('').map((char) => { - if (char >= 'a' && char <= 'f') { - return char.toUpperCase(); - } else if (char >= 'A' && char <= 'F') { - return char.toLowerCase(); - } - - return char; - }).join(''); - const invalidhex = '0x01234567890123456789012345678901234567gh'; - - describe('isChecksumValid', () => { - it('returns false when fully lowercase', () => { - expect(isChecksumValid(lowercase)).to.be.false; - }); - - it('returns false when fully uppercase', () => { - expect(isChecksumValid(uppercase)).to.be.false; - }); - - it('returns false on a mixed-case address', () => { - expect(isChecksumValid(invalid)).to.be.false; - }); - - it('returns true on a checksummed address', () => { - expect(isChecksumValid(address)).to.be.true; - }); - }); - - describe('isAddress', () => { - it('returns true when fully lowercase', () => { - expect(isAddress(lowercase)).to.be.true; - }); - - it('returns true when fully uppercase', () => { - expect(isAddress(uppercase)).to.be.true; - }); - - it('returns true when checksummed', () => { - expect(isAddress(address)).to.be.true; - }); - - it('returns false when invalid checksum', () => { - expect(isAddress(invalid)).to.be.false; - }); - - it('returns false on valid length, non-hex', () => { - expect(isAddress(invalidhex)).to.be.false; - }); - }); - - describe('toChecksumAddress', () => { - it('returns empty when no address specified', () => { - expect(toChecksumAddress()).to.equal(''); - }); - - it('returns empty on invalid address structure', () => { - expect(toChecksumAddress('0xnotaddress')).to.equal(''); - }); - - it('returns formatted address on checksum input', () => { - expect(toChecksumAddress(address)).to.equal(address); - }); - - it('returns formatted address on lowercase input', () => { - expect(toChecksumAddress(lowercase)).to.equal(address); - }); - - it('returns formatted address on uppercase input', () => { - expect(toChecksumAddress(uppercase)).to.equal(address); - }); - - it('returns formatted address on mixed input', () => { - expect(toChecksumAddress(invalid)).to.equal(address); - }); - }); -}); diff --git a/js-old/src/abi/util/pad.js b/js-old/src/abi/util/pad.js deleted file mode 100644 index 476a27445..000000000 --- a/js-old/src/abi/util/pad.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; -import utf8 from 'utf8'; - -import { isArray } from './types'; - -const ZERO_64 = '0000000000000000000000000000000000000000000000000000000000000000'; - -export function padAddress (_input) { - const input = _input.substr(0, 2) === '0x' ? _input.substr(2) : _input; - - return `${ZERO_64}${input}`.slice(-64); -} - -export function padBool (input) { - return `${ZERO_64}${input ? '1' : '0'}`.slice(-64); -} - -export function padU32 (input) { - let bn = new BigNumber(input); - - if (bn.lessThan(0)) { - bn = new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16) - .plus(bn).plus(1); - } - - return `${ZERO_64}${bn.toString(16)}`.slice(-64); -} - -function stringToBytes (input) { - if (isArray(input)) { - return input; - } else if (input.substr(0, 2) === '0x') { - const matches = input.substr(2).toLowerCase().match(/.{1,2}/g) || []; - - return matches.map((value) => parseInt(value, 16)); - } else { - return input.split('').map((char) => char.charCodeAt(0)); - } -} - -export function padBytes (_input) { - const input = stringToBytes(_input); - - return `${padU32(input.length)}${padFixedBytes(input)}`; -} - -export function padFixedBytes (_input) { - const input = stringToBytes(_input); - const sinput = input.map((code) => `0${code.toString(16)}`.slice(-2)).join(''); - const max = Math.floor((sinput.length + 63) / 64) * 64; - - return `${sinput}${ZERO_64}`.substr(0, max); -} - -export function padString (input) { - const array = utf8.encode(input) - .split('') - .map((char) => char.charCodeAt(0)); - - return padBytes(array); -} diff --git a/js-old/src/abi/util/pad.spec.js b/js-old/src/abi/util/pad.spec.js deleted file mode 100644 index 74463b438..000000000 --- a/js-old/src/abi/util/pad.spec.js +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; -import { padAddress, padBool, padBytes, padFixedBytes, padString, padU32 } from './pad'; - -describe('abi/util/pad', () => { - const SHORT15 = '1234567890abcdef'; - const BYTES15 = [0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef]; - const LONG15 = `${SHORT15}000000000000000000000000000000000000000000000000`; - const PAD123 = '0000000000000000000000000000000000000000000000000000000000000123'; - - describe('padAddress', () => { - it('pads to 64 characters', () => { - expect(padAddress('123')).to.equal(PAD123); - }); - - it('strips leading 0x when passed in', () => { - expect(padFixedBytes(`0x${PAD123}`)).to.equal(PAD123); - }); - }); - - describe('padBool', () => { - const TRUE = '0000000000000000000000000000000000000000000000000000000000000001'; - const FALSE = '0000000000000000000000000000000000000000000000000000000000000000'; - - it('pads true to 64 characters', () => { - expect(padBool(true)).to.equal(TRUE); - }); - - it('pads false to 64 characters', () => { - expect(padBool(false)).to.equal(FALSE); - }); - }); - - describe('padU32', () => { - it('left pads length < 64 bytes to 64 bytes', () => { - expect(padU32(1)).to.equal('0000000000000000000000000000000000000000000000000000000000000001'); - }); - - it('pads hex representation', () => { - expect(padU32(0x123)).to.equal(PAD123); - }); - - it('pads decimal representation', () => { - expect(padU32(291)).to.equal(PAD123); - }); - - it('pads string representation', () => { - expect(padU32('0x123')).to.equal(PAD123); - }); - - it('pads BigNumber representation', () => { - expect(padU32(new BigNumber(0x123))).to.equal(PAD123); - }); - - it('converts negative numbers to 2s complement', () => { - expect(padU32(-123)).to.equal('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85'); - }); - }); - - describe('padFixedBytes', () => { - it('right pads length < 64 bytes to 64 bytes (string)', () => { - expect(padFixedBytes(`0x${SHORT15}`)).to.equal(LONG15); - }); - - it('right pads length < 64 bytes to 64 bytes (array)', () => { - expect(padFixedBytes(BYTES15)).to.equal(LONG15); - }); - - it('right pads length > 64 bytes (64 byte multiples)', () => { - expect(padFixedBytes(`0x${LONG15}${SHORT15}`)).to.equal(`${LONG15}${LONG15}`); - }); - - it('strips leading 0x when passed in', () => { - expect(padFixedBytes(`0x${SHORT15}`)).to.equal(LONG15); - }); - }); - - describe('padBytes', () => { - it('right pads length < 64, adding the length (string)', () => { - const result = padBytes(`0x${SHORT15}`); - - expect(result.length).to.equal(128); - expect(result).to.equal(`${padU32(8)}${LONG15}`); - }); - - it('right pads length < 64, adding the length (array)', () => { - const result = padBytes(BYTES15); - - expect(result.length).to.equal(128); - expect(result).to.equal(`${padU32(8)}${LONG15}`); - }); - - it('right pads length > 64, adding the length', () => { - const result = padBytes(`0x${LONG15}${SHORT15}`); - - expect(result.length).to.equal(192); - expect(result).to.equal(`${padU32(0x28)}${LONG15}${LONG15}`); - }); - }); - - describe('padString', () => { - it('correctly converts & pads strings', () => { - const result = padString('gavofyork'); - - expect(result.length).to.equal(128); - expect(result).to.equal(padBytes('0x6761766f66796f726b')); - }); - }); -}); diff --git a/js-old/src/abi/util/signature.js b/js-old/src/abi/util/signature.js deleted file mode 100644 index 86ed6f265..000000000 --- a/js-old/src/abi/util/signature.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { keccak_256 } from 'js-sha3'; // eslint-disable-line camelcase -import { fromParamType } from '../spec/paramType/format'; - -export function eventSignature (eventName, params) { - const { strName, name } = parseName(eventName); - const types = (params || []).map(fromParamType).join(','); - const id = `${strName}(${types})`; - const signature = strName ? keccak_256(id) : ''; - - return { id, name, signature }; -} - -export function methodSignature (methodName, params) { - const { id, name, signature } = eventSignature(methodName, params); - - return { id, name, signature: signature.substr(0, 8) }; -} - -function parseName (name) { - const strName = `${name || ''}`; - const idx = strName.indexOf('('); - - if (idx === -1) { - return { strName, name }; - } - - const trimmedName = strName.slice(0, idx); - - return { - strName: trimmedName, - name: trimmedName - }; -} diff --git a/js-old/src/abi/util/signature.spec.js b/js-old/src/abi/util/signature.spec.js deleted file mode 100644 index 118ebf4e5..000000000 --- a/js-old/src/abi/util/signature.spec.js +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { eventSignature, methodSignature } from './signature'; - -describe('abi/util/signature', () => { - describe('eventSignature', () => { - it('encodes signature baz() correctly', () => { - expect(eventSignature('baz', [])).to.deep.equal({ - id: 'baz()', - name: 'baz', - signature: 'a7916fac4f538170f7cd12c148552e2cba9fcd72329a2dd5b07a6fa906488ddf' - }); - }); - - it('encodes signature baz(uint32) correctly', () => { - expect(eventSignature('baz', [{ type: 'uint', length: 32 }])).to.deep.equal({ - id: 'baz(uint32)', - name: 'baz', - signature: '7d68785e8fc871be024b75964bd86d093511d4bc2dc7cf7bea32c48a0efaecb1' - }); - }); - - it('encodes signature baz(uint32, bool) correctly', () => { - expect(eventSignature('baz', [{ type: 'uint', length: 32 }, { type: 'bool' }])).to.deep.equal({ - id: 'baz(uint32,bool)', - name: 'baz', - signature: 'cdcd77c0992ec5bbfc459984220f8c45084cc24d9b6efed1fae540db8de801d2' - }); - }); - - it('encodes no-name signature correctly as ()', () => { - expect(eventSignature(undefined, [])).to.deep.equal({ - id: '()', - name: undefined, - signature: '' - }); - }); - - it('encodes no-params signature correctly as ()', () => { - expect(eventSignature(undefined, undefined)).to.deep.equal({ - id: '()', - name: undefined, - signature: '' - }); - }); - }); - - describe('methodSignature', () => { - it('encodes signature baz() correctly', () => { - expect(methodSignature('baz', [])).to.deep.equal({ - id: 'baz()', - name: 'baz', - signature: 'a7916fac' - }); - }); - - it('encodes signature baz(uint32) correctly', () => { - expect(methodSignature('baz', [{ type: 'uint', length: 32 }])).to.deep.equal({ - id: 'baz(uint32)', - name: 'baz', - signature: '7d68785e' - }); - }); - - it('encodes signature baz(uint32, bool) correctly', () => { - expect(methodSignature('baz', [{ type: 'uint', length: 32 }, { type: 'bool' }])).to.deep.equal({ - id: 'baz(uint32,bool)', - name: 'baz', - signature: 'cdcd77c0' - }); - }); - - it('encodes signature in name correctly', () => { - expect(methodSignature('baz(uint32,bool)', [{ type: 'uint', length: 32 }, { type: 'bool' }])).to.deep.equal({ - id: 'baz(uint32,bool)', - name: 'baz', - signature: 'cdcd77c0' - }); - }); - - it('encodes no-name signature correctly as ()', () => { - expect(methodSignature(undefined, [])).to.deep.equal({ - id: '()', - name: undefined, - signature: '' - }); - }); - - it('encodes no-params signature correctly as ()', () => { - expect(methodSignature(undefined, undefined)).to.deep.equal({ - id: '()', - name: undefined, - signature: '' - }); - }); - }); -}); diff --git a/js-old/src/abi/util/slice.js b/js-old/src/abi/util/slice.js deleted file mode 100644 index daab54f1c..000000000 --- a/js-old/src/abi/util/slice.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { padAddress } from './pad'; - -export function sliceData (_data) { - if (!_data || !_data.length) { - return []; - } - - let data = (_data.substr(0, 2) === '0x') ? _data.substr(2) : _data; - - if (!data.length) { - data = padAddress(''); - } - - return data.match(/.{1,64}/g); -} diff --git a/js-old/src/abi/util/slice.spec.js b/js-old/src/abi/util/slice.spec.js deleted file mode 100644 index 1b754ccbb..000000000 --- a/js-old/src/abi/util/slice.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { sliceData } from './slice'; - -describe('abi/util/slice', () => { - describe('sliceData', () => { - const slice1 = '131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'; - const slice2 = '2124768576358735263578356373526387638357635873563586353756358763'; - - it('returns an empty array when length === 0', () => { - expect(sliceData('')).to.deep.equal([]); - }); - - it('returns an array with the slices otherwise', () => { - const sliced = sliceData(`${slice1}${slice2}`); - - expect(sliced.length).to.equal(2); - expect(sliced[0]).to.equal(slice1); - expect(sliced[1]).to.equal(slice2); - }); - - it('removes leading 0x when passed in', () => { - const sliced = sliceData(`0x${slice1}${slice2}`); - - expect(sliced.length).to.equal(2); - expect(sliced[0]).to.equal(slice1); - expect(sliced[1]).to.equal(slice2); - }); - }); -}); diff --git a/js-old/src/abi/util/sliceAs.js b/js-old/src/abi/util/sliceAs.js deleted file mode 100644 index e177897a1..000000000 --- a/js-old/src/abi/util/sliceAs.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -import { toChecksumAddress } from './address'; - -export function asU32 (slice) { - // TODO: validation - - return new BigNumber(slice, 16); -} - -export function asI32 (slice) { - if (new BigNumber(slice.substr(0, 1), 16).toString(2)[0] === '1') { - return new BigNumber(slice, 16) - .minus(new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)) - .minus(1); - } - - return new BigNumber(slice, 16); -} - -export function asAddress (slice) { - // TODO: address validation? - - return toChecksumAddress(`0x${slice.slice(-40)}`); -} - -export function asBool (slice) { - // TODO: everything else should be 0 - - return new BigNumber(slice[63]).eq(1); -} diff --git a/js-old/src/abi/util/sliceAs.spec.js b/js-old/src/abi/util/sliceAs.spec.js deleted file mode 100644 index c29e34554..000000000 --- a/js-old/src/abi/util/sliceAs.spec.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { asAddress, asBool, asI32, asU32 } from './sliceAs'; - -describe('abi/util/sliceAs', () => { - const MAX_INT = 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'; - - describe('asAddress', () => { - it('correctly returns the last 0x40 characters', () => { - const address = '1111111111222222222233333333334444444444'; - - expect(asAddress(`000000000000000000000000${address}`)).to.equal(`0x${address}`); - }); - }); - - describe('asBool', () => { - it('correctly returns true', () => { - expect(asBool('0000000000000000000000000000000000000000000000000000000000000001')).to.be.true; - }); - - it('correctly returns false', () => { - expect(asBool('0000000000000000000000000000000000000000000000000000000000000000')).to.be.false; - }); - }); - - describe('asI32', () => { - it('correctly decodes positive numbers', () => { - expect(asI32('000000000000000000000000000000000000000000000000000000000000007b').toString()).to.equal('123'); - }); - - it('correctly decodes negative numbers', () => { - expect(asI32('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85').toString()).to.equal('-123'); - }); - }); - - describe('asU32', () => { - it('returns a maxium U32', () => { - expect(asU32(MAX_INT).toString(16)).to.equal(MAX_INT); - }); - }); -}); diff --git a/js-old/src/abi/util/types.js b/js-old/src/abi/util/types.js deleted file mode 100644 index dd408f371..000000000 --- a/js-old/src/abi/util/types.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export function isArray (test) { - return Object.prototype.toString.call(test) === '[object Array]'; -} - -export function isString (test) { - return Object.prototype.toString.call(test) === '[object String]'; -} - -export function isInstanceOf (test, clazz) { - return test instanceof clazz; -} diff --git a/js-old/src/abi/util/types.spec.js b/js-old/src/abi/util/types.spec.js deleted file mode 100644 index 177662ae2..000000000 --- a/js-old/src/abi/util/types.spec.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { isArray, isString, isInstanceOf } from './types'; -import Token from '../token'; - -describe('abi/util/types', () => { - describe('isArray', () => { - it('correctly identifies empty arrays as Array', () => { - expect(isArray([])).to.be.true; - }); - - it('correctly identifies non-empty arrays as Array', () => { - expect(isArray([1, 2, 3])).to.be.true; - }); - - it('correctly identifies strings as non-Array', () => { - expect(isArray('not an array')).to.be.false; - }); - - it('correctly identifies objects as non-Array', () => { - expect(isArray({})).to.be.false; - }); - }); - - describe('isString', () => { - it('correctly identifies empty string as string', () => { - expect(isString('')).to.be.true; - }); - - it('correctly identifies string as string', () => { - expect(isString('123')).to.be.true; - }); - }); - - describe('isInstanceOf', () => { - it('correctly identifies build-in instanceof', () => { - expect(isInstanceOf(new String('123'), String)).to.be.true; // eslint-disable-line no-new-wrappers - }); - - it('correctly identifies own instanceof', () => { - expect(isInstanceOf(new Token('int', 123), Token)).to.be.true; - }); - - it('correctly reports false for own', () => { - expect(isInstanceOf({ type: 'int' }, Token)).to.be.false; - }); - }); -}); diff --git a/js-old/src/api/README.md b/js-old/src/api/README.md deleted file mode 100644 index 1a2051eaf..000000000 --- a/js-old/src/api/README.md +++ /dev/null @@ -1,146 +0,0 @@ -# ethapi-js - -A thin, fast, low-level Promise-based wrapper around the Ethereum APIs. - -[![Build Status](https://travis-ci.org/jacogr/ethapi-js.svg?branch=master)](https://travis-ci.org/jacogr/ethapi-js) -[![Coverage Status](https://coveralls.io/repos/github/jacogr/ethapi-js/badge.svg?branch=master)](https://coveralls.io/github/jacogr/ethapi-js?branch=master) -[![Dependency Status](https://david-dm.org/jacogr/ethapi-js.svg)](https://david-dm.org/jacogr/ethapi-js) -[![devDependency Status](https://david-dm.org/jacogr/ethapi-js/dev-status.svg)](https://david-dm.org/jacogr/ethapi-js#info=devDependencies) - -## contributing - -Clone the repo and install dependencies via `npm install`. Tests can be executed via - -- `npm run testOnce` (100% covered unit tests) -- `npm run testE2E` (E2E against a running RPC-enabled testnet Parity/Geth instance, `parity --testnet` and for WebScokets, `geth --testnet --ws --wsorigins '*' --rpc`) -- setting the environment `DEBUG=true` will display the RPC POST bodies and responses on E2E tests - -## installation - -Install the package with `npm install --save ethapi-js` from the [npm registry ethapi-js](https://www.npmjs.com/package/ethapi-js) - -## usage - -### initialisation - -```javascript -// import the actual EthApi class -import EthApi from 'ethapi-js'; - -// do the setup -const transport = new EthApi.Transport.Http('http://localhost:8545'); // or .Ws('ws://localhost:8546') -const ethapi = new EthApi(transport); -``` - -You will require native Promises and fetch support (latest browsers only), they can be utilised by - -```javascript -import 'isomorphic-fetch'; - -import es6Promise from 'es6-promise'; -es6Promise.polyfill(); -``` - -### making calls - -perform a call - -```javascript -ethapi.eth - .coinbase() - .then((coinbase) => { - console.log(`The coinbase is ${coinbase}`); - }); -``` - -multiple promises - -```javascript -Promise - .all([ - ethapi.eth.coinbase(), - ethapi.net.listening() - ]) - .then(([coinbase, listening]) => { - // do stuff here - }); -``` - -chaining promises - -```javascript -ethapi.eth - .newFilter({...}) - .then((filterId) => ethapi.eth.getFilterChanges(filterId)) - .then((changes) => { - console.log(changes); - }); -``` - -### contracts - -attach contract - -```javascript -const abi = [{ name: 'callMe', inputs: [{ type: 'bool', ...}, { type: 'string', ...}]}, ...abi...]; -const contract = new ethapi.newContract(abi); -``` - -deploy - -```javascript -contract - .deploy('0xc0de', [params], 'superPassword') - .then((address) => { - console.log(`the contract was deployed at ${address}`); - }); -``` - -attach a contract at address - -```javascript -// via the constructor & .at function -const contract = api.newContract(abi).at('0xa9280...7347b'); -// or on an already initialised contract -contract.at('0xa9280...7347b'); -// perform calls here -``` - -find & call a function - -```javascript -contract.instance - .myContractMethodName - .call({}, [myContractMethodParameter]) // or estimateGas or sendTransaction - .then((result) => { - console.log(`the result was ${result}`); - }); -``` - -parse events from transaction receipt - -```javascript -contract - .parseTransactionEvents(txReceipt) - .then((receipt) => { - receipt.logs.forEach((log) => { - console.log('log parameters', log.params); - }); - }); -``` - -## apis - -APIs implement the calls as exposed in the [Ethcore JSON Ethereum RPC](https://github.com/paritytech/ethereum-rpc-json/) definitions. Mapping follows the naming conventions of the originals, i.e. `eth_call` becomes `eth.call`, `personal_accounts` becomes `personal.accounts`, etc. - -- [ethapi.db](https://github.com/paritytech/ethereum-rpc-json/blob/master/interfaces.md#db) -- [ethapi.eth](https://github.com/paritytech/ethereum-rpc-json/blob/master/interfaces.md#eth) -- [ethapi.parity](https://github.com/paritytech/ethereum-rpc-json/blob/master/interfaces.md#parity) -- [ethapi.net](https://github.com/paritytech/ethereum-rpc-json/blob/master/interfaces.md#net) -- [ethapi.personal](https://github.com/paritytech/ethereum-rpc-json/blob/master/interfaces.md#personal) -- [ethapi.shh](https://github.com/paritytech/ethereum-rpc-json/blob/master/interfaces.md#shh) -- [ethapi.signer](https://github.com/paritytech/ethereum-rpc-json/blob/master/interfaces.md#signer) -- [ethapi.trace](https://github.com/paritytech/ethereum-rpc-json/blob/master/interfaces.md#trace) -- [ethapi.web3](https://github.com/paritytech/ethereum-rpc-json/blob/master/interfaces.md#web3) - -As a verification step, all exposed interfaces are tested for existing and pointing to the correct endpoints by using the generated interfaces from the above repo. diff --git a/js-old/src/api/api.js b/js-old/src/api/api.js deleted file mode 100644 index 220c3be29..000000000 --- a/js-old/src/api/api.js +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import EventEmitter from 'eventemitter3'; - -import { Http, Ws } from './transport'; -import Contract from './contract'; - -import { Db, Eth, Parity, Net, Personal, Shh, Signer, Trace, Web3 } from './rpc'; -import Subscriptions from './subscriptions'; -import Pubsub from './pubsub'; -import util from './util'; -import { isFunction } from './util/types'; - -import LocalAccountsMiddleware from '~/api/local'; - -export default class Api extends EventEmitter { - constructor (transport, allowSubscriptions = true) { - super(); - - if (!transport || !isFunction(transport.execute)) { - throw new Error('EthApi needs transport with execute() function defined'); - } - - this._transport = transport; - - this._db = new Db(transport); - this._eth = new Eth(transport); - this._net = new Net(transport); - this._parity = new Parity(transport); - this._personal = new Personal(transport); - this._shh = new Shh(transport); - this._signer = new Signer(transport); - this._trace = new Trace(transport); - this._web3 = new Web3(transport); - - if (isFunction(transport.subscribe)) { - this._pubsub = new Pubsub(transport); - } - - if (allowSubscriptions) { - this._subscriptions = new Subscriptions(this); - } - // Doing a request here in test env would cause an error - if (LocalAccountsMiddleware && process.env.NODE_ENV !== 'test') { - const middleware = this.parity - .nodeKind() - .then((nodeKind) => { - if (nodeKind.availability === 'public') { - return LocalAccountsMiddleware; - } - - return null; - }) - .catch(() => null); - - transport.addMiddleware(middleware); - } - } - - get pubsub () { - if (!this._pubsub) { - throw Error('Pubsub is only available with a subscribing-supported transport injected!'); - } - return this._pubsub; - } - - get db () { - return this._db; - } - - get eth () { - return this._eth; - } - - get parity () { - return this._parity; - } - - get net () { - return this._net; - } - - get personal () { - return this._personal; - } - - get shh () { - return this._shh; - } - - get signer () { - return this._signer; - } - - get trace () { - return this._trace; - } - - get transport () { - return this._transport; - } - - get web3 () { - return this._web3; - } - - get util () { - return util; - } - - newContract (abi, address) { - return new Contract(this, abi).at(address); - } - - subscribe (subscriptionName, callback) { - if (!this._subscriptions) { - return Promise.resolve(1); - } - - return this._subscriptions.subscribe(subscriptionName, callback); - } - - unsubscribe (subscriptionId) { - if (!this._subscriptions) { - return Promise.resolve(true); - } - - return this._subscriptions.unsubscribe(subscriptionId); - } - - pollMethod (method, input, validate) { - const [_group, endpoint] = method.split('_'); - const group = `_${_group}`; - - return new Promise((resolve, reject) => { - const timeout = () => { - this[group][endpoint](input) - .then((result) => { - if (validate ? validate(result) : result) { - resolve(result); - } else { - setTimeout(timeout, 500); - } - }) - .catch((error) => { - // Don't print if the request is rejected: that's ok - if (error.type !== 'REQUEST_REJECTED') { - console.error('pollMethod', error); - } - - reject(error); - }); - }; - - timeout(); - }); - } - - static util = util - - static Transport = { - Http: Http, - Ws: Ws - } -} diff --git a/js-old/src/api/api.spec.js b/js-old/src/api/api.spec.js deleted file mode 100644 index c72b22849..000000000 --- a/js-old/src/api/api.spec.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { TEST_HTTP_URL, endpointTest } from '../../test/mockRpc'; - -import util from './util'; -import Api from './api'; - -import ethereumRpc from '../jsonrpc/'; - -describe('api/Api', () => { - describe('constructor', () => { - it('requires defined/non-null transport object', () => { - expect(() => new Api()).to.throw(/Api needs transport/); - expect(() => new Api(null)).to.throw(/Api needs transport/); - }); - - it('requires an execute function on the transport object', () => { - expect(() => new Api({})).to.throw(/Api needs transport/); - expect(() => new Api({ execute: true })).to.throw(/Api needs transport/); - }); - }); - - describe('interface', () => { - const api = new Api(new Api.Transport.Http(TEST_HTTP_URL, -1)); - const ignored = [ - 'eth_subscribe', 'eth_unsubscribe', - 'parity_subscribe', 'parity_unsubscribe', - 'signer_subscribePending', 'signer_unsubscribePending' - ]; - - Object.keys(ethereumRpc).sort().forEach((endpoint) => { - describe(endpoint, () => { - Object.keys(ethereumRpc[endpoint]).sort() - .filter(method => ignored.indexOf(method) !== -1) - .forEach((method) => { - endpointTest(api, endpoint, method); - }); - }); - }); - }); - - it('exposes util as static property', () => { - expect(Api.util).to.equal(util); - }); -}); diff --git a/js-old/src/api/contract/contract.js b/js-old/src/api/contract/contract.js deleted file mode 100644 index dee4d6d77..000000000 --- a/js-old/src/api/contract/contract.js +++ /dev/null @@ -1,561 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Abi from '~/abi'; - -let nextSubscriptionId = 0; - -export default class Contract { - constructor (api, abi) { - if (!api) { - throw new Error('API instance needs to be provided to Contract'); - } - - if (!abi) { - throw new Error('ABI needs to be provided to Contract instance'); - } - - this._api = api; - this._abi = new Abi(abi); - - this._subscriptions = {}; - this._constructors = this._abi.constructors.map(this._bindFunction); - this._functions = this._abi.functions.map(this._bindFunction); - this._events = this._abi.events.map(this._bindEvent); - - this._instance = {}; - - this._events.forEach((evt) => { - this._instance[evt.name] = evt; - this._instance[evt.signature] = evt; - }); - - this._functions.forEach((fn) => { - this._instance[fn.name] = fn; - this._instance[fn.signature] = fn; - }); - - this._subscribedToPendings = false; - this._pendingsSubscriptionId = null; - - this._subscribedToBlock = false; - this._blockSubscriptionId = null; - - if (api && api.patch && api.patch.contract) { - api.patch.contract(this); - } - } - - get address () { - return this._address; - } - - get constructors () { - return this._constructors; - } - - get events () { - return this._events; - } - - get functions () { - return this._functions; - } - - get receipt () { - return this._receipt; - } - - get instance () { - this._instance.address = this._address; - return this._instance; - } - - get api () { - return this._api; - } - - get abi () { - return this._abi; - } - - at (address) { - this._address = address; - return this; - } - - deployEstimateGas (options, values) { - const _options = this._encodeOptions(this.constructors[0], options, values); - - return this._api.eth - .estimateGas(_options) - .then((gasEst) => { - return [gasEst, gasEst.mul(1.2)]; - }); - } - - deploy (options, values, statecb = () => {}, skipGasEstimate = false) { - let gasEstPromise; - - if (skipGasEstimate) { - gasEstPromise = Promise.resolve(null); - } else { - statecb(null, { state: 'estimateGas' }); - - gasEstPromise = this.deployEstimateGas(options, values) - .then(([gasEst, gas]) => gas); - } - - return gasEstPromise - .then((_gas) => { - if (_gas) { - options.gas = _gas.toFixed(0); - } - - const gas = _gas || options.gas; - - statecb(null, { state: 'postTransaction', gas }); - - const encodedOptions = this._encodeOptions(this.constructors[0], options, values); - - return this._api.parity - .postTransaction(encodedOptions) - .then((requestId) => { - statecb(null, { state: 'checkRequest', requestId }); - return this._pollCheckRequest(requestId); - }) - .then((txhash) => { - statecb(null, { state: 'getTransactionReceipt', txhash }); - return this._pollTransactionReceipt(txhash, gas); - }) - .then((receipt) => { - if (receipt.gasUsed.eq(gas)) { - throw new Error(`Contract not deployed, gasUsed == ${gas.toFixed(0)}`); - } - - statecb(null, { state: 'hasReceipt', receipt }); - this._receipt = receipt; - this._address = receipt.contractAddress; - return this._address; - }) - .then((address) => { - statecb(null, { state: 'getCode' }); - return this._api.eth.getCode(this._address); - }) - .then((code) => { - if (code === '0x') { - throw new Error('Contract not deployed, getCode returned 0x'); - } - - statecb(null, { state: 'completed' }); - return this._address; - }); - }); - } - - parseEventLogs (logs) { - return logs - .map((log) => { - const signature = log.topics[0].substr(2); - const event = this.events.find((evt) => evt.signature === signature); - - if (!event) { - console.warn(`Unable to find event matching signature ${signature}`); - return null; - } - - try { - const decoded = event.decodeLog(log.topics, log.data); - - log.params = {}; - log.event = event.name; - - decoded.params.forEach((param, index) => { - const { type, value } = param.token; - const key = param.name || index; - - log.params[key] = { type, value }; - }); - - return log; - } catch (error) { - console.warn('Error decoding log', log); - console.warn(error); - - return null; - } - }) - .filter((log) => log); - } - - parseTransactionEvents (receipt) { - receipt.logs = this.parseEventLogs(receipt.logs); - - return receipt; - } - - _pollCheckRequest = (requestId) => { - return this._api.pollMethod('parity_checkRequest', requestId); - } - - _pollTransactionReceipt = (txhash, gas) => { - return this.api.pollMethod('eth_getTransactionReceipt', txhash, (receipt) => { - if (!receipt || !receipt.blockNumber || receipt.blockNumber.eq(0)) { - return false; - } - - return true; - }); - } - - getCallData = (func, options, values) => { - let data = options.data; - - const tokens = func ? Abi.encodeTokens(func.inputParamTypes(), values) : null; - const call = tokens ? func.encodeCall(tokens) : null; - - if (data && data.substr(0, 2) === '0x') { - data = data.substr(2); - } - - return `0x${data || ''}${call || ''}`; - } - - _encodeOptions (func, options, values) { - const data = this.getCallData(func, options, values); - - return { - ...options, - data - }; - } - - _addOptionsTo (options = {}) { - return { - to: this._address, - ...options - }; - } - - _bindFunction = (func) => { - func.contract = this; - - func.call = (_options = {}, values = []) => { - const rawTokens = !!_options.rawTokens; - const options = { - ..._options - }; - - delete options.rawTokens; - - let callParams; - - try { - callParams = this._encodeOptions(func, this._addOptionsTo(options), values); - } catch (error) { - return Promise.reject(error); - } - - return this._api.eth - .call(callParams) - .then((encoded) => func.decodeOutput(encoded)) - .then((tokens) => { - if (rawTokens) { - return tokens; - } - - return tokens.map((token) => token.value); - }) - .then((returns) => returns.length === 1 ? returns[0] : returns) - .catch((error) => { - console.warn(`${func.name}.call`, values, error); - throw error; - }); - }; - - if (!func.constant) { - func.postTransaction = (options, values = []) => { - let _options; - - try { - _options = this._encodeOptions(func, this._addOptionsTo(options), values); - } catch (error) { - return Promise.reject(error); - } - - return this._api.parity - .postTransaction(_options) - .catch((error) => { - console.warn(`${func.name}.postTransaction`, values, error); - throw error; - }); - }; - - func.estimateGas = (options, values = []) => { - const _options = this._encodeOptions(func, this._addOptionsTo(options), values); - - return this._api.eth - .estimateGas(_options) - .catch((error) => { - console.warn(`${func.name}.estimateGas`, values, error); - throw error; - }); - }; - } - - return func; - } - - _bindEvent = (event) => { - event.subscribe = (options = {}, callback, autoRemove) => { - return this._subscribe(event, options, callback, autoRemove); - }; - - event.unsubscribe = (subscriptionId) => { - return this.unsubscribe(subscriptionId); - }; - - event.getAllLogs = (options = {}) => { - return this.getAllLogs(event); - }; - - return event; - } - - getAllLogs (event, _options) { - // Options as first parameter - if (!_options && event && event.topics) { - return this.getAllLogs(null, event); - } - - const options = this._getFilterOptions(event, _options); - - options.fromBlock = 0; - options.toBlock = 'latest'; - - return this._api.eth - .getLogs(options) - .then((logs) => this.parseEventLogs(logs)); - } - - _findEvent (eventName = null) { - const event = eventName - ? this._events.find((evt) => evt.name === eventName) - : null; - - if (eventName && !event) { - const events = this._events.map((evt) => evt.name).join(', '); - - throw new Error(`${eventName} is not a valid eventName, subscribe using one of ${events} (or null to include all)`); - } - - return event; - } - - _getFilterOptions (event = null, _options = {}) { - const optionTopics = _options.topics || []; - const signature = event && event.signature || null; - - // If event provided, remove the potential event signature - // as the first element of the topics - const topics = signature - ? [ signature ].concat(optionTopics.filter((t, idx) => idx > 0 || t !== signature)) - : optionTopics; - - const options = Object.assign({}, _options, { - address: this._address, - topics - }); - - return options; - } - - _createEthFilter (event = null, _options) { - const options = this._getFilterOptions(event, _options); - - return this._api.eth.newFilter(options); - } - - subscribe (eventName = null, options = {}, callback, autoRemove) { - try { - const event = this._findEvent(eventName); - - return this._subscribe(event, options, callback, autoRemove); - } catch (e) { - return Promise.reject(e); - } - } - - _sendData (subscriptionId, error, logs) { - const { autoRemove, callback } = this._subscriptions[subscriptionId]; - let result = true; - - try { - result = callback(error, logs); - } catch (error) { - console.warn('_sendData', subscriptionId, error); - } - - if (autoRemove && result && typeof result === 'boolean') { - this.unsubscribe(subscriptionId); - } - } - - _subscribe (event = null, _options, callback, autoRemove = false) { - const subscriptionId = nextSubscriptionId++; - const { skipInitFetch } = _options; - - delete _options['skipInitFetch']; - - return this - ._createEthFilter(event, _options) - .then((filterId) => { - this._subscriptions[subscriptionId] = { - options: _options, - autoRemove, - callback, - filterId, - id: subscriptionId - }; - - if (skipInitFetch) { - this._subscribeToChanges(); - return subscriptionId; - } - - return this._api.eth - .getFilterLogs(filterId) - .then((logs) => { - this._sendData(subscriptionId, null, this.parseEventLogs(logs)); - this._subscribeToChanges(); - return subscriptionId; - }); - }) - .catch((error) => { - console.warn('subscribe', event, _options, error); - throw error; - }); - } - - unsubscribe (subscriptionId) { - return this._api.eth - .uninstallFilter(this._subscriptions[subscriptionId].filterId) - .catch((error) => { - console.error('unsubscribe', error); - }) - .then(() => { - delete this._subscriptions[subscriptionId]; - this._unsubscribeFromChanges(); - }); - } - - _subscribeToChanges = () => { - const subscriptions = Object.values(this._subscriptions); - - const pendingSubscriptions = subscriptions - .filter((s) => s.options.toBlock && s.options.toBlock === 'pending'); - - const otherSubscriptions = subscriptions - .filter((s) => !(s.options.toBlock && s.options.toBlock === 'pending')); - - if (pendingSubscriptions.length > 0 && !this._subscribedToPendings) { - this._subscribedToPendings = true; - this._subscribeToPendings(); - } - - if (otherSubscriptions.length > 0 && !this._subscribedToBlock) { - this._subscribedToBlock = true; - this._subscribeToBlock(); - } - } - - _unsubscribeFromChanges = () => { - const subscriptions = Object.values(this._subscriptions); - - const pendingSubscriptions = subscriptions - .filter((s) => s.options.toBlock && s.options.toBlock === 'pending'); - - const otherSubscriptions = subscriptions - .filter((s) => !(s.options.toBlock && s.options.toBlock === 'pending')); - - if (pendingSubscriptions.length === 0 && this._subscribedToPendings) { - this._subscribedToPendings = false; - clearTimeout(this._pendingsSubscriptionId); - } - - if (otherSubscriptions.length === 0 && this._subscribedToBlock) { - this._subscribedToBlock = false; - this._api.unsubscribe(this._blockSubscriptionId); - } - } - - _subscribeToBlock = () => { - this._api - .subscribe('eth_blockNumber', (error) => { - if (error) { - console.error('::_subscribeToBlock', error, error && error.stack); - } - - const subscriptions = Object.values(this._subscriptions) - .filter((s) => !(s.options.toBlock && s.options.toBlock === 'pending')); - - this._sendSubscriptionChanges(subscriptions); - }) - .then((blockSubId) => { - this._blockSubscriptionId = blockSubId; - }) - .catch((e) => { - console.error('::_subscribeToBlock', e, e && e.stack); - }); - } - - _subscribeToPendings = () => { - const subscriptions = Object.values(this._subscriptions) - .filter((s) => s.options.toBlock && s.options.toBlock === 'pending'); - - const timeout = () => setTimeout(() => this._subscribeToPendings(), 1000); - - this._sendSubscriptionChanges(subscriptions) - .then(() => { - this._pendingsSubscriptionId = timeout(); - }); - } - - _sendSubscriptionChanges = (subscriptions) => { - return Promise - .all( - subscriptions.map((subscription) => { - return this._api.eth.getFilterChanges(subscription.filterId); - }) - ) - .then((logsArray) => { - logsArray.forEach((logs, index) => { - if (!logs || !logs.length) { - return; - } - - try { - this._sendData(subscriptions[index].id, null, this.parseEventLogs(logs)); - } catch (error) { - console.error('_sendSubscriptionChanges', error); - } - }); - }) - .catch((error) => { - console.error('_sendSubscriptionChanges', error); - }); - } -} diff --git a/js-old/src/api/contract/contract.spec.js b/js-old/src/api/contract/contract.spec.js deleted file mode 100644 index bd8b0fbda..000000000 --- a/js-old/src/api/contract/contract.spec.js +++ /dev/null @@ -1,597 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; -import sinon from 'sinon'; - -import { TEST_HTTP_URL, mockHttp } from '../../../test/mockRpc'; - -import Abi from '../../abi'; -import { sha3 } from '../util/sha3'; - -import Api from '../api'; -import Contract from './contract'; -import { isInstanceOf, isFunction } from '../util/types'; - -const transport = new Api.Transport.Http(TEST_HTTP_URL, -1); -const eth = new Api(transport); - -describe('api/contract/Contract', () => { - const ADDR = '0x0123456789'; - - const ABI = [ - { - type: 'function', name: 'test', - inputs: [{ name: 'boolin', type: 'bool' }, { name: 'stringin', type: 'string' }], - outputs: [{ type: 'uint' }] - }, - { - type: 'function', name: 'test2', - outputs: [{ type: 'uint' }, { type: 'uint' }] - }, - { - type: 'constructor', - inputs: [{ name: 'boolin', type: 'bool' }, { name: 'stringin', type: 'string' }] - }, - { type: 'event', name: 'baz' }, - { type: 'event', name: 'foo' } - ]; - - const ABI_NO_PARAMS = [ - { - type: 'function', name: 'test', - inputs: [{ name: 'boolin', type: 'bool' }, { name: 'stringin', type: 'string' }], - outputs: [{ type: 'uint' }] - }, - { - type: 'function', name: 'test2', - outputs: [{ type: 'uint' }, { type: 'uint' }] - }, - { - type: 'constructor' - }, - { type: 'event', name: 'baz' }, - { type: 'event', name: 'foo' } - ]; - - const VALUES = [ true, 'jacogr' ]; - const CALLDATA = ` - 0000000000000000000000000000000000000000000000000000000000000001 - 0000000000000000000000000000000000000000000000000000000000000040 - 0000000000000000000000000000000000000000000000000000000000000006 - 6a61636f67720000000000000000000000000000000000000000000000000000 - `.replace(/\s/g, ''); - const SIGNATURE = '02356205'; - - const ENCODED = `0x${SIGNATURE}${CALLDATA}`; - - const RETURN1 = '0000000000000000000000000000000000000000000000000000000000123456'; - const RETURN2 = '0000000000000000000000000000000000000000000000000000000000456789'; - let scope; - - describe('constructor', () => { - it('needs an EthAbi instance', () => { - expect(() => new Contract()).to.throw(/API instance needs to be provided to Contract/); - }); - - it('needs an ABI', () => { - expect(() => new Contract(eth)).to.throw(/ABI needs to be provided to Contract instance/); - }); - - describe('internal setup', () => { - const contract = new Contract(eth, ABI); - - it('sets EthApi & parsed interface', () => { - expect(contract.address).to.not.be.ok; - expect(contract.api).to.deep.equal(eth); - expect(isInstanceOf(contract.abi, Abi)).to.be.ok; - }); - - it('attaches functions', () => { - expect(contract.functions.length).to.equal(2); - expect(contract.functions[0].name).to.equal('test'); - }); - - it('attaches constructors', () => { - expect(contract.constructors.length).to.equal(1); - }); - - it('attaches events', () => { - expect(contract.events.length).to.equal(2); - expect(contract.events[0].name).to.equal('baz'); - }); - }); - }); - - describe('at', () => { - it('sets returns the functions, events & sets the address', () => { - const contract = new Contract(eth, [ - { - constant: true, - inputs: [{ - name: '_who', - type: 'address' - }], - name: 'balanceOf', - outputs: [{ - name: '', - type: 'uint256' - }], - type: 'function' - }, - { - anonymous: false, - inputs: [{ - indexed: false, - name: 'amount', - type: 'uint256' - }], - name: 'Drained', - type: 'event' - } - ]); - - contract.at('6789'); - - expect(Object.keys(contract.instance)).to.deep.equal([ - 'Drained', - /^(?:0x)(.+)$/.exec(sha3('Drained(uint256)'))[1], - 'balanceOf', - /^(?:0x)(.+)$/.exec(sha3('balanceOf(address)'))[1].substr(0, 8), - 'address' - ]); - expect(contract.address).to.equal('6789'); - }); - }); - - describe('parseTransactionEvents', () => { - it('parses a transaction log into the data', () => { - const contract = new Contract(eth, [ - { - anonymous: false, name: 'Message', type: 'event', - inputs: [ - { indexed: true, name: 'postId', type: 'uint256' }, - { indexed: false, name: 'parentId', type: 'uint256' }, - { indexed: false, name: 'sender', type: 'address' }, - { indexed: false, name: 'at', type: 'uint256' }, - { indexed: false, name: 'messageId', type: 'uint256' }, - { indexed: false, name: 'message', type: 'string' } - ] - } - ]); - const decoded = contract.parseTransactionEvents({ - blockHash: '0xa9280530a3b47bee2fc80f2862fd56502ae075350571d724d6442ea4c597347b', - blockNumber: '0x4fcd', - cumulativeGasUsed: '0xb57f', - gasUsed: '0xb57f', - logs: [{ - address: '0x22bff18ec62281850546a664bb63a5c06ac5f76c', - blockHash: '0xa9280530a3b47bee2fc80f2862fd56502ae075350571d724d6442ea4c597347b', - blockNumber: '0x4fcd', - data: '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063cf90d3f0410092fc0fca41846f5962239791950000000000000000000000000000000000000000000000000000000056e6c85f0000000000000000000000000000000000000000000000000001000000004fcd00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000d706f7374286d6573736167652900000000000000000000000000000000000000', - logIndex: '0x0', - topics: [ - '0x954ba6c157daf8a26539574ffa64203c044691aa57251af95f4b48d85ec00dd5', - '0x0000000000000000000000000000000000000000000000000001000000004fe0' - ], - transactionHash: '0xca16f537d761d13e4e80953b754e2b15541f267d6cad9381f750af1bae1e4917', - transactionIndex: '0x0' - }], - to: '0x22bff18ec62281850546a664bb63a5c06ac5f76c', - transactionHash: '0xca16f537d761d13e4e80953b754e2b15541f267d6cad9381f750af1bae1e4917', - transactionIndex: '0x0' - }); - const log = decoded.logs[0]; - - expect(log.event).to.equal('Message'); - expect(log.address).to.equal('0x22bff18ec62281850546a664bb63a5c06ac5f76c'); - expect(log.params).to.deep.equal({ - at: { type: 'uint', value: new BigNumber('1457965151') }, - message: { type: 'string', value: 'post(message)' }, - messageId: { type: 'uint', value: new BigNumber('281474976731085') }, - parentId: { type: 'uint', value: new BigNumber(0) }, - postId: { type: 'uint', value: new BigNumber('281474976731104') }, - sender: { type: 'address', value: '0x63Cf90D3f0410092FC0fca41846f596223979195' } - }); - }); - }); - - describe('_pollTransactionReceipt', () => { - const contract = new Contract(eth, ABI); - const ADDRESS = '0xD337e80eEdBdf86eDBba021797d7e4e00Bb78351'; - const BLOCKNUMBER = '555000'; - const RECEIPT = { contractAddress: ADDRESS.toLowerCase(), blockNumber: BLOCKNUMBER }; - const EXPECT = { contractAddress: ADDRESS, blockNumber: new BigNumber(BLOCKNUMBER) }; - - let scope; - let receipt; - - describe('success', () => { - before(() => { - scope = mockHttp([ - { method: 'eth_getTransactionReceipt', reply: { result: null } }, - { method: 'eth_getTransactionReceipt', reply: { result: null } }, - { method: 'eth_getTransactionReceipt', reply: { result: RECEIPT } } - ]); - - return contract - ._pollTransactionReceipt('0x123') - .then((_receipt) => { - receipt = _receipt; - }); - }); - - it('sends multiple getTransactionReceipt calls', () => { - expect(scope.isDone()).to.be.true; - }); - - it('passes the txhash through', () => { - expect(scope.body.eth_getTransactionReceipt.params[0]).to.equal('0x123'); - }); - - it('receives the final receipt', () => { - expect(receipt).to.deep.equal(EXPECT); - }); - }); - - describe('error', () => { - before(() => { - scope = mockHttp([{ method: 'eth_getTransactionReceipt', reply: { error: { code: -1, message: 'failure' } } }]); - }); - - it('returns the errors', () => { - return contract - ._pollTransactionReceipt('0x123') - .catch((error) => { - expect(error.message).to.match(/failure/); - }); - }); - }); - }); - - describe('deploy without parameters', () => { - const contract = new Contract(eth, ABI_NO_PARAMS); - const CODE = '0x123'; - const ADDRESS = '0xD337e80eEdBdf86eDBba021797d7e4e00Bb78351'; - const RECEIPT_DONE = { contractAddress: ADDRESS.toLowerCase(), gasUsed: 50, blockNumber: 2500 }; - - let scope; - - describe('success', () => { - before(() => { - scope = mockHttp([ - { method: 'eth_estimateGas', reply: { result: 1000 } }, - { method: 'parity_postTransaction', reply: { result: '0x678' } }, - { method: 'parity_checkRequest', reply: { result: '0x890' } }, - { method: 'eth_getTransactionReceipt', reply: { result: RECEIPT_DONE } }, - { method: 'eth_getCode', reply: { result: CODE } } - ]); - - return contract.deploy({ data: CODE }, []); - }); - - it('passes the options through to postTransaction (incl. gas calculation)', () => { - expect(scope.body.parity_postTransaction.params[0].data).to.equal(CODE); - }); - }); - }); - - describe('deploy', () => { - const contract = new Contract(eth, ABI); - const ADDRESS = '0xD337e80eEdBdf86eDBba021797d7e4e00Bb78351'; - const RECEIPT_PEND = { contractAddress: ADDRESS.toLowerCase(), gasUsed: 50, blockNumber: 0 }; - const RECEIPT_DONE = { contractAddress: ADDRESS.toLowerCase(), gasUsed: 50, blockNumber: 2500 }; - const RECEIPT_EXCP = { contractAddress: ADDRESS.toLowerCase(), gasUsed: 1200, blockNumber: 2500 }; - - let scope; - - describe('success', () => { - before(() => { - scope = mockHttp([ - { method: 'eth_estimateGas', reply: { result: 1000 } }, - { method: 'parity_postTransaction', reply: { result: '0x678' } }, - { method: 'parity_checkRequest', reply: { result: null } }, - { method: 'parity_checkRequest', reply: { result: '0x890' } }, - { method: 'eth_getTransactionReceipt', reply: { result: null } }, - { method: 'eth_getTransactionReceipt', reply: { result: RECEIPT_PEND } }, - { method: 'eth_getTransactionReceipt', reply: { result: RECEIPT_DONE } }, - { method: 'eth_getCode', reply: { result: '0x456' } } - ]); - - return contract.deploy({ data: '0x123' }, VALUES); - }); - - it('calls estimateGas, postTransaction, checkRequest, getTransactionReceipt & getCode in order', () => { - expect(scope.isDone()).to.be.true; - }); - - it('passes the options through to postTransaction (incl. gas calculation)', () => { - expect(scope.body.parity_postTransaction.params).to.deep.equal([ - { data: `0x123${CALLDATA}`, gas: '0x4b0' } - ]); - }); - - it('sets the address of the contract', () => { - expect(contract.address).to.equal(ADDRESS); - }); - }); - - describe('error', () => { - it('fails when gasUsed == gas', () => { - mockHttp([ - { method: 'eth_estimateGas', reply: { result: 1000 } }, - { method: 'parity_postTransaction', reply: { result: '0x678' } }, - { method: 'parity_checkRequest', reply: { result: '0x789' } }, - { method: 'eth_getTransactionReceipt', reply: { result: RECEIPT_EXCP } } - ]); - - return contract - .deploy({ data: '0x123' }, VALUES) - .catch((error) => { - expect(error.message).to.match(/not deployed, gasUsed/); - }); - }); - - it('fails when no code was deployed', () => { - mockHttp([ - { method: 'eth_estimateGas', reply: { result: 1000 } }, - { method: 'parity_postTransaction', reply: { result: '0x678' } }, - { method: 'parity_checkRequest', reply: { result: '0x789' } }, - { method: 'eth_getTransactionReceipt', reply: { result: RECEIPT_DONE } }, - { method: 'eth_getCode', reply: { result: '0x' } } - ]); - - return contract - .deploy({ data: '0x123' }, VALUES) - .catch((error) => { - expect(error.message).to.match(/not deployed, getCode/); - }); - }); - }); - }); - - describe('bindings', () => { - let contract; - let cons; - let func; - - beforeEach(() => { - contract = new Contract(eth, ABI); - contract.at(ADDR); - cons = contract.constructors[0]; - func = contract.functions.find((fn) => fn.name === 'test'); - }); - - describe('_addOptionsTo', () => { - it('works on no object specified', () => { - expect(contract._addOptionsTo()).to.deep.equal({ to: ADDR }); - }); - - it('uses the contract address when none specified', () => { - expect(contract._addOptionsTo({ from: 'me' })).to.deep.equal({ to: ADDR, from: 'me' }); - }); - - it('overrides the contract address when specified', () => { - expect(contract._addOptionsTo({ to: 'you', from: 'me' })).to.deep.equal({ to: 'you', from: 'me' }); - }); - }); - - describe('attachments', () => { - it('attaches .call, .postTransaction & .estimateGas to constructors', () => { - expect(isFunction(cons.call)).to.be.true; - expect(isFunction(cons.postTransaction)).to.be.true; - expect(isFunction(cons.estimateGas)).to.be.true; - }); - - it('attaches .call, .postTransaction & .estimateGas to functions', () => { - expect(isFunction(func.call)).to.be.true; - expect(isFunction(func.postTransaction)).to.be.true; - expect(isFunction(func.estimateGas)).to.be.true; - }); - - it('attaches .call only to constant functions', () => { - func = (new Contract(eth, [{ type: 'function', name: 'test', constant: true }])).functions[0]; - - expect(isFunction(func.call)).to.be.true; - expect(isFunction(func.postTransaction)).to.be.false; - expect(isFunction(func.estimateGas)).to.be.false; - }); - }); - - describe('postTransaction', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'parity_postTransaction', reply: { result: ['hashId'] } }]); - }); - - it('encodes options and mades an parity_postTransaction call', () => { - return func - .postTransaction({ someExtras: 'foo' }, VALUES) - .then(() => { - expect(scope.isDone()).to.be.true; - expect(scope.body.parity_postTransaction.params[0]).to.deep.equal({ - someExtras: 'foo', - to: ADDR, - data: ENCODED - }); - }); - }); - }); - - describe('estimateGas', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_estimateGas', reply: { result: ['0x123'] } }]); - }); - - it('encodes options and mades an eth_estimateGas call', () => { - return func - .estimateGas({ someExtras: 'foo' }, VALUES) - .then((amount) => { - expect(scope.isDone()).to.be.true; - expect(amount.toString(16)).to.equal('123'); - expect(scope.body.eth_estimateGas.params).to.deep.equal([{ - someExtras: 'foo', - to: ADDR, - data: ENCODED - }]); - }); - }); - }); - - describe('call', () => { - it('encodes options and mades an eth_call call', () => { - scope = mockHttp([{ method: 'eth_call', reply: { result: RETURN1 } }]); - - return func - .call({ someExtras: 'foo' }, VALUES) - .then((result) => { - expect(scope.isDone()).to.be.true; - expect(scope.body.eth_call.params).to.deep.equal([{ - someExtras: 'foo', - to: ADDR, - data: ENCODED - }, 'latest']); - expect(result.toString(16)).to.equal('123456'); - }); - }); - - it('encodes options and mades an eth_call call (multiple returns)', () => { - scope = mockHttp([{ method: 'eth_call', reply: { result: `${RETURN1}${RETURN2}` } }]); - - return contract.functions[1] - .call({}, []) - .then((result) => { - expect(scope.isDone()).to.be.true; - expect(result.length).to.equal(2); - expect(result[0].toString(16)).to.equal('123456'); - expect(result[1].toString(16)).to.equal('456789'); - }); - }); - }); - }); - - describe('subscribe', () => { - const abi = [ - { - anonymous: false, name: 'Message', type: 'event', - inputs: [ - { indexed: true, name: 'postId', type: 'uint256' }, - { indexed: false, name: 'parentId', type: 'uint256' }, - { indexed: false, name: 'sender', type: 'address' }, - { indexed: false, name: 'at', type: 'uint256' }, - { indexed: false, name: 'messageId', type: 'uint256' }, - { indexed: false, name: 'message', type: 'string' } - ] - } - ]; - - const logs = [{ - address: '0x22bff18ec62281850546a664bb63a5c06ac5f76c', - blockHash: '0xa9280530a3b47bee2fc80f2862fd56502ae075350571d724d6442ea4c597347b', - blockNumber: '0x4fcd', - data: '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063cf90d3f0410092fc0fca41846f5962239791950000000000000000000000000000000000000000000000000000000056e6c85f0000000000000000000000000000000000000000000000000001000000004fcd00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000d706f7374286d6573736167652900000000000000000000000000000000000000', - logIndex: '0x0', - topics: [ - '0x954ba6c157daf8a26539574ffa64203c044691aa57251af95f4b48d85ec00dd5', - '0x0000000000000000000000000000000000000000000000000001000000004fe0' - ], - transactionHash: '0xca16f537d761d13e4e80953b754e2b15541f267d6cad9381f750af1bae1e4917', - transactionIndex: '0x0' - }]; - - const parsed = [{ - address: '0x22bfF18ec62281850546a664bb63a5C06AC5F76C', - blockHash: '0xa9280530a3b47bee2fc80f2862fd56502ae075350571d724d6442ea4c597347b', - blockNumber: new BigNumber(20429), - data: '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063cf90d3f0410092fc0fca41846f5962239791950000000000000000000000000000000000000000000000000000000056e6c85f0000000000000000000000000000000000000000000000000001000000004fcd00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000d706f7374286d6573736167652900000000000000000000000000000000000000', - event: 'Message', - logIndex: new BigNumber(0), - params: { - at: { type: 'uint', value: new BigNumber(1457965151) }, - message: { type: 'string', value: 'post(message)' }, - messageId: { type: 'uint', value: new BigNumber(281474976731085) }, - parentId: { type: 'uint', value: new BigNumber(0) }, - postId: { type: 'uint', value: new BigNumber(281474976731104) }, - sender: { type: 'address', value: '0x63Cf90D3f0410092FC0fca41846f596223979195' } - }, - topics: [ - '0x954ba6c157daf8a26539574ffa64203c044691aa57251af95f4b48d85ec00dd5', - '0x0000000000000000000000000000000000000000000000000001000000004fe0' - ], - transactionHash: '0xca16f537d761d13e4e80953b754e2b15541f267d6cad9381f750af1bae1e4917', - transactionIndex: new BigNumber(0) - }]; - - let contract; - - beforeEach(() => { - contract = new Contract(eth, abi); - contract.at(ADDR); - }); - - describe('invalid events', () => { - it('fails to subscribe to an invalid names', () => { - return contract - .subscribe('invalid') - .catch((error) => { - expect(error.message).to.match(/invalid is not a valid eventName/); - }); - }); - }); - - describe('valid events', () => { - let cbb; - let cbe; - - beforeEach(() => { - scope = mockHttp([ - { method: 'eth_newFilter', reply: { result: '0x123' } }, - { method: 'eth_getFilterLogs', reply: { result: logs } }, - { method: 'eth_getFilterChanges', reply: { result: logs } }, - { method: 'eth_newFilter', reply: { result: '0x123' } }, - { method: 'eth_getFilterLogs', reply: { result: logs } } - ]); - cbb = sinon.stub(); - cbe = sinon.stub(); - - return contract.subscribe('Message', { toBlock: 'pending' }, cbb); - }); - - it('sets the subscriptionId returned', () => { - return contract - .subscribe('Message', { toBlock: 'pending' }, cbe) - .then((subscriptionId) => { - expect(subscriptionId).to.equal(1); - }); - }); - - it('creates a new filter and retrieves the logs on it', () => { - return contract - .subscribe('Message', { toBlock: 'pending' }, cbe) - .then((subscriptionId) => { - expect(scope.isDone()).to.be.true; - }); - }); - - it('returns the logs to the callback', () => { - return contract - .subscribe('Message', { toBlock: 'pending' }, cbe) - .then((subscriptionId) => { - expect(cbe).to.have.been.calledWith(null, parsed); - }); - }); - }); - }); -}); diff --git a/js-old/src/api/contract/index.js b/js-old/src/api/contract/index.js deleted file mode 100644 index 74c58e942..000000000 --- a/js-old/src/api/contract/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './contract'; diff --git a/js-old/src/api/format/input.js b/js-old/src/api/format/input.js deleted file mode 100644 index 0ccd10604..000000000 --- a/js-old/src/api/format/input.js +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -import { isArray, isHex, isInstanceOf, isString } from '../util/types'; -import { padLeft, toHex } from '../util/format'; - -export function inAddress (address) { - // TODO: address validation if we have upper-lower addresses - return inHex(address); -} - -export function inAddresses (addresses) { - return (addresses || []).map(inAddress); -} - -export function inBlockNumber (blockNumber) { - if (isString(blockNumber)) { - switch (blockNumber) { - case 'earliest': - case 'latest': - case 'pending': - return blockNumber; - } - } - - return inNumber16(blockNumber); -} - -export function inData (data) { - if (data && data.length && !isHex(data)) { - data = data.split('').map((chr) => { - return `0${chr.charCodeAt(0).toString(16)}`.slice(-2); - }).join(''); - } - - return inHex(data); -} - -export function inHash (hash) { - return inHex(hash); -} - -export function inTopics (_topics) { - let topics = (_topics || []) - .filter((topic) => topic === null || topic) - .map((topic) => { - if (topic === null) { - return null; - } - - if (Array.isArray(topic)) { - return inTopics(topic); - } - - return padLeft(topic, 32); - }); - - return topics; -} - -export function inFilter (options) { - if (options) { - Object.keys(options).forEach((key) => { - switch (key) { - case 'address': - if (isArray(options[key])) { - options[key] = options[key].map(inAddress); - } else { - options[key] = inAddress(options[key]); - } - break; - - case 'fromBlock': - case 'toBlock': - options[key] = inBlockNumber(options[key]); - break; - - case 'limit': - options[key] = inNumber10(options[key]); - break; - - case 'topics': - options[key] = inTopics(options[key]); - } - }); - } - - return options; -} - -export function inHex (str) { - return toHex(str); -} - -export function inNumber10 (number) { - if (isInstanceOf(number, BigNumber)) { - return number.toNumber(); - } - - return (new BigNumber(number || 0)).toNumber(); -} - -export function inNumber16 (number) { - const bn = isInstanceOf(number, BigNumber) - ? 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(bn.toString(16)); -} - -export function inOptionsCondition (condition) { - if (condition) { - if (condition.block) { - condition.block = condition.block ? inNumber10(condition.block) : null; - } else if (condition.time) { - condition.time = inNumber10(Math.floor(condition.time.getTime() / 1000)); - } - } - - return condition; -} - -export function inOptions (_options = {}) { - const options = { ..._options }; - - Object.keys(options).forEach((key) => { - switch (key) { - case 'to': - // Don't encode the `to` option if it's empty - // (eg. contract deployments) - if (options[key]) { - options.to = inAddress(options[key]); - } - break; - - case 'from': - options[key] = inAddress(options[key]); - break; - - case 'condition': - options[key] = inOptionsCondition(options[key]); - break; - - case 'gas': - case 'gasPrice': - options[key] = inNumber16((new BigNumber(options[key])).round()); - break; - - case 'value': - case 'nonce': - options[key] = inNumber16(options[key]); - break; - - case 'data': - options[key] = inData(options[key]); - break; - } - }); - - return options; -} - -export function inTraceFilter (filterObject) { - if (filterObject) { - Object.keys(filterObject).forEach((key) => { - switch (key) { - case 'fromAddress': - case 'toAddress': - filterObject[key] = [].concat(filterObject[key]) - .map(address => inAddress(address)); - break; - - case 'toBlock': - case 'fromBlock': - filterObject[key] = inBlockNumber(filterObject[key]); - break; - } - }); - } - - return filterObject; -} - -export function inTraceType (whatTrace) { - if (isString(whatTrace)) { - return [whatTrace]; - } - - return whatTrace; -} - -function inDeriveType (derive) { - return derive && derive.type === 'hard' ? 'hard' : 'soft'; -} - -export function inDeriveHash (derive) { - const hash = derive && derive.hash ? derive.hash : derive; - const type = inDeriveType(derive); - - return { - hash: inHex(hash), - type - }; -} - -export function inDeriveIndex (derive) { - if (!derive) { - return []; - } - - if (!isArray(derive)) { - derive = [derive]; - } - - return derive.map(item => { - const index = inNumber10(item && item.index ? item.index : item); - - return { - index, - type: inDeriveType(item) - }; - }); -} diff --git a/js-old/src/api/format/input.spec.js b/js-old/src/api/format/input.spec.js deleted file mode 100644 index eb74b7bd6..000000000 --- a/js-old/src/api/format/input.spec.js +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -import { - inAddress, inBlockNumber, inData, inFilter, inHex, - inNumber10, inNumber16, inOptions, inTraceType, - inDeriveHash, inDeriveIndex -} from './input'; -import { isAddress } from '../../../test/types'; - -describe('api/format/input', () => { - const address = '0x63cf90d3f0410092fc0fca41846f596223979195'; - - describe('inAddress', () => { - const address = '63cf90d3f0410092fc0fca41846f596223979195'; - - it('adds the leading 0x as required', () => { - expect(inAddress(address)).to.equal(`0x${address}`); - }); - - it('returns verified addresses as-is', () => { - expect(inAddress(`0x${address}`)).to.equal(`0x${address}`); - }); - - it('returns lowercase equivalents', () => { - expect(inAddress(address.toUpperCase())).to.equal(`0x${address}`); - }); - - it('returns 0x on null addresses', () => { - expect(inAddress()).to.equal('0x'); - }); - }); - - describe('inBlockNumber()', () => { - it('returns earliest as-is', () => { - expect(inBlockNumber('earliest')).to.equal('earliest'); - }); - - it('returns latest as-is', () => { - expect(inBlockNumber('latest')).to.equal('latest'); - }); - - it('returns pending as-is', () => { - expect(inBlockNumber('pending')).to.equal('pending'); - }); - - it('formats existing BigNumber into hex', () => { - expect(inBlockNumber(new BigNumber(0x123456))).to.equal('0x123456'); - }); - - it('formats hex strings into hex', () => { - expect(inBlockNumber('0x123456')).to.equal('0x123456'); - }); - - it('formats numbers into hex', () => { - expect(inBlockNumber(0x123456)).to.equal('0x123456'); - }); - }); - - describe('inData', () => { - it('formats to hex', () => { - expect(inData('123456')).to.equal('0x123456'); - }); - - it('converts a string to a hex representation', () => { - expect(inData('jaco')).to.equal('0x6a61636f'); - }); - }); - - describe('inHex', () => { - it('leaves leading 0x as-is', () => { - expect(inHex('0x123456')).to.equal('0x123456'); - }); - - it('adds a leading 0x', () => { - expect(inHex('123456')).to.equal('0x123456'); - }); - - it('returns uppercase as lowercase (leading 0x)', () => { - expect(inHex('0xABCDEF')).to.equal('0xabcdef'); - }); - - it('returns uppercase as lowercase (no leading 0x)', () => { - expect(inHex('ABCDEF')).to.equal('0xabcdef'); - }); - - it('handles empty & null', () => { - expect(inHex()).to.equal('0x'); - expect(inHex('')).to.equal('0x'); - }); - }); - - describe('inFilter', () => { - ['address'].forEach((input) => { - it(`formats ${input} address as address`, () => { - const block = {}; - - block[input] = address; - const formatted = inFilter(block)[input]; - - expect(isAddress(formatted)).to.be.true; - expect(formatted).to.equal(address); - }); - }); - - ['fromBlock', 'toBlock'].forEach((input) => { - it(`formats ${input} number as blockNumber`, () => { - const block = {}; - - block[input] = 0x123; - const formatted = inFilter(block)[input]; - - expect(formatted).to.equal('0x123'); - }); - }); - - it('ignores and passes through unknown keys', () => { - expect(inFilter({ someRandom: 'someRandom' })).to.deep.equal({ someRandom: 'someRandom' }); - }); - - it('formats an filter options object with relevant entries converted', () => { - expect( - inFilter({ - address: address, - fromBlock: 'latest', - toBlock: 0x101, - extraData: 'someExtraStuffInHere', - limit: 0x32 - }) - ).to.deep.equal({ - address: address, - fromBlock: 'latest', - toBlock: '0x101', - extraData: 'someExtraStuffInHere', - limit: 50 - }); - }); - }); - - describe('inNumber10()', () => { - it('formats existing BigNumber into number', () => { - expect(inNumber10(new BigNumber(123))).to.equal(123); - }); - - it('formats hex strings into decimal', () => { - expect(inNumber10('0x0a')).to.equal(10); - }); - - it('formats numbers into number', () => { - expect(inNumber10(123)).to.equal(123); - }); - - it('formats undefined into 0', () => { - expect(inNumber10()).to.equal(0); - }); - }); - - describe('inNumber16()', () => { - it('formats existing BigNumber into hex', () => { - expect(inNumber16(new BigNumber(0x123456))).to.equal('0x123456'); - }); - - it('formats hex strings into hex', () => { - expect(inNumber16('0x123456')).to.equal('0x123456'); - }); - - it('formats numbers into hex', () => { - expect(inNumber16(0x123456)).to.equal('0x123456'); - }); - - it('formats undefined into 0', () => { - expect(inNumber16()).to.equal('0x0'); - }); - }); - - describe('inOptions', () => { - ['data'].forEach((input) => { - it(`converts ${input} to hex data`, () => { - const block = {}; - - block[input] = '1234'; - const formatted = inData(block[input]); - - expect(formatted).to.equal('0x1234'); - }); - }); - - ['from', 'to'].forEach((input) => { - it(`formats ${input} address as address`, () => { - const block = {}; - - block[input] = address; - const formatted = inOptions(block)[input]; - - expect(isAddress(formatted)).to.be.true; - expect(formatted).to.equal(address); - }); - }); - - it('does not encode an empty `to` value', () => { - const options = { to: '' }; - const formatted = inOptions(options); - - expect(formatted.to).to.equal(''); - }); - - ['gas', 'gasPrice', 'value', 'nonce'].forEach((input) => { - it(`formats ${input} number as hexnumber`, () => { - const block = {}; - - block[input] = 0x123; - const formatted = inOptions(block)[input]; - - expect(formatted).to.equal('0x123'); - }); - }); - - it('passes condition as null when specified as such', () => { - expect(inOptions({ condition: null })).to.deep.equal({ condition: null }); - }); - - it('ignores and passes through unknown keys', () => { - expect(inOptions({ someRandom: 'someRandom' })).to.deep.equal({ someRandom: 'someRandom' }); - }); - - it('formats an options object with relevant entries converted', () => { - expect( - inOptions({ - from: address, - to: address, - gas: new BigNumber('0x100'), - gasPrice: 0x101, - value: 258, - nonce: '0x104', - data: '0123456789', - extraData: 'someExtraStuffInHere' - }) - ).to.deep.equal({ - from: address, - to: address, - gas: '0x100', - gasPrice: '0x101', - value: '0x102', - nonce: '0x104', - data: '0x0123456789', - extraData: 'someExtraStuffInHere' - }); - }); - }); - - describe('inTraceType', () => { - it('returns array of types as is', () => { - const types = ['vmTrace', 'trace', 'stateDiff']; - - expect(inTraceType(types)).to.deep.equal(types); - }); - - it('formats single string type into array', () => { - const type = 'vmTrace'; - - expect(inTraceType(type)).to.deep.equal([type]); - }); - }); - - describe('inDeriveHash', () => { - it('returns derive hash', () => { - expect(inDeriveHash(1)).to.deep.equal({ - hash: '0x1', - type: 'soft' - }); - - expect(inDeriveHash(null)).to.deep.equal({ - hash: '0x', - type: 'soft' - }); - - expect(inDeriveHash({ - hash: 5 - })).to.deep.equal({ - hash: '0x5', - type: 'soft' - }); - - expect(inDeriveHash({ - hash: 5, - type: 'hard' - })).to.deep.equal({ - hash: '0x5', - type: 'hard' - }); - }); - }); - - describe('inDeriveIndex', () => { - it('returns derive hash', () => { - expect(inDeriveIndex(null)).to.deep.equal([]); - expect(inDeriveIndex([])).to.deep.equal([]); - - expect(inDeriveIndex([1])).to.deep.equal([{ - index: 1, - type: 'soft' - }]); - - expect(inDeriveIndex({ - index: 1 - })).to.deep.equal([{ - index: 1, - type: 'soft' - }]); - - expect(inDeriveIndex([{ - index: 1, - type: 'hard' - }, 5])).to.deep.equal([ - { - index: 1, - type: 'hard' - }, - { - index: 5, - type: 'soft' - } - ]); - }); - }); -}); diff --git a/js-old/src/api/format/output.js b/js-old/src/api/format/output.js deleted file mode 100644 index 7bf39d17c..000000000 --- a/js-old/src/api/format/output.js +++ /dev/null @@ -1,414 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -import { toChecksumAddress } from '../../abi/util/address'; -import { isString } from '../util/types'; - -export function outAccountInfo (infos) { - return Object - .keys(infos) - .reduce((ret, _address) => { - const info = infos[_address]; - const address = outAddress(_address); - - ret[address] = { - name: info.name - }; - - if (info.meta) { - ret[address].uuid = info.uuid; - ret[address].meta = JSON.parse(info.meta); - } - - return ret; - }, {}); -} - -export function outAddress (address) { - return toChecksumAddress(address); -} - -export function outAddresses (addresses) { - return (addresses || []).map(outAddress); -} - -export function outBlock (block) { - if (block) { - Object.keys(block).forEach((key) => { - switch (key) { - case 'author': - case 'miner': - block[key] = outAddress(block[key]); - break; - - case 'difficulty': - case 'gasLimit': - case 'gasUsed': - case 'nonce': - case 'number': - case 'totalDifficulty': - block[key] = outNumber(block[key]); - break; - - case 'timestamp': - block[key] = outDate(block[key]); - break; - } - }); - } - - return block; -} - -export function outChainStatus (status) { - if (status) { - Object.keys(status).forEach((key) => { - switch (key) { - case 'blockGap': - status[key] = status[key] - ? status[key].map(outNumber) - : status[key]; - break; - } - }); - } - - return status; -} - -export function outDate (date) { - if (typeof date.toISOString === 'function') { - return date; - } - - try { - if (typeof date === 'string' && (new Date(date)).toISOString() === date) { - return new Date(date); - } - } catch (error) {} - - return new Date(outNumber(date).toNumber() * 1000); -} - -export function outHistogram (histogram) { - if (histogram) { - Object.keys(histogram).forEach((key) => { - switch (key) { - case 'bucketBounds': - case 'counts': - histogram[key] = histogram[key].map(outNumber); - break; - } - }); - } - - return histogram; -} - -export function outLog (log) { - Object.keys(log).forEach((key) => { - switch (key) { - case 'blockNumber': - case 'logIndex': - case 'transactionIndex': - log[key] = outNumber(log[key]); - break; - - case 'address': - log[key] = outAddress(log[key]); - break; - } - }); - - return log; -} - -export function outHwAccountInfo (infos) { - return Object - .keys(infos) - .reduce((ret, _address) => { - const address = outAddress(_address); - - ret[address] = infos[_address]; - - return ret; - }, {}); -} - -export function outNodeKind (info) { - return info; -} - -export function outNumber (number) { - return new BigNumber(number || 0); -} - -export function outPeer (peer) { - const protocols = Object.keys(peer.protocols) - .reduce((obj, key) => { - if (peer.protocols[key]) { - obj[key] = { - ...peer.protocols[key], - difficulty: outNumber(peer.protocols[key].difficulty) - }; - } - - return obj; - }, {}); - - return { - ...peer, - protocols - }; -} - -export function outPeers (peers) { - return { - active: outNumber(peers.active), - connected: outNumber(peers.connected), - max: outNumber(peers.max), - peers: peers.peers.map((peer) => outPeer(peer)) - }; -} - -export function outReceipt (receipt) { - if (receipt) { - Object.keys(receipt).forEach((key) => { - switch (key) { - case 'blockNumber': - case 'cumulativeGasUsed': - case 'gasUsed': - case 'transactionIndex': - receipt[key] = outNumber(receipt[key]); - break; - - case 'contractAddress': - receipt[key] = outAddress(receipt[key]); - break; - } - }); - } - - return receipt; -} - -export function outRecentDapps (recentDapps) { - if (recentDapps) { - Object.keys(recentDapps).forEach((url) => { - recentDapps[url] = outDate(recentDapps[url]); - }); - } - - return recentDapps; -} - -export function outSignerRequest (request) { - if (request) { - Object.keys(request).forEach((key) => { - switch (key) { - case 'id': - request[key] = outNumber(request[key]); - break; - - case 'payload': - request[key].decrypt = outSigningPayload(request[key].decrypt); - request[key].sign = outSigningPayload(request[key].sign); - request[key].signTransaction = outTransaction(request[key].signTransaction); - request[key].sendTransaction = outTransaction(request[key].sendTransaction); - break; - - case 'origin': - const type = Object.keys(request[key])[0]; - const details = request[key][type]; - - request[key] = { type, details }; - break; - } - }); - } - - return request; -} - -export function outSyncing (syncing) { - if (syncing && syncing !== 'false') { - Object.keys(syncing).forEach((key) => { - switch (key) { - case 'currentBlock': - case 'highestBlock': - case 'startingBlock': - case 'warpChunksAmount': - case 'warpChunksProcessed': - syncing[key] = outNumber(syncing[key]); - break; - - case 'blockGap': - syncing[key] = syncing[key] ? syncing[key].map(outNumber) : syncing[key]; - break; - } - }); - } - - return syncing; -} - -export function outTransactionCondition (condition) { - if (condition) { - if (condition.block) { - condition.block = outNumber(condition.block); - } else if (condition.time) { - condition.time = outDate(condition.time); - } - } - - return condition; -} - -export function outTransaction (tx) { - if (tx) { - Object.keys(tx).forEach((key) => { - switch (key) { - case 'blockNumber': - case 'gasPrice': - case 'gas': - case 'nonce': - case 'transactionIndex': - case 'value': - tx[key] = outNumber(tx[key]); - break; - - case 'condition': - tx[key] = outTransactionCondition(tx[key]); - break; - - case 'creates': - case 'from': - case 'to': - tx[key] = outAddress(tx[key]); - break; - } - }); - } - - return tx; -} - -export function outSigningPayload (payload) { - if (payload) { - Object.keys(payload).forEach((key) => { - switch (key) { - case 'address': - payload[key] = outAddress(payload[key]); - break; - } - }); - } - - return payload; -} - -export function outTrace (trace) { - if (trace) { - if (trace.action) { - Object.keys(trace.action).forEach(key => { - switch (key) { - case 'gas': - case 'value': - case 'balance': - trace.action[key] = outNumber(trace.action[key]); - break; - - case 'from': - case 'to': - case 'address': - case 'refundAddress': - trace.action[key] = outAddress(trace.action[key]); - break; - } - }); - } - - if (trace.result) { - Object.keys(trace.result).forEach(key => { - switch (key) { - case 'gasUsed': - trace.result[key] = outNumber(trace.result[key]); - break; - - case 'address': - trace.action[key] = outAddress(trace.action[key]); - break; - } - }); - } - - if (trace.traceAddress) { - trace.traceAddress.forEach((address, index) => { - trace.traceAddress[index] = outNumber(address); - }); - } - - Object.keys(trace).forEach((key) => { - switch (key) { - case 'subtraces': - case 'transactionPosition': - case 'blockNumber': - trace[key] = outNumber(trace[key]); - break; - } - }); - } - - return trace; -} - -export function outTraces (traces) { - if (traces) { - return traces.map(outTrace); - } - - return traces; -} - -export function outTraceReplay (trace) { - if (trace) { - Object.keys(trace).forEach((key) => { - switch (key) { - case 'trace': - trace[key] = outTraces(trace[key]); - break; - } - }); - } - - return trace; -} - -export function outVaultMeta (meta) { - if (isString(meta)) { - try { - const obj = JSON.parse(meta); - - return obj; - } catch (error) { - return {}; - } - } - - return meta || {}; -} diff --git a/js-old/src/api/format/output.spec.js b/js-old/src/api/format/output.spec.js deleted file mode 100644 index 6ffefaedc..000000000 --- a/js-old/src/api/format/output.spec.js +++ /dev/null @@ -1,502 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -import { outBlock, outAccountInfo, outAddress, outChainStatus, outDate, outHistogram, outHwAccountInfo, outNodeKind, outNumber, outPeer, outPeers, outReceipt, outRecentDapps, outSyncing, outTransaction, outTrace, outVaultMeta } from './output'; -import { isAddress, isBigNumber, isInstanceOf } from '../../../test/types'; - -describe('api/format/output', () => { - const address = '0x63cf90d3f0410092fc0fca41846f596223979195'; - const checksum = '0x63Cf90D3f0410092FC0fca41846f596223979195'; - - describe('outAccountInfo', () => { - it('returns meta objects parsed', () => { - expect(outAccountInfo( - { '0x63cf90d3f0410092fc0fca41846f596223979195': { - name: 'name', uuid: 'uuid', meta: '{"name":"456"}' } - } - )).to.deep.equal({ - '0x63Cf90D3f0410092FC0fca41846f596223979195': { - name: 'name', uuid: 'uuid', meta: { name: '456' } - } - }); - }); - - it('returns objects without meta & uuid as required', () => { - expect(outAccountInfo( - { '0x63cf90d3f0410092fc0fca41846f596223979195': { name: 'name' } } - )).to.deep.equal({ - '0x63Cf90D3f0410092FC0fca41846f596223979195': { name: 'name' } - }); - }); - }); - - describe('outAddress', () => { - it('retuns the address as checksummed', () => { - expect(outAddress(address)).to.equal(checksum); - }); - - it('retuns the checksum as checksummed', () => { - expect(outAddress(checksum)).to.equal(checksum); - }); - }); - - describe('outBlock', () => { - ['author', 'miner'].forEach((input) => { - it(`formats ${input} address as address`, () => { - const block = {}; - - block[input] = address; - const formatted = outBlock(block)[input]; - - expect(isAddress(formatted)).to.be.true; - expect(formatted).to.equal(checksum); - }); - }); - - ['difficulty', 'gasLimit', 'gasUsed', 'number', 'nonce', 'totalDifficulty'].forEach((input) => { - it(`formats ${input} number as hexnumber`, () => { - const block = {}; - - block[input] = 0x123; - const formatted = outBlock(block)[input]; - - expect(isInstanceOf(formatted, BigNumber)).to.be.true; - expect(formatted.toString(16)).to.equal('123'); - }); - }); - - ['timestamp'].forEach((input) => { - it(`formats ${input} number as Date`, () => { - const block = {}; - - block[input] = 0x57513668; - const formatted = outBlock(block)[input]; - - expect(isInstanceOf(formatted, Date)).to.be.true; - expect(formatted.getTime()).to.equal(1464940136000); - }); - }); - - it('ignores and passes through unknown keys', () => { - expect(outBlock({ someRandom: 'someRandom' })).to.deep.equal({ someRandom: 'someRandom' }); - }); - - it('formats a block with all the info converted', () => { - expect( - outBlock({ - author: address, - miner: address, - difficulty: '0x100', - gasLimit: '0x101', - gasUsed: '0x102', - number: '0x103', - nonce: '0x104', - totalDifficulty: '0x105', - timestamp: '0x57513668', - extraData: 'someExtraStuffInHere' - }) - ).to.deep.equal({ - author: checksum, - miner: checksum, - difficulty: new BigNumber('0x100'), - gasLimit: new BigNumber('0x101'), - gasUsed: new BigNumber('0x102'), - number: new BigNumber('0x103'), - nonce: new BigNumber('0x104'), - totalDifficulty: new BigNumber('0x105'), - timestamp: new Date('2016-06-03T07:48:56.000Z'), - extraData: 'someExtraStuffInHere' - }); - }); - }); - - describe('outChainStatus', () => { - it('formats blockGap values', () => { - const status = { - blockGap: [0x1234, '0x5678'] - }; - - expect(outChainStatus(status)).to.deep.equal({ - blockGap: [new BigNumber(0x1234), new BigNumber(0x5678)] - }); - }); - - it('handles null blockGap values', () => { - const status = { - blockGap: null - }; - - expect(outChainStatus(status)).to.deep.equal(status); - }); - }); - - describe('outDate', () => { - it('converts a second date in unix timestamp', () => { - expect(outDate(0x57513668)).to.deep.equal(new Date('2016-06-03T07:48:56.000Z')); - }); - }); - - describe('outHistogram', () => { - ['bucketBounds', 'counts'].forEach((type) => { - it(`formats ${type} as number arrays`, () => { - expect( - outHistogram({ [type]: [0x123, 0x456, 0x789] }) - ).to.deep.equal({ - [type]: [new BigNumber(0x123), new BigNumber(0x456), new BigNumber(0x789)] - }); - }); - }); - }); - - describe('outHwAccountInfo', () => { - it('returns objects with formatted addresses', () => { - expect(outHwAccountInfo( - { '0x63cf90d3f0410092fc0fca41846f596223979195': { manufacturer: 'mfg', name: 'type' } } - )).to.deep.equal({ - '0x63Cf90D3f0410092FC0fca41846f596223979195': { manufacturer: 'mfg', name: 'type' } - }); - }); - }); - - describe('outNodeKind', () => { - it('formats the input as received', () => { - const kind = { availability: 'personal', capability: 'full' }; - - expect(outNodeKind(kind)).to.deep.equal(kind); - }); - }); - - describe('outNumber', () => { - it('returns a BigNumber equalling the value', () => { - const bn = outNumber('0x123456'); - - expect(isBigNumber(bn)).to.be.true; - expect(bn.eq(0x123456)).to.be.true; - }); - - it('assumes 0 when ivalid input', () => { - expect(outNumber().eq(0)).to.be.true; - }); - }); - - describe('outPeer', () => { - it('converts all internal numbers to BigNumbers', () => { - expect(outPeer({ - caps: ['par/1'], - id: '0x01', - name: 'Parity', - network: { - localAddress: '10.0.0.1', - remoteAddress: '10.0.0.1' - }, - protocols: { - par: { - difficulty: '0x0f', - head: '0x02', - version: 63 - } - } - })).to.deep.equal({ - caps: ['par/1'], - id: '0x01', - name: 'Parity', - network: { - localAddress: '10.0.0.1', - remoteAddress: '10.0.0.1' - }, - protocols: { - par: { - difficulty: new BigNumber(15), - head: '0x02', - version: 63 - } - } - }); - }); - - it('does not output null protocols', () => { - expect(outPeer({ - caps: ['par/1'], - id: '0x01', - name: 'Parity', - network: { - localAddress: '10.0.0.1', - remoteAddress: '10.0.0.1' - }, - protocols: { - les: null - } - })).to.deep.equal({ - caps: ['par/1'], - id: '0x01', - name: 'Parity', - network: { - localAddress: '10.0.0.1', - remoteAddress: '10.0.0.1' - }, - protocols: {} - }); - }); - }); - - describe('outPeers', () => { - it('converts all internal numbers to BigNumbers', () => { - expect(outPeers({ - active: 789, - connected: '456', - max: 0x7b, - peers: [ - { - caps: ['par/1'], - id: '0x01', - name: 'Parity', - network: { - localAddress: '10.0.0.1', - remoteAddress: '10.0.0.1' - }, - protocols: { - par: { - difficulty: '0x0f', - head: '0x02', - version: 63 - }, - les: null - } - } - ] - })).to.deep.equal({ - active: new BigNumber(789), - connected: new BigNumber(456), - max: new BigNumber(123), - peers: [ - { - caps: ['par/1'], - id: '0x01', - name: 'Parity', - network: { - localAddress: '10.0.0.1', - remoteAddress: '10.0.0.1' - }, - protocols: { - par: { - difficulty: new BigNumber(15), - head: '0x02', - version: 63 - } - } - } - ] - }); - }); - }); - - describe('outReceipt', () => { - ['contractAddress'].forEach((input) => { - it(`formats ${input} address as address`, () => { - const block = {}; - - block[input] = address; - const formatted = outReceipt(block)[input]; - - expect(isAddress(formatted)).to.be.true; - expect(formatted).to.equal(checksum); - }); - }); - - ['blockNumber', 'cumulativeGasUsed', 'cumulativeGasUsed', 'gasUsed', 'transactionIndex'].forEach((input) => { - it(`formats ${input} number as hexnumber`, () => { - const block = {}; - - block[input] = 0x123; - const formatted = outReceipt(block)[input]; - - expect(isInstanceOf(formatted, BigNumber)).to.be.true; - expect(formatted.toString(16)).to.equal('123'); - }); - }); - - it('ignores and passes through unknown keys', () => { - expect(outReceipt({ someRandom: 'someRandom' })).to.deep.equal({ someRandom: 'someRandom' }); - }); - - it('formats a receipt with all the info converted', () => { - expect( - outReceipt({ - contractAddress: address, - blockNumber: '0x100', - cumulativeGasUsed: '0x101', - gasUsed: '0x102', - transactionIndex: '0x103', - extraData: 'someExtraStuffInHere' - }) - ).to.deep.equal({ - contractAddress: checksum, - blockNumber: new BigNumber('0x100'), - cumulativeGasUsed: new BigNumber('0x101'), - gasUsed: new BigNumber('0x102'), - transactionIndex: new BigNumber('0x103'), - extraData: 'someExtraStuffInHere' - }); - }); - }); - - describe('outRecentDapps', () => { - it('formats the URLs with timestamps', () => { - expect(outRecentDapps({ testing: 0x57513668 })).to.deep.equal({ - testing: new Date('2016-06-03T07:48:56.000Z') - }); - }); - }); - - describe('outSyncing', () => { - ['currentBlock', 'highestBlock', 'startingBlock', 'warpChunksAmount', 'warpChunksProcessed'].forEach((input) => { - it(`formats ${input} numbers as a number`, () => { - expect(outSyncing({ [input]: '0x123' })).to.deep.equal({ - [input]: new BigNumber('0x123') - }); - }); - }); - - it('formats blockGap properly', () => { - expect(outSyncing({ blockGap: [0x123, 0x456] })).to.deep.equal({ - blockGap: [new BigNumber(0x123), new BigNumber(0x456)] - }); - }); - }); - - describe('outTransaction', () => { - ['from', 'to'].forEach((input) => { - it(`formats ${input} address as address`, () => { - const block = {}; - - block[input] = address; - const formatted = outTransaction(block)[input]; - - expect(isAddress(formatted)).to.be.true; - expect(formatted).to.equal(checksum); - }); - }); - - ['blockNumber', 'gasPrice', 'gas', 'nonce', 'transactionIndex', 'value'].forEach((input) => { - it(`formats ${input} number as hexnumber`, () => { - const block = {}; - - block[input] = 0x123; - const formatted = outTransaction(block)[input]; - - expect(isInstanceOf(formatted, BigNumber)).to.be.true; - expect(formatted.toString(16)).to.equal('123'); - }); - }); - - it('passes condition as null when null', () => { - expect(outTransaction({ condition: null })).to.deep.equal({ condition: null }); - }); - - it('ignores and passes through unknown keys', () => { - expect(outTransaction({ someRandom: 'someRandom' })).to.deep.equal({ someRandom: 'someRandom' }); - }); - - it('formats a transaction with all the info converted', () => { - expect( - outTransaction({ - from: address, - to: address, - blockNumber: '0x100', - gasPrice: '0x101', - gas: '0x102', - nonce: '0x103', - transactionIndex: '0x104', - value: '0x105', - extraData: 'someExtraStuffInHere' - }) - ).to.deep.equal({ - from: checksum, - to: checksum, - blockNumber: new BigNumber('0x100'), - gasPrice: new BigNumber('0x101'), - gas: new BigNumber('0x102'), - nonce: new BigNumber('0x103'), - transactionIndex: new BigNumber('0x104'), - value: new BigNumber('0x105'), - extraData: 'someExtraStuffInHere' - }); - }); - }); - - describe('outTrace', () => { - it('ignores and passes through unknown keys', () => { - expect(outTrace({ someRandom: 'someRandom' })).to.deep.equal({ someRandom: 'someRandom' }); - }); - - it('formats a trace with all the info converted', () => { - const formatted = outTrace({ - type: 'call', - action: { - from: address, - to: address, - value: '0x06', - gas: '0x07', - input: '0x1234', - callType: 'call' - }, - result: { - gasUsed: '0x08', - output: '0x5678' - }, - traceAddress: [ '0x2' ], - subtraces: 3, - transactionPosition: '0xb', - transactionHash: '0x000000000000000000000000000000000000000000000000000000000000000c', - blockNumber: '0x0d', - blockHash: '0x000000000000000000000000000000000000000000000000000000000000000e' - }); - - expect(isBigNumber(formatted.action.gas)).to.be.true; - expect(formatted.action.gas.toNumber()).to.equal(7); - expect(isBigNumber(formatted.action.value)).to.be.true; - expect(formatted.action.value.toNumber()).to.equal(6); - - expect(formatted.action.from).to.equal(checksum); - expect(formatted.action.to).to.equal(checksum); - - expect(isBigNumber(formatted.blockNumber)).to.be.true; - expect(formatted.blockNumber.toNumber()).to.equal(13); - expect(isBigNumber(formatted.transactionPosition)).to.be.true; - expect(formatted.transactionPosition.toNumber()).to.equal(11); - }); - }); - - describe('outVaultMeta', () => { - it('returns an exmpt object on null', () => { - expect(outVaultMeta(null)).to.deep.equal({}); - }); - - it('returns the original value if not string', () => { - expect(outVaultMeta({ test: 123 })).to.deep.equal({ test: 123 }); - }); - - it('returns an object from JSON string', () => { - expect(outVaultMeta('{"test":123}')).to.deep.equal({ test: 123 }); - }); - - it('returns an empty object on invalid JSON', () => { - expect(outVaultMeta('{"test"}')).to.deep.equal({}); - }); - }); -}); diff --git a/js-old/src/api/index.js b/js-old/src/api/index.js deleted file mode 100644 index 978d98fec..000000000 --- a/js-old/src/api/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './api'; diff --git a/js-old/src/api/local/accounts/account.js b/js-old/src/api/local/accounts/account.js deleted file mode 100644 index 224a05cd9..000000000 --- a/js-old/src/api/local/accounts/account.js +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { createKeyObject, decryptPrivateKey } from '../ethkey'; - -export default class Account { - constructor (persist, data = {}) { - const { - keyObject = null, - meta = {}, - name = '' - } = data; - - this._persist = persist; - this._keyObject = keyObject; - this._name = name; - this._meta = meta; - } - - isValidPassword (password) { - if (!this._keyObject) { - return false; - } - - return decryptPrivateKey(this._keyObject, password) - .then((privateKey) => { - if (!privateKey) { - return false; - } - - return true; - }); - } - - export () { - const exported = Object.assign({}, this._keyObject); - - exported.meta = JSON.stringify(this._meta); - exported.name = this._name; - - return exported; - } - - get address () { - return `0x${this._keyObject.address.toLowerCase()}`; - } - - get name () { - return this._name; - } - - set name (name) { - this._name = name; - - this._persist(); - } - - get meta () { - return JSON.stringify(this._meta); - } - - set meta (meta) { - this._meta = JSON.parse(meta); - - this._persist(); - } - - get uuid () { - if (!this._keyObject) { - return null; - } - - return this._keyObject.id; - } - - decryptPrivateKey (password) { - return decryptPrivateKey(this._keyObject, password); - } - - changePassword (key, password) { - return createKeyObject(key, password).then((keyObject) => { - this._keyObject = keyObject; - - this._persist(); - }); - } - - static fromPrivateKey (persist, key, password) { - return createKeyObject(key, password).then((keyObject) => { - const account = new Account(persist, { keyObject }); - - return account; - }); - } - - toJSON () { - return { - keyObject: this._keyObject, - name: this._name, - meta: this._meta - }; - } -} diff --git a/js-old/src/api/local/accounts/accounts.js b/js-old/src/api/local/accounts/accounts.js deleted file mode 100644 index d11ea2bad..000000000 --- a/js-old/src/api/local/accounts/accounts.js +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Account from './account'; -import localStore from 'store'; -import { debounce } from 'lodash'; -import { decryptPrivateKey } from '../ethkey'; - -const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; -const LS_STORE_KEY = '_parity::localAccounts'; - -export default class Accounts { - persist = debounce(() => { - this._lastState = JSON.stringify(this); - - localStore.set(LS_STORE_KEY, this); - }, 100); - - constructor (data = localStore.get(LS_STORE_KEY) || {}) { - this._lastState = JSON.stringify(data); - - window.addEventListener('storage', ({ key, newValue }) => { - if (key !== LS_STORE_KEY) { - return; - } - - if (newValue !== this._lastState) { - console.log('Data changed in a second tab, syncing state'); - - this.restore(JSON.parse(newValue)); - } - }); - - this.restore(data); - } - - restore (data) { - const { - last = NULL_ADDRESS, - dappsDefault = NULL_ADDRESS, - store = {} - } = data; - - this._last = last; - this._dappsDefaultAddress = dappsDefault; - this._store = {}; - - if (Array.isArray(store)) { - // Recover older version that stored accounts as an array - store.forEach((data) => { - const account = new Account(this.persist, data); - - this._store[account.address] = account; - }); - } else { - Object.keys(store).forEach((key) => { - this._store[key] = new Account(this.persist, store[key]); - }); - } - } - - _addAccount = (account) => { - const { address } = account; - - if (address in this._store && this._store[address].uuid) { - throw new Error(`Account ${address} already exists!`); - } - - this._store[address] = account; - this.lastAddress = address; - - this.persist(); - - return account.address; - } - - create (secret, password) { - const privateKey = Buffer.from(secret.slice(2), 'hex'); - - return Account - .fromPrivateKey(this.persist, privateKey, password) - .then(this._addAccount); - } - - restoreFromWallet (wallet, password) { - return decryptPrivateKey(wallet, password) - .then((privateKey) => { - if (!privateKey) { - throw new Error('Invalid password'); - } - - return Account.fromPrivateKey(this.persist, privateKey, password); - }) - .then(this._addAccount); - } - - set lastAddress (value) { - this._last = value.toLowerCase(); - } - - get lastAddress () { - return this._last; - } - - get dappsDefaultAddress () { - if (this._dappsDefaultAddress === NULL_ADDRESS) { - return this._last; - } - - if (this._dappsDefaultAddress in this._store) { - return this._dappsDefaultAddress; - } - - return NULL_ADDRESS; - } - - set dappsDefaultAddress (value) { - this._dappsDefaultAddress = value.toLowerCase(); - - this.persist(); - } - - get (address) { - address = address.toLowerCase(); - - const account = this._store[address]; - - if (!account) { - throw new Error(`Account not found: ${address}`); - } - - this.lastAddress = address; - - return account; - } - - getLazyCreate (address) { - address = address.toLowerCase(); - - this.lastAddress = address; - - if (!(address in this._store)) { - this._store[address] = new Account(this.persist); - } - - return this._store[address]; - } - - remove (address, password) { - address = address.toLowerCase(); - - const account = this.get(address); - - if (!account) { - return false; - } - - if (!account.uuid) { - this.removeUnsafe(address); - - return true; - } - - return account - .isValidPassword(password) - .then((isValid) => { - if (!isValid) { - return false; - } - - if (address === this.lastAddress) { - this.lastAddress = NULL_ADDRESS; - } - - this.removeUnsafe(address); - - return true; - }); - } - - removeUnsafe (address) { - address = address.toLowerCase(); - - delete this._store[address]; - - this.persist(); - } - - allAddresses () { - return Object.keys(this._store); - } - - accountAddresses () { - return Object - .keys(this._store) - .filter((address) => this._store[address].uuid); - } - - map (mapper) { - const result = {}; - - Object.keys(this._store).forEach((key) => { - result[key] = mapper(this._store[key]); - }); - - return result; - } - - toJSON () { - return { - last: this._last, - dappsDefault: this._dappsDefaultAddress, - store: this._store - }; - } -} diff --git a/js-old/src/api/local/accounts/index.js b/js-old/src/api/local/accounts/index.js deleted file mode 100644 index 800cf95f6..000000000 --- a/js-old/src/api/local/accounts/index.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Accounts from './accounts'; - -const accounts = new Accounts(); - -export default accounts; diff --git a/js-old/src/api/local/ethkey/ethkey.js b/js-old/src/api/local/ethkey/ethkey.js deleted file mode 100644 index f8395b007..000000000 --- a/js-old/src/api/local/ethkey/ethkey.js +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -/* global WebAssembly */ - -import wasmBuffer from './ethkey.wasm.js'; - -const NOOP = () => {}; - -// WASM memory setup -const WASM_PAGE_SIZE = 65536; -const STATIC_BASE = 1024; -const STATICTOP = STATIC_BASE + WASM_PAGE_SIZE * 2; -const STACK_BASE = align(STATICTOP + 16); -const STACKTOP = STACK_BASE; -const TOTAL_STACK = 5 * 1024 * 1024; -const TOTAL_MEMORY = 16777216; -const STACK_MAX = STACK_BASE + TOTAL_STACK; -const DYNAMIC_BASE = STACK_MAX + 64; -const DYNAMICTOP_PTR = STACK_MAX; - -function mockWebAssembly () { - function throwWasmError () { - throw new Error('Missing WebAssembly support'); - } - - // Simple mock replacement - return { - Memory: class { buffer = new ArrayBuffer(2048) }, - Table: class {}, - Module: class {}, - Instance: class { - exports = { - '_input_ptr': () => 0, - '_secret_ptr': () => 0, - '_public_ptr': () => 0, - '_address_ptr': () => 0, - '_ecpointg': NOOP, - '_brain': throwWasmError, - '_verify_secret': throwWasmError - } - } - }; -} - -const { Memory, Table, Module, Instance } = typeof WebAssembly !== 'undefined' ? WebAssembly : mockWebAssembly(); - -const wasmMemory = new Memory({ - initial: TOTAL_MEMORY / WASM_PAGE_SIZE, - maximum: TOTAL_MEMORY / WASM_PAGE_SIZE -}); - -const wasmTable = new Table({ - initial: 8, - maximum: 8, - element: 'anyfunc' -}); - -// TypedArray views into the memory -const wasmMemoryU8 = new Uint8Array(wasmMemory.buffer); -const wasmMemoryU32 = new Uint32Array(wasmMemory.buffer); - -// Keep DYNAMIC_BASE in memory -wasmMemoryU32[DYNAMICTOP_PTR >> 2] = align(DYNAMIC_BASE); - -function align (mem) { - const ALIGN_SIZE = 16; - - return (Math.ceil(mem / ALIGN_SIZE) * ALIGN_SIZE) | 0; -} - -export function slice (ptr, len) { - return wasmMemoryU8.subarray(ptr, ptr + len); -} - -// Required by emscripten -function abort (what) { - throw new Error(what || 'WASM abort'); -} - -// Required by emscripten -function abortOnCannotGrowMemory () { - abort(`Cannot enlarge memory arrays.`); -} - -// Required by emscripten -function enlargeMemory () { - abortOnCannotGrowMemory(); -} - -// Required by emscripten -function getTotalMemory () { - return TOTAL_MEMORY; -} - -// Required by emscripten - used to perform memcpy on large data -function memcpy (dest, src, len) { - wasmMemoryU8.set(wasmMemoryU8.subarray(src, src + len), dest); - - return dest; -} - -// Synchronously compile WASM from the buffer -const module = new Module(wasmBuffer); - -// Instantiated WASM module -const instance = new Instance(module, { - global: {}, - env: { - DYNAMICTOP_PTR, - STACKTOP, - STACK_MAX, - abort, - enlargeMemory, - getTotalMemory, - abortOnCannotGrowMemory, - ___lock: NOOP, - ___syscall6: () => 0, - ___setErrNo: (no) => no, - _abort: abort, - ___syscall140: () => 0, - _emscripten_memcpy_big: memcpy, - ___syscall54: () => 0, - ___unlock: NOOP, - _llvm_trap: abort, - ___syscall146: () => 0, - 'memory': wasmMemory, - 'table': wasmTable, - tableBase: 0, - memoryBase: STATIC_BASE - } -}); - -export const extern = instance.exports; diff --git a/js-old/src/api/local/ethkey/ethkey.wasm.js b/js-old/src/api/local/ethkey/ethkey.wasm.js deleted file mode 100644 index d426f0e0c..000000000 --- a/js-old/src/api/local/ethkey/ethkey.wasm.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = new Buffer('AGFzbQEAAAABOgpgA39/fwF/YAF/AX9gAn9/AX9gAX8AYAABf2AAAGACf38AYAR/f39/AGADf39/AGAGf39/f39/AX8CyQELA2VudghTVEFDS1RPUAN/AANlbnYFYWJvcnQAAwNlbnYLX19fc3lzY2FsbDYAAgNlbnYNX19fc3lzY2FsbDE0MAACA2VudhZfZW1zY3JpcHRlbl9tZW1jcHlfYmlnAAADZW52DF9fX3N5c2NhbGw1NAACA2VudgpfbGx2bV90cmFwAAUDZW52DV9fX3N5c2NhbGwxNDYAAgNlbnYGbWVtb3J5AgGAAoACA2VudgV0YWJsZQFwAQgIA2Vudgl0YWJsZUJhc2UDfwADOjkEBAQEBAQDBwMICAgIAwYGBgIIAwMDBgMDCAYGBgMCBwYIAgICBgkDBgEAAAEEBAQAAQAAAQABAAIGBgF/ASMACwdfBw5fdmVyaWZ5X3NlY3JldAAMC19wdWJsaWNfcHRyAAoLX3NlY3JldF9wdHIACQpfaW5wdXRfcHRyAAgJX2VjcG9pbnRnAAcGX2JyYWluAA0MX2FkZHJlc3NfcHRyAAsJDgEAIwELCD0wPjEyNz8rCpClAzlJAQJ/An8jAiEAIwJB0JgBaiQCQagZKAIAQQFGBEAgACQCQawZDwsgACIBEB9BqBlBATYCAEGsGSABQdCYARA8GiAAJAJBrBkLCwYAQbi2AQsGAEG4vgELBgBB2L4BCwYAQZi/AQsKAEG4vgFBIBAlC74HAQt/AkAjAiEIIwJBoJwBaiQCIABBgAhLBEAgAEGACBAnCyAIQaACaiEFQagZKAIAQQFHBEAgBRAfQagZQQE2AgBBrBkgBUHQmAEQPBoLIAghCSAIQcgAaiIEEBQgCEH4mwFqIgFCADcAACABQgA3AAggAUIANwAQIAFCADcAGCAEQbi2ASAAEBAgBSAEQdgBEDwaIAUgAUEgEBIgCEHwmgFqIgMgASkAADcAACADIAEpAAg3AAggAyABKQAQNwAQIAMgASkAGDcAGCAIQZCbAWoiBkEBaiEHIAhB2JsBaiICQQxqIQpBACEAA0AgBBAUIAFCADcAACABQgA3AAggAUIANwAQIAFCADcAGCAEIANBIBAQIAUgBEHYARA8GiAFIAFBIBASIAIgASkAADcAACACIAEpAAg3AAggAiABKQAQNwAQIAIgASkAGDcAGCADIAIpAAA3AAAgAyACKQAINwAIIAMgAikAEDcAECADIAIpABg3ABggAEEBaiELIABBgYABRwRAIAshAAwBCwsgCUEBaiEAA0ACQCAJQawZIANBIBAmIAksAABBAUYEQCAGIAApAAA3AAAgBiAAKQAINwAIIAYgACkAEDcAECAGIAApABg3ABggBiAAKQAgNwAgIAYgACkAKDcAKCAGIAApADA3ADAgBiAAKQA4NwA4IAYgACwAQDoAQCAEEBQgAUIANwAAIAFCADcACCABQgA3ABAgAUIANwAYIAQgB0HAABAQIAUgBEHYARA8GiAFIAFBIBASIAIgASkAADcAACACIAEpAAg3AAggAiABKQAQNwAQIAIgASkAGDcAGEGYvwEgCikAADcAAEGgvwEgCikACDcAAEGovwEgCigAEDYAAEGYvwEsAABFDQELIAQQFCABQgA3AAAgAUIANwAIIAFCADcAECABQgA3ABggBCADQSAQECAFIARB2AEQPBogBSABQSAQEiACIAEpAAA3AAAgAiABKQAINwAIIAIgASkAEDcAECACIAEpABg3ABggAyACKQAANwAAIAMgAikACDcACCADIAIpABA3ABAgAyACKQAYNwAYDAELC0HYvgEgBykAADcAAEHgvgEgBykACDcAAEHovgEgBykAEDcAAEHwvgEgBykAGDcAAEH4vgEgBykAIDcAAEGAvwEgBykAKDcAAEGIvwEgBykAMDcAAEGQvwEgBykAODcAAEG4vgEgAykAADcAAEHAvgEgAykACDcAAEHIvgEgAykAEDcAAEHQvgEgAykAGDcAACAIJAILCwQAEAUL1wsCGX8tfgJAIAApAwAhJCAAQShqIgIpAwAhJSAAQdAAaiIDKQMAITAgAEH4AGoiBCkDACE+IABBoAFqIgUpAwAhJiAAQQhqIgYpAwAhMSAAQTBqIgcpAwAhMiAAQdgAaiIIKQMAIScgAEGAAWoiCSkDACEgIABBqAFqIgopAwAhPyAAQRBqIgspAwAhMyAAQThqIgwpAwAhHSAAQeAAaiINKQMAISEgAEGIAWoiDikDACE0IABBsAFqIg8pAwAhHiAAQRhqIhApAwAhNSAAQcAAaiIRKQMAISggAEHoAGoiEikDACE2IABBkAFqIhMpAwAhGyAAQbgBaiIUKQMAISIgAEEgaiIVKQMAITcgAEHIAGoiFikDACE4IABB8ABqIhcpAwAhHCAAQZgBaiIYKQMAISMgAEHAAWoiGSkDACEaQQAhAQNAICQgGiAjIBwgOCA3hYWFhSIphSA/ICAgJyAyIDGFhYWFIipCAYYgKkI/iIQiOYUhQCAxICYgPiAwICUgJIWFhYUiK4UgHiA0ICEgHSAzhYWFhSIsQgGGICxCP4iEIjqFIUEgMyAqhSAiIBsgNiAoIDWFhYWFIi1CAYYgLUI/iIQiO4UhQiA1ICyFIClCAYYgKUI/iIQiPIUhLiA3IC2FICtCAYYgK0I/iIQiPYUhQyAbICyFIDyFIhtCFYYgG0IriIQiHyAhICqFIDuFIhtCK4YgG0IViIQiREJ/hYMgMiArhSA6hSIbQiyGIBtCFIiEIiSFITEgGiAthSA9hSIaQg6GIBpCMoiEIhogH0J/hYMgRIUhMyBAIBpCf4WDIB+FITUgJCBAQn+FgyAahSE3IDAgKYUgOYUiGkIDhiAaQj2IhCIvIDggLYUgPYUiGkIUhiAaQiyIhCIhQn+FgyAuQhyGIC5CJIiEIh+FIUUgICArhSA6hSIaQi2GIBpCE4iEIhsgL0J/hYMgIYUhMiAeICqFIDuFIhpCPYYgGkIDiIQiGiAbQn+FgyAvhSFGIB8gGkJ/hYMgG4UhLiAhIB9Cf4WDIBqFITggNiAshSA8hSIaQhmGIBpCJ4iEIiAgHSAqhSA7hSIaQgaGIBpCOoiEIhtCf4WDIEFCAYYgQUI/iIQiHYUhMCAjIC2FID2FIhpCCIYgGkI4iIQiHiAgQn+FgyAbhSEvICYgKYUgOYUiGkIShiAaQi6IhCIaIB5Cf4WDICCFISEgHSAaQn+FgyAehSE2IBsgHUJ/hYMgGoUhHyAnICuFIDqFIhpCCoYgGkI2iIQiGyAlICmFIDmFIhpCJIYgGkIciIQiI0J/hYMgQ0IbhiBDQiWIhCIdhSEnIDQgKoUgO4UiGkIPhiAaQjGIhCIeIBtCf4WDICOFISAgIiAshSA8hSIaQjiGIBpCCIiEIhogHkJ/hYMgG4UhNCAdIBpCf4WDIB6FIRsgIyAdQn+FgyAahSEjIBwgLYUgPYUiHEInhiAcQhmIhCIiICggLIUgPIUiHEI3hiAcQgmIhCIlQn+FgyBCQj6GIEJCAoiEIiaFIR0gPiAphSA5hSIcQimGIBxCF4iEIhogIkJ/hYMgJYUhHiA/ICuFIDqFIhxCAoYgHEI+iIQiHCAaQn+FgyAihSEoICYgHEJ/hYMgGoUhIiAlICZCf4WDIByFIRogRCAkQn+FgyBAhSABQQN0QYAIaikDAIUhHCABQQFqIgFBGEcEQCAcISQgRSElICchPiAdISYgLyEnIB4hPyBGIR0gKCEeIC4hKCAfIRwMAQsLIAAgHDcDACACIEU3AwAgAyAwNwMAIAQgJzcDACAFIB03AwAgBiAxNwMAIAcgMjcDACAIIC83AwAgCSAgNwMAIAogHjcDACALIDM3AwAgDCBGNwMAIA0gITcDACAOIDQ3AwAgDyAoNwMAIBAgNTcDACARIC43AwAgEiA2NwMAIBMgGzcDACAUICI3AwAgFSA3NwMAIBYgODcDACAXIB83AwAgGCAjNwMAIBkgGjcDAAsLCgAgACABIAIQEQu9AwEPfwJAIABByAFqIgooAgAiA0HIAUsEQCADQcgBEC8LIAAgA2ohC0HIASADayEEAkAgAEHMAWoiECgCACADayIFIAJLBEAgBCEMIAshDSADIQ9BACEIIAIhBgUgBCEJQQAhByACIQ4gBSEEAkACQAJAA0AgBCAJSw0BIAcgAksNAiABIAdqIREgBCACIAdrIgNNBH8gBAUgAwsiCQRAIAshA0EAIQUDQCADIAMsAAAgESAFaiwAAHM6AAAgCyAFQQFqIgVqIQMgBSAJSQ0ACwsgABAPIAQgB2ohAyAQKAIAIQUgCkEANgIAIA4gBGsiDiAFSQRAQcgBIQwgACENQQAhDyADIQggDiEGDAYFQcgBIQkgACELIAMhByAFIQQMAQsACwALIAQgCRAnDAELIAcgAhAvCwsLIAYgDEsEQCAGIAwQJwsgCCACSwRAIAggAhAvCyAGIAIgCGsiAE0EfyAGBSAACyIEBEAgDSEAQQAhAgUgCiAPIAZqNgIADwsgASAIaiEBA0AgACAALAAAIAEgAmosAABzOgAAIA0gAkEBaiICaiEAIAIgBEkNAAsgCiAKKAIAIAZqNgIACwuSAQEDfwJAIwIhBCMCQeABaiQCIAQiAyAAQdgBEDwaIAMoAsgBIgBByAFPBEBB3AogAEHIARAoCyADKALMASEFIAMgAGoiACAALAAAIAMsANABczoAACAFQX9qIgBByAFJBEAgAyAAaiIAIAAsAABBgH9zOgAAIAMQDyADIAEgAhATIAQkAgVB0AogAEHIARAoCwsLygEBB38CQAJAIAAoAswBIgNByAFLBEAgAyACSwRAIAEhCCACIQYFIANByAEQJwsFIAIhBEEAIQUCQAJAAkACQANAIAEgBWohCSACIAVrIQcgBCADSQ0DIAMgB0sNAiAJIAAgAxA8GiAAEA8gBCADayEEIAUgA2oiBSACTQ0ADAELAAsgBSACEC8MAgsgAyAHECcMAQsgBCAHTQRAIAkhCCAEIQYMAwsgBCAHECcLCwsgBkHIAUsEQCAGQcgBECcFIAggACAGEDwaCwsLIAACQCAAQQBBzAEQOhogAEGIATYCzAEgAEEBOgDQAQsLgQUCCH8DfgJAIwIhBSMCQdAAaiQCIAUhAiAAQcQAaiIDLAAAIgcgASwAREcEQCAHBEAgA0EAOgAAIAAgARAWIAMgAywAAEEBczoAAAUgAiABKQIANwIAIAIgASkCCDcCCCACIAEpAhA3AhAgAiABKQIYNwIYIAIgASkCIDcCICACIAEpAig3AiggAiABKQIwNwIwIAIgASkCODcCOCACIAEpAkA3AkAgAkEAOgBEIAAgAhAWCyAAKAIABEAgBSQCDwsgACgCBARAIAUkAg8LIANBADoAACAFJAIPCwJAIAEoAgAiAyAAKAIAIgJLBEACQAJAA0AgAkEQTw0CIABBBGogAkECdGpBADYCACACQQFqIgIgA0kNAAwBCwALIAAgAzYCAEIAIQtBACEEDAILQcgLIAJBEBAoBSADBEBCACELQQAhBAUgBSQCDwsLCwJAAkADQCAEQRBPDQEgAEEEaiAEQQJ0aiICKAIArSALfCABQQRqIARBAnRqKAIArXwhCiACIAo+AgAgCkIgiCEKIARBAWoiBiADSQRAIAohCyAGIQQMAQsLDAELQdQLIARBEBAoCyAKQgBSIgQgBiAAKAIAIgFJcQRAIAYhAQJAAkADQCABQRBPDQEgAEEEaiABQQJ0aiICKAIArSAKfCEKIAIgCj4CACAKQiCIIgxCAFIiCCABQQFqIgEgACgCACIJSXEEQCAMIQoMAQsLDAELQeALIAFBEBAoCyAMpyECIAgEQCAJIQEFIAUkAg8LBSAKpyECIARFBEAgBSQCDwsLIAFBEE8EQEHsCyABQRAQKAsgAEEEaiABQQJ0aiACNgIAIAAgACgCAEEBajYCACAFJAILC+YHAg1/An4CQCMCIQUjAkHQAGokAiAFIQIgAEHEAGoiBiwAACIDIAEsAERHBEAgAwRAIAZBADoAACAAIAEQFSAGQQE6AAAFIAIgASkCADcCACACIAEpAgg3AgggAiABKQIQNwIQIAIgASkCGDcCGCACIAEpAiA3AiAgAiABKQIoNwIoIAIgASkCMDcCMCACIAEpAjg3AjggAiABKQJANwJAIAJBADoARCAAIAIQFQsgACgCAARAIAUkAg8LIAAoAgQEQCAFJAIPCyAGQQA6AAAgBSQCDwsgACgCACIHQRBLBEAgB0EQECcLIAEoAgAiCEEQSwRAIAhBEBAnCyAAQQRqIQsCQAJAIAcgCEYEQCAAIAFHBEAgCyABQQRqIAdBAnQQOQRAIAchAwJAAkACQANAIANBf2ohCSADRQ0IIAlBEE8NASABQQRqIAlBAnRqKAIAIgMgAEEEaiAJQQJ0aigCACIORw0CIAkhAwwACwALQbwLIAlBEBAoDAELIAMgDkkNBQwECwsLIABBATYCACAGQQA6AAAgC0EANgIAIAUkAg8FIAggB08NAQsMAQsgAiAAKQIANwIAIAIgACkCCDcCCCACIAApAhA3AhAgAiAAKQIYNwIYIAIgACkCIDcCICACIAApAig3AiggAiAAKQIwNwIwIAIgACkCODcCOCACIAApAkA3AkAgACABKQIANwIAIAAgASkCCDcCCCAAIAEpAhA3AhAgACABKQIYNwIYIAAgASkCIDcCICAAIAEpAig3AiggACABKQIwNwIwIAAgASkCODcCOCAAIAEpAkA3AkAgACACEBYgBkEBOgAAIAUkAg8LAkAgCAR/QgAhD0EAIQMCQAJAA0AgA0EQTw0BIABBBGogA0ECdGoiBCgCAK0gAUEEaiADQQJ0aigCAK19IA98Ig9CIIchECAEIA8+AgAgA0EBaiIEIAhJBEAgECEPIAQhAwwBCwsMAQtB+AsgA0EQECgLAkAgEEIAUiAEIAAoAgAiAUlxBEADQCAEQRBJBEAgAEEEaiAEQQJ0aiIBKAIArSAQfCIPQiCHIRAgASAPPgIAIBBCAFIgBEEBaiIEIAAoAgAiAUlxDQEgASEMIAQhCgwDCwtBhAwgBEEQECgFIAEhDCAEIQoLCyAKIAxLBH8gACAKNgIAIAoFIAwLBSAHCyIBQQFLBEACQAJAA0AgAUF/aiIBQRBPDQIgAEEEaiABQQJ0aigCAA0BIAAgATYCACABQQFLDQAgASENDAQLAAsgBSQCDwtBsAsgAUEQECgFIAEhDQsLIA0gCygCAHIEQCAFJAIPCyAGQQA6AAAgBSQCCwv1GwIofwN+AkAjAiEgIwJB0ABqJAIgACgCACIKQQhGIAEoAgAiA0EIRnEEQCAAQQRqIg0oAgAiDkH//wNxIQQgAEEIaiIPKAIAIhBB//8DcSEIIABBDGoiESgCACISQf//A3EhBSAAQRBqIhMoAgAiFEH//wNxIQkgAEEUaiIVKAIAIhZB//8DcSEGIABBGGoiFygCACIYQf//A3EhAiAAQRxqIhkoAgAiGkH//wNxIQcgAEEgaiIbKAIAIiFB//8DcSELIAEoAgQiIkH//wNxIQMgASgCCCIjQf//A3EhCiABKAIMIiRB//8DcSEMIAEoAhAiJUH//wNxIRwgASgCFCImQf//A3EhHSABKAIYIidB//8DcSEeIAEoAhwiKEH//wNxIR8gASgCICIpQf//A3EhASANICJBEHYiDSAEbK0gAyAOQRB2Ig5srXwiKkIQhkKAgPz/D4MgAyAEbK18Iis+AgAgDyANIA5srSADIAhsrXwgCiAEbK18ICpCEIh8ICtCIIh8IA0gCGytIAMgEEEQdiIPbK18ICNBEHYiECAEbK18IAogDmytfCIqQhCGQoCA/P8Pg3wiKz4CACARIA0gD2ytIAMgBWytfCAKIAhsrXwgECAObK18IAwgBGytfCAqQhCIfCANIAVsrSADIBJBEHYiEWytfCAQIAhsrXwgCiAPbK18ICRBEHYiEiAEbK18IAwgDmytfCIqQhCGQoCA/P8Pg3wgK0IgiHwiKz4CACATIA0gEWytIAMgCWytfCAKIAVsrXwgECAPbK18IAwgCGytfCASIA5srXwgHCAEbK18ICpCEIh8IA0gCWytIAMgFEEQdiITbK18IBAgBWytfCAKIBFsrXwgEiAIbK18IAwgD2ytfCAlQRB2IhQgBGytfCAcIA5srXwiKkIQhkKAgPz/D4N8ICtCIIh8Iis+AgAgFSANIBNsrSADIAZsrXwgCiAJbK18IBAgEWytfCAMIAVsrXwgEiAPbK18IBwgCGytfCAUIA5srXwgHSAEbK18ICpCEIh8IA0gBmytIAMgFkEQdiIVbK18IBAgCWytfCAKIBNsrXwgEiAFbK18IAwgEWytfCAUIAhsrXwgHCAPbK18ICZBEHYiFiAEbK18IB0gDmytfCIqQhCGQoCA/P8Pg3wgK0IgiHwiKz4CACAXIA0gFWytIAMgAmytfCAKIAZsrXwgECATbK18IAwgCWytfCASIBFsrXwgHCAFbK18IBQgD2ytfCAdIAhsrXwgFiAObK18IB4gBGytfCAqQhCIfCANIAJsrSADIBhBEHYiF2ytfCAQIAZsrXwgCiAVbK18IBIgCWytfCAMIBNsrXwgFCAFbK18IBwgEWytfCAWIAhsrXwgHSAPbK18ICdBEHYiGCAEbK18IB4gDmytfCIqQhCGQoCA/P8Pg3wgK0IgiHwiKz4CACAZIA0gF2ytIAMgB2ytfCAKIAJsrXwgECAVbK18IAwgBmytfCASIBNsrXwgHCAJbK18IBQgEWytfCAdIAVsrXwgFiAPbK18IB4gCGytfCAYIA5srXwgHyAEbK18ICpCEIh8IA0gB2ytIAMgGkEQdiIZbK18IBAgAmytfCAKIBdsrXwgEiAGbK18IAwgFWytfCAUIAlsrXwgHCATbK18IBYgBWytfCAdIBFsrXwgGCAIbK18IB4gD2ytfCAoQRB2IhogBGytfCAfIA5srXwiKkIQhkKAgPz/D4N8ICtCIIh8Iis+AgAgGyANIBlsrSADIAtsrXwgCiAHbK18IBAgF2ytfCAMIAJsrXwgEiAVbK18IBwgBmytfCAUIBNsrXwgHSAJbK18IBYgEWytfCAeIAVsrXwgGCAPbK18IB8gCGytfCAaIA5srXwgASAEbK18ICpCEIh8IA0gC2ytIAMgIUEQdiIDbK18IBAgB2ytfCAKIBlsrXwgEiACbK18IAwgF2ytfCAUIAZsrXwgHCAVbK18IBYgCWytfCAdIBNsrXwgGCAFbK18IB4gEWytfCAaIAhsrXwgHyAPbK18IClBEHYiGyAEbK18IAEgDmytfCIqQhCGQoCA/P8Pg3wgK0IgiHwiKz4CACAAIAogC2ytIA0gA2ytfCAQIBlsrXwgDCAHbK18IBIgF2ytfCAcIAJsrXwgFCAVbK18IB0gBmytfCAWIBNsrXwgHiAJbK18IBggEWytfCAfIAVsrXwgGiAPbK18IAEgCGytfCAbIA5srXwgKkIQiHwgECALbK0gCiADbK18IBIgB2ytfCAMIBlsrXwgFCACbK18IBwgF2ytfCAWIAZsrXwgHSAVbK18IBggCWytfCAeIBNsrXwgGiAFbK18IB8gEWytfCAbIAhsrXwgASAPbK18IipCEIZCgID8/w+DfCArQiCIfCIrPgIkIAAgDCALbK0gECADbK18IBIgGWytfCAcIAdsrXwgFCAXbK18IB0gAmytfCAWIBVsrXwgHiAGbK18IBggE2ytfCAfIAlsrXwgGiARbK18IAEgBWytfCAbIA9srXwgKkIQiHwgEiALbK0gDCADbK18IBQgB2ytfCAcIBlsrXwgFiACbK18IB0gF2ytfCAYIAZsrXwgHiAVbK18IBogCWytfCAfIBNsrXwgGyAFbK18IAEgEWytfCIqQhCGQoCA/P8Pg3wgK0IgiHwiKz4CKCAAIBwgC2ytIBIgA2ytfCAUIBlsrXwgHSAHbK18IBYgF2ytfCAeIAJsrXwgGCAVbK18IB8gBmytfCAaIBNsrXwgASAJbK18IBsgEWytfCAqQhCIfCAUIAtsrSAcIANsrXwgFiAHbK18IB0gGWytfCAYIAJsrXwgHiAXbK18IBogBmytfCAfIBVsrXwgGyAJbK18IAEgE2ytfCIqQhCGQoCA/P8Pg3wgK0IgiHwiKz4CLCAAIB0gC2ytIBQgA2ytfCAWIBlsrXwgHiAHbK18IBggF2ytfCAfIAJsrXwgGiAVbK18IAEgBmytfCAbIBNsrXwgKkIQiHwgFiALbK0gHSADbK18IBggB2ytfCAeIBlsrXwgGiACbK18IB8gF2ytfCAbIAZsrXwgASAVbK18IipCEIZCgID8/w+DfCArQiCIfCIrPgIwIAAgHiALbK0gFiADbK18IBggGWytfCAfIAdsrXwgGiAXbK18IAEgAmytfCAbIBVsrXwgKkIQiHwgGCALbK0gHiADbK18IBogB2ytfCAfIBlsrXwgGyACbK18IAEgF2ytfCIqQhCGQoCA/P8Pg3wgK0IgiHwiKz4CNCAAIB8gC2ytIBggA2ytfCAaIBlsrXwgASAHbK18IBsgF2ytfCAqQhCIfCAaIAtsrSAfIANsrXwgGyAHbK18IAEgGWytfCIqQhCGQoCA/P8Pg3wgK0IgiHwiKz4COCAAIBsgGWytIBogA2ytfCABIAtsrXwgKkIQiHwgGyALbK0gASADbK18IipCEIZCgID8/w+DfCArQiCIfCIrPgI8IABBDzYCACAqQhCIIBsgA2ytfCArQiCIfCIqQgBRBEAgICQCDwsgACAqPgJAIABBEDYCACAgJAIPCyAgIQIgA0EBRgRAIAEoAgQhCCACIAApAgA3AgAgAiAAKQIINwIIIAIgACkCEDcCECACIAApAhg3AhggAiAAKQIgNwIgIAIgACkCKDcCKCACIAApAjA3AjAgAiAAKQI4NwI4IAIgACkCQDcCQCACKAIAIgFBEEsEQCABQRAQJwsgAkEEaiABQQJ0aiEEIAEEQCAIrSErQgAhKiACQQRqIQADQCAAIAAoAgCtICt+IixC/////w+DICp8Iio+AgAgKkIgiCAsQiCIfCEqIABBBGoiACAERw0ACyAqQgBSBEAgAUEQSQRAIAQgKj4CACACIAFBAWo2AgAFQZwMIAFBEBAoCwsLICAkAg8LIAJBADoARCACIApBf2ogA2oiBzYCACACQQhqIgRCADcCACAEQgA3AgggBEIANwIQIARCADcCGCAEQgA3AiAgBEIANwIoIARCADcCMCAEQQA2AjggAiABKAIErSAAKAIErX4iKj4CBCAqQiCIISoCQCAHQQFLBEBBAiEEQQEhBgJAAkACQAJAA0AgKkIgiCEsICqnIQkgBkEBaiILIAprIQUgBiAKSwR/IAUFQQAiBQsgAyAGSwR/IAsFIAMiCwtJBEAgLCEqA0AgBiAFayIMQRBPDQMgBUEQTw0EIAFBBGogBUECdGooAgCtIABBBGogDEECdGooAgCtfiAJrXwiLEIgiCAqfCEqICynIQkgBUEBaiIFIAtJDQALBSAsISoLIAZBEE8NAyACQQRqIAZBAnRqIAk2AgAgBEEBaiEJIAQgB0kEQCAEIQUgCSEEIAUhBgwBBSAqISsMBwsACwALQagMIAxBEBAoDAILQbQMIAVBEBAoDAELQcAMIAZBEBAoCwUgKiErCwsgK0IAUQRAIAchCAUgB0EQSQRAIAJBBGogB0ECdGogKz4CACACIAogA2oiCDYCAAVBzAwgB0EQECgLCyAIQQFLBEAgCCEBAkACQAJAA0AgAUF/aiIEQRBPDQEgAkEEaiAEQQJ0aigCAA0CIARBAUsEQCAEIQEMAQUgBCEBDAMLAAsAC0GwCyAEQRAQKAwBCyACIAE2AgALCyAAIAIpAgA3AgAgACACKQIINwIIIAAgAikCEDcCECAAIAIpAhg3AhggACACKQIgNwIgIAAgAikCKDcCKCAAIAIpAjA3AjAgACACKQI4NwI4IAAgAikCQDcCQCAgJAILCyQAIAEEfyAAQYCAgIB4RiABQX9GcQR/QQAFIAAgAW0LBUEACwv5CQIOfwZ+AkAjAiEJIwJB0ARqJAIgCSIIQQBBhAQQOhpBASACQQFqQRh0QRh1QR9xdCIFQQIQGCEOIAlBiARqIgMgASkCADcCACADIAEpAgg3AgggAyABKQIQNwIQIAMgASkCGDcCGCADIAEpAiA3AiAgAyABKQIoNwIoIAMgASkCMDcCMCADIAEpAjg3AjggAyABKQJANwJAIAMoAgAiAUEBRyADQQRqIgcoAgAiBEEAR3JFBEAgACAIQYQEEDwaIAkkAg8LIAVBf2ohECAIQYAEaiEFIAJB/wFxIg9BP3GtIRNBICAPa0E/ca0hFCABIQIDQAJAAkACQCAEaCIBBEAgBSAFKAIAIAFqNgIAIAJBEEsEQEEGIQEMBAtBICABayEEIAIEQCABrSEVIARBP3GtIRZCACERIANBBGogAkECdGohAQNAIAFBfGoiASgCAK0hEiABIBIgFYggEYQ+AgAgEiAWhiERIAEgB0cNAAsgAygCACIBQQFNDQMgAUF/aiINQRBPBEBBDCEBDAULIANBBGogDUECdGooAgAEQCABIQIFIAMgDTYCACANIQEMBAsFQQAhAgsFIAUoAgAiCkGABEkhBiAEIBBxIgEgDkwEQCAGRQRAQSUhAQwFCyAIIApqIAE6AAAgBSAFKAIAIgZBAWo2AgAgByAEIAFrIgE2AgAgAUEARyACQQFHckUEQEEBIQEMBAsgBSAPIAZqNgIAIAJBEEsEQEEqIQEMBQsgAkUEQEEAIQIMAwtCACERIANBBGogAkECdGohAQNAIAFBfGoiASgCAK0hEiABIBIgE4ggEYQ+AgAgEiAUhiERIAEgB0cNAAsgAygCACIBQQFNDQMgAUF/aiILQRBPBEBBMCEBDAULIANBBGogC0ECdGooAgAEQCABIQIMAwsgAyALNgIAIAshAQwDCyAGRQRAQREhAQwECyAIIApqIA4gAWs6AAAgBSAFKAIAQQFqNgIAIAJBEEsEQEETIQEMBAsgA0EEaiACQQJ0aiEGIAEgDmutIREgByEBAkACQAJAA0AgASAGRg0BIAFBBGohBCABIAEoAgCtIBF8IhE+AgAgEUIgiCIRQgBRDQIgBCEBDAALAAsgAkEQTwRAQRkhAQwGCyAGIBE+AgAgAyACQQFqIgE2AgAMAQsgAkEQSwRAQRshAQwFCyACBEAgAiEBBUEAIQIMAwsLQQAhBCADQQRqIAFBAnRqIQEDQCABQXxqIgEoAgAhBiABIAZBAXYgBHI2AgAgBkEfdCEEIAEgB0cNAAsgAygCACIBQQFNDQIgAUF/aiIMQRBPBEBBISEBDAQLIANBBGogDEECdGooAgAEQCABIQIFIAMgDDYCACAMIQEMAwsLCyAHKAIAIQQMAgsgAUEBRyAHKAIAIgRyBEAgASECDAIFQQMhAQsLCwJAAkACQAJAAkACQAJAAkACQAJAAkACQCABQQNrDi4ACwsBCwsLCwsCCwsLCwMLBAsLCwsLBQsGCwsLCwsHCwsLCAsLCwsJCwsLCwsKCwsgACAIQYQEEDwaIAkkAg8LIAJBEBAnDAkLQbALIA1BEBAoDAgLQawNIApBgAQQKAwHCyACQRAQJwwGC0GQDCACQRAQKAwFCyACQRAQJwwEC0GwCyAMQRAQKAwDC0GsDSAKQYAEECgMAgsgAkEQECcMAQtBsAsgC0EQECgLCwuhAgIFfwF+AkAgACgCACIBQRBLBEAgAUEQECcLIAFFBEAPCyAAQQRqIAFBAnRqIQNCACEGIABBBGohAQNAIAEgASgCAK1CAYYgBnwiBj4CACAGQiCIIQYgAUEEaiIBIANHDQALIAAoAgAhASAGQgBRBEAgASECBSABQRBJBEAgAEEEaiABQQJ0aiAGPgIAIAAgACgCAEEBaiICNgIABUGgDSABQRAQKAsLAkAgAkEIRgRAQQghAgJAAkADQCACQX9qIQEgAkUNBCABQRBPDQEgAEEEaiABQQJ0aigCACIEIAFBAnRBxAlqKAIAIgVGBEAgASECDAELCwwBC0G8CyABQRAQKAsgBCAFSQRADwsFIAJBCEkEQA8LCwsgAEHACRAWCwukBQEHfwJAIwIhBCMCQZABaiQCIAQhASAAKAIAIgJBCUkEQCABQdgMKQIANwIAIAFB4AwpAgA3AgggAUHoDCkCADcCECABQfAMKQIANwIYIAFB+AwpAgA3AiAgAUGADSkCADcCKCABQYgNKQIANwIwIAFBkA0pAgA3AjggAUGYDSkCADcCQAUgAEEINgIAIAEgAkF4ajYCACABQQRqIgIgAEEkaiIDKQIANwIAIAIgAykCCDcCCCACIAMpAhA3AhAgAiADKQIYNwIYIAFBJGoiAkIANwIAIAJCADcCCCACQgA3AhAgAkIANwIYIAJBADoAIAsgBEHIAGohAiABEBwgACABEBUgACgCACIBQQhLBEAgAEEINgIAIAIgAUF4ajYCACACQQRqIgEgAEEkaiIDKQIANwIAIAEgAykCCDcCCCABIAMpAhA3AhAgASADKQIYNwIYIAJBJGoiAUIANwIAIAFCADcCCCABQgA3AhAgAUIANwIYIAFBADoAICACEBwgACACEBUgACgCACEBCyABQQhGBEBBCCEDA0ACQCADQX9qIQIgA0UEQEEUIQMMAQsgAkEQTwRAQQshAwwBCyAAQQRqIAJBAnRqKAIAIgYgAkECdEHECWooAgAiB0YEQCACIQMMAgVBDCEDCwsLIANBC0YEQEG8CyACQRAQKAUgA0EMRgRAIAYgB0khBQUgA0EURgRAIAQkAg8LCwsFIAFBCEkhBQsgBUUEQCAAQcAJEBYgBCQCDwsgAUEBTQRAIAQkAg8LA0ACQCABQX9qIgFBEE8EQEERIQMMAQsgAEEEaiABQQJ0aigCAARAQRQhAwwBCyAAIAE2AgAgAUEBSw0BQRQhAwsLIANBEUYEQEGwCyABQRAQKAUgA0EURgRAIAQkAgsLCwuQAgICfwJ+AkAgACgCACIBQRBPBEBBxA0gAUEQECgLIABBBGogAUECdGpBADYCACAAKAIAQQFqIgFBEE8EQEG4DSABQRAQKAsgAEEEaiABQQJ0akEANgIAIAAgACgCAEECaiICNgIAIAJBEEsEQCACQRAQJwsgAEEEaiEBIAIEQEIAIQMFDwsgAEEEaiACQQJ0aiECA0AgASABKAIArSIEQtEHfiADfCIDPgIAIANCIIggBHwhAyABQQRqIgEgAkcNAAsgACgCACIBQQFNBEAPCwJAAkADQCABQX9qIgFBEE8NASAAQQRqIAFBAnRqKAIADQIgACABNgIAIAFBAUsNAAwCCwALQbALIAFBEBAoCwsL0BACD38EfgJAIwIhByMCQfACaiQCIAciAyABKQIANwIAIAMgASkCCDcCCCADIAEpAhA3AhAgAyABKQIYNwIYIAMgASkCIDcCICADIAEpAig3AiggAyABKQIwNwIwIAMgASkCODcCOCADIAEpAkA3AkAgB0HIAGoiBkHACSkDADcDACAGQcgJKQMANwMIIAZB0AkpAwA3AxAgBkHYCSkDADcDGCAGQeAJKQMANwMgIAZB6AkpAwA3AyggBkHwCSkDADcDMCAGQfgJKQMANwM4IAZBgAopAwA3A0AgB0GQAWoiBEGICikDADcDACAEQZAKKQMANwMIIARBmAopAwA3AxAgBEGgCikDADcDGCAEQagKKQMANwMgIARBsAopAwA3AyggBEG4CikDADcDMCAEQcAKKQMANwM4IARByAopAwA3A0AgB0HYAWoiBUHYDCkCADcCACAFQeAMKQIANwIIIAVB6AwpAgA3AhAgBUHwDCkCADcCGCAFQfgMKQIANwIgIAVBgA0pAgA3AiggBUGIDSkCADcCMCAFQZANKQIANwI4IAVBmA0pAgA3AkACQCADQQRqIgsoAgAiASADKAIAIgJyQQFLBEAgBkEEaiEMIAVBBGohDyAEQQRqIRACQAJAAkACQAJAAkACQAJAAkACQANAIAFoIggEQCACQRBLDQJBICAIayEBIAIEfyAIrSETIAFBP3GtIRRCACERIANBBGogAkECdGohAQNAIAFBfGoiASgCAK0hEiABIBIgE4ggEYQ+AgAgEiAUhiERIAEgC0cNAAsgAygCACIBQQFLBH8gAUF/aiIBQRBPDQUgA0EEaiABQQJ0aigCAAR/QQEFIAMgATYCAEEBCwVBAQsFQQELIQEDQCAQKAIAQQFxBEAgBEHACRAVCyAEKAIAIgJBEEsNBSACBEBBACEJIARBBGogAkECdGohAgNAIAJBfGoiAigCACEKIAIgCkEBdiAJcjYCACAKQR90IQkgAiAQRw0ACyAEKAIAIgJBAUsEQCACQX9qIgJBEE8NCCAEQQRqIAJBAnRqKAIARQRAIAQgAjYCAAsLCyABQQFqIQIgASAISQRAIAIhAQwBCwsLIAwoAgBoIggEQCAGKAIAIgFBEEsNBkEgIAhrIQIgAQR/IAitIRMgAkE/ca0hFEIAIREgBkEEaiABQQJ0aiEBA0AgAUF8aiIBKAIArSESIAEgEiATiCARhD4CACASIBSGIREgASAMRw0ACyAGKAIAIgFBAUsEfyABQX9qIgFBEE8NCSAGQQRqIAFBAnRqKAIABH9BAQUgBiABNgIAQQELBUEBCwVBAQshAQNAIA8oAgBBAXEEQCAFQcAJEBULIAUoAgAiAkEQSw0JIAIEQEEAIQkgBUEEaiACQQJ0aiECA0AgAkF8aiICKAIAIQogAiAKQQF2IAlyNgIAIApBH3QhCSACIA9HDQALIAUoAgAiAkEBSwRAIAJBf2oiAkEQTw0MIAVBBGogAkECdGooAgBFBEAgBSACNgIACwsLIAFBAWohAiABIAhJBEAgAiEBDAELCwsCQAJAAkAgAygCACIBIAYoAgAiAkYEQANAIAFBf2ohAiABRQ0CIAJBEE8NDiADQQRqIAJBAnRqKAIAIgEgBkEEaiACQQJ0aigCACIJRgRAIAIhAQwBCwsgASAJSQ0CBSABIAJJDQILCyADIAYQFiAEIAUQFgwBCyAGIAMQFiAFIAQQFgsgCygCACIBIAMoAgAiAnJBAU0EQCACIQ0gASEODA0LIAwoAgAgBigCAHJBAUsNACACIQ0gASEODAwLAAsgAkEQECcMCAtBsAsgAUEQECgMBwsgAkEQECcMBgtBsAsgAkEQECgMBQsgAUEQECcMBAtBsAsgAUEQECgMAwsgAkEQECcMAgtBsAsgAkEQECgMAQtBvAsgAkEQECgLBSACIQ0gASEOCwsgDUEBRiAOQQFGcQRAIAMgBCkDADcDACADIAQpAwg3AwggAyAEKQMQNwMQIAMgBCkDGDcDGCADIAQpAyA3AyAgAyAEKQMoNwMoIAMgBCkDMDcDMCADIAQpAzg3AzggAyAEKQNANwNABSADIAUpAwA3AwAgAyAFKQMINwMIIAMgBSkDEDcDECADIAUpAxg3AxggAyAFKQMgNwMgIAMgBSkDKDcDKCADIAUpAzA3AzAgAyAFKQM4NwM4IAMgBSkDQDcDQAsgB0GgAmohASADQcQAaiICLAAABEAgA0HACRAVIAIsAAAEQCACQQA6AAAgAxAbIAMoAgBBAUYgCygCAEVxBEAgAEHYDCkCADcCACAAQeAMKQIANwIIIABB6AwpAgA3AhAgAEHwDCkCADcCGCAAQfgMKQIANwIgIABBgA0pAgA3AiggAEGIDSkCADcCMCAAQZANKQIANwI4IABBmA0pAgA3AkAgByQCDwUgAUHACSkDADcDACABQcgJKQMANwMIIAFB0AkpAwA3AxAgAUHYCSkDADcDGCABQeAJKQMANwMgIAFB6AkpAwA3AyggAUHwCSkDADcDMCABQfgJKQMANwM4IAFBgAopAwA3A0AgASADEBYgACABKQIANwIAIAAgASkCCDcCCCAAIAEpAhA3AhAgACABKQIYNwIYIAAgASkCIDcCICAAIAEpAig3AiggACABKQIwNwIwIAAgASkCODcCOCAAIAEpAkA3AkAgByQCDwsACwsgAxAbIAAgAykCADcCACAAIAMpAgg3AgggACADKQIQNwIQIAAgAykCGDcCGCAAIAMpAiA3AiAgACADKQIoNwIoIAAgAykCMDcCMCAAIAMpAjg3AjggACADKQJANwJAIAckAgsLzx8BD38CQCMCIQwjAkGABWokAiAAQZABaiIELAAABEAgDCQCDwsgDCELIAxBuARqIgIgAEHIAGoiCikCADcCACACIAopAgg3AgggAiAKKQIQNwIQIAIgCikCGDcCGCACIAopAiA3AiAgAiAKKQIoNwIoIAIgCikCMDcCMCACIAopAjg3AjggAiAKKQJANwJAIAIgChAVIAxB8ANqIgEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAAkACQCABKAIAIgNBCEYEQEEIIQcCQAJAAkADQCAHQX9qIQMgB0UNBSADQRBPDQEgAUEEaiADQQJ0aigCACIHIANBAnRBxAlqKAIAIgVHDQIgAyEHDAALAAtBvAsgA0EQECgMAQsgByAFTw0CQQghDQsFIANBCE8NASADIQ0LDAELIAFBwAkQFiABKAIAIQ0LIAEoAgQhDiALIAFBCGoiAykCADcCACALIAMpAgg3AgggCyADKQIQNwIQIAsgAykCGDcCGCALIAMpAiA3AiAgCyADKQIoNwIoIAsgAykCMDcCMCALIAMpAjg3AjggDUEBRiAORXEEQCAEQQE6AAAgDCQCDwsgDEGoA2ohCCAMQeACaiEEIAxBmAJqIQUgDEGIAWohBiACIAApAgA3AgAgAiAAKQIINwIIIAIgACkCEDcCECACIAApAhg3AhggAiAAKQIgNwIgIAIgACkCKDcCKCACIAApAjA3AjAgAiAAKQI4NwI4IAIgACkCQDcCQCACIAAQFyABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABEBsgDEHAAGoiCSABKQMANwMAIAkgASkDCDcDCCAJIAEpAxA3AxAgCSABKQMYNwMYIAkgASkDIDcDICAJIAEpAyg3AyggCSABKQMwNwMwIAkgASkDODcDOCAJIAEpA0A3A0AgAiAJKQMANwMAIAIgCSkDCDcDCCACIAkpAxA3AxAgAiAJKQMYNwMYIAIgCSkDIDcDICACIAkpAyg3AyggAiAJKQMwNwMwIAIgCSkDODcDOCACIAkpA0A3A0AgAiAJEBUgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0ACQAJAIAEoAgAiA0EIRgRAQQghBwJAAkACQANAIAdBf2ohAyAHRQ0FIANBEE8NASABQQRqIANBAnRqKAIAIgcgA0ECdEHECWooAgAiD0cNAiADIQcMAAsAC0G8CyADQRAQKAwBCyAHIA9PDQILBSADQQhPDQELDAELIAFBwAkQFgsgBCABKQMANwMAIAQgASkDCDcDCCAEIAEpAxA3AxAgBCABKQMYNwMYIAQgASkDIDcDICAEIAEpAyg3AyggBCABKQMwNwMwIAQgASkDODcDOCAEIAEpA0A3A0AgAiAEKQMANwMAIAIgBCkDCDcDCCACIAQpAxA3AxAgAiAEKQMYNwMYIAIgBCkDIDcDICACIAQpAyg3AyggAiAEKQMwNwMwIAIgBCkDODcDOCACIAQpA0A3A0AgAiAJEBUgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0ACQAJAIAEoAgAiA0EIRgRAQQghBwJAAkACQANAIAdBf2ohAyAHRQ0FIANBEE8NASABQQRqIANBAnRqKAIAIgcgA0ECdEHECWooAgAiCUcNAiADIQcMAAsAC0G8CyADQRAQKAwBCyAHIAlPDQILBSADQQhPDQELDAELIAFBwAkQFgsgBSABKQMANwMAIAUgASkDCDcDCCAFIAEpAxA3AxAgBSABKQMYNwMYIAUgASkDIDcDICAFIAEpAyg3AyggBSABKQMwNwMwIAUgASkDODcDOCAFIAEpA0A3A0AgAiANNgIAIAIgDjYCBCACQQhqIgMgCykDADcDACADIAspAwg3AwggAyALKQMQNwMQIAMgCykDGDcDGCADIAspAyA3AyAgAyALKQMoNwMoIAMgCykDMDcDMCADIAspAzg3AzggCCACEB0gAiAFKQMANwMAIAIgBSkDCDcDCCACIAUpAxA3AxAgAiAFKQMYNwMYIAIgBSkDIDcDICACIAUpAyg3AyggAiAFKQMwNwMwIAIgBSkDODcDOCACIAUpA0A3A0AgAiAIEBcgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgARAbIAYgASkDADcDACAGIAEpAwg3AwggBiABKQMQNwMQIAYgASkDGDcDGCAGIAEpAyA3AyAgBiABKQMoNwMoIAYgASkDMDcDMCAGIAEpAzg3AzggBiABKQNANwNAIAIgBikDADcDACACIAYpAwg3AwggAiAGKQMQNwMQIAIgBikDGDcDGCACIAYpAyA3AyAgAiAGKQMoNwMoIAIgBikDMDcDMCACIAYpAzg3AzggAiAGKQNANwNAIAIgBhAXIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAIAEQGyAEIAEpAwA3AwAgBCABKQMINwMIIAQgASkDEDcDECAEIAEpAxg3AxggBCABKQMgNwMgIAQgASkDKDcDKCAEIAEpAzA3AzAgBCABKQM4NwM4IAQgASkDQDcDQCACIAApAgA3AgAgAiAAKQIINwIIIAIgACkCEDcCECACIAApAhg3AhggAiAAKQIgNwIgIAIgACkCKDcCKCACIAApAjA3AjAgAiAAKQI4NwI4IAIgACkCQDcCQCACIAAQFSABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQAJAAkAgASgCACIDQQhGBEBBCCEHAkACQAJAA0AgB0F/aiEDIAdFDQUgA0EQTw0BIAFBBGogA0ECdGooAgAiByADQQJ0QcQJaigCACILRw0CIAMhBwwACwALQbwLIANBEBAoDAELIAcgC08NAgsFIANBCE8NAQsMAQsgAUHACRAWCyAIIAEpAwA3AwAgCCABKQMINwMIIAggASkDEDcDECAIIAEpAxg3AxggCCABKQMgNwMgIAggASkDKDcDKCAIIAEpAzA3AzAgCCABKQM4NwM4IAggASkDQDcDQCACIAQpAwA3AwAgAiAEKQMINwMIIAIgBCkDEDcDECACIAQpAxg3AxggAiAEKQMgNwMgIAIgBCkDKDcDKCACIAQpAzA3AzAgAiAEKQM4NwM4IAIgBCkDQDcDQCACIAgQFiABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABLABEBEAgAUHACRAVCyAMQdABaiIDIAEpAwA3AwAgAyABKQMINwMIIAMgASkDEDcDECADIAEpAxg3AxggAyABKQMgNwMgIAMgASkDKDcDKCADIAEpAzA3AzAgAyABKQM4NwM4IAMgASkDQDcDQCACIAApAgA3AgAgAiAAKQIINwIIIAIgACkCEDcCECACIAApAhg3AhggAiAAKQIgNwIgIAIgACkCKDcCKCACIAApAjA3AjAgAiAAKQI4NwI4IAIgACkCQDcCQCACIAMQFiABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABLABEBEAgAUHACRAVCyAIIAEpAwA3AwAgCCABKQMINwMIIAggASkDEDcDECAIIAEpAxg3AxggCCABKQMgNwMgIAggASkDKDcDKCAIIAEpAzA3AzAgCCABKQM4NwM4IAggASkDQDcDQCACIAYpAwA3AwAgAiAGKQMINwMIIAIgBikDEDcDECACIAYpAxg3AxggAiAGKQMgNwMgIAIgBikDKDcDKCACIAYpAzA3AzAgAiAGKQM4NwM4IAIgBikDQDcDQCACIAgQFyABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABEBsgBCABKQMANwMAIAQgASkDCDcDCCAEIAEpAxA3AxAgBCABKQMYNwMYIAQgASkDIDcDICAEIAEpAyg3AyggBCABKQMwNwMwIAQgASkDODcDOCAEIAEpA0A3A0AgAiAEKQMANwMAIAIgBCkDCDcDCCACIAQpAxA3AxAgAiAEKQMYNwMYIAIgBCkDIDcDICACIAQpAyg3AyggAiAEKQMwNwMwIAIgBCkDODcDOCACIAQpA0A3A0AgAiAKEBYgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgASwARARAIAFBwAkQFQsgBSABKQMANwMAIAUgASkDCDcDCCAFIAEpAxA3AxAgBSABKQMYNwMYIAUgASkDIDcDICAFIAEpAyg3AyggBSABKQMwNwMwIAUgASkDODcDOCAFIAEpA0A3A0AgCiAFKQIANwIAIAogBSkCCDcCCCAKIAUpAhA3AhAgCiAFKQIYNwIYIAogBSkCIDcCICAKIAUpAig3AiggCiAFKQIwNwIwIAogBSkCODcCOCAKIAUpAkA3AkAgACADKQIANwIAIAAgAykCCDcCCCAAIAMpAhA3AhAgACADKQIYNwIYIAAgAykCIDcCICAAIAMpAig3AiggACADKQIwNwIwIAAgAykCODcCOCAAIAMpAkA3AkAgDCQCCwvCFgETfwJAIwIhCSMCQfC1AmokAiAJQZC0AmohAyAJQcizAmohBSAJQbiyAmohByAJQey1AmohCyAJIgRBCDYCACAEQZiv4LcBNgIEIARB24LKzwU2AgggBEHZ0bjuAjYCDCAEQdv57xQ2AhAgBEGHlpz0fDYCFCAEQZXFga0FNgIYIARBrPfyTjYCHCAEQf7M+c0HNgIgIARBJGoiBkIANwIAIAZCADcCCCAGQgA3AhAgBkIANwIYIAZBADoAICAEQQg2AkggBEHMAGoiD0G4qcNYNgIAIARBj6Gf4nk2AlAgBEGZqJW0ejYCVCAEQcjo3mg2AlggBEGokcTwADYCXCAEQfz3k+0FNgJgIARB5YiPtQI2AmQgBEH3tOvBBDYCaCAEQewAaiIGQgA3AgAgBkIANwIIIAZCADcCECAGQgA3AhggBkEAOgAgIARBkAFqIhBBADoAACAJQdi0AmoiASAEQZQBEDwaIAlB6JkBaiICIARBlAEQPBogAkGUAWogAUGUARA8GiACQagCaiABQZQBEDwaIAJBvANqIAFBlAEQPBogAkHQBGogAUGUARA8GiACQeQFaiABQZQBEDwaIAJB+AZqIAFBlAEQPBogAkGMCGogAUGUARA8GiACQaAJaiABQZQBEDwaIAJBtApqIAFBlAEQPBogAkHIC2ogAUGUARA8GiACQdwMaiABQZQBEDwaIAJB8A1qIAFBlAEQPBogAkGED2ogAUGUARA8GiACQZgQaiABQZQBEDwaIAJBrBFqIAFBlAEQPBogAkHAEmogAUGUARA8GiACQdQTaiABQZQBEDwaIAJB6BRqIAFBlAEQPBogAkH8FWogAUGUARA8GiACQZAXaiABQZQBEDwaIAJBpBhqIAFBlAEQPBogAkG4GWogAUGUARA8GiACQcwaaiABQZQBEDwaIAJB4BtqIAFBlAEQPBogAkH0HGogAUGUARA8GiACQYgeaiABQZQBEDwaIAJBnB9qIAFBlAEQPBogAkGwIGogAUGUARA8GiACQcQhaiABQZQBEDwaIAJB2CJqIAFBlAEQPBogAkHsI2ogAUGUARA8GiACQYAlaiABQZQBEDwaIAJBlCZqIAFBlAEQPBogAkGoJ2ogAUGUARA8GiACQbwoaiABQZQBEDwaIAJB0ClqIAFBlAEQPBogAkHkKmogAUGUARA8GiACQfgraiABQZQBEDwaIAJBjC1qIAFBlAEQPBogAkGgLmogAUGUARA8GiACQbQvaiABQZQBEDwaIAJByDBqIAFBlAEQPBogAkHcMWogAUGUARA8GiACQfAyaiABQZQBEDwaIAJBhDRqIAFBlAEQPBogAkGYNWogAUGUARA8GiACQaw2aiABQZQBEDwaIAJBwDdqIAFBlAEQPBogAkHUOGogAUGUARA8GiACQeg5aiABQZQBEDwaIAJB/DpqIAFBlAEQPBogAkGQPGogAUGUARA8GiACQaQ9aiABQZQBEDwaIAJBuD5qIAFBlAEQPBogAkHMP2ogAUGUARA8GiACQeDAAGogAUGUARA8GiACQfTBAGogAUGUARA8GiACQYjDAGogAUGUARA8GiACQZzEAGogAUGUARA8GiACQbDFAGogAUGUARA8GiACQcTGAGogAUGUARA8GiACQdjHAGogAUGUARA8GiACQezIAGogAUGUARA8GiACQYDKAGogAUGUARA8GiACQZTLAGogAUGUARA8GiAQLAAABH8gByAEQZABEDwaIAsgBEGRAWoiBi4AADsAACALIAYsAAI6AAJBAQUgBSAEKQMANwMAIAUgBCkDCDcDCCAFIAQpAxA3AxAgBSAEKQMYNwMYIAUgBCkDIDcDICAFIAQpAyg3AyggBSAEKQMwNwMwIAUgBCkDODcDOCAFIAQpA0A3A0AgBEHIAGoiBigCAEEBRiAPKAIARXEEQCADQdgMKQIANwIAIANB4AwpAgA3AgggA0HoDCkCADcCECADQfAMKQIANwIYIANB+AwpAgA3AiAgA0GADSkCADcCKCADQYgNKQIANwIwIANBkA0pAgA3AjggA0GYDSkCADcCQAUgAUHACSkDADcDACABQcgJKQMANwMIIAFB0AkpAwA3AxAgAUHYCSkDADcDGCABQeAJKQMANwMgIAFB6AkpAwA3AyggAUHwCSkDADcDMCABQfgJKQMANwM4IAFBgAopAwA3A0AgASAGEBYgAyABKQMANwMAIAMgASkDCDcDCCADIAEpAxA3AxAgAyABKQMYNwMYIAMgASkDIDcDICADIAEpAyg3AyggAyABKQMwNwMwIAMgASkDODcDOCADIAEpA0A3A0ALIAcgBSkDADcDACAHIAUpAwg3AwggByAFKQMQNwMQIAcgBSkDGDcDGCAHIAUpAyA3AyAgByAFKQMoNwMoIAcgBSkDMDcDMCAHIAUpAzg3AzggByAFKQNANwNAIAdByABqIgYgAykDADcDACAGIAMpAwg3AwggBiADKQMQNwMQIAYgAykDGDcDGCAGIAMpAyA3AyAgBiADKQMoNwMoIAYgAykDMDcDMCAGIAMpAzg3AzggBiADKQNANwNAQQALIQwgCUGYAWohDSAJQZDmAWoiCkGozABqIQggCiEGA0AgBiAHQZABEDwaIAYgDDoAkAEgBkGRAWoiDiALLgAAOwAAIA4gCywAAjoAAiAGQZQBaiIGIAhHDQALIA0gAkGozAAQPBogDUGozABqIApBqMwAEDwaIA1BlAFqIRMgBEHIAGohESAHQcgAaiEIIARBkQFqIRIgDUG8zQBqIg4hAkEBIQZBACEKA0AgBBAeIAQQHiAEEB4gBBAeIBMgCkGUAWxqIARBlAEQPBogECwAAAR/IAcgBEGQARA8GiALIBIuAAA7AAAgCyASLAACOgACQQEFIAUgBCkDADcDACAFIAQpAwg3AwggBSAEKQMQNwMQIAUgBCkDGDcDGCAFIAQpAyA3AyAgBSAEKQMoNwMoIAUgBCkDMDcDMCAFIAQpAzg3AzggBSAEKQNANwNAIBEoAgBBAUYgDygCAEVxBEAgA0HYDCkCADcCACADQeAMKQIANwIIIANB6AwpAgA3AhAgA0HwDCkCADcCGCADQfgMKQIANwIgIANBgA0pAgA3AiggA0GIDSkCADcCMCADQZANKQIANwI4IANBmA0pAgA3AkAFIAFBwAkpAwA3AwAgAUHICSkDADcDCCABQdAJKQMANwMQIAFB2AkpAwA3AxggAUHgCSkDADcDICABQegJKQMANwMoIAFB8AkpAwA3AzAgAUH4CSkDADcDOCABQYAKKQMANwNAIAEgERAWIAMgASkDADcDACADIAEpAwg3AwggAyABKQMQNwMQIAMgASkDGDcDGCADIAEpAyA3AyAgAyABKQMoNwMoIAMgASkDMDcDMCADIAEpAzg3AzggAyABKQNANwNACyAHIAUpAwA3AwAgByAFKQMINwMIIAcgBSkDEDcDECAHIAUpAxg3AxggByAFKQMgNwMgIAcgBSkDKDcDKCAHIAUpAzA3AzAgByAFKQM4NwM4IAcgBSkDQDcDQCAIIAMpAwA3AwAgCCADKQMINwMIIAggAykDEDcDECAIIAMpAxg3AxggCCADKQMgNwMgIAggAykDKDcDKCAIIAMpAzA3AzAgCCADKQM4NwM4IAggAykDQDcDQEEACyEMIAIgB0GQARA8GiAOIApBlAFsaiAMOgCQASAOIApBlAFsakGRAWoiCiALLgAAOwAAIAogCywAAjoAAiAOIAZBlAFsaiECIAZBAWoiDEHCAEcEQCAGIQogDCEGDAELCyAAIA1B0JgBEDwaIAkkAgsLwgwBEH8CQCMCIQsjAkGQCmokAiALIgcgAkEBEBkgC0GQCWoiBkIANwAAIAZCADcACCAGQgA3ABAgBkIANwAYIAZCADcAICAGQgA3ACggBkIANwAwIAZCADcAOCAGQgA3AEAgBkIANwBIIAZCADcAUCAGQgA3AFggBkIANwBgIAZCADcAaCAGQgA3AHAgBkIANwB4IAcoAoAEIglBgARLBEAgCUGABBAnCyALQbgHaiEOIAtB4AVqIQQgC0GIBGohBSAJRSEDIAlBBEkEfyAJBUEECyECAkAgAwRAQQAhDQUgCSACayEIIAchAyACIQkgByACaiECQQAhBwJAAkACQANAAkACQAJAAkACQAJAIAlBAWsOBAMCAQAECyADLAACQQJ0Qf8BcSADLAADQQN0Qf8BcWpBGHRBGHUgAywAAUEBdEH/AXFqQRh0QRh1IAMsAABqQRh0QRh1IQMMBAsgAywAAUEBdEH/AXEgAywAAkECdEH/AXFqQRh0QRh1IAMsAABqQRh0QRh1IQMMAwsgAywAAUEBdEH/AXEgAywAAGpBGHRBGHUhAwwCCyADLAAAIQMMAQsMAgsgB0GAAU8NAiAGIAdqIAM6AAAgB0EBaiEHIAhFIQwgCCAIQQRJBH8gCAVBBAsiCmshCCACIgMgCmohDyAMBEBBACEICyAMBEAgAiEPCyAMRQRAIAohCQsgDCACRXIEQCAHIQ0MBgUgDyECDAELAAsAC0HQDRAuDAELQeQNIAdBgAEQKAsLCyAFQYgKKQMANwMAIAVBkAopAwA3AwggBUGYCikDADcDECAFQaAKKQMANwMYIAVBqAopAwA3AyAgBUGwCikDADcDKCAFQbgKKQMANwMwIAVBwAopAwA3AzggBUHICikDADcDQCAFQcgAaiICQYgKKQMANwMAIAJBkAopAwA3AwggAkGYCikDADcDECACQaAKKQMANwMYIAJBqAopAwA3AyAgAkGwCikDADcDKCACQbgKKQMANwMwIAJBwAopAwA3AzggAkHICikDADcDQCAFQZABaiICQdgMKQIANwIAIAJB4AwpAgA3AgggAkHoDCkCADcCECACQfAMKQIANwIYIAJB+AwpAgA3AiAgAkGADSkCADcCKCACQYgNKQIANwIwIAJBkA0pAgA3AjggAkGYDSkCADcCQCAEQYgKKQMANwMAIARBkAopAwA3AwggBEGYCikDADcDECAEQaAKKQMANwMYIARBqAopAwA3AyAgBEGwCikDADcDKCAEQbgKKQMANwMwIARBwAopAwA3AzggBEHICikDADcDQCAEQcgAaiICQYgKKQMANwMAIAJBkAopAwA3AwggAkGYCikDADcDECACQaAKKQMANwMYIAJBqAopAwA3AyAgAkGwCikDADcDKCACQbgKKQMANwMwIAJBwAopAwA3AzggAkHICikDADcDQCAEQZABaiICQdgMKQIANwIAIAJB4AwpAgA3AgggAkHoDCkCADcCECACQfAMKQIANwIYIAJB+AwpAgA3AiAgAkGADSkCADcCKCACQYgNKQIANwIwIAJBkA0pAgA3AjggAkGYDSkCADcCQCANRSICBEAgBSAEECEgBSAEECEgBSAEECEgBSAEECEgBSAEECEgBSAEECEgBSAEECEgBSAEECEgBSAEECEgBSAEECEgDiAFQdgBEDwaIAAgDhAiIAskAg8FQQohCgsgBiANaiERIAYhCSAGQQFqIQMgAgR/IAkFIAMLIQYgAkEBc0EBcSEMAkACQAJAAkADQEEAIAprQRh0QRh1IRJBACEIIAYhAiAJIQMgDCEHA0AgAywAACIDIApBGHRBGHVGBEAgCEHCAE8NBCAEIAEgCEGUAWxqECMFIAMgEkYEQCAIQcIATw0GIAQgAUGozABqIAhBlAFsahAjCwsgAiIDIBFGIRAgA0EBaiEDIBAEfyACBSADCyEPIBBBAXMgB2ohDSAQRQRAIAchCAsgAkUgEHJFBEAgAiEDIA8hAiANIQcMAQsLIAUgBBAhIApBf2pBGHRBGHUhAiAKQRh0QRh1QQFMDQEgAiEKDAALAAsgDiAFQdgBEDwaIAAgDhAiIAskAg8LQfANIAhBwgAQKAwBC0H8DSAIQcIAECgLCwu9OgEPfwJAIwIhDCMCQeAKaiQCIAAoApABQQFGBEAgACgClAFFBEAgACABQdgBEDwaIAwkAg8LCyABKAKQAUEBRgRAIAEoApQBRQRAIAwkAg8LCyAMQYAJaiICIAFBkAFqIg4pAgA3AgAgAiAOKQIINwIIIAIgDikCEDcCECACIA4pAhg3AhggAiAOKQIgNwIgIAIgDikCKDcCKCACIA4pAjA3AjAgAiAOKQI4NwI4IAIgDikCQDcCQCACIA4QFyAMQbgIaiIDIAIpAwA3AwAgAyACKQMINwMIIAMgAikDEDcDECADIAIpAxg3AxggAyACKQMgNwMgIAMgAikDKDcDKCADIAIpAzA3AzAgAyACKQM4NwM4IAMgAikDQDcDQCADEBsgDCIGIAMpAwA3AwAgBiADKQMINwMIIAYgAykDEDcDECAGIAMpAxg3AxggBiADKQMgNwMgIAYgAykDKDcDKCAGIAMpAzA3AzAgBiADKQM4NwM4IAYgAykDQDcDQCACIABBkAFqIgkpAgA3AgAgAiAJKQIINwIIIAIgCSkCEDcCECACIAkpAhg3AhggAiAJKQIgNwIgIAIgCSkCKDcCKCACIAkpAjA3AjAgAiAJKQI4NwI4IAIgCSkCQDcCQCACIAkQFyADIAIpAwA3AwAgAyACKQMINwMIIAMgAikDEDcDECADIAIpAxg3AxggAyACKQMgNwMgIAMgAikDKDcDKCADIAIpAzA3AzAgAyACKQM4NwM4IAMgAikDQDcDQCADEBsgDEHIAGoiBSADKQMANwMAIAUgAykDCDcDCCAFIAMpAxA3AxAgBSADKQMYNwMYIAUgAykDIDcDICAFIAMpAyg3AyggBSADKQMwNwMwIAUgAykDODcDOCAFIAMpA0A3A0AgAiAAKQIANwIAIAIgACkCCDcCCCACIAApAhA3AhAgAiAAKQIYNwIYIAIgACkCIDcCICACIAApAig3AiggAiAAKQIwNwIwIAIgACkCODcCOCACIAApAkA3AkAgAiAGEBcgAyACKQMANwMAIAMgAikDCDcDCCADIAIpAxA3AxAgAyACKQMYNwMYIAMgAikDIDcDICADIAIpAyg3AyggAyACKQMwNwMwIAMgAikDODcDOCADIAIpA0A3A0AgAxAbIAxBkAFqIgcgAykDADcDACAHIAMpAwg3AwggByADKQMQNwMQIAcgAykDGDcDGCAHIAMpAyA3AyAgByADKQMoNwMoIAcgAykDMDcDMCAHIAMpAzg3AzggByADKQNANwNAIAIgASkCADcCACACIAEpAgg3AgggAiABKQIQNwIQIAIgASkCGDcCGCACIAEpAiA3AiAgAiABKQIoNwIoIAIgASkCMDcCMCACIAEpAjg3AjggAiABKQJANwJAIAIgBRAXIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAIAMQGyAMQdgBaiIIIAMpAwA3AwAgCCADKQMINwMIIAggAykDEDcDECAIIAMpAxg3AxggCCADKQMgNwMgIAggAykDKDcDKCAIIAMpAzA3AzAgCCADKQM4NwM4IAggAykDQDcDQCACIABByABqIg0pAgA3AgAgAiANKQIINwIIIAIgDSkCEDcCECACIA0pAhg3AhggAiANKQIgNwIgIAIgDSkCKDcCKCACIA0pAjA3AjAgAiANKQI4NwI4IAIgDSkCQDcCQCACIAYQFyADIAIpAwA3AwAgAyACKQMINwMIIAMgAikDEDcDECADIAIpAxg3AxggAyACKQMgNwMgIAMgAikDKDcDKCADIAIpAzA3AzAgAyACKQM4NwM4IAMgAikDQDcDQCADEBsgDEHwB2oiBCADKQMANwMAIAQgAykDCDcDCCAEIAMpAxA3AxAgBCADKQMYNwMYIAQgAykDIDcDICAEIAMpAyg3AyggBCADKQMwNwMwIAQgAykDODcDOCAEIAMpA0A3A0AgAiAEKQMANwMAIAIgBCkDCDcDCCACIAQpAxA3AxAgAiAEKQMYNwMYIAIgBCkDIDcDICACIAQpAyg3AyggAiAEKQMwNwMwIAIgBCkDODcDOCACIAQpA0A3A0AgAiAOEBcgAyACKQMANwMAIAMgAikDCDcDCCADIAIpAxA3AxAgAyACKQMYNwMYIAMgAikDIDcDICADIAIpAyg3AyggAyACKQMwNwMwIAMgAikDODcDOCADIAIpA0A3A0AgAxAbIAxBoAJqIgogAykDADcDACAKIAMpAwg3AwggCiADKQMQNwMQIAogAykDGDcDGCAKIAMpAyA3AyAgCiADKQMoNwMoIAogAykDMDcDMCAKIAMpAzg3AzggCiADKQNANwNAIAIgAUHIAGoiASkCADcCACACIAEpAgg3AgggAiABKQIQNwIQIAIgASkCGDcCGCACIAEpAiA3AiAgAiABKQIoNwIoIAIgASkCMDcCMCACIAEpAjg3AjggAiABKQJANwJAIAIgBRAXIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAIAMQGyAEIAMpAwA3AwAgBCADKQMINwMIIAQgAykDEDcDECAEIAMpAxg3AxggBCADKQMgNwMgIAQgAykDKDcDKCAEIAMpAzA3AzAgBCADKQM4NwM4IAQgAykDQDcDQCACIAQpAwA3AwAgAiAEKQMINwMIIAIgBCkDEDcDECACIAQpAxg3AxggAiAEKQMgNwMgIAIgBCkDKDcDKCACIAQpAzA3AzAgAiAEKQM4NwM4IAIgBCkDQDcDQCACIAkQFyADIAIpAwA3AwAgAyACKQMINwMIIAMgAikDEDcDECADIAIpAxg3AxggAyACKQMgNwMgIAMgAikDKDcDKCADIAIpAzA3AzAgAyACKQM4NwM4IAMgAikDQDcDQCADEBsgDEHoAmoiASADKQMANwMAIAEgAykDCDcDCCABIAMpAxA3AxAgASADKQMYNwMYIAEgAykDIDcDICABIAMpAyg3AyggASADKQMwNwMwIAEgAykDODcDOCABIAMpA0A3A0AgAiAHKQMANwMAIAIgBykDCDcDCCACIAcpAxA3AxAgAiAHKQMYNwMYIAIgBykDIDcDICACIAcpAyg3AyggAiAHKQMwNwMwIAIgBykDODcDOCACIAcpA0A3A0AgAiAIEBYgAyACKQMANwMAIAMgAikDCDcDCCADIAIpAxA3AxAgAyACKQMYNwMYIAMgAikDIDcDICADIAIpAyg3AyggAyACKQMwNwMwIAMgAikDODcDOCADIAIpA0A3A0AgAywARARAIANBwAkQFQsgDEGwA2oiCyADKQMANwMAIAsgAykDCDcDCCALIAMpAxA3AxAgCyADKQMYNwMYIAsgAykDIDcDICALIAMpAyg3AyggCyADKQMwNwMwIAsgAykDODcDOCALIAMpA0A3A0AgAiAKKQMANwMAIAIgCikDCDcDCCACIAopAxA3AxAgAiAKKQMYNwMYIAIgCikDIDcDICACIAopAyg3AyggAiAKKQMwNwMwIAIgCikDODcDOCACIAopA0A3A0AgAiABEBYgAyACKQMANwMAIAMgAikDCDcDCCADIAIpAxA3AxAgAyACKQMYNwMYIAMgAikDIDcDICADIAIpAyg3AyggAyACKQMwNwMwIAMgAikDODcDOCADIAIpA0A3A0AgAywARARAIANBwAkQFQsgDEH4A2oiCCADKQMANwMAIAggAykDCDcDCCAIIAMpAxA3AxAgCCADKQMYNwMYIAggAykDIDcDICAIIAMpAyg3AyggCCADKQMwNwMwIAggAykDODcDOCAIIAMpA0A3A0AgCygCAEEBRgRAIAsoAgRFBEACQAJAIAgoAgBBAUcNACAIKAIEDQAgABAkDAELIAJBiAopAwA3AwAgAkGQCikDADcDCCACQZgKKQMANwMQIAJBoAopAwA3AxggAkGoCikDADcDICACQbAKKQMANwMoIAJBuAopAwA3AzAgAkHACikDADcDOCACQcgKKQMANwNAIAJByABqIgFBiAopAwA3AwAgAUGQCikDADcDCCABQZgKKQMANwMQIAFBoAopAwA3AxggAUGoCikDADcDICABQbAKKQMANwMoIAFBuAopAwA3AzAgAUHACikDADcDOCABQcgKKQMANwNAIAJBkAFqIgFB2AwpAgA3AgAgAUHgDCkCADcCCCABQegMKQIANwIQIAFB8AwpAgA3AhggAUH4DCkCADcCICABQYANKQIANwIoIAFBiA0pAgA3AjAgAUGQDSkCADcCOCABQZgNKQIANwJAIAAgAkHYARA8GgsgDCQCDwsLIAxBqAdqIQUgAiALKQMANwMAIAIgCykDCDcDCCACIAspAxA3AxAgAiALKQMYNwMYIAIgCykDIDcDICACIAspAyg3AyggAiALKQMwNwMwIAIgCykDODcDOCACIAspA0A3A0AgAiALEBcgAyACKQMANwMAIAMgAikDCDcDCCADIAIpAxA3AxAgAyACKQMYNwMYIAMgAikDIDcDICADIAIpAyg3AyggAyACKQMwNwMwIAMgAikDODcDOCADIAIpA0A3A0AgAxAbIAxBwARqIgEgAykDADcDACABIAMpAwg3AwggASADKQMQNwMQIAEgAykDGDcDGCABIAMpAyA3AyAgASADKQMoNwMoIAEgAykDMDcDMCABIAMpAzg3AzggASADKQNANwNAIAIgBykDADcDACACIAcpAwg3AwggAiAHKQMQNwMQIAIgBykDGDcDGCACIAcpAyA3AyAgAiAHKQMoNwMoIAIgBykDMDcDMCACIAcpAzg3AzggAiAHKQNANwNAIAIgARAXIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAIAMQGyAMQYgFaiIHIAMpAwA3AwAgByADKQMINwMIIAcgAykDEDcDECAHIAMpAxg3AxggByADKQMgNwMgIAcgAykDKDcDKCAHIAMpAzA3AzAgByADKQM4NwM4IAcgAykDQDcDQCACIAEpAwA3AwAgAiABKQMINwMIIAIgASkDEDcDECACIAEpAxg3AxggAiABKQMgNwMgIAIgASkDKDcDKCACIAEpAzA3AzAgAiABKQM4NwM4IAIgASkDQDcDQCACIAsQFyADIAIpAwA3AwAgAyACKQMINwMIIAMgAikDEDcDECADIAIpAxg3AxggAyACKQMgNwMgIAMgAikDKDcDKCADIAIpAzA3AzAgAyACKQM4NwM4IAMgAikDQDcDQCADEBsgDEHQBWoiDyADKQMANwMAIA8gAykDCDcDCCAPIAMpAxA3AxAgDyADKQMYNwMYIA8gAykDIDcDICAPIAMpAyg3AyggDyADKQMwNwMwIA8gAykDODcDOCAPIAMpA0A3A0AgAiAIKQMANwMAIAIgCCkDCDcDCCACIAgpAxA3AxAgAiAIKQMYNwMYIAIgCCkDIDcDICACIAgpAyg3AyggAiAIKQMwNwMwIAIgCCkDODcDOCACIAgpA0A3A0AgAiAIEBcgAyACKQMANwMAIAMgAikDCDcDCCADIAIpAxA3AxAgAyACKQMYNwMYIAMgAikDIDcDICADIAIpAyg3AyggAyACKQMwNwMwIAMgAikDODcDOCADIAIpA0A3A0AgAxAbIAQgAykDADcDACAEIAMpAwg3AwggBCADKQMQNwMQIAQgAykDGDcDGCAEIAMpAyA3AyAgBCADKQMoNwMoIAQgAykDMDcDMCAEIAMpAzg3AzggBCADKQNANwNAIAIgBCkDADcDACACIAQpAwg3AwggAiAEKQMQNwMQIAIgBCkDGDcDGCACIAQpAyA3AyAgAiAEKQMoNwMoIAIgBCkDMDcDMCACIAQpAzg3AzggAiAEKQNANwNAIAIgDxAVIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAAkACQCADKAIAIgFBCEYEQEEIIQYCQAJAAkADQCAGQX9qIQEgBkUNBSABQRBPDQEgA0EEaiABQQJ0aigCACIGIAFBAnRBxAlqKAIAIhBHDQIgASEGDAALAAtBvAsgAUEQECgMAQsgBiAQTw0CCwUgAUEITw0BCwwBCyADQcAJEBYLIAUgAykDADcDACAFIAMpAwg3AwggBSADKQMQNwMQIAUgAykDGDcDGCAFIAMpAyA3AyAgBSADKQMoNwMoIAUgAykDMDcDMCAFIAMpAzg3AzggBSADKQNANwNAIAIgBSkDADcDACACIAUpAwg3AwggAiAFKQMQNwMQIAIgBSkDGDcDGCACIAUpAyA3AyAgAiAFKQMoNwMoIAIgBSkDMDcDMCACIAUpAzg3AzggAiAFKQNANwNAIAIgBxAWIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAIAMsAEQEQCADQcAJEBULIAxB4AZqIgEgAykDADcDACABIAMpAwg3AwggASADKQMQNwMQIAEgAykDGDcDGCABIAMpAyA3AyAgASADKQMoNwMoIAEgAykDMDcDMCABIAMpAzg3AzggASADKQNANwNAIAIgASkDADcDACACIAEpAwg3AwggAiABKQMQNwMQIAIgASkDGDcDGCACIAEpAyA3AyAgAiABKQMoNwMoIAIgASkDMDcDMCACIAEpAzg3AzggAiABKQNANwNAIAIgBxAWIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAIAMsAEQEQCADQcAJEBULIAxBmAZqIgYgAykDADcDACAGIAMpAwg3AwggBiADKQMQNwMQIAYgAykDGDcDGCAGIAMpAyA3AyAgBiADKQMoNwMoIAYgAykDMDcDMCAGIAMpAzg3AzggBiADKQNANwNAIAAgBikCADcCACAAIAYpAgg3AgggACAGKQIQNwIQIAAgBikCGDcCGCAAIAYpAiA3AiAgACAGKQIoNwIoIAAgBikCMDcCMCAAIAYpAjg3AjggACAGKQJANwJAIAIgBykDADcDACACIAcpAwg3AwggAiAHKQMQNwMQIAIgBykDGDcDGCACIAcpAyA3AyAgAiAHKQMoNwMoIAIgBykDMDcDMCACIAcpAzg3AzggAiAHKQNANwNAIAIgABAWIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAIAMsAEQEQCADQcAJEBULIAUgAykDADcDACAFIAMpAwg3AwggBSADKQMQNwMQIAUgAykDGDcDGCAFIAMpAyA3AyAgBSADKQMoNwMoIAUgAykDMDcDMCAFIAMpAzg3AzggBSADKQNANwNAIAIgCCkDADcDACACIAgpAwg3AwggAiAIKQMQNwMQIAIgCCkDGDcDGCACIAgpAyA3AyAgAiAIKQMoNwMoIAIgCCkDMDcDMCACIAgpAzg3AzggAiAIKQNANwNAIAIgBRAXIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAIAMQGyABIAMpAwA3AwAgASADKQMINwMIIAEgAykDEDcDECABIAMpAxg3AxggASADKQMgNwMgIAEgAykDKDcDKCABIAMpAzA3AzAgASADKQM4NwM4IAEgAykDQDcDQCACIAopAwA3AwAgAiAKKQMINwMIIAIgCikDEDcDECACIAopAxg3AxggAiAKKQMgNwMgIAIgCikDKDcDKCACIAopAzA3AzAgAiAKKQM4NwM4IAIgCikDQDcDQCACIA8QFyADIAIpAwA3AwAgAyACKQMINwMIIAMgAikDEDcDECADIAIpAxg3AxggAyACKQMgNwMgIAMgAikDKDcDKCADIAIpAzA3AzAgAyACKQM4NwM4IAMgAikDQDcDQCADEBsgBCADKQMANwMAIAQgAykDCDcDCCAEIAMpAxA3AxAgBCADKQMYNwMYIAQgAykDIDcDICAEIAMpAyg3AyggBCADKQMwNwMwIAQgAykDODcDOCAEIAMpA0A3A0AgAiABKQMANwMAIAIgASkDCDcDCCACIAEpAxA3AxAgAiABKQMYNwMYIAIgASkDIDcDICACIAEpAyg3AyggAiABKQMwNwMwIAIgASkDODcDOCACIAEpA0A3A0AgAiAEEBYgAyACKQMANwMAIAMgAikDCDcDCCADIAIpAxA3AxAgAyACKQMYNwMYIAMgAikDIDcDICADIAIpAyg3AyggAyACKQMwNwMwIAMgAikDODcDOCADIAIpA0A3A0AgAywARARAIANBwAkQFQsgBiADKQMANwMAIAYgAykDCDcDCCAGIAMpAxA3AxAgBiADKQMYNwMYIAYgAykDIDcDICAGIAMpAyg3AyggBiADKQMwNwMwIAYgAykDODcDOCAGIAMpA0A3A0AgDSAGKQIANwIAIA0gBikCCDcCCCANIAYpAhA3AhAgDSAGKQIYNwIYIA0gBikCIDcCICANIAYpAig3AiggDSAGKQIwNwIwIA0gBikCODcCOCANIAYpAkA3AkAgAiAJKQIANwIAIAIgCSkCCDcCCCACIAkpAhA3AhAgAiAJKQIYNwIYIAIgCSkCIDcCICACIAkpAig3AiggAiAJKQIwNwIwIAIgCSkCODcCOCACIAkpAkA3AkAgAiAOEBcgAyACKQMANwMAIAMgAikDCDcDCCADIAIpAxA3AxAgAyACKQMYNwMYIAMgAikDIDcDICADIAIpAyg3AyggAyACKQMwNwMwIAMgAikDODcDOCADIAIpA0A3A0AgAxAbIAQgAykDADcDACAEIAMpAwg3AwggBCADKQMQNwMQIAQgAykDGDcDGCAEIAMpAyA3AyAgBCADKQMoNwMoIAQgAykDMDcDMCAEIAMpAzg3AzggBCADKQNANwNAIAIgBCkDADcDACACIAQpAwg3AwggAiAEKQMQNwMQIAIgBCkDGDcDGCACIAQpAyA3AyAgAiAEKQMoNwMoIAIgBCkDMDcDMCACIAQpAzg3AzggAiAEKQNANwNAIAIgCxAXIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAIAMQGyAFIAMpAwA3AwAgBSADKQMINwMIIAUgAykDEDcDECAFIAMpAxg3AxggBSADKQMgNwMgIAUgAykDKDcDKCAFIAMpAzA3AzAgBSADKQM4NwM4IAUgAykDQDcDQCAJIAUpAgA3AgAgCSAFKQIINwIIIAkgBSkCEDcCECAJIAUpAhg3AhggCSAFKQIgNwIgIAkgBSkCKDcCKCAJIAUpAjA3AjAgCSAFKQI4NwI4IAkgBSkCQDcCQCAMJAILC94KAQt/AkAjAiEJIwJBgAVqJAIgCUG4BGohAiAJQfADaiEDIAlBqANqIQQgCUHgAmohBSAJQZgCaiEIIAlB0AFqIQcgCUHAAGoiCiABQZABEDwaIAEoApABIQsgASgClAEhDCAJIgYgAUGYAWoiASkCADcCACAGIAEpAgg3AgggBiABKQIQNwIQIAYgASkCGDcCGCAGIAEpAiA3AiAgBiABKQIoNwIoIAYgASkCMDcCMCAGIAEpAjg3AjggC0EBRiAMRXEEQCAAQYgOQZQBEDwaIAkkAgUgAiALNgIAIAIgDDYCBCACQQhqIgEgBikDADcDACABIAYpAwg3AwggASAGKQMQNwMQIAEgBikDGDcDGCABIAYpAyA3AyAgASAGKQMoNwMoIAEgBikDMDcDMCABIAYpAzg3AzggByACEB0gAiAHKQMANwMAIAIgBykDCDcDCCACIAcpAxA3AxAgAiAHKQMYNwMYIAIgBykDIDcDICACIAcpAyg3AyggAiAHKQMwNwMwIAIgBykDODcDOCACIAcpA0A3A0AgAiAHEBcgAyACKQMANwMAIAMgAikDCDcDCCADIAIpAxA3AxAgAyACKQMYNwMYIAMgAikDIDcDICADIAIpAyg3AyggAyACKQMwNwMwIAMgAikDODcDOCADIAIpA0A3A0AgAxAbIAggAykDADcDACAIIAMpAwg3AwggCCADKQMQNwMQIAggAykDGDcDGCAIIAMpAyA3AyAgCCADKQMoNwMoIAggAykDMDcDMCAIIAMpAzg3AzggCCADKQNANwNAIAIgCikDADcDACACIAopAwg3AwggAiAKKQMQNwMQIAIgCikDGDcDGCACIAopAyA3AyAgAiAKKQMoNwMoIAIgCikDMDcDMCACIAopAzg3AzggAiAKKQNANwNAIAIgCBAXIAMgAikDADcDACADIAIpAwg3AwggAyACKQMQNwMQIAMgAikDGDcDGCADIAIpAyA3AyAgAyACKQMoNwMoIAMgAikDMDcDMCADIAIpAzg3AzggAyACKQNANwNAIAMQGyAFIAMpAwA3AwAgBSADKQMINwMIIAUgAykDEDcDECAFIAMpAxg3AxggBSADKQMgNwMgIAUgAykDKDcDKCAFIAMpAzA3AzAgBSADKQM4NwM4IAUgAykDQDcDQCACIApByABqIgEpAwA3AwAgAiABKQMINwMIIAIgASkDEDcDECACIAEpAxg3AxggAiABKQMgNwMgIAIgASkDKDcDKCACIAEpAzA3AzAgAiABKQM4NwM4IAIgASkDQDcDQCACIAgQFyADIAIpAwA3AwAgAyACKQMINwMIIAMgAikDEDcDECADIAIpAxg3AxggAyACKQMgNwMgIAMgAikDKDcDKCADIAIpAzA3AzAgAyACKQM4NwM4IAMgAikDQDcDQCADEBsgBCADKQMANwMAIAQgAykDCDcDCCAEIAMpAxA3AxAgBCADKQMYNwMYIAQgAykDIDcDICAEIAMpAyg3AyggBCADKQMwNwMwIAQgAykDODcDOCAEIAMpA0A3A0AgBCAHEBcgBBAbIAAgBSkCADcCACAAIAUpAgg3AgggACAFKQIQNwIQIAAgBSkCGDcCGCAAIAUpAiA3AiAgACAFKQIoNwIoIAAgBSkCMDcCMCAAIAUpAjg3AjggACAFKQJANwJAIABByABqIgEgBCkCADcCACABIAQpAgg3AgggASAEKQIQNwIQIAEgBCkCGDcCGCABIAQpAiA3AiAgASAEKQIoNwIoIAEgBCkCMDcCMCABIAQpAjg3AjggASAEKQJANwJAIABBADoAkAEgCSQCCwsLhC0BDX8CQCMCIQwjAkHQCWokAiAMQbgIaiEDIAxB4AZqIQIgACgCkAFBAUYEQCAAKAKUAUUEQCABLACQASEHIAMgAUGQARA8GiAHQQFxBEAgAkGICikDADcDACACQZAKKQMANwMIIAJBmAopAwA3AxAgAkGgCikDADcDGCACQagKKQMANwMgIAJBsAopAwA3AyggAkG4CikDADcDMCACQcAKKQMANwM4IAJByAopAwA3A0AgAkHIAGoiAUGICikDADcDACABQZAKKQMANwMIIAFBmAopAwA3AxAgAUGgCikDADcDGCABQagKKQMANwMgIAFBsAopAwA3AyggAUG4CikDADcDMCABQcAKKQMANwM4IAFByAopAwA3A0AgAkGQAWoiAUHYDCkCADcCACABQeAMKQIANwIIIAFB6AwpAgA3AhAgAUHwDCkCADcCGCABQfgMKQIANwIgIAFBgA0pAgA3AiggAUGIDSkCADcCMCABQZANKQIANwI4IAFBmA0pAgA3AkAFIAIgAykDADcDACACIAMpAwg3AwggAiADKQMQNwMQIAIgAykDGDcDGCACIAMpAyA3AyAgAiADKQMoNwMoIAIgAykDMDcDMCACIAMpAzg3AzggAiADKQNANwNAIAJByABqIgEgA0HIAGoiBykDADcDACABIAcpAwg3AwggASAHKQMQNwMQIAEgBykDGDcDGCABIAcpAyA3AyAgASAHKQMoNwMoIAEgBykDMDcDMCABIAcpAzg3AzggASAHKQNANwNAIAJBkAFqIgFBiAopAwA3AwAgAUGQCikDADcDCCABQZgKKQMANwMQIAFBoAopAwA3AxggAUGoCikDADcDICABQbAKKQMANwMoIAFBuAopAwA3AzAgAUHACikDADcDOCABQcgKKQMANwNACyAAIAJB2AEQPBogDCQCDwsLIAEsAJABBEAgDCQCDwsgAyAAQZABaiIKKQIANwIAIAMgCikCCDcCCCADIAopAhA3AhAgAyAKKQIYNwIYIAMgCikCIDcCICADIAopAig3AiggAyAKKQIwNwIwIAMgCikCODcCOCADIAopAkA3AkAgAyAKEBcgAiADKQMANwMAIAIgAykDCDcDCCACIAMpAxA3AxAgAiADKQMYNwMYIAIgAykDIDcDICACIAMpAyg3AyggAiADKQMwNwMwIAIgAykDODcDOCACIAMpA0A3A0AgAhAbIAwiByACKQMANwMAIAcgAikDCDcDCCAHIAIpAxA3AxAgByACKQMYNwMYIAcgAikDIDcDICAHIAIpAyg3AyggByACKQMwNwMwIAcgAikDODcDOCAHIAIpA0A3A0AgAyABKQIANwIAIAMgASkCCDcCCCADIAEpAhA3AhAgAyABKQIYNwIYIAMgASkCIDcCICADIAEpAig3AiggAyABKQIwNwIwIAMgASkCODcCOCADIAEpAkA3AkAgAyAHEBcgAiADKQMANwMAIAIgAykDCDcDCCACIAMpAxA3AxAgAiADKQMYNwMYIAIgAykDIDcDICACIAMpAyg3AyggAiADKQMwNwMwIAIgAykDODcDOCACIAMpA0A3A0AgAhAbIAxByABqIgQgAikDADcDACAEIAIpAwg3AwggBCACKQMQNwMQIAQgAikDGDcDGCAEIAIpAyA3AyAgBCACKQMoNwMoIAQgAikDMDcDMCAEIAIpAzg3AzggBCACKQNANwNAIAMgAUHIAGoiASkCADcCACADIAEpAgg3AgggAyABKQIQNwIQIAMgASkCGDcCGCADIAEpAiA3AiAgAyABKQIoNwIoIAMgASkCMDcCMCADIAEpAjg3AjggAyABKQJANwJAIAMgBxAXIAIgAykDADcDACACIAMpAwg3AwggAiADKQMQNwMQIAIgAykDGDcDGCACIAMpAyA3AyAgAiADKQMoNwMoIAIgAykDMDcDMCACIAMpAzg3AzggAiADKQNANwNAIAIQGyAMQZABaiIBIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABIAoQFyABEBsgAyAAKQIANwIAIAMgACkCCDcCCCADIAApAhA3AhAgAyAAKQIYNwIYIAMgACkCIDcCICADIAApAig3AiggAyAAKQIwNwIwIAMgACkCODcCOCADIAApAkA3AkAgAyAEEBYgAiADKQMANwMAIAIgAykDCDcDCCACIAMpAxA3AxAgAiADKQMYNwMYIAIgAykDIDcDICACIAMpAyg3AyggAiADKQMwNwMwIAIgAykDODcDOCACIAMpA0A3A0AgAiwARARAIAJBwAkQFQsgDEHYAWoiCSACKQMANwMAIAkgAikDCDcDCCAJIAIpAxA3AxAgCSACKQMYNwMYIAkgAikDIDcDICAJIAIpAyg3AyggCSACKQMwNwMwIAkgAikDODcDOCAJIAIpA0A3A0AgAyAAQcgAaiIEKQIANwIAIAMgBCkCCDcCCCADIAQpAhA3AhAgAyAEKQIYNwIYIAMgBCkCIDcCICADIAQpAig3AiggAyAEKQIwNwIwIAMgBCkCODcCOCADIAQpAkA3AkAgAyABEBYgAiADKQMANwMAIAIgAykDCDcDCCACIAMpAxA3AxAgAiADKQMYNwMYIAIgAykDIDcDICACIAMpAyg3AyggAiADKQMwNwMwIAIgAykDODcDOCACIAMpA0A3A0AgAiwARARAIAJBwAkQFQsgDEGgAmoiBSACKQMANwMAIAUgAikDCDcDCCAFIAIpAxA3AxAgBSACKQMYNwMYIAUgAikDIDcDICAFIAIpAyg3AyggBSACKQMwNwMwIAUgAikDODcDOCAFIAIpA0A3A0AgCSgCAEEBRgRAIAkoAgRFBEACQAJAIAUoAgBBAUcNACAFKAIEDQAgABAkDAELIABBiAopAgA3AgAgAEGQCikCADcCCCAAQZgKKQIANwIQIABBoAopAgA3AhggAEGoCikCADcCICAAQbAKKQIANwIoIABBuAopAgA3AjAgAEHACikCADcCOCAAQcgKKQIANwJAIARBiAopAgA3AgAgBEGQCikCADcCCCAEQZgKKQIANwIQIARBoAopAgA3AhggBEGoCikCADcCICAEQbAKKQIANwIoIARBuAopAgA3AjAgBEHACikCADcCOCAEQcgKKQIANwJAIApB2AwpAgA3AgAgCkHgDCkCADcCCCAKQegMKQIANwIQIApB8AwpAgA3AhggCkH4DCkCADcCICAKQYANKQIANwIoIApBiA0pAgA3AjAgCkGQDSkCADcCOCAKQZgNKQIANwJACyAMJAIPCwsgDEHQBWohBiADIAkpAwA3AwAgAyAJKQMINwMIIAMgCSkDEDcDECADIAkpAxg3AxggAyAJKQMgNwMgIAMgCSkDKDcDKCADIAkpAzA3AzAgAyAJKQM4NwM4IAMgCSkDQDcDQCADIAkQFyACIAMpAwA3AwAgAiADKQMINwMIIAIgAykDEDcDECACIAMpAxg3AxggAiADKQMgNwMgIAIgAykDKDcDKCACIAMpAzA3AzAgAiADKQM4NwM4IAIgAykDQDcDQCACEBsgDEHoAmoiASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgAyAAKQIANwIAIAMgACkCCDcCCCADIAApAhA3AhAgAyAAKQIYNwIYIAMgACkCIDcCICADIAApAig3AiggAyAAKQIwNwIwIAMgACkCODcCOCADIAApAkA3AkAgAyABEBcgAiADKQMANwMAIAIgAykDCDcDCCACIAMpAxA3AxAgAiADKQMYNwMYIAIgAykDIDcDICACIAMpAyg3AyggAiADKQMwNwMwIAIgAykDODcDOCACIAMpA0A3A0AgAhAbIAxBsANqIgsgAikDADcDACALIAIpAwg3AwggCyACKQMQNwMQIAsgAikDGDcDGCALIAIpAyA3AyAgCyACKQMoNwMoIAsgAikDMDcDMCALIAIpAzg3AzggCyACKQNANwNAIAMgASkDADcDACADIAEpAwg3AwggAyABKQMQNwMQIAMgASkDGDcDGCADIAEpAyA3AyAgAyABKQMoNwMoIAMgASkDMDcDMCADIAEpAzg3AzggAyABKQNANwNAIAMgCRAXIAIgAykDADcDACACIAMpAwg3AwggAiADKQMQNwMQIAIgAykDGDcDGCACIAMpAyA3AyAgAiADKQMoNwMoIAIgAykDMDcDMCACIAMpAzg3AzggAiADKQNANwNAIAIQGyAMQfgDaiINIAIpAwA3AwAgDSACKQMINwMIIA0gAikDEDcDECANIAIpAxg3AxggDSACKQMgNwMgIA0gAikDKDcDKCANIAIpAzA3AzAgDSACKQM4NwM4IA0gAikDQDcDQCADIAUpAwA3AwAgAyAFKQMINwMIIAMgBSkDEDcDECADIAUpAxg3AxggAyAFKQMgNwMgIAMgBSkDKDcDKCADIAUpAzA3AzAgAyAFKQM4NwM4IAMgBSkDQDcDQCADIAUQFyACIAMpAwA3AwAgAiADKQMINwMIIAIgAykDEDcDECACIAMpAxg3AxggAiADKQMgNwMgIAIgAykDKDcDKCACIAMpAzA3AzAgAiADKQM4NwM4IAIgAykDQDcDQCACEBsgDEGYBmoiCCACKQMANwMAIAggAikDCDcDCCAIIAIpAxA3AxAgCCACKQMYNwMYIAggAikDIDcDICAIIAIpAyg3AyggCCACKQMwNwMwIAggAikDODcDOCAIIAIpA0A3A0AgAyAIKQMANwMAIAMgCCkDCDcDCCADIAgpAxA3AxAgAyAIKQMYNwMYIAMgCCkDIDcDICADIAgpAyg3AyggAyAIKQMwNwMwIAMgCCkDODcDOCADIAgpA0A3A0AgAyANEBUgAiADKQMANwMAIAIgAykDCDcDCCACIAMpAxA3AxAgAiADKQMYNwMYIAIgAykDIDcDICACIAMpAyg3AyggAiADKQMwNwMwIAIgAykDODcDOCACIAMpA0A3A0ACQAJAIAIoAgAiAUEIRgRAQQghBwJAAkACQANAIAdBf2ohASAHRQ0FIAFBEE8NASACQQRqIAFBAnRqKAIAIgcgAUECdEHECWooAgAiDkcNAiABIQcMAAsAC0G8CyABQRAQKAwBCyAHIA5PDQILBSABQQhPDQELDAELIAJBwAkQFgsgBiACKQMANwMAIAYgAikDCDcDCCAGIAIpAxA3AxAgBiACKQMYNwMYIAYgAikDIDcDICAGIAIpAyg3AyggBiACKQMwNwMwIAYgAikDODcDOCAGIAIpA0A3A0AgAyAGKQMANwMAIAMgBikDCDcDCCADIAYpAxA3AxAgAyAGKQMYNwMYIAMgBikDIDcDICADIAYpAyg3AyggAyAGKQMwNwMwIAMgBikDODcDOCADIAYpA0A3A0AgAyALEBYgAiADKQMANwMAIAIgAykDCDcDCCACIAMpAxA3AxAgAiADKQMYNwMYIAIgAykDIDcDICACIAMpAyg3AyggAiADKQMwNwMwIAIgAykDODcDOCACIAMpA0A3A0AgAiALEBYgAkHEAGoiASwAAARAA0AgAkHACRAVIAEsAAANAAsLIAxBiAVqIgEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAIAAgASkCADcCACAAIAEpAgg3AgggACABKQIQNwIQIAAgASkCGDcCGCAAIAEpAiA3AiAgACABKQIoNwIoIAAgASkCMDcCMCAAIAEpAjg3AjggACABKQJANwJAIAMgCykDADcDACADIAspAwg3AwggAyALKQMQNwMQIAMgCykDGDcDGCADIAspAyA3AyAgAyALKQMoNwMoIAMgCykDMDcDMCADIAspAzg3AzggAyALKQNANwNAIAMgABAWIAIgAykDADcDACACIAMpAwg3AwggAiADKQMQNwMQIAIgAykDGDcDGCACIAMpAyA3AyAgAiADKQMoNwMoIAIgAykDMDcDMCACIAMpAzg3AzggAiADKQNANwNAIAIsAEQEQCACQcAJEBULIAYgAikDADcDACAGIAIpAwg3AwggBiACKQMQNwMQIAYgAikDGDcDGCAGIAIpAyA3AyAgBiACKQMoNwMoIAYgAikDMDcDMCAGIAIpAzg3AzggBiACKQNANwNAIAMgBSkDADcDACADIAUpAwg3AwggAyAFKQMQNwMQIAMgBSkDGDcDGCADIAUpAyA3AyAgAyAFKQMoNwMoIAMgBSkDMDcDMCADIAUpAzg3AzggAyAFKQNANwNAIAMgBhAXIAIgAykDADcDACACIAMpAwg3AwggAiADKQMQNwMQIAIgAykDGDcDGCACIAMpAyA3AyAgAiADKQMoNwMoIAIgAykDMDcDMCACIAMpAzg3AzggAiADKQNANwNAIAIQGyABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCADIAQpAgA3AgAgAyAEKQIINwIIIAMgBCkCEDcCECADIAQpAhg3AhggAyAEKQIgNwIgIAMgBCkCKDcCKCADIAQpAjA3AjAgAyAEKQI4NwI4IAMgBCkCQDcCQCADIA0QFyACIAMpAwA3AwAgAiADKQMINwMIIAIgAykDEDcDECACIAMpAxg3AxggAiADKQMgNwMgIAIgAykDKDcDKCACIAMpAzA3AzAgAiADKQM4NwM4IAIgAykDQDcDQCACEBsgCCACKQMANwMAIAggAikDCDcDCCAIIAIpAxA3AxAgCCACKQMYNwMYIAggAikDIDcDICAIIAIpAyg3AyggCCACKQMwNwMwIAggAikDODcDOCAIIAIpA0A3A0AgAyABKQMANwMAIAMgASkDCDcDCCADIAEpAxA3AxAgAyABKQMYNwMYIAMgASkDIDcDICADIAEpAyg3AyggAyABKQMwNwMwIAMgASkDODcDOCADIAEpA0A3A0AgAyAIEBYgAiADKQMANwMAIAIgAykDCDcDCCACIAMpAxA3AxAgAiADKQMYNwMYIAIgAykDIDcDICACIAMpAyg3AyggAiADKQMwNwMwIAIgAykDODcDOCACIAMpA0A3A0AgAiwARARAIAJBwAkQFQsgDEHABGoiACACKQMANwMAIAAgAikDCDcDCCAAIAIpAxA3AxAgACACKQMYNwMYIAAgAikDIDcDICAAIAIpAyg3AyggACACKQMwNwMwIAAgAikDODcDOCAAIAIpA0A3A0AgBCAAKQIANwIAIAQgACkCCDcCCCAEIAApAhA3AhAgBCAAKQIYNwIYIAQgACkCIDcCICAEIAApAig3AiggBCAAKQIwNwIwIAQgACkCODcCOCAEIAApAkA3AkAgCiAJEBcgChAbIAwkAgsLklcBE38CQCMCIREjAkHwB2okAiAAKAKQAUEBRiIIBEAgACgClAFFBEAgESQCDwsLIBFBqAdqIQIgEUHgBmohASARQZgGaiEDIBFB0AVqIQUgEUGIBWohBiARQcAEaiEOIBFB+ANqIQcgEUGwA2ohCyARQegCaiENIBFBoAJqIQQgEUHYAWohCSARQZABaiEKIBFByABqIRAgESEPIABBkAFqIRICfwJAIAhFDQAgACgClAFBAUcNACACIAApAgA3AgAgAiAAKQIINwIIIAIgACkCEDcCECACIAApAhg3AhggAiAAKQIgNwIgIAIgACkCKDcCKCACIAApAjA3AjAgAiAAKQI4NwI4IAIgACkCQDcCQCACIAAQFyABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABEBsgCSABKQMANwMAIAkgASkDCDcDCCAJIAEpAxA3AxAgCSABKQMYNwMYIAkgASkDIDcDICAJIAEpAyg3AyggCSABKQMwNwMwIAkgASkDODcDOCAJIAEpA0A3A0AgAiAAQcgAaiIMKQIANwIAIAIgDCkCCDcCCCACIAwpAhA3AhAgAiAMKQIYNwIYIAIgDCkCIDcCICACIAwpAig3AiggAiAMKQIwNwIwIAIgDCkCODcCOCACIAwpAkA3AkAgAiAMEBcgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgARAbIAQgASkDADcDACAEIAEpAwg3AwggBCABKQMQNwMQIAQgASkDGDcDGCAEIAEpAyA3AyAgBCABKQMoNwMoIAQgASkDMDcDMCAEIAEpAzg3AzggBCABKQNANwNAIAIgBCkDADcDACACIAQpAwg3AwggAiAEKQMQNwMQIAIgBCkDGDcDGCACIAQpAyA3AyAgAiAEKQMoNwMoIAIgBCkDMDcDMCACIAQpAzg3AzggAiAEKQNANwNAIAIgBBAXIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAIAEQGyANIAEpAwA3AwAgDSABKQMINwMIIA0gASkDEDcDECANIAEpAxg3AxggDSABKQMgNwMgIA0gASkDKDcDKCANIAEpAzA3AzAgDSABKQM4NwM4IA0gASkDQDcDQCACIAApAgA3AgAgAiAAKQIINwIIIAIgACkCEDcCECACIAApAhg3AhggAiAAKQIgNwIgIAIgACkCKDcCKCACIAApAjA3AjAgAiAAKQI4NwI4IAIgACkCQDcCQCACIAQQFSABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQAJAAkAgASgCACIEQQhGBEBBCCEIAkACQAJAA0AgCEF/aiEEIAhFDQUgBEEQTw0BIAFBBGogBEECdGooAgAiCCAEQQJ0QcQJaigCACITRw0CIAQhCAwACwALQbwLIARBEBAoDAELIAggE08NAgsFIARBCE8NAQsMAQsgAUHACRAWCyADIAEpAwA3AwAgAyABKQMINwMIIAMgASkDEDcDECADIAEpAxg3AxggAyABKQMgNwMgIAMgASkDKDcDKCADIAEpAzA3AzAgAyABKQM4NwM4IAMgASkDQDcDQCACIAMpAwA3AwAgAiADKQMINwMIIAIgAykDEDcDECACIAMpAxg3AxggAiADKQMgNwMgIAIgAykDKDcDKCACIAMpAzA3AzAgAiADKQM4NwM4IAIgAykDQDcDQCACIAMQFyABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABEBsgBSABKQMANwMAIAUgASkDCDcDCCAFIAEpAxA3AxAgBSABKQMYNwMYIAUgASkDIDcDICAFIAEpAyg3AyggBSABKQMwNwMwIAUgASkDODcDOCAFIAEpA0A3A0AgAiAFKQMANwMAIAIgBSkDCDcDCCACIAUpAxA3AxAgAiAFKQMYNwMYIAIgBSkDIDcDICACIAUpAyg3AyggAiAFKQMwNwMwIAIgBSkDODcDOCACIAUpA0A3A0AgAiAJEBYgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgASwARARAIAFBwAkQFQsgBiABKQMANwMAIAYgASkDCDcDCCAGIAEpAxA3AxAgBiABKQMYNwMYIAYgASkDIDcDICAGIAEpAyg3AyggBiABKQMwNwMwIAYgASkDODcDOCAGIAEpA0A3A0AgAiAGKQMANwMAIAIgBikDCDcDCCACIAYpAxA3AxAgAiAGKQMYNwMYIAIgBikDIDcDICACIAYpAyg3AyggAiAGKQMwNwMwIAIgBikDODcDOCACIAYpA0A3A0AgAiANEBYgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgASwARARAIAFBwAkQFQsgCyABKQMANwMAIAsgASkDCDcDCCALIAEpAxA3AxAgCyABKQMYNwMYIAsgASkDIDcDICALIAEpAyg3AyggCyABKQMwNwMwIAsgASkDODcDOCALIAEpA0A3A0AgCxAaIAIgCSkDADcDACACIAkpAwg3AwggAiAJKQMQNwMQIAIgCSkDGDcDGCACIAkpAyA3AyAgAiAJKQMoNwMoIAIgCSkDMDcDMCACIAkpAzg3AzggAiAJKQNANwNAIAIgCRAVIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAAkACQCABKAIAIgRBCEYEQEEIIQgCQAJAAkADQCAIQX9qIQQgCEUNBSAEQRBPDQEgAUEEaiAEQQJ0aigCACIIIARBAnRBxAlqKAIAIhNHDQIgBCEIDAALAAtBvAsgBEEQECgMAQsgCCATTw0CCwUgBEEITw0BCwwBCyABQcAJEBYLIAMgASkDADcDACADIAEpAwg3AwggAyABKQMQNwMQIAMgASkDGDcDGCADIAEpAyA3AyAgAyABKQMoNwMoIAMgASkDMDcDMCADIAEpAzg3AzggAyABKQNANwNAIAIgAykDADcDACACIAMpAwg3AwggAiADKQMQNwMQIAIgAykDGDcDGCACIAMpAyA3AyAgAiADKQMoNwMoIAIgAykDMDcDMCACIAMpAzg3AzggAiADKQNANwNAIAIgCRAVIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAAkACQCABKAIAIgRBCEYEQEEIIQgCQAJAAkADQCAIQX9qIQQgCEUNBSAEQRBPDQEgAUEEaiAEQQJ0aigCACIIIARBAnRBxAlqKAIAIglHDQIgBCEIDAALAAtBvAsgBEEQECgMAQsgCCAJTw0CCwUgBEEITw0BCwwBCyABQcAJEBYLIAcgASkDADcDACAHIAEpAwg3AwggByABKQMQNwMQIAcgASkDGDcDGCAHIAEpAyA3AyAgByABKQMoNwMoIAcgASkDMDcDMCAHIAEpAzg3AzggByABKQNANwNAIAIgBykDADcDACACIAcpAwg3AwggAiAHKQMQNwMQIAIgBykDGDcDGCACIAcpAyA3AyAgAiAHKQMoNwMoIAIgBykDMDcDMCACIAcpAzg3AzggAiAHKQNANwNAIAIgBxAXIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAIAEQGyADIAEpAwA3AwAgAyABKQMINwMIIAMgASkDEDcDECADIAEpAxg3AxggAyABKQMgNwMgIAMgASkDKDcDKCADIAEpAzA3AzAgAyABKQM4NwM4IAMgASkDQDcDQCACIAMpAwA3AwAgAiADKQMINwMIIAIgAykDEDcDECACIAMpAxg3AxggAiADKQMgNwMgIAIgAykDKDcDKCACIAMpAzA3AzAgAiADKQM4NwM4IAIgAykDQDcDQCACIAsQFiABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABLABEBEAgAUHACRAVCyAFIAEpAwA3AwAgBSABKQMINwMIIAUgASkDEDcDECAFIAEpAxg3AxggBSABKQMgNwMgIAUgASkDKDcDKCAFIAEpAzA3AzAgBSABKQM4NwM4IAUgASkDQDcDQCACIAUpAwA3AwAgAiAFKQMINwMIIAIgBSkDEDcDECACIAUpAxg3AxggAiAFKQMgNwMgIAIgBSkDKDcDKCACIAUpAzA3AzAgAiAFKQM4NwM4IAIgBSkDQDcDQCACIAsQFiABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABLABEBEAgAUHACRAVCyAOIAEpAwA3AwAgDiABKQMINwMIIA4gASkDEDcDECAOIAEpAxg3AxggDiABKQMgNwMgIA4gASkDKDcDKCAOIAEpAzA3AzAgDiABKQM4NwM4IA4gASkDQDcDQCAGIA0pAwA3AwAgBiANKQMINwMIIAYgDSkDEDcDECAGIA0pAxg3AxggBiANKQMgNwMgIAYgDSkDKDcDKCAGIA0pAzA3AzAgBiANKQM4NwM4IAYgDSkDQDcDQCAGEBogBhAaIAYQGiAPIA4pAwA3AwAgDyAOKQMINwMIIA8gDikDEDcDECAPIA4pAxg3AxggDyAOKQMgNwMgIA8gDikDKDcDKCAPIA4pAzA3AzAgDyAOKQM4NwM4IA8gDikDQDcDQCACIAspAwA3AwAgAiALKQMINwMIIAIgCykDEDcDECACIAspAxg3AxggAiALKQMgNwMgIAIgCykDKDcDKCACIAspAzA3AzAgAiALKQM4NwM4IAIgCykDQDcDQCACIA4QFiABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABLABEBEAgAUHACRAVCyADIAEpAwA3AwAgAyABKQMINwMIIAMgASkDEDcDECADIAEpAxg3AxggAyABKQMgNwMgIAMgASkDKDcDKCADIAEpAzA3AzAgAyABKQM4NwM4IAMgASkDQDcDQCACIAcpAwA3AwAgAiAHKQMINwMIIAIgBykDEDcDECACIAcpAxg3AxggAiAHKQMgNwMgIAIgBykDKDcDKCACIAcpAzA3AzAgAiAHKQM4NwM4IAIgBykDQDcDQCACIAMQFyABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABEBsgBSABKQMANwMAIAUgASkDCDcDCCAFIAEpAxA3AxAgBSABKQMYNwMYIAUgASkDIDcDICAFIAEpAyg3AyggBSABKQMwNwMwIAUgASkDODcDOCAFIAEpA0A3A0AgAiAFKQMANwMAIAIgBSkDCDcDCCACIAUpAxA3AxAgAiAFKQMYNwMYIAIgBSkDIDcDICACIAUpAyg3AyggAiAFKQMwNwMwIAIgBSkDODcDOCACIAUpA0A3A0AgAiAGEBYgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgASwARARAIAFBwAkQFQsgECABKQMANwMAIBAgASkDCDcDCCAQIAEpAxA3AxAgECABKQMYNwMYIBAgASkDIDcDICAQIAEpAyg3AyggECABKQMwNwMwIBAgASkDODcDOCAQIAEpA0A3A0AgAiAMKQIANwIAIAIgDCkCCDcCCCACIAwpAhA3AhAgAiAMKQIYNwIYIAIgDCkCIDcCICACIAwpAig3AiggAiAMKQIwNwIwIAIgDCkCODcCOCACIAwpAkA3AkAgAiAMEBUgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0ACQAJAIAEoAgAiBEEIRgRAQQghCAJAAkACQANAIAhBf2ohBCAIRQ0FIARBEE8NASABQQRqIARBAnRqKAIAIgggBEECdEHECWooAgAiAkcNAiAEIQgMAAsAC0G8CyAEQRAQKAwBCyAIIAJPDQILBSAEQQhPDQELDAELIAFBwAkQFgsgCiABKQMANwMAIAogASkDCDcDCCAKIAEpAxA3AxAgCiABKQMYNwMYIAogASkDIDcDICAKIAEpAyg3AyggCiABKQMwNwMwIAogASkDODcDOCAKIAEpA0A3A0AgDAwBCyACIAApAgA3AgAgAiAAKQIINwIIIAIgACkCEDcCECACIAApAhg3AhggAiAAKQIgNwIgIAIgACkCKDcCKCACIAApAjA3AjAgAiAAKQI4NwI4IAIgACkCQDcCQCACIAAQFyABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABEBsgCSABKQMANwMAIAkgASkDCDcDCCAJIAEpAxA3AxAgCSABKQMYNwMYIAkgASkDIDcDICAJIAEpAyg3AyggCSABKQMwNwMwIAkgASkDODcDOCAJIAEpA0A3A0AgAiAAQcgAaiIMKQIANwIAIAIgDCkCCDcCCCACIAwpAhA3AhAgAiAMKQIYNwIYIAIgDCkCIDcCICACIAwpAig3AiggAiAMKQIwNwIwIAIgDCkCODcCOCACIAwpAkA3AkAgAiAMEBcgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgARAbIAQgASkDADcDACAEIAEpAwg3AwggBCABKQMQNwMQIAQgASkDGDcDGCAEIAEpAyA3AyAgBCABKQMoNwMoIAQgASkDMDcDMCAEIAEpAzg3AzggBCABKQNANwNAIAIgBCkDADcDACACIAQpAwg3AwggAiAEKQMQNwMQIAIgBCkDGDcDGCACIAQpAyA3AyAgAiAEKQMoNwMoIAIgBCkDMDcDMCACIAQpAzg3AzggAiAEKQNANwNAIAIgBBAXIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAIAEQGyANIAEpAwA3AwAgDSABKQMINwMIIA0gASkDEDcDECANIAEpAxg3AxggDSABKQMgNwMgIA0gASkDKDcDKCANIAEpAzA3AzAgDSABKQM4NwM4IA0gASkDQDcDQCACIAApAgA3AgAgAiAAKQIINwIIIAIgACkCEDcCECACIAApAhg3AhggAiAAKQIgNwIgIAIgACkCKDcCKCACIAApAjA3AjAgAiAAKQI4NwI4IAIgACkCQDcCQCACIAQQFSABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQAJAAkAgASgCACIEQQhGBEBBCCEIAkACQAJAA0AgCEF/aiEEIAhFDQUgBEEQTw0BIAFBBGogBEECdGooAgAiCCAEQQJ0QcQJaigCACITRw0CIAQhCAwACwALQbwLIARBEBAoDAELIAggE08NAgsFIARBCE8NAQsMAQsgAUHACRAWCyADIAEpAwA3AwAgAyABKQMINwMIIAMgASkDEDcDECADIAEpAxg3AxggAyABKQMgNwMgIAMgASkDKDcDKCADIAEpAzA3AzAgAyABKQM4NwM4IAMgASkDQDcDQCACIAMpAwA3AwAgAiADKQMINwMIIAIgAykDEDcDECACIAMpAxg3AxggAiADKQMgNwMgIAIgAykDKDcDKCACIAMpAzA3AzAgAiADKQM4NwM4IAIgAykDQDcDQCACIAMQFyABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABEBsgBSABKQMANwMAIAUgASkDCDcDCCAFIAEpAxA3AxAgBSABKQMYNwMYIAUgASkDIDcDICAFIAEpAyg3AyggBSABKQMwNwMwIAUgASkDODcDOCAFIAEpA0A3A0AgAiAFKQMANwMAIAIgBSkDCDcDCCACIAUpAxA3AxAgAiAFKQMYNwMYIAIgBSkDIDcDICACIAUpAyg3AyggAiAFKQMwNwMwIAIgBSkDODcDOCACIAUpA0A3A0AgAiAJEBYgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgASwARARAIAFBwAkQFQsgBiABKQMANwMAIAYgASkDCDcDCCAGIAEpAxA3AxAgBiABKQMYNwMYIAYgASkDIDcDICAGIAEpAyg3AyggBiABKQMwNwMwIAYgASkDODcDOCAGIAEpA0A3A0AgAiAGKQMANwMAIAIgBikDCDcDCCACIAYpAxA3AxAgAiAGKQMYNwMYIAIgBikDIDcDICACIAYpAyg3AyggAiAGKQMwNwMwIAIgBikDODcDOCACIAYpA0A3A0AgAiANEBYgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgASwARARAIAFBwAkQFQsgCyABKQMANwMAIAsgASkDCDcDCCALIAEpAxA3AxAgCyABKQMYNwMYIAsgASkDIDcDICALIAEpAyg3AyggCyABKQMwNwMwIAsgASkDODcDOCALIAEpA0A3A0AgCxAaIAIgCSkDADcDACACIAkpAwg3AwggAiAJKQMQNwMQIAIgCSkDGDcDGCACIAkpAyA3AyAgAiAJKQMoNwMoIAIgCSkDMDcDMCACIAkpAzg3AzggAiAJKQNANwNAIAIgCRAVIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAAkACQCABKAIAIgRBCEYEQEEIIQgCQAJAAkADQCAIQX9qIQQgCEUNBSAEQRBPDQEgAUEEaiAEQQJ0aigCACIIIARBAnRBxAlqKAIAIhNHDQIgBCEIDAALAAtBvAsgBEEQECgMAQsgCCATTw0CCwUgBEEITw0BCwwBCyABQcAJEBYLIAMgASkDADcDACADIAEpAwg3AwggAyABKQMQNwMQIAMgASkDGDcDGCADIAEpAyA3AyAgAyABKQMoNwMoIAMgASkDMDcDMCADIAEpAzg3AzggAyABKQNANwNAIAIgAykDADcDACACIAMpAwg3AwggAiADKQMQNwMQIAIgAykDGDcDGCACIAMpAyA3AyAgAiADKQMoNwMoIAIgAykDMDcDMCACIAMpAzg3AzggAiADKQNANwNAIAIgCRAVIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAAkACQCABKAIAIgRBCEYEQEEIIQgCQAJAAkADQCAIQX9qIQQgCEUNBSAEQRBPDQEgAUEEaiAEQQJ0aigCACIIIARBAnRBxAlqKAIAIglHDQIgBCEIDAALAAtBvAsgBEEQECgMAQsgCCAJTw0CCwUgBEEITw0BCwwBCyABQcAJEBYLIAcgASkDADcDACAHIAEpAwg3AwggByABKQMQNwMQIAcgASkDGDcDGCAHIAEpAyA3AyAgByABKQMoNwMoIAcgASkDMDcDMCAHIAEpAzg3AzggByABKQNANwNAIAIgBykDADcDACACIAcpAwg3AwggAiAHKQMQNwMQIAIgBykDGDcDGCACIAcpAyA3AyAgAiAHKQMoNwMoIAIgBykDMDcDMCACIAcpAzg3AzggAiAHKQNANwNAIAIgBxAXIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAIAEQGyAOIAEpAwA3AwAgDiABKQMINwMIIA4gASkDEDcDECAOIAEpAxg3AxggDiABKQMgNwMgIA4gASkDKDcDKCAOIAEpAzA3AzAgDiABKQM4NwM4IA4gASkDQDcDQCAGIA0pAwA3AwAgBiANKQMINwMIIAYgDSkDEDcDECAGIA0pAxg3AxggBiANKQMgNwMgIAYgDSkDKDcDKCAGIA0pAzA3AzAgBiANKQM4NwM4IAYgDSkDQDcDQCAGEBogBhAaIAYQGiACIA4pAwA3AwAgAiAOKQMINwMIIAIgDikDEDcDECACIA4pAxg3AxggAiAOKQMgNwMgIAIgDikDKDcDKCACIA4pAzA3AzAgAiAOKQM4NwM4IAIgDikDQDcDQCACIAsQFiABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABLABEBEAgAUHACRAVCyADIAEpAwA3AwAgAyABKQMINwMIIAMgASkDEDcDECADIAEpAxg3AxggAyABKQMgNwMgIAMgASkDKDcDKCADIAEpAzA3AzAgAyABKQM4NwM4IAMgASkDQDcDQCACIAMpAwA3AwAgAiADKQMINwMIIAIgAykDEDcDECACIAMpAxg3AxggAiADKQMgNwMgIAIgAykDKDcDKCACIAMpAzA3AzAgAiADKQM4NwM4IAIgAykDQDcDQCACIAsQFiABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABLABEBEAgAUHACRAVCyAPIAEpAwA3AwAgDyABKQMINwMIIA8gASkDEDcDECAPIAEpAxg3AxggDyABKQMgNwMgIA8gASkDKDcDKCAPIAEpAzA3AzAgDyABKQM4NwM4IA8gASkDQDcDQCACIAspAwA3AwAgAiALKQMINwMIIAIgCykDEDcDECACIAspAxg3AxggAiALKQMgNwMgIAIgCykDKDcDKCACIAspAzA3AzAgAiALKQM4NwM4IAIgCykDQDcDQCACIA8QFiABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABLABEBEAgAUHACRAVCyADIAEpAwA3AwAgAyABKQMINwMIIAMgASkDEDcDECADIAEpAxg3AxggAyABKQMgNwMgIAMgASkDKDcDKCADIAEpAzA3AzAgAyABKQM4NwM4IAMgASkDQDcDQCACIAcpAwA3AwAgAiAHKQMINwMIIAIgBykDEDcDECACIAcpAxg3AxggAiAHKQMgNwMgIAIgBykDKDcDKCACIAcpAzA3AzAgAiAHKQM4NwM4IAIgBykDQDcDQCACIAMQFyABIAIpAwA3AwAgASACKQMINwMIIAEgAikDEDcDECABIAIpAxg3AxggASACKQMgNwMgIAEgAikDKDcDKCABIAIpAzA3AzAgASACKQM4NwM4IAEgAikDQDcDQCABEBsgBSABKQMANwMAIAUgASkDCDcDCCAFIAEpAxA3AxAgBSABKQMYNwMYIAUgASkDIDcDICAFIAEpAyg3AyggBSABKQMwNwMwIAUgASkDODcDOCAFIAEpA0A3A0AgAiAFKQMANwMAIAIgBSkDCDcDCCACIAUpAxA3AxAgAiAFKQMYNwMYIAIgBSkDIDcDICACIAUpAyg3AyggAiAFKQMwNwMwIAIgBSkDODcDOCACIAUpA0A3A0AgAiAGEBYgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgASwARARAIAFBwAkQFQsgECABKQMANwMAIBAgASkDCDcDCCAQIAEpAxA3AxAgECABKQMYNwMYIBAgASkDIDcDICAQIAEpAyg3AyggECABKQMwNwMwIBAgASkDODcDOCAQIAEpA0A3A0AgAiAMKQIANwIAIAIgDCkCCDcCCCACIAwpAhA3AhAgAiAMKQIYNwIYIAIgDCkCIDcCICACIAwpAig3AiggAiAMKQIwNwIwIAIgDCkCODcCOCACIAwpAkA3AkAgAiASEBcgASACKQMANwMAIAEgAikDCDcDCCABIAIpAxA3AxAgASACKQMYNwMYIAEgAikDIDcDICABIAIpAyg3AyggASACKQMwNwMwIAEgAikDODcDOCABIAIpA0A3A0AgARAbIAogASkDADcDACAKIAEpAwg3AwggCiABKQMQNwMQIAogASkDGDcDGCAKIAEpAyA3AyAgCiABKQMoNwMoIAogASkDMDcDMCAKIAEpAzg3AzggCiABKQNANwNAIAIgCikDADcDACACIAopAwg3AwggAiAKKQMQNwMQIAIgCikDGDcDGCACIAopAyA3AyAgAiAKKQMoNwMoIAIgCikDMDcDMCACIAopAzg3AzggAiAKKQNANwNAIAIgChAVIAEgAikDADcDACABIAIpAwg3AwggASACKQMQNwMQIAEgAikDGDcDGCABIAIpAyA3AyAgASACKQMoNwMoIAEgAikDMDcDMCABIAIpAzg3AzggASACKQNANwNAAkACQCABKAIAIgRBCEYEQEEIIQgCQAJAAkADQCAIQX9qIQQgCEUNBSAEQRBPDQEgAUEEaiAEQQJ0aigCACIIIARBAnRBxAlqKAIAIgJHDQIgBCEIDAALAAtBvAsgBEEQECgMAQsgCCACTw0CCwUgBEEITw0BCwwBCyABQcAJEBYLIAogASkDADcDACAKIAEpAwg3AwggCiABKQMQNwMQIAogASkDGDcDGCAKIAEpAyA3AyAgCiABKQMoNwMoIAogASkDMDcDMCAKIAEpAzg3AzggCiABKQNANwNAIAwLIQQgACAPKQIANwIAIAAgDykCCDcCCCAAIA8pAhA3AhAgACAPKQIYNwIYIAAgDykCIDcCICAAIA8pAig3AiggACAPKQIwNwIwIAAgDykCODcCOCAAIA8pAkA3AkAgBCAQKQIANwIAIAQgECkCCDcCCCAEIBApAhA3AhAgBCAQKQIYNwIYIAQgECkCIDcCICAEIBApAig3AiggBCAQKQIwNwIwIAQgECkCODcCOCAEIBApAkA3AkAgEiAKKQIANwIAIBIgCikCCDcCCCASIAopAhA3AhAgEiAKKQIYNwIYIBIgCikCIDcCICASIAopAig3AiggEiAKKQIwNwIwIBIgCikCODcCOCASIAopAkA3AkAgESQCCwukBAEQfwJ/IwIhAyMCQZABaiQCIAFBIEcEQCADJAJBAA8LIAAoAhwQOyEBIAAoAhgiAhA7IQQgACgCFCIFEDshByAAKAIQIggQOyEJIAAoAgwiChA7IQsgACgCCCIMEDshDSAAKAIEIg4QOyEPIAAoAgAiEBA7IREgA0HIAGoiAEEAOgBEIABBCDYCACAAIAE2AgQgACAENgIIIAAgBzYCDCAAIAk2AhAgACALNgIUIAAgDTYCGCAAIA82AhwgACARNgIgIABBJGoiAUIANwIAIAFCADcCCCABQgA3AhAgAUIANwIYIAAgEAR/QQgFIA4Ef0EHBSAMBH9BBgUgCgR/QQUFIAgEf0EEBSAFBH9BAwUgAgR/QQIFQQELCwsLCwsLIgE2AgAgAyICIAApAwA3AwAgAiAAKQMINwMIIAIgACkDEDcDECACIAApAxg3AxggAiAAKQMgNwMgIAIgACkDKDcDKCACIAApAzA3AzAgAiAAKQM4NwM4IAIgACkDQDcDQAJAAkACQCACKAIAIgRBCEYEQEEIIQECQAJAAkADQCABQX9qIQAgAUUNBiAAQRBPDQEgAkEEaiAAQQJ0aigCACIBIABBAnRB7ApqKAIAIgVHDQIgACEBDAALAAtBvAsgAEEQECgMAQsgASAFSQ0CDAMLBSAEQQhJDQEMAgsMAgsgBEEBRyACKAIEQQBHckUNAEEBIQYMAQtBACEGCyADJAIgBgsLvQYBD38CQCMCIQgjAkHgAWokAiADQSBJBEBBICADECcLIAghBSACKAIcEDshCSACKAIYEDshCiACKAIUEDshCyACKAIQEDshDCACKAIMEDshDSACKAIIEDshDiACKAIEEDshDyACKAIAEDshBiAIQcgAaiIEQQA6AEQgBCADQQJ2IgI2AgAgBCAJNgIEIAQgCjYCCCAEIAs2AgwgBCAMNgIQIAQgDTYCFCAEIA42AhggBCAPNgIcIAQgBjYCICAEQSRqIgNCADcCACADQgA3AgggA0IANwIQIANCADcCGAJAAkADQAJAIAJBf2oiA0EQTw0CIARBBGogA0ECdGooAgAEQCACIQcMAQsgA0EBSwRAIAMhAgwCBSADIQcLCwsMAQtBsAsgA0EQECgLIAQgBzYCACAFIAQpAwA3AwAgBSAEKQMINwMIIAUgBCkDEDcDECAFIAQpAxg3AxggBSAEKQMgNwMgIAUgBCkDKDcDKCAFIAQpAzA3AzAgBSAEKQM4NwM4IAUgBCkDQDcDQAJAAkAgBSgCACIGQQhGBEBBCCECAkACQAJAA0AgAkF/aiEDIAJFDQYgA0EQTw0BIAVBBGogA0ECdGooAgAiByADQQJ0QewKaigCACICRw0CIAMhAgwACwALQbwLIANBEBAoDAELIAcgAkkNAgsFIAZBCEkNAQsMAQsgBkEBRgRAIAUoAgRFDQELIAQgASAFECAgBCgCBBA7IRAgBCgCCBA7IREgBCgCDBA7IRIgBCgCEBA7IQkgBCgCFBA7IQogBCgCGBA7IQsgBCgCHBA7IQwgBCgCIBA7IQ0gBCgCTBA7IQ4gBCgCUBA7IQ8gBCgCVBA7IQYgBCgCWBA7IQUgBCgCXBA7IQcgBCgCYBA7IQMgBCgCZBA7IQIgBCgCaBA7IQEgAEEBOgAAIABBBDoAASAAIA02AAIgACAMNgAGIAAgCzYACiAAIAo2AA4gACAJNgASIAAgEjYAFiAAIBE2ABogACAQNgAeIAAgATYAIiAAIAI2ACYgACADNgAqIAAgBzYALiAAIAU2ADIgACAGNgA2IAAgDzYAOiAAIA42AD4gCCQCDwsgAEEAOgAAIAgkAgsLdgECfwJAIwIhAiMCQTBqJAIgAkEoaiIDIAA2AgAgAkEsaiIAIAE2AgAgAkEYaiIBIAM2AgAgAUEBNgIEIAEgADYCCCABQQE2AgwgAkGsDzYCACACQQI2AgQgAkEANgIIIAIgATYCECACQQI2AhQgAkG8DxAsCwt1AQJ/AkAjAiEDIwJBMGokAiADQShqIgQgATYCACADQSxqIgEgAjYCACADQRhqIgIgATYCACACQQE2AgQgAiAENgIIIAJBATYCDCADQZwPNgIAIANBAjYCBCADQQA2AgggAyACNgIQIANBAjYCFCADIAAQLAsLDwAgAQR/IAAgAXAFQQALCw8AIAEEfyAAIAFuBUEACwvNAgEHfwJ/IwIhBSMCQTBqJAIgBSEEIAAoAgAiAEGPzgBLBEBBJyEGA0AgAEGQzgAQKSECIABBkM4AECohAyACQeQAECpBAXQhByACQeQAEClBAXQhCCAEIAZBfGoiAmogB0GQF2ouAAA7AAAgBCAGQX5qaiAIQZAXai4AADsAACAAQf/B1y9LBEAgAiEGIAMhAAwBBSADIQALCwVBJyECCyAAQeMASgRAIABB5AAQKUEBdCEDIABB5AAQKiEAIAQgAkF+aiICaiADQZAXai4AADsAAAsgAEEKSAR/IAQgAkF/aiIDaiAAQf8BcUEwajoAACABQQFBrL8BQQAgBCADIgBqQScgAGsQLSEAIAUkAiAABSAEIAJBfmoiA2ogAEEBdEGQF2ouAAA7AAAgAUEBQay/AUEAIAQgAyIAakEnIABrEC0hACAFJAIgAAsLC3QBBH8CQCMCIQIjAkEwaiQCIAEoAgAhAyABKAIEIQQgASgCCCEFIAIiASAAKQIANwIAIAEgACkCCDcCCCABIAApAhA3AhAgAkEYaiIAIAEpAgA3AgAgACABKQIINwIIIAAgASkCEDcCECAAIAMgBCAFEA4LC/cRAQ1/An8jAiEMIwJBEGokAiAAKAIAIQgCQAJAIAEEQCAIQQFxBEBBKyEGDAIFQQAhDkEAIQYgBSEHCwVBLSEGDAELDAELQQEhDiAFQQFqIQcLIAhBBHEEfyACIANqIQsgAwRAIAIhAUEAIQkDQCABLAAAQcABcUGAAUYgCWohCSABQQFqIgEgC0cNAAsFQQAhCQsgByADaiAJayEHQQEFQQALIREgDEEEaiEBIAAoAghFBEAgDkEBRgRAIAAoAhghDSAAKAIcIQogAUEANgIAIAZBgAFJBEAgASAGOgAAQQEhBwUgBkGAEEkEf0FAIQhBASELQQIhByABBSAGQYCABEkEfyABQWA6AABBgH8hCEECIQtBAyEHIAFBAWoFIAFBcDoAACABQYB/OgABQYB/IQhBAyELQQQhByABQQJqCwsiCSAIOgAAIAEgC2ogBkE/cUGAf3I6AAALIA0gASAHIAooAgxBA3FBAmoRAABB/wFxBEAgDCQCQQEPCwsgAEEYaiEBIBEEQCABKAIAIAIgAyAAQRxqIgAoAgAoAgxBA3FBAmoRAABB/wFxBEAgDCQCQQEPCwUgAEEcaiEACyABKAIAIAQgBSAAKAIAKAIMQQNxQQJqEQAAIQAgDCQCIAAPCyAAKAIMIgogB00EQCAOQQFGBEAgACgCGCENIAAoAhwhCiABQQA2AgAgBkGAAUkEQCABIAY6AABBASEHBSAGQYAQSQR/QUAhCEEBIQtBAiEHIAEFIAZBgIAESQR/IAFBYDoAAEGAfyEIQQIhC0EDIQcgAUEBagUgAUFwOgAAIAFBgH86AAFBgH8hCEEDIQtBBCEHIAFBAmoLCyIJIAg6AAAgASALaiAGQT9xQYB/cjoAAAsgDSABIAcgCigCDEEDcUECahEAAEH/AXEEQCAMJAJBAQ8LCyAAQRhqIQEgEQRAIAEoAgAgAiADIABBHGoiACgCACgCDEEDcUECahEAAEH/AXEEQCAMJAJBAQ8LBSAAQRxqIQALIAEoAgAgBCAFIAAoAgAoAgxBA3FBAmoRAAAhACAMJAIgAA8LIAwhCSAIQQhxRQRAIAogB2shBwJAAkACQAJAIAAsADAiCEEDRgR/QQEFIAgLQQNxDgMAAgECCyAHIQhBACEHDAILIAdBAWpBAXYhCCAHQQF2IQcMAQtBACEICyAJQQA2AgAgACgCBCIKQYABSQR/IAkgCjoAAEEBBSAKQYAQSQR/IApBBnZBH3FBQHIhD0EBIRBBAiENIAkFIApBgIAESQR/IAkgCkEMdkEPcUFgcjoAACAKQQZ2QT9xQYB/ciEPQQIhEEEDIQ0gCUEBagUgCSAKQRJ2Qf8BcUFwcjoAACAJIApBDHZBP3FBgH9yOgABIApBBnZBP3FBgH9yIQ9BAyEQQQQhDSAJQQJqCwsiCyAPOgAAIAkgEGogCkE/cUGAf3I6AAAgDQshCyAAQRhqIQ0gAEEcaiEKQQAhAAJAAkADQCAAIAdJBEAgAEEBaiEAIA0oAgAgCSALIAooAgAoAgxBA3FBAmoRAABB/wFxDQIMAQsLDAELIAwkAkEBDwsCQAJAIA5BAUcNACANKAIAIRAgCigCACESIAFBADYCACAGQYABSQRAIAEgBjoAAEEBIQcFIAZBgBBJBH9BQCEOQQEhD0ECIQcgAQUgBkGAgARJBH8gAUFgOgAAQYB/IQ5BAiEPQQMhByABQQFqBSABQXA6AAAgAUGAfzoAAUGAfyEOQQMhD0EEIQcgAUECagsLIgAgDjoAACABIA9qIAZBP3FBgH9yOgAACyAQIAEgByASKAIMQQNxQQJqEQAAQf8BcUUNAAwBCyARBEAgDSgCACACIAMgCigCACgCDEEDcUECahEAAEH/AXENAQsgDSgCACAEIAUgCigCACgCDEEDcUECahEAAEH/AXFFBEBBACEAAkACQANAIAAgCE8NASAAQQFqIQAgDSgCACAJIAsgCigCACgCDEEDcUECahEAAEH/AXFFDQAMAgsACyAMJAJBAA8LIAwkAkEBDwsLIAwkAkEBDwsgAEEEaiIPQTA2AgAgAEEwaiIQQQE6AAAgDkEBRgRAIAAoAhghDiAAKAIcIRIgAUEANgIAIAZBgAFJBEAgASAGOgAAQQEhCAUgBkGAEEkEf0FAIQtBASENQQIhCCABBSAGQYCABEkEfyABQWA6AABBgH8hC0ECIQ1BAyEIIAFBAWoFIAFBcDoAACABQYB/OgABQYB/IQtBAyENQQQhCCABQQJqCwsiCSALOgAAIAEgDWogBkE/cUGAf3I6AAALIA4gASAIIBIoAgxBA3FBAmoRAABB/wFxBEAgDCQCQQEPCwsgEQRAIAAoAhggAiADIAAoAhwoAgxBA3FBAmoRAABB/wFxBEAgDCQCQQEPCwsgCiAHayECAkACQAJAAkAgECwAACIDQQNGBH9BAQUgAwtBA3EOAwACAQILIAIhA0EAIQIMAgsgAkEBakEBdiEDIAJBAXYhAgwBC0EAIQMLIAFBADYCACAPKAIAIgZBgAFJBH8gASAGOgAAQQEFIAZBgBBJBH8gBkEGdkEfcUFAciEIQQEhC0ECIQcgAQUgBkGAgARJBH8gASAGQQx2QQ9xQWByOgAAIAZBBnZBP3FBgH9yIQhBAiELQQMhByABQQFqBSABIAZBEnZB/wFxQXByOgAAIAEgBkEMdkE/cUGAf3I6AAEgBkEGdkE/cUGAf3IhCEEDIQtBBCEHIAFBAmoLCyIJIAg6AAAgASALaiAGQT9xQYB/cjoAACAHCyEJIABBGGohByAAQRxqIQZBACEAAkACQANAIAAgAkkEQCAAQQFqIQAgBygCACABIAkgBigCACgCDEEDcUECahEAAEH/AXENAgwBCwsMAQsgDCQCQQEPCyAHKAIAIAQgBSAGKAIAKAIMQQNxQQJqEQAAQf8BcQRAIAwkAkEBDwVBACEACwJAAkADQCAAIANPDQEgAEEBaiEAIAcoAgAgASAJIAYoAgAoAgxBA3FBAmoRAABB/wFxRQ0ADAILAAsgDCQCQQAPCyAMJAJBAQsLiwEBBn8CQCMCIQEjAkEwaiQCIAAoAgQhAyAAKAIIIQQgACgCDCEFIAAoAhAhBiABQRhqIgIgACgCADYCACACIAM2AgQgASIAIAI2AgAgAEEBNgIEIABBADYCCCAAQfyxATYCECAAQQA2AhQgAUEgaiIBIAQ2AgAgASAFNgIEIAEgBjYCCCAAIAEQLAsLdgECfwJAIwIhAiMCQTBqJAIgAkEoaiIDIAA2AgAgAkEsaiIAIAE2AgAgAkEYaiIBIAM2AgAgAUEBNgIEIAEgADYCCCABQQE2AgwgAkHIDzYCACACQQI2AgQgAkEANgIIIAIgATYCECACQQI2AhQgAkHYDxAsCwswAQJ/An8jAiEBIwJBEGokAiABIgIgACgCPBA4NgIAQQYgAhABEDMhACABJAIgAAsLawEDfwJ/IwIhBCMCQSBqJAIgBCEDIARBEGohBSAAQQM2AiQgACgCAEHAAHFFBEAgAyAAKAI8NgIAIANBk6gBNgIEIAMgBTYCCEE2IAMQBARAIABBfzoASwsLIAAgASACEDchACAEJAIgAAsLZQECfwJ/IwIhBCMCQSBqJAIgBCIDIAAoAjw2AgAgA0EANgIEIAMgATYCCCADIARBFGoiADYCDCADIAI2AhBBjAEgAxACEDNBAEgEfyAAQX82AgBBfwUgACgCAAshACAEJAIgAAsLGgAgAEGAYEsEfxA0QQAgAGs2AgBBfwUgAAsLCAAQNUHAAGoLBAAQNgsFAEHgEAv9AgELfwJ/IwIhBSMCQTBqJAIgBUEQaiEGIAVBIGoiAyAAQRxqIgkoAgAiBDYCACADIABBFGoiCigCACAEayIENgIEIAMgATYCCCADIAI2AgwgBSIBIABBPGoiDCgCADYCACABIAM2AgQgAUECNgIIAkACQCAEIAJqIgRBkgEgARAGEDMiAUYNAEECIQcDQCABQQBOBEAgBCABayEEIANBCGohCCABIAMoAgQiDUsiCwRAIAghAwsgC0EfdEEfdSAHaiEHIAMgAygCACABIAsEfyANBUEAC2siAWo2AgAgA0EEaiIIIAgoAgAgAWs2AgAgBiAMKAIANgIAIAYgAzYCBCAGIAc2AgggBEGSASAGEAYQMyIBRg0CDAELCyAAQQA2AhAgCUEANgIAIApBADYCACAAIAAoAgBBIHI2AgAgB0ECRgR/QQAFIAIgAygCBGsLIQIMAQsgACAAKAIsIgEgACgCMGo2AhAgCSABNgIAIAogATYCAAsgBSQCIAILCwQAIAALUAECfwJ/IAIEfwNAIAAsAAAiAyABLAAAIgRGBEAgAEEBaiEAIAFBAWohAUEAIAJBf2oiAkUNAxoMAQsLIANB/wFxIARB/wFxawVBAAsLIgALnQIBBH8CfyAAIAJqIQQgAUH/AXEhASACQcMATgRAA0AgAEEDcQRAIAAgAToAACAAQQFqIQAMAQsLIARBfHEiBUHAAGshBiABIAFBCHRyIAFBEHRyIAFBGHRyIQMDQCAAIAZMBEAgACADNgIAIAAgAzYCBCAAIAM2AgggACADNgIMIAAgAzYCECAAIAM2AhQgACADNgIYIAAgAzYCHCAAIAM2AiAgACADNgIkIAAgAzYCKCAAIAM2AiwgACADNgIwIAAgAzYCNCAAIAM2AjggACADNgI8IABBwABqIQAMAQsLA0AgACAFSARAIAAgAzYCACAAQQRqIQAMAQsLCwNAIAAgBEgEQCAAIAE6AAAgAEEBaiEADAELCyAEIAJrCwsrACAAQf8BcUEYdCAAQQh1Qf8BcUEQdHIgAEEQdUH/AXFBCHRyIABBGHZyC8kDAQN/An8gAkGAwABOBEAgACABIAIQAw8LIAAhBCAAIAJqIQMgAEEDcSABQQNxRgRAA0AgAEEDcQRAIAJFBEAgBA8LIAAgASwAADoAACAAQQFqIQAgAUEBaiEBIAJBAWshAgwBCwsgA0F8cSICQcAAayEFA0AgACAFTARAIAAgASgCADYCACAAIAEoAgQ2AgQgACABKAIINgIIIAAgASgCDDYCDCAAIAEoAhA2AhAgACABKAIUNgIUIAAgASgCGDYCGCAAIAEoAhw2AhwgACABKAIgNgIgIAAgASgCJDYCJCAAIAEoAig2AiggACABKAIsNgIsIAAgASgCMDYCMCAAIAEoAjQ2AjQgACABKAI4NgI4IAAgASgCPDYCPCAAQcAAaiEAIAFBwABqIQEMAQsLA0AgACACSARAIAAgASgCADYCACAAQQRqIQAgAUEEaiEBDAELCwUgA0EEayECA0AgACACSARAIAAgASwAADoAACAAIAEsAAE6AAEgACABLAACOgACIAAgASwAAzoAAyAAQQRqIQAgAUEEaiEBDAELCwsDQCAAIANIBEAgACABLAAAOgAAIABBAWohACABQQFqIQEMAQsLIAQLCwsAAn9BABAAQQALCwsAAn9BARAAQQALCwsAAn9BAhAAQQALCwu9DA0AQYAIC+QBAQAAAAAAAACCgAAAAAAAAIqAAAAAAACAAIAAgAAAAICLgAAAAAAAAAEAAIAAAAAAgYAAgAAAAIAJgAAAAAAAgIoAAAAAAAAAiAAAAAAAAAAJgACAAAAAAAoAAIAAAAAAi4AAgAAAAACLAAAAAAAAgImAAAAAAACAA4AAAAAAAIACgAAAAAAAgIAAAAAAAACACoAAAAAAAAAKAACAAAAAgIGAAIAAAACAgIAAAAAAAIABAACAAAAAAAiAAIAAAACACAAAAC/8///+////////////////////////////////////AEGICgsFAQAAAAEAQdAKCzyxCQAAIgAAAPYCAABYCQAAWQAAADwBAAAIAAAAQUE20Ixe0r87oEiv5tyuuv7///////////////////8AQbALC6kBMwoAACIAAADwAgAA0wkAAGAAAAA9AAAA0wkAAGAAAACBAAAA0wkAAGAAAACLAAAA0wkAAGAAAACTAAAA0wkAAGAAAACbAAAA0wkAAGAAAADvAAAA0wkAAGAAAAD3AAAA0wkAAGAAAAC6AAAA0wkAAGAAAABeAQAA0wkAAGAAAAAxAQAA0wkAAGAAAAAyAQAA0wkAAGAAAAA4AQAA0wkAAGAAAAA9AQAAAQBBoA0LadMJAABgAAAAbgMAAFUKAABcAAAAEAAAADMKAAAiAAAA9gIAANMJAABgAAAAHgQAABQLAAAoAAAAsQoAAGMAAABCAAAAsQoAAGMAAAA9AAAAsQoAAGMAAABQAAAAsQoAAGMAAABSAAAAAQBB0A4LAQEAQZgPC00BAAAAXgsAACAAAAB+CwAAEgAAAFgMAAAGAAAAXgwAACIAAAA8CwAAIgAAAKACAACADAAAFgAAAJYMAAANAAAAPAsAACIAAACmAgAABQBB8A8LAQEAQYgQCw4BAAAAAgAAALRfAAAABABBoBALAQEAQa8QCwUK/////wBBnBILAiRZAEHUEgvPBuQHAAAvaG9tZS9tYWNpZWovLmNhcmdvL3JlZ2lzdHJ5L3NyYy9naXRodWIuY29tLTFlY2M2Mjk5ZGI5ZWM4MjMvdGlueS1rZWNjYWstMS4yLjEvc3JjL2xpYi5ycy9jaGVja291dC9zcmMvbGliY29yZS9zbGljZS9tb2QucnMvaG9tZS9tYWNpZWovLmNhcmdvL3JlZ2lzdHJ5L3NyYy9naXRodWIuY29tLTFlY2M2Mjk5ZGI5ZWM4MjMvdGlueS1zZWNwMjU2azEtMC4xLjAvc3JjL2JpZ19udW0ucnMvY2hlY2tvdXQvc3JjL2xpYmNvcmUvc2xpY2UvbW9kLnJzL2hvbWUvbWFjaWVqLy5jYXJnby9yZWdpc3RyeS9zcmMvZ2l0aHViLmNvbS0xZWNjNjI5OWRiOWVjODIzL3Rpbnktc2VjcDI1NmsxLTAuMS4wL3NyYy9uYWYucnMvaG9tZS9tYWNpZWovLmNhcmdvL3JlZ2lzdHJ5L3NyYy9naXRodWIuY29tLTFlY2M2Mjk5ZGI5ZWM4MjMvdGlueS1zZWNwMjU2azEtMC4xLjAvc3JjL2VjX3BvaW50X2cucnNpbnRlcm5hbCBlcnJvcjogZW50ZXJlZCB1bnJlYWNoYWJsZSBjb2RlL2NoZWNrb3V0L3NyYy9saWJjb3JlL3NsaWNlL21vZC5yc2luZGV4IG91dCBvZiBib3VuZHM6IHRoZSBsZW4gaXMgIGJ1dCB0aGUgaW5kZXggaXMgMDAwMTAyMDMwNDA1MDYwNzA4MDkxMDExMTIxMzE0MTUxNjE3MTgxOTIwMjEyMjIzMjQyNTI2MjcyODI5MzAzMTMyMzMzNDM1MzYzNzM4Mzk0MDQxNDI0MzQ0NDU0NjQ3NDg0OTUwNTE1MjUzNTQ1NTU2NTc1ODU5NjA2MTYyNjM2NDY1NjY2NzY4Njk3MDcxNzI3Mzc0NzU3Njc3Nzg3OTgwODE4MjgzODQ4NTg2ODc4ODg5OTA5MTkyOTM5NDk1OTY5Nzk4OTlpbmRleCAgb3V0IG9mIHJhbmdlIGZvciBzbGljZSBvZiBsZW5ndGggc2xpY2UgaW5kZXggc3RhcnRzIGF0ICBidXQgZW5kcyBhdCA=', 'base64'); diff --git a/js-old/src/api/local/ethkey/index.js b/js-old/src/api/local/ethkey/index.js deleted file mode 100644 index 07ca34ba1..000000000 --- a/js-old/src/api/local/ethkey/index.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import workerPool from './workerPool'; - -export function createKeyObject (key, password) { - return workerPool.action('createKeyObject', { key, password }) - .then((obj) => JSON.parse(obj)); -} - -export function decryptPrivateKey (keyObject, password) { - return workerPool - .action('decryptPrivateKey', { keyObject, password }) - .then((privateKey) => { - if (privateKey) { - return Buffer.from(privateKey); - } - - return null; - }); -} - -export function phraseToAddress (phrase) { - return phraseToWallet(phrase) - .then((wallet) => wallet.address); -} - -export function phraseToWallet (phrase) { - return workerPool.action('phraseToWallet', phrase); -} - -export function verifySecret (secret) { - return workerPool.action('verifySecret', secret); -} diff --git a/js-old/src/api/local/ethkey/index.spec.js b/js-old/src/api/local/ethkey/index.spec.js deleted file mode 100644 index ce4cc29df..000000000 --- a/js-old/src/api/local/ethkey/index.spec.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { randomPhrase } from '@parity/wordlist'; -import { phraseToAddress, phraseToWallet } from './'; - -// TODO: Skipping until Node.js 8.0 comes out and we can test WebAssembly -describe.skip('api/local/ethkey', () => { - describe('phraseToAddress', function () { - this.timeout(30000); - - it('generates a valid address', () => { - const phrase = randomPhrase(12); - - return phraseToAddress(phrase).then((address) => { - expect(address.length).to.be.equal(42); - expect(address.slice(0, 4)).to.be.equal('0x00'); - }); - }); - - it('generates valid address for empty phrase', () => { - return phraseToAddress('').then((address) => { - expect(address).to.be.equal('0x00a329c0648769a73afac7f9381e08fb43dbea72'); - }); - }); - }); - - describe('phraseToWallet', function () { - this.timeout(30000); - - it('generates a valid wallet object', () => { - const phrase = randomPhrase(12); - - return phraseToWallet(phrase).then((wallet) => { - expect(wallet.address.length).to.be.equal(42); - expect(wallet.secret.length).to.be.equal(66); - expect(wallet.public.length).to.be.equal(130); - - expect(wallet.address.slice(0, 4)).to.be.equal('0x00'); - expect(wallet.secret.slice(0, 2)).to.be.equal('0x'); - expect(wallet.public.slice(0, 2)).to.be.equal('0x'); - }); - }); - }); -}); diff --git a/js-old/src/api/local/ethkey/worker.js b/js-old/src/api/local/ethkey/worker.js deleted file mode 100644 index 76ccf06b2..000000000 --- a/js-old/src/api/local/ethkey/worker.js +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { bytesToHex } from '~/api/util/format'; -import { extern, slice } from './ethkey.js'; - -const isWorker = typeof self !== 'undefined'; - -// Stay compatible between environments -if (!isWorker) { - const scope = typeof global === 'undefined' ? window : global; - - scope.self = scope; -} - -// keythereum should never be used outside of the browser -let keythereum = require('keythereum'); - -if (isWorker) { - keythereum = self.keythereum; -} - -function route ({ action, payload }) { - if (action in actions) { - return actions[action](payload); - } - - return null; -} - -const input = slice(extern._input_ptr(), 1024); -const secret = slice(extern._secret_ptr(), 32); -const publicKey = slice(extern._public_ptr(), 64); -const address = slice(extern._address_ptr(), 20); - -extern._ecpointg(); - -const actions = { - phraseToWallet (phrase) { - const phraseUtf8 = Buffer.from(phrase, 'utf8'); - - if (phraseUtf8.length > input.length) { - throw new Error('Phrase is too long!'); - } - - input.set(phraseUtf8); - - extern._brain(phraseUtf8.length); - - const wallet = { - secret: bytesToHex(secret), - public: bytesToHex(publicKey), - address: bytesToHex(address) - }; - - return wallet; - }, - - verifySecret (key) { - const keyBuf = Buffer.from(key.slice(2), 'hex'); - - secret.set(keyBuf); - - return extern._verify_secret(); - }, - - createKeyObject ({ key, password }) { - key = Buffer.from(key); - password = Buffer.from(password); - - const iv = keythereum.crypto.randomBytes(16); - const salt = keythereum.crypto.randomBytes(32); - const keyObject = keythereum.dump(password, key, salt, iv); - - return JSON.stringify(keyObject); - }, - - decryptPrivateKey ({ keyObject, password }) { - password = Buffer.from(password); - - try { - const key = keythereum.recover(password, keyObject); - - // Convert to array to safely send from the worker - return Array.from(key); - } catch (e) { - return null; - } - } -}; - -self.onmessage = function ({ data }) { - try { - const result = route(data); - - postMessage([null, result]); - } catch (err) { - console.error(err); - postMessage([err.toString(), null]); - } -}; - -// Emulate a web worker in Node.js -class KeyWorker { - postMessage (data) { - // Force async - setTimeout(() => { - try { - const result = route(data); - - this.onmessage({ data: [null, result] }); - } catch (err) { - this.onmessage({ data: [err, null] }); - } - }, 0); - } - - onmessage (event) { - // no-op to be overriden - } -} - -if (exports != null) { - exports.KeyWorker = KeyWorker; -} diff --git a/js-old/src/api/local/ethkey/workerPool.js b/js-old/src/api/local/ethkey/workerPool.js deleted file mode 100644 index d7db73b41..000000000 --- a/js-old/src/api/local/ethkey/workerPool.js +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -// Allow a web worker in the browser, with a fallback for Node.js -const hasWebWorkers = typeof Worker !== 'undefined'; -const KeyWorker = hasWebWorkers ? require('worker-loader!./worker') - : require('./worker').KeyWorker; - -class WorkerContainer { - busy = false; - _worker = new KeyWorker(); - - action (action, payload) { - if (this.busy) { - throw new Error('Cannot issue an action on a busy worker!'); - } - - this.busy = true; - - return new Promise((resolve, reject) => { - this._worker.postMessage({ action, payload }); - this._worker.onmessage = ({ data }) => { - const [err, result] = data; - - this.busy = false; - - if (err) { - // `err` ought to be a String - reject(new Error(err)); - } else { - resolve(result); - } - }; - }); - } -} - -class WorkerPool { - pool = [ - new WorkerContainer(), - new WorkerContainer() - ]; - - queue = []; - - _getContainer () { - return this.pool.find((container) => !container.busy); - } - - action (action, payload) { - let container = this.pool.find((container) => !container.busy); - - let promise; - - // const start = Date.now(); - - if (container) { - promise = container.action(action, payload); - } else { - promise = new Promise((resolve, reject) => { - this.queue.push([action, payload, resolve]); - }); - } - - return promise - .catch((err) => { - this.processQueue(); - - throw err; - }) - .then((result) => { - this.processQueue(); - - // console.log('Work done in ', Date.now() - start); - - return result; - }); - } - - processQueue () { - let container = this._getContainer(); - - while (container && this.queue.length > 0) { - const [action, payload, resolve] = this.queue.shift(); - - resolve(container.action(action, payload)); - container = this._getContainer(); - } - } -} - -export default new WorkerPool(); diff --git a/js-old/src/api/local/index.js b/js-old/src/api/local/index.js deleted file mode 100644 index 190a38ea4..000000000 --- a/js-old/src/api/local/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default null; diff --git a/js-old/src/api/local/localAccountsMiddleware.js b/js-old/src/api/local/localAccountsMiddleware.js deleted file mode 100644 index c452f541a..000000000 --- a/js-old/src/api/local/localAccountsMiddleware.js +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import EthereumTx from 'ethereumjs-tx'; -import accounts from './accounts'; -import transactions from './transactions'; -import { Middleware } from '../transport'; -import { inNumber16 } from '../format/input'; -import { phraseToWallet, phraseToAddress, verifySecret } from './ethkey'; -import { randomPhrase } from '@parity/wordlist'; - -export default class LocalAccountsMiddleware extends Middleware { - constructor (transport) { - super(transport); - - const register = this.register.bind(this); - - register('eth_accounts', () => { - return accounts.accountAddresses(); - }); - - register('eth_coinbase', () => { - return accounts.lastAddress; - }); - - register('parity_accountsInfo', () => { - return accounts.map(({ name }) => { - return { name }; - }); - }); - - register('parity_allAccountsInfo', () => { - return accounts.map(({ name, meta, uuid }) => { - return { name, meta, uuid }; - }); - }); - - register('parity_changePassword', ([address, oldPassword, newPassword]) => { - const account = accounts.get(address); - - return account - .decryptPrivateKey(oldPassword) - .then((privateKey) => { - if (!privateKey) { - return false; - } - - account.changePassword(privateKey, newPassword); - - return true; - }); - }); - - register('parity_checkRequest', ([id]) => { - return transactions.hash(id) || Promise.resolve(null); - }); - - register('parity_dappsList', () => { - return []; - }); - - register('parity_defaultAccount', () => { - return accounts.dappsDefaultAddress; - }); - - register('parity_exportAccount', ([address, password]) => { - const account = accounts.get(address); - - if (!password) { - password = ''; - } - - return account.isValidPassword(password) - .then((isValid) => { - if (!isValid) { - throw new Error('Invalid password'); - } - - return account.export(); - }); - }); - - register('parity_generateSecretPhrase', () => { - return randomPhrase(12); - }); - - register('parity_getNewDappsAddresses', () => { - return accounts.accountAddresses(); - }); - - register('parity_getNewDappsDefaultAddress', () => { - return accounts.dappsDefaultAddress; - }); - - register('parity_hardwareAccountsInfo', () => { - return {}; - }); - - register('parity_newAccountFromPhrase', ([phrase, password]) => { - return phraseToWallet(phrase) - .then((wallet) => { - return accounts.create(wallet.secret, password); - }); - }); - - register('parity_newAccountFromSecret', ([secret, password]) => { - return verifySecret(secret) - .then((isValid) => { - if (!isValid) { - throw new Error('Invalid secret key'); - } - - return accounts.create(secret, password); - }); - }); - - register('parity_newAccountFromWallet', ([json, password]) => { - if (!password) { - password = ''; - } - - return accounts.restoreFromWallet(JSON.parse(json), password); - }); - - register('parity_setAccountMeta', ([address, meta]) => { - accounts.getLazyCreate(address).meta = meta; - - return true; - }); - - register('parity_setAccountName', ([address, name]) => { - accounts.getLazyCreate(address).name = name; - - return true; - }); - - register('parity_setNewDappsDefaultAddress', ([address]) => { - accounts.dappsDefaultAddress = address; - - return true; - }); - - register('parity_postTransaction', ([tx]) => { - if (!tx.from) { - tx.from = accounts.lastAddress; - } - - tx.nonce = null; - tx.condition = null; - - return transactions.add(tx); - }); - - register('parity_phraseToAddress', ([phrase]) => { - return phraseToAddress(phrase); - }); - - register('parity_useLocalAccounts', () => { - return true; - }); - - register('parity_listGethAccounts', () => { - return []; - }); - - register('parity_listOpenedVaults', () => { - return []; - }); - - register('parity_listRecentDapps', () => { - return {}; - }); - - register('parity_listVaults', () => { - return []; - }); - - register('parity_wsUrl', () => { - // This is a hack, will be replaced by a `hostname` setting on the node itself - return `${window.location.hostname}:8546`; - }); - - register('parity_dappsUrl', () => { - // This is a hack, will be replaced by a `hostname` setting on the node itself - return `${window.location.hostname}:8545`; - }); - - register('parity_hashContent', () => { - throw new Error('Functionality unavailable on a public wallet.'); - }); - - register('parity_killAccount', ([address, password]) => { - return accounts.remove(address, password); - }); - - register('parity_removeAddress', ([address]) => { - return accounts.remove(address, null); - }); - - register('parity_testPassword', ([address, password]) => { - const account = accounts.get(address); - - return account.isValidPassword(password); - }); - - register('parity_upgradeReady', () => { - return false; - }); - - register('signer_confirmRequest', ([id, modify, password]) => { - const { - gasPrice, - gas: gasLimit, - from, - to, - value, - data - } = Object.assign(transactions.get(id), modify); - - transactions.lock(id); - - const account = accounts.get(from); - - return Promise.all([ - this.rpcRequest('parity_nextNonce', [from]), - account.decryptPrivateKey(password) - ]) - .catch((err) => { - transactions.unlock(id); - - // transaction got unlocked, can propagate rejection further - throw err; - }) - .then(([nonce, privateKey]) => { - if (!privateKey) { - transactions.unlock(id); - - throw new Error('Invalid password'); - } - - const tx = new EthereumTx({ - nonce, - to, - data, - gasLimit: inNumber16(gasLimit), - gasPrice: inNumber16(gasPrice), - value: inNumber16(value) - }); - - tx.sign(privateKey); - - const serializedTx = `0x${tx.serialize().toString('hex')}`; - - return this.rpcRequest('eth_sendRawTransaction', [serializedTx]); - }) - .then((hash) => { - transactions.confirm(id, hash); - - return {}; - }); - }); - - register('signer_generateAuthorizationToken', () => { - return ''; - }); - - register('signer_rejectRequest', ([id]) => { - return transactions.reject(id); - }); - - register('signer_requestsToConfirm', () => { - return transactions.requestsToConfirm(); - }); - } -} diff --git a/js-old/src/api/local/localAccountsMiddleware.spec.js b/js-old/src/api/local/localAccountsMiddleware.spec.js deleted file mode 100644 index b3de3992d..000000000 --- a/js-old/src/api/local/localAccountsMiddleware.spec.js +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import LocalAccountsMiddleware from './localAccountsMiddleware'; -import JsonRpcBase from '../transport/jsonRpcBase'; - -const RPC_RESPONSE = Symbol('RPC response'); -const ADDRESS = '0x00a329c0648769a73afac7f9381e08fb43dbea72'; -const SECRET = '0x4d5db4107d237df6a3d58ee5f70ae63d73d7658d4026f2eefd2f204c81682cb7'; -const PASSWORD = 'password'; - -const FOO_PHRASE = 'foobar'; -const FOO_PASSWORD = 'foopass'; -const FOO_ADDRESS = '0x007ef7ac1058e5955e366ab9d6b6c4ebcc937e7e'; - -class MockedTransport extends JsonRpcBase { - _execute (method, params) { - return RPC_RESPONSE; - } -} - -// Skip till all CI runs on Node 8+ -describe.skip('api/local/LocalAccountsMiddleware', function () { - this.timeout(30000); - - let transport; - - beforeEach(() => { - transport = new MockedTransport(); - transport.addMiddleware(LocalAccountsMiddleware); - - // Same as `parity_newAccountFromPhrase` with empty phrase - return transport - .execute('parity_newAccountFromSecret', SECRET, PASSWORD) - .catch((_err) => { - // Ignore the error - all instances of LocalAccountsMiddleware - // share account storage - }); - }); - - it('registers all necessary methods', () => { - return Promise - .all([ - 'eth_accounts', - 'eth_coinbase', - 'parity_accountsInfo', - 'parity_allAccountsInfo', - 'parity_changePassword', - 'parity_checkRequest', - 'parity_defaultAccount', - 'parity_generateSecretPhrase', - 'parity_getNewDappsAddresses', - 'parity_hardwareAccountsInfo', - 'parity_newAccountFromPhrase', - 'parity_newAccountFromSecret', - 'parity_setAccountMeta', - 'parity_setAccountName', - 'parity_postTransaction', - 'parity_phraseToAddress', - 'parity_useLocalAccounts', - 'parity_listGethAccounts', - 'parity_listOpenedVaults', - 'parity_listRecentDapps', - 'parity_listVaults', - 'parity_killAccount', - 'parity_testPassword', - 'signer_confirmRequest', - 'signer_rejectRequest', - 'signer_requestsToConfirm' - ].map((method) => { - return transport - .execute(method) - .then((result) => { - expect(result).not.to.be.equal(RPC_RESPONSE); - }) - // Some errors are expected here since we are calling methods - // without parameters. - .catch((_) => {}); - })); - }); - - it('allows non-registered methods through', () => { - return transport - .execute('eth_getBalance', '0x407d73d8a49eeb85d32cf465507dd71d507100c1') - .then((result) => { - expect(result).to.be.equal(RPC_RESPONSE); - }); - }); - - it('can handle `eth_accounts`', () => { - return transport - .execute('eth_accounts') - .then((accounts) => { - expect(accounts.length).to.be.equal(1); - expect(accounts[0]).to.be.equal(ADDRESS); - }); - }); - - it('can handle `parity_defaultAccount`', () => { - return transport - .execute('parity_defaultAccount') - .then((address) => { - expect(address).to.be.equal(ADDRESS); - }); - }); - - it('can handle `parity_phraseToAddress`', () => { - return transport - .execute('parity_phraseToAddress', '') - .then((address) => { - expect(address).to.be.equal(ADDRESS); - - return transport.execute('parity_phraseToAddress', FOO_PHRASE); - }) - .then((address) => { - expect(address).to.be.equal(FOO_ADDRESS); - }); - }); - - it('can create and kill an account', () => { - return transport - .execute('parity_newAccountFromPhrase', FOO_PHRASE, FOO_PASSWORD) - .then((address) => { - expect(address).to.be.equal(FOO_ADDRESS); - - return transport.execute('eth_accounts'); - }) - .then((accounts) => { - expect(accounts.length).to.be.equal(2); - expect(accounts.includes(FOO_ADDRESS)).to.be.true; - - return transport.execute('parity_killAccount', FOO_ADDRESS, FOO_PASSWORD); - }) - .then((result) => { - expect(result).to.be.true; - - return transport.execute('eth_accounts'); - }) - .then((accounts) => { - expect(accounts.length).to.be.equal(1); - expect(accounts.includes(FOO_ADDRESS)).to.be.false; - }); - }); -}); diff --git a/js-old/src/api/local/transactions.js b/js-old/src/api/local/transactions.js deleted file mode 100644 index 421e73012..000000000 --- a/js-old/src/api/local/transactions.js +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { toHex } from '../util/format'; -import { TransportError } from '../transport'; - -const AWAITING = Symbol('awaiting'); -const LOCKED = Symbol('locked'); -const CONFIRMED = Symbol('confirmed'); -const REJECTED = Symbol('rejected'); - -class Transactions { - constructor () { - this.reset(); - } - - // should only really be needed in the constructor and tests - reset () { - this._id = 1; - this._states = {}; - } - - nextId () { - return toHex(this._id++); - } - - add (tx) { - const id = this.nextId(); - - this._states[id] = { - status: AWAITING, - transaction: tx - }; - - return id; - } - - get (id) { - const state = this._states[id]; - - if (!state || state.status !== AWAITING) { - return null; - } - - return state.transaction; - } - - lock (id) { - const state = this._states[id]; - - if (!state || state.status !== AWAITING) { - throw new Error('Trying to lock an invalid transaction'); - } - - state.status = LOCKED; - } - - unlock (id) { - const state = this._states[id]; - - if (!state || state.status !== LOCKED) { - throw new Error('Trying to unlock an invalid transaction'); - } - - state.status = AWAITING; - } - - hash (id) { - const state = this._states[id]; - - if (!state) { - return null; - } - - switch (state.status) { - case REJECTED: - throw TransportError.requestRejected(); - case CONFIRMED: - return state.hash; - default: - return null; - } - } - - confirm (id, hash) { - const state = this._states[id]; - const status = state ? state.status : null; - - switch (status) { - case AWAITING: break; - case LOCKED: break; - default: throw new Error('Trying to confirm an invalid transaction'); - } - - state.hash = hash; - state.status = CONFIRMED; - } - - reject (id) { - const state = this._states[id]; - - if (!state) { - return false; - } - - state.status = REJECTED; - - return true; - } - - requestsToConfirm () { - const result = []; - - Object.keys(this._states).forEach((id) => { - const state = this._states[id]; - - if (state.status === AWAITING) { - result.push({ - id, - origin: { - signer: '0x0' - }, - payload: { - sendTransaction: state.transaction - } - }); - } - }); - - return result; - } -} - -export default new Transactions(); diff --git a/js-old/src/api/local/transactions.spec.js b/js-old/src/api/local/transactions.spec.js deleted file mode 100644 index 65f2d8ddc..000000000 --- a/js-old/src/api/local/transactions.spec.js +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import transactions from './transactions'; -import { TransportError } from '../transport/error'; - -const DUMMY_TX = 'dummy'; - -describe('api/local/transactions', () => { - beforeEach(() => { - transactions.reset(); - }); - - it('can store transactions', () => { - const id1 = transactions.add(DUMMY_TX); - const id2 = transactions.add(DUMMY_TX); - const requests = transactions.requestsToConfirm(); - - expect(id1).to.be.equal('0x1'); - expect(id2).to.be.equal('0x2'); - expect(requests.length).to.be.equal(2); - expect(requests[0].id).to.be.equal(id1); - expect(requests[1].id).to.be.equal(id2); - expect(requests[0].payload.sendTransaction).to.be.equal(DUMMY_TX); - expect(requests[1].payload.sendTransaction).to.be.equal(DUMMY_TX); - }); - - it('can confirm transactions', () => { - const id1 = transactions.add(DUMMY_TX); - const id2 = transactions.add(DUMMY_TX); - - const hash1 = '0x1111111111111111111111111111111111111111'; - const hash2 = '0x2222222222222222222222222222222222222222'; - - transactions.confirm(id1, hash1); - transactions.confirm(id2, hash2); - - const requests = transactions.requestsToConfirm(); - - expect(requests.length).to.be.equal(0); - expect(transactions.hash(id1)).to.be.equal(hash1); - expect(transactions.hash(id2)).to.be.equal(hash2); - }); - - it('can reject transactions', () => { - const id = transactions.add(DUMMY_TX); - - transactions.reject(id); - - const requests = transactions.requestsToConfirm(); - - expect(requests.length).to.be.equal(0); - expect(() => transactions.hash(id)).to.throw(TransportError); - }); - - it('can lock and confirm transactions', () => { - const id = transactions.add(DUMMY_TX); - const hash = '0x1111111111111111111111111111111111111111'; - - transactions.lock(id); - - const requests = transactions.requestsToConfirm(); - - expect(requests.length).to.be.equal(0); - expect(transactions.get(id)).to.be.null; - expect(transactions.hash(id)).to.be.null; - - transactions.confirm(id, hash); - - expect(transactions.hash(id)).to.be.equal(hash); - }); -}); diff --git a/js-old/src/api/pubsub/eth/eth.js b/js-old/src/api/pubsub/eth/eth.js deleted file mode 100644 index 0bbc85bec..000000000 --- a/js-old/src/api/pubsub/eth/eth.js +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . -import PubsubBase from '../pubsubBase'; - -import { inAddress, inBlockNumber, inHex, inNumber16, inOptions, inFilter } from '../../format/input'; -import { outAddress, outBlock, outNumber, outTransaction, outSyncing, outReceipt, outLog } from '../../format/output'; - -export default class Eth extends PubsubBase { - constructor (transport) { - super(transport); - this._api = 'parity'; - } - - newHeads (callback) { - return this.addListener('eth', 'newHeads', callback); - } - - logs (callback) { - throw Error('not supported yet'); - } - - // eth API - protocolVersion (callback) { - return this.addListener(this._api, 'eth_protocolVersion', callback); - } - - syncing (callback) { - return this.addListener(this._api, 'eth_syncing', (error, data) => { - error - ? callback(error) - : callback(null, outSyncing(data)); - }); - } - - hashrate (callback) { - return this.addListener(this._api, 'eth_hashrate', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - coinbase (callback) { - return this.addListener(this._api, 'eth_coinbase', (error, data) => { - error - ? callback(error) - : callback(null, outAddress(data)); - }); - } - - mining (callback) { - return this.addListener(this._api, 'eth_mining', callback); - } - - gasPrice (callback) { - return this.addListener(this._api, 'eth_gasPrice', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - accounts (callback) { - return this.addListener(this._api, 'eth_accounts', (error, accounts) => { - error - ? callback(error) - : callback(null, (accounts || []).map(outAddress)); - }); - } - - blockNumber (callback) { - return this.addListener(this._api, 'eth_blockNumber', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - getBalance (callback, address, blockNumber = 'latest') { - return this.addListener(this._api, 'eth_getBalance', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }, [inAddress(address), inBlockNumber(blockNumber)]); - } - - getStorageAt (callback, address, index = 0, blockNumber = 'latest') { - return this.addListener(this._api, 'eth_getStorageAt', callback, [inAddress(address), inNumber16(index), inBlockNumber(blockNumber)]); - } - - getBlockByHash (callback, hash, full = false) { - return this.addListener(this._api, 'eth_getBlockByHash', (error, data) => { - error - ? callback(error) - : callback(null, outBlock(data)); - }, [inHex(hash), full]); - } - - getBlockByNumber (callback, blockNumber = 'latest', full = false) { - return this.addListener(this._api, 'eth_getBlockByNumber', (error, data) => { - error - ? callback(error) - : callback(null, outBlock(data)); - }, [inBlockNumber(blockNumber), full]); - } - - getTransactionCount (callback, address, blockNumber = 'latest') { - return this.addListener(this._api, 'eth_getTransactionCount', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }, [inAddress(address), inBlockNumber(blockNumber)]); - } - - getBlockTransactionCountByHash (callback, hash) { - return this.addListener(this._api, 'eth_getBlockTransactionCountByHash', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }, [inHex(hash)]); - } - - getBlockTransactionCountByNumber (callback, blockNumber = 'latest') { - return this.addListener(this._api, 'eth_getBlockTransactionCountByNumber', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }, [inBlockNumber(blockNumber)]); - } - - getUncleCountByBlockHash (callback, hash) { - return this.addListener(this._api, 'eth_getUncleCountByBlockHash', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }, [inHex(hash)]); - } - - getUncleCountByBlockNumber (callback, blockNumber = 'latest') { - return this.addListener(this._api, 'eth_getUncleCountByBlockNumber', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }, [inBlockNumber(blockNumber)]); - } - - getCode (callback, address, blockNumber = 'latest') { - return this.addListener(this._api, 'eth_getCode', callback, [inAddress(address), inBlockNumber(blockNumber)]); - } - - call (callback, options, blockNumber = 'latest') { - return this.addListener(this._api, 'eth_call', callback, [inOptions(options), inBlockNumber(blockNumber)]); - } - - estimateGas (callback, options) { - return this.addListener(this._api, 'eth_estimateGas', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }, [inOptions(options)]); - } - - getTransactionByHash (callback, hash) { - return this.addListener(this._api, 'eth_getTransactionByHash', (error, data) => { - error - ? callback(error) - : callback(null, outTransaction(data)); - }, [inHex(hash)]); - } - - getTransactionByBlockHashAndIndex (callback, hash, index = 0) { - return this.addListener(this._api, 'eth_getTransactionByBlockHashAndIndex', (error, data) => { - error - ? callback(error) - : callback(null, outTransaction(data)); - }, [inHex(hash), inNumber16(index)]); - } - - getTransactionByBlockNumberAndIndex (callback, blockNumber = 'latest', index = 0) { - return this.addListener(this._api, 'eth_getTransactionByBlockNumberAndIndex', (error, data) => { - error - ? callback(error) - : callback(null, outTransaction(data)); - }, [inBlockNumber(blockNumber), inNumber16(index)]); - } - - getTransactionReceipt (callback, txhash) { - return this.addListener(this._api, 'eth_getTransactionReceipt', (error, data) => { - error - ? callback(error) - : callback(null, outReceipt(data)); - }, [inHex(txhash)]); - } - - getUncleByBlockHashAndIndex (callback, hash, index = 0) { - return this.addListener(this._api, 'eth_getUncleByBlockHashAndIndex', callback, [inHex(hash), inNumber16(index)]); - } - - getUncleByBlockNumberAndIndex (callback, blockNumber = 'latest', index = 0) { - return this.addListener(this._api, 'eth_getUncleByBlockNumberAndIndex', callback, [inBlockNumber(blockNumber), inNumber16(index)]); - } - - getLogs (callback, options) { - return this.addListener(this._api, 'eth_getLogs', (error, logs) => { - error - ? callback(error) - : callback(null, (logs) => logs.map(outLog)); - }, [inFilter(options)]); - } - - getWork (callback) { - return this.addListener(this._api, 'eth_getWork', callback); - } -} diff --git a/js-old/src/api/pubsub/eth/index.js b/js-old/src/api/pubsub/eth/index.js deleted file mode 100644 index 3b8d1994c..000000000 --- a/js-old/src/api/pubsub/eth/index.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . -export default from './eth'; diff --git a/js-old/src/api/pubsub/index.js b/js-old/src/api/pubsub/index.js deleted file mode 100644 index bf342e1de..000000000 --- a/js-old/src/api/pubsub/index.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . -export default from './pubsub'; diff --git a/js-old/src/api/pubsub/net/index.js b/js-old/src/api/pubsub/net/index.js deleted file mode 100644 index 6d13847c5..000000000 --- a/js-old/src/api/pubsub/net/index.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . -export default from './net'; diff --git a/js-old/src/api/pubsub/net/net.js b/js-old/src/api/pubsub/net/net.js deleted file mode 100644 index e1dc3c4e1..000000000 --- a/js-old/src/api/pubsub/net/net.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . -import PubsubBase from '../pubsubBase'; - -import { outNumber } from '../../format/output'; - -export default class Net extends PubsubBase { - constructor (transport) { - super(transport); - this._api = 'parity'; - } - - // net API - version (callback) { - return this.addListener(this._api, 'net_version', callback); - } - - peerCount (callback) { - return this.addListener(this._api, 'net_peerCount', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - listening (callback) { - return this.addListener(this._api, 'net_listening', callback); - } -} diff --git a/js-old/src/api/pubsub/parity/index.js b/js-old/src/api/pubsub/parity/index.js deleted file mode 100644 index 33ce7aa7f..000000000 --- a/js-old/src/api/pubsub/parity/index.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . -export default from './parity'; diff --git a/js-old/src/api/pubsub/parity/parity.js b/js-old/src/api/pubsub/parity/parity.js deleted file mode 100644 index 6df4a9204..000000000 --- a/js-old/src/api/pubsub/parity/parity.js +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import PubsubBase from '../pubsubBase'; -import { inAddress, inBlockNumber, inData, inHex, inDeriveHash, inDeriveIndex } from '../../format/input'; -import { outAccountInfo, outAddress, outBlock, outChainStatus, outHistogram, outHwAccountInfo, outNodeKind, outNumber, outPeers, outTransaction, outAddresses, outRecentDapps, outVaultMeta } from '../../format/output'; - -export default class Parity extends PubsubBase { - constructor (transport) { - super(transport); - this._api = 'parity'; - } - - // parity API - accountsInfo (callback) { - return this.addListener(this._api, 'parity_accountsInfo', (error, data) => { - error - ? callback(error) - : callback(null, outAccountInfo(data)); - }); - } - - hardwareAccountsInfo (callback) { - return this.addListener(this._api, 'parity_hardwareAccountsInfo', (error, data) => { - error - ? callback(error) - : callback(null, outHwAccountInfo(data)); - }); - } - - defaultAccount (callback) { - return this.addListener(this._api, 'parity_defaultAccount', (error, data) => { - error - ? callback(error) - : callback(null, outAddress(data)); - }); - } - - transactionsLimit (callback) { - return this.addListener(this._api, 'parity_transactionsLimit', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - extraData (callback) { - return this.addListener(this._api, 'parity_extraData', callback); - } - - gasFloorTarget (callback) { - return this.addListener(this._api, 'parity_gasFloorTarget', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - gasCeilTarget (callback) { - return this.addListener(this._api, 'parity_gasCeilTarget', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - minGasPrice (callback) { - return this.addListener(this._api, 'parity_minGasPrice', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - devLogs (callback) { - return this.addListener(this._api, 'parity_devLogs', callback); - } - - devLogsLevels (callback) { - return this.addListener(this._api, 'parity_devLogsLevels', callback); - } - - netChain (callback) { - return this.addListener(this._api, 'parity_netChain', callback); - } - - netPeers (callback) { - return this.addListener(this._api, 'parity_netPeers', (error, data) => { - error - ? callback(error) - : callback(null, outPeers(data)); - }); - } - - netPort (callback) { - return this.addListener(this._api, 'parity_netPort', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - rpcSettings (callback) { - return this.addListener(this._api, 'parity_rpcSettings', callback); - } - - nodeName (callback) { - return this.addListener(this._api, 'parity_nodeName', callback); - } - - defaultExtraData (callback) { - return this.addListener(this._api, 'parity_defaultExtraData', callback); - } - - gasPriceHistogram (callback) { - return this.addListener(this._api, 'parity_gasPriceHistogram', (error, data) => { - error - ? callback(error) - : callback(null, outHistogram(data)); - }); - } - - unsignedTransactionsCount (callback) { - return this.addListener(this._api, 'parity_unsignedTransactionsCount', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }); - } - - registryAddress (callback) { - return this.addListener(this._api, 'parity_registryAddress', (error, data) => { - error - ? callback(error) - : callback(null, outAddress(data)); - }); - } - - listAccounts (callback, count, offset = null, blockNumber = 'latest') { - return this.addListener(this._api, 'parity_listAccounts', (error, data) => { - error - ? callback(error) - : callback(null, (data) => (data || []).map(outAddress)); - }, [count, inAddress(offset), inBlockNumber(blockNumber)]); - } - - listStorageKeys (callback, address, count, hash = null, blockNumber = 'latest') { - return this.addListener(this._api, 'parity_listStorageKeys', callback, [inAddress(address), count, inHex(hash), inBlockNumber(blockNumber)]); - } - - pendingTransactions (callback) { - return this.addListener(this._api, 'parity_pendingTransactions', (error, data) => { - error - ? callback(error) - : callback(null, outTransaction(data)); - }); - } - - futureTransactions (callback) { - return this.addListener(this._api, 'parity_futureTransactions', (error, data) => { - error - ? callback(error) - : callback(null, outTransaction(data)); - }); - } - - pendingTransactionsStats (callback) { - return this.addListener(this._api, 'parity_pendingTransactionsStats', callback); - } - - localTransactions (callback) { - return this.addListener(this._api, 'parity_localTransactions', (error, transactions) => { - if (error) { - return callback(error); - } - - Object.values(transactions) - .filter(tx => tx.transaction) - .map(tx => { - tx.transaction = outTransaction(tx.transaction); - }); - - callback(null, transactions); - }); - } - - dappsUrl (callback) { - return this.addListener(this._api, 'parity_dappsUrl', callback); - } - - wsUrl (callback) { - return this.addListener(this._api, 'parity_wsUrl', callback); - } - - nextNonce (callback, account) { - return this.addListener(this._api, 'parity_nextNonce', (error, data) => { - error - ? callback(error) - : callback(null, outNumber(data)); - }, [inAddress(account)]); - } - - mode (callback) { - return this.addListener(this._api, 'parity_mode', callback); - } - - chain (callback) { - return this.addListener(this._api, 'parity_chain', callback); - } - - enode (callback) { - return this.addListener(this._api, 'parity_enode', callback); - } - - consensusCapability (callback) { - return this.addListener(this._api, 'parity_consensusCapability', callback); - } - - versionInfo (callback) { - return this.addListener(this._api, 'parity_versionInfo', callback); - } - - releasesInfo (callback) { - return this.addListener(this._api, 'parity_releasesInfo', callback); - } - - chainStatus (callback) { - return this.addListener(this._api, 'parity_chainStatus', (error, data) => { - error - ? callback(error) - : callback(null, outChainStatus(data)); - }); - } - - nodeKind (callback) { - return this.addListener(this._api, 'parity_nodeKind', (error, data) => { - error - ? callback(error) - : callback(null, outNodeKind(data)); - }); - } - - getBlockHeaderByNumber (callback, blockNumber = 'latest') { - return this.addListener(this._api, 'parity_getBlockHeaderByNumber', (error, data) => { - error - ? callback(error) - : callback(null, outBlock(data)); - }, [inBlockNumber(blockNumber)]); - } - - cidV0 (callback, data) { - return this.addListener(this._api, 'parity_cidV0', callback, [inData(data)]); - } - - // parity accounts API (only secure API or configured to be exposed) - allAccountsInfo (callback) { - return this._addListener(this._api, 'parity_allAccountsInfo', (error, data) => { - error - ? callback(error) - : callback(null, outAccountInfo(data)); - }); - } - - getDappAddresses (callback, dappId) { - return this._addListener(this._api, 'parity_getDappAddresses', (error, data) => { - error - ? callback(error) - : callback(null, outAddresses(data)); - }, [dappId]); - } - - getDappDefaultAddress (callback, dappId) { - return this._addListener(this._api, 'parity_getDappDefaultAddress', (error, data) => { - error - ? callback(error) - : callback(null, outAddress(data)); - }, [dappId]); - } - - getNewDappsAddresses (callback) { - return this._addListener(this._api, 'parity_getDappDefaultAddress', (error, addresses) => { - error - ? callback(error) - : callback(null, addresses ? addresses.map(outAddress) : null); - }); - } - - getNewDappsDefaultAddress (callback) { - return this._addListener(this._api, 'parity_getNewDappsDefaultAddress', (error, data) => { - error - ? callback(error) - : callback(null, outAddress(data)); - }); - } - - listRecentDapps (callback) { - return this._addListener(this._api, 'parity_listRecentDapps', (error, data) => { - error - ? callback(error) - : callback(null, outRecentDapps(data)); - }); - } - - listGethAccounts (callback) { - return this._addListener(this._api, 'parity_listGethAccounts', (error, data) => { - error - ? callback(error) - : callback(null, outAddresses(data)); - }); - } - - listVaults (callback) { - return this._addListener(this._api, 'parity_listVaults', callback); - } - - listOpenedVaults (callback) { - return this._addListener(this._api, 'parity_listOpenedVaults', callback); - } - - getVaultMeta (callback, vaultName) { - return this._addListener(this._api, 'parity_getVaultMeta', (error, data) => { - error - ? callback(error) - : callback(null, outVaultMeta(data)); - }, [vaultName]); - } - - deriveAddressHash (callback, address, password, hash, shouldSave) { - return this._addListener(this._api, 'parity_deriveAddressHash', (error, data) => { - error - ? callback(error) - : callback(null, outAddress(data)); - }, [inAddress(address), password, inDeriveHash(hash), !!shouldSave]); - } - - deriveAddressIndex (callback, address, password, index, shouldSave) { - return this._addListener(this._api, 'parity_deriveAddressIndex', (error, data) => { - error - ? callback(error) - : callback(null, outAddress(data)); - }, [inAddress(address), password, inDeriveIndex(index), !!shouldSave]); - } -} diff --git a/js-old/src/api/pubsub/pubsub.js b/js-old/src/api/pubsub/pubsub.js deleted file mode 100644 index edbc201ae..000000000 --- a/js-old/src/api/pubsub/pubsub.js +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Eth from './eth'; -import Parity from './parity'; -import Net from './net'; - -import { isFunction } from '../util/types'; - -export default class Pubsub { - constructor (transport) { - if (!transport || !isFunction(transport.subscribe)) { - throw new Error('Pubsub API needs transport with subscribe() function defined. (WebSocket)'); - } - - this._eth = new Eth(transport); - this._net = new Net(transport); - this._parity = new Parity(transport); - } - - get net () { - return this._net; - } - - get eth () { - return this._eth; - } - - get parity () { - return this._parity; - } - - unsubscribe (subscriptionIds) { - // subscriptions are namespace independent. Thus we can simply removeListener from any. - return this._parity.removeListener(subscriptionIds); - } -} diff --git a/js-old/src/api/pubsub/pubsub.spec.js b/js-old/src/api/pubsub/pubsub.spec.js deleted file mode 100644 index 10fcd2edb..000000000 --- a/js-old/src/api/pubsub/pubsub.spec.js +++ /dev/null @@ -1,613 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; -import { TEST_WS_URL, mockWs } from '../../../test/mockRpc'; -import { isBigNumber } from '../../../test/types'; - -import Ws from '../transport/ws'; -import Pubsub from './pubsub'; - -describe('api/pubsub/Pubsub', () => { - let scope; - let instance; - const address = '0x63Cf90D3f0410092FC0fca41846f596223979195'; - - describe('accountsInfo', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: { - '0x63cf90d3f0410092fc0fca41846f596223979195': { - name: 'name', uuid: 'uuid', meta: '{"data":"data"}' - } - }, - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('retrieves the available account info', (done) => { - instance.parity.accountsInfo((error, result) => { - expect(error).to.be.null; - expect(result).to.deep.equal({ - '0x63Cf90D3f0410092FC0fca41846f596223979195': { - name: 'name', uuid: 'uuid', meta: { - data: 'data' - } - } - }); - done(); - }); - }); - }); - - describe('Unsubscribe', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2 }, - { method: 'parity_unsubscribe', reply: true }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('Promise gets resolved on success.', (done) => { - instance.parity.accountsInfo().then(s => { - instance.parity.unsubscribe(s).then(b => { - expect(b).to.be.true; - }); - }); - done(); - }); - }); - - describe('chainStatus', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: { - 'blockGap': [0x123, 0x456] - }, - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('retrieves the chain status', (done) => { - instance.parity.chainStatus((error, result) => { - expect(error).to.be.null; - expect(result).to.deep.equal({ - 'blockGap': [new BigNumber(0x123), new BigNumber(0x456)] - }); - done(); - }); - }); - }); - - describe('gasFloorTarget', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: '0x123456', - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns the gasfloor, formatted', (done) => { - instance.parity.gasFloorTarget((error, result) => { - expect(error).to.be.null; - expect(isBigNumber(result)).to.be.true; - expect(result.eq(0x123456)).to.be.true; - done(); - }); - }); - }); - - describe('transactionsLimit', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: 1024, - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns the tx limit, formatted', (done) => { - instance.parity.transactionsLimit((error, result) => { - expect(error).to.be.null; - expect(isBigNumber(result)).to.be.true; - expect(result.eq(1024)).to.be.true; - done(); - }); - }); - }); - - describe('minGasPrice', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: '0x123456', - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns the min gasprice, formatted', (done) => { - instance.parity.minGasPrice((error, result) => { - expect(error).to.be.null; - expect(isBigNumber(result)).to.be.true; - expect(result.eq(0x123456)).to.be.true; - done(); - }); - }); - }); - - describe('netPeers', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: { active: 123, connected: 456, max: 789, peers: [] }, - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns the peer structure, formatted', (done) => { - instance.parity.netPeers((error, peers) => { - expect(error).to.be.null; - expect(peers.active.eq(123)).to.be.true; - expect(peers.connected.eq(456)).to.be.true; - expect(peers.max.eq(789)).to.be.true; - done(); - }); - }); - }); - - describe('netPort', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: 33030, - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns the connected port, formatted', (done) => { - instance.parity.netPort((error, count) => { - expect(error).to.be.null; - expect(isBigNumber(count)).to.be.true; - expect(count.eq(33030)).to.be.true; - done(); - }); - }); - }); - -// Eth API - describe('accounts', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: [address.toLowerCase()], - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns a list of accounts, formatted', (done) => { - instance.eth.accounts((error, accounts) => { - expect(error).to.be.null; - expect(accounts).to.deep.equal([address]); - done(); - }); - }); - }); - - describe('newHeads', () => { - beforeEach(() => { - scope = mockWs([{ method: 'eth_subscribe', reply: 2, subscription: { - method: 'eth_subscription', - params: { - result: '0x123456', - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns newHeads for eth_subscribe', (done) => { - instance.eth.newHeads((error, blockNumber) => { - expect(error).to.be.null; - expect(blockNumber).to.equal('0x123456'); - done(); - }); - }); - }); - - describe('blockNumber', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: '0x123456', - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns the current blockNumber, formatted', (done) => { - instance.eth.blockNumber((error, blockNumber) => { - expect(error).to.be.null; - expect(isBigNumber(blockNumber)).to.be.true; - expect(blockNumber.toString(16)).to.equal('123456'); - done(); - }); - }); - }); - - describe('call', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: [], - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('formats the input options & blockNumber', (done) => { - instance.eth.call((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_call', [{ data: '0x12345678' }, 'earliest']]); - done(); - }, { data: '12345678' }, 'earliest'); - }); - - it('provides a latest blockNumber when not specified', (done) => { - instance.eth.call((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_call', [{ data: '0x12345678' }, 'latest']]); - done(); - }, { data: '12345678' }); - }); - }); - - describe('coinbase', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: address.toLowerCase(), - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns the coinbase, formatted', (done) => { - instance.eth.coinbase((error, account) => { - expect(error).to.be.null; - expect(account).to.deep.equal(address); - done(); - }); - }); - }); - - describe('estimateGas', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: '0x123', - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('converts the options correctly', (done) => { - instance.eth.estimateGas((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_estimateGas', [{ gas: '0x5208' }]]); - done(); - }, { gas: 21000 }); - }); - - it('returns the gas used, formatted', (done) => { - instance.eth.estimateGas((error, gas) => { - expect(error).to.be.null; - expect(isBigNumber(gas)).to.be.true; - expect(gas.toString(16)).to.deep.equal('123'); - done(); - }); - }); - }); - - describe('gasPrice', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: '0x123', - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns the gas price, formatted', (done) => { - instance.eth.gasPrice((error, price) => { - expect(error).to.be.null; - expect(isBigNumber(price)).to.be.true; - expect(price.toString(16)).to.deep.equal('123'); - done(); - }); - }); - }); - - describe('getBalance', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: '0x123', - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('passes in the address (default blockNumber)', (done) => { - instance.eth.getBalance((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_getBalance', [address.toLowerCase(), 'latest']]); - done(); - }, address); - }); - - it('passes in the address & blockNumber', (done) => { - instance.eth.getBalance((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_getBalance', [address.toLowerCase(), '0x456']]); - done(); - }, address, 0x456); - }); - - it('returns the balance', (done) => { - instance.eth.getBalance((error, balance) => { - expect(error).to.be.null; - expect(isBigNumber(balance)).to.be.true; - expect(balance.toString(16)).to.deep.equal('123'); - done(); - }, address); - }); - }); - - describe('getBlockByHash', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: { miner: address.toLowerCase() }, - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('formats the input hash as a hash, default full', (done) => { - instance.eth.getBlockByHash((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_getBlockByHash', ['0x1234', false]]); - done(); - }, '1234'); - }); - - it('formats the input hash as a hash, full true', (done) => { - instance.eth.getBlockByHash((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_getBlockByHash', ['0x1234', true]]); - done(); - }, '1234', true); - }); - - it('formats the output into block', (done) => { - instance.eth.getBlockByHash((error, block) => { - expect(error).to.be.null; - expect(block.miner).to.equal(address); - done(); - }, '1234'); - }); - }); - - describe('getBlockByNumber', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: { miner: address.toLowerCase() }, - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('assumes blockNumber latest & full false', (done) => { - instance.eth.getBlockByNumber((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_getBlockByNumber', ['latest', false]]); - done(); - }); - }); - - it('uses input blockNumber & full false', (done) => { - instance.eth.getBlockByNumber((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_getBlockByNumber', ['0x1234', false]]); - done(); - }, '0x1234'); - }); - - it('formats the input blockNumber, full true', (done) => { - instance.eth.getBlockByNumber((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_getBlockByNumber', ['0x1234', true]]); - done(); - }, 0x1234, true); - }); - - it('formats the output into block', (done) => { - instance.eth.getBlockByNumber((error, block) => { - expect(error).to.be.null; - expect(block.miner).to.equal(address); - done(); - }, 0x1234); - }); - }); - - describe('getTransactionCount', () => { - beforeEach(() => { - scope = mockWs([{ method: 'parity_subscribe', reply: 2, subscription: { - method: 'parity_subscription', - params: { - result: '0x123', - subscription: 2 - } - } }]); - instance = new Pubsub(new Ws(TEST_WS_URL)); - }); - - afterEach(() => { - scope.stop(); - }); - - it('passes in the address (default blockNumber)', (done) => { - instance.eth.getTransactionCount((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_getTransactionCount', [address.toLowerCase(), 'latest']]); - done(); - }, address); - }); - - it('passes in the address & blockNumber', (done) => { - instance.eth.getTransactionCount((error) => { - expect(error).to.be.null; - expect(scope.body.parity_subscribe.params).to.deep.equal(['eth_getTransactionCount', [address.toLowerCase(), '0x456']]); - done(); - }, address, 0x456); - }); - - it('returns the count, formatted', (done) => { - instance.eth.getTransactionCount((error, count) => { - expect(error).to.be.null; - expect(isBigNumber(count)).to.be.true; - expect(count.toString(16)).to.equal('123'); - done(); - }, address, 0x456); - }); - }); -}); diff --git a/js-old/src/api/pubsub/pubsubBase.js b/js-old/src/api/pubsub/pubsubBase.js deleted file mode 100644 index fcc7525d5..000000000 --- a/js-old/src/api/pubsub/pubsubBase.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default class PubsubBase { - // Provider for websocket pubsub transport - constructor (transport) { - this._transport = transport; - } - - addListener (module, eventName, callback, eventParams) { - return eventParams - ? this._transport.subscribe(module, callback, eventName, eventParams) - : this._transport.subscribe(module, callback, eventName, []); - // this._transport.subscribe(module, callback, eventName); After Patch from tomac is merged to master! => eth_subscribe does not support empty array as params - } - - removeListener (subscriptionIds) { - return this._transport.unsubscribe(subscriptionIds); - } - - unsubscribe (subscriptionIds) { - return this.removeListener(subscriptionIds); - } -} diff --git a/js-old/src/api/rpc/db/db.js b/js-old/src/api/rpc/db/db.js deleted file mode 100644 index c87911b8d..000000000 --- a/js-old/src/api/rpc/db/db.js +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { inHex } from '../../format/input'; - -export default class Db { - constructor (transport) { - this._transport = transport; - } - - getHex (dbName, keyName) { - return this._transport - .execute('db_getHex', dbName, keyName); - } - - getString (dbName, keyName) { - return this._transport - .execute('db_getString', dbName, keyName); - } - - putHex (dbName, keyName, hexData) { - return this._transport - .execute('db_putHex', dbName, keyName, inHex(hexData)); - } - - putString (dbName, keyName, stringData) { - return this._transport - .execute('db_putString', dbName, keyName, stringData); - } -} diff --git a/js-old/src/api/rpc/db/db.spec.js b/js-old/src/api/rpc/db/db.spec.js deleted file mode 100644 index 94256931b..000000000 --- a/js-old/src/api/rpc/db/db.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; - -import Http from '../../transport/http'; -import Db from './db'; - -const instance = new Db(new Http(TEST_HTTP_URL, -1)); - -describe('api/rpc/Db', () => { - let scope; - - describe('putHex', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'db_putHex', reply: { result: [] } }]); - }); - - it('formats the inputs correctly', () => { - return instance.putHex('db', 'key', '1234').then(() => { - expect(scope.body.db_putHex.params).to.deep.equal(['db', 'key', '0x1234']); - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/db/index.js b/js-old/src/api/rpc/db/index.js deleted file mode 100644 index 0dc25441b..000000000 --- a/js-old/src/api/rpc/db/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './db'; diff --git a/js-old/src/api/rpc/eth/eth.e2e.js b/js-old/src/api/rpc/eth/eth.e2e.js deleted file mode 100644 index 1c8d95a0b..000000000 --- a/js-old/src/api/rpc/eth/eth.e2e.js +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { createHttpApi } from '../../../../test/e2e/ethapi'; -import { isAddress } from '../../../../test/types'; - -describe('ethapi.eth', () => { - const ethapi = createHttpApi(); - const address = '0x63cf90d3f0410092fc0fca41846f596223979195'; - - let latestBlockNumber; - let latestBlockHash; - - describe('accounts', () => { - it('returns the available accounts', () => { - return ethapi.eth.accounts().then((accounts) => { - accounts.forEach((account) => { - expect(isAddress(account)).to.be.true; - }); - }); - }); - }); - - describe('blockNumber', () => { - it('returns the current blockNumber', () => { - return ethapi.eth.blockNumber().then((blockNumber) => { - latestBlockNumber = blockNumber; - expect(blockNumber.gt(0xabcde)).to.be.true; - }); - }); - }); - - describe('coinbase', () => { - it('returns the coinbase', () => { - return ethapi.eth.coinbase().then((coinbase) => { - expect(isAddress(coinbase)).to.be.true; - }); - }); - }); - - describe('gasPrice', () => { - it('returns the current gasPrice', () => { - return ethapi.eth.gasPrice().then((gasPrice) => { - expect(gasPrice.gt(0)).to.be.true; - }); - }); - }); - - describe('getBalance', () => { - it('returns the balance for latest block', () => { - return ethapi.eth.getBalance(address).then((balance) => { - expect(balance.gt(0)).to.be.true; - }); - }); - - it('returns the balance for a very early block', () => { - const atBlock = '0x65432'; - const atValue = '18e07120a6e164fee1b'; - - return ethapi.eth - .getBalance(address, atBlock) - .then((balance) => { - expect(balance.toString(16)).to.equal(atValue); - }) - .catch((error) => { - // Parity doesn't support pruned-before-block balance lookups - expect(error.message).to.match(/not supported/); - }); - }); - - it('returns the balance for a recent/out-of-pruning-range block', () => { - return ethapi.eth - .getBalance(address, latestBlockNumber.minus(1000)) - .then((balance) => { - expect(balance.gt(0)).to.be.true; - }); - }); - }); - - describe('getBlockByNumber', () => { - it('returns the latest block', () => { - return ethapi.eth.getBlockByNumber().then((block) => { - expect(block).to.be.ok; - }); - }); - - it('returns a block by blockNumber', () => { - return ethapi.eth.getBlockByNumber(latestBlockNumber).then((block) => { - latestBlockHash = block.hash; - expect(block).to.be.ok; - }); - }); - - it('returns a block by blockNumber (full)', () => { - return ethapi.eth.getBlockByNumber(latestBlockNumber, true).then((block) => { - expect(block).to.be.ok; - }); - }); - }); - - describe('getBlockByHash', () => { - it('returns the specified block', () => { - return ethapi.eth.getBlockByHash(latestBlockHash).then((block) => { - expect(block).to.be.ok; - expect(block.hash).to.equal(latestBlockHash); - }); - }); - - it('returns the specified block (full)', () => { - return ethapi.eth.getBlockByHash(latestBlockHash, true).then((block) => { - expect(block).to.be.ok; - expect(block.hash).to.equal(latestBlockHash); - }); - }); - }); - - describe('getBlockTransactionCountByHash', () => { - it('returns the transactions of the specified hash', () => { - return ethapi.eth.getBlockTransactionCountByHash(latestBlockHash).then((count) => { - expect(count).to.be.ok; - expect(count.gte(0)).to.be.true; - }); - }); - }); - - describe('getBlockTransactionCountByNumber', () => { - it('returns the transactions of latest', () => { - return ethapi.eth.getBlockTransactionCountByNumber().then((count) => { - expect(count).to.be.ok; - expect(count.gte(0)).to.be.true; - }); - }); - - it('returns the transactions of a specified number', () => { - return ethapi.eth.getBlockTransactionCountByNumber(latestBlockNumber).then((count) => { - expect(count).to.be.ok; - expect(count.gte(0)).to.be.true; - }); - }); - }); - - describe('getTransactionCount', () => { - it('returns the count for an address', () => { - return ethapi.eth.getTransactionCount(address).then((count) => { - expect(count).to.be.ok; - expect(count.gte(0x1000c2)).to.be.ok; - }); - }); - - it('returns the count for an address at specified blockNumber', () => { - return ethapi.eth.getTransactionCount(address, latestBlockNumber).then((count) => { - expect(count).to.be.ok; - expect(count.gte(0x1000c2)).to.be.ok; - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/eth/eth.js b/js-old/src/api/rpc/eth/eth.js deleted file mode 100644 index ffde938ea..000000000 --- a/js-old/src/api/rpc/eth/eth.js +++ /dev/null @@ -1,321 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { inAddress, inBlockNumber, inData, inFilter, inHash, inHex, inNumber16, inOptions } from '../../format/input'; -import { outAddress, outBlock, outLog, outNumber, outReceipt, outSyncing, outTransaction } from '../../format/output'; - -export default class Eth { - constructor (transport) { - this._transport = transport; - } - - accounts () { - return this._transport - .execute('eth_accounts') - .then((accounts) => (accounts || []).map(outAddress)); - } - - blockNumber () { - return this._transport - .execute('eth_blockNumber') - .then(outNumber); - } - - call (options, blockNumber = 'latest') { - return this._transport - .execute('eth_call', inOptions(options), inBlockNumber(blockNumber)); - } - - coinbase () { - return this._transport - .execute('eth_coinbase') - .then(outAddress); - } - - compileLLL (code) { - return this._transport - .execute('eth_compileLLL', inData(code)); - } - - compileSerpent (code) { - return this._transport - .execute('eth_compileSerpent', inData(code)); - } - - compileSolidity (code) { - return this._transport - .execute('eth_compileSolidity', inData(code)); - } - - estimateGas (options) { - return this._transport - .execute('eth_estimateGas', inOptions(options)) - .then(outNumber); - } - - fetchQueuedTransactions () { - return this._transport - .execute('eth_fetchQueuedTransactions'); - } - - flush () { - return this._transport - .execute('eth_flush'); - } - - gasPrice () { - return this._transport - .execute('eth_gasPrice') - .then(outNumber); - } - - getBalance (address, blockNumber = 'latest') { - return this._transport - .execute('eth_getBalance', inAddress(address), inBlockNumber(blockNumber)) - .then(outNumber); - } - - getBlockByHash (hash, full = false) { - return this._transport - .execute('eth_getBlockByHash', inHex(hash), full) - .then(outBlock); - } - - getBlockByNumber (blockNumber = 'latest', full = false) { - return this._transport - .execute('eth_getBlockByNumber', inBlockNumber(blockNumber), full) - .then(outBlock); - } - - getBlockTransactionCountByHash (hash) { - return this._transport - .execute('eth_getBlockTransactionCountByHash', inHex(hash)) - .then(outNumber); - } - - getBlockTransactionCountByNumber (blockNumber = 'latest') { - return this._transport - .execute('eth_getBlockTransactionCountByNumber', inBlockNumber(blockNumber)) - .then(outNumber); - } - - getCode (address, blockNumber = 'latest') { - return this._transport - .execute('eth_getCode', inAddress(address), inBlockNumber(blockNumber)); - } - - getCompilers () { - return this._transport - .execute('eth_getCompilers'); - } - - getFilterChanges (filterId) { - return this._transport - .execute('eth_getFilterChanges', inNumber16(filterId)) - .then((logs) => logs.map(outLog)); - } - - getFilterChangesEx (filterId) { - return this._transport - .execute('eth_getFilterChangesEx', inNumber16(filterId)); - } - - getFilterLogs (filterId) { - return this._transport - .execute('eth_getFilterLogs', inNumber16(filterId)) - .then((logs) => logs.map(outLog)); - } - - getFilterLogsEx (filterId) { - return this._transport - .execute('eth_getFilterLogsEx', inNumber16(filterId)); - } - - getLogs (options) { - return this._transport - .execute('eth_getLogs', inFilter(options)) - .then((logs) => logs.map(outLog)); - } - - getLogsEx (options) { - return this._transport - .execute('eth_getLogsEx', inFilter(options)); - } - - getStorageAt (address, index = 0, blockNumber = 'latest') { - return this._transport - .execute('eth_getStorageAt', inAddress(address), inNumber16(index), inBlockNumber(blockNumber)); - } - - getTransactionByBlockHashAndIndex (hash, index = 0) { - return this._transport - .execute('eth_getTransactionByBlockHashAndIndex', inHex(hash), inNumber16(index)) - .then(outTransaction); - } - - getTransactionByBlockNumberAndIndex (blockNumber = 'latest', index = 0) { - return this._transport - .execute('eth_getTransactionByBlockNumberAndIndex', inBlockNumber(blockNumber), inNumber16(index)) - .then(outTransaction); - } - - getTransactionByHash (hash) { - return this._transport - .execute('eth_getTransactionByHash', inHex(hash)) - .then(outTransaction); - } - - getTransactionCount (address, blockNumber = 'latest') { - return this._transport - .execute('eth_getTransactionCount', inAddress(address), inBlockNumber(blockNumber)) - .then(outNumber); - } - - getTransactionReceipt (txhash) { - return this._transport - .execute('eth_getTransactionReceipt', inHex(txhash)) - .then(outReceipt); - } - - getUncleByBlockHashAndIndex (hash, index = 0) { - return this._transport - .execute('eth_getUncleByBlockHashAndIndex', inHex(hash), inNumber16(index)); - } - - getUncleByBlockNumberAndIndex (blockNumber = 'latest', index = 0) { - return this._transport - .execute('eth_getUncleByBlockNumberAndIndex', inBlockNumber(blockNumber), inNumber16(index)); - } - - getUncleCountByBlockHash (hash) { - return this._transport - .execute('eth_getUncleCountByBlockHash', inHex(hash)) - .then(outNumber); - } - - getUncleCountByBlockNumber (blockNumber = 'latest') { - return this._transport - .execute('eth_getUncleCountByBlockNumber', inBlockNumber(blockNumber)) - .then(outNumber); - } - - getWork () { - return this._transport - .execute('eth_getWork'); - } - - hashrate () { - return this._transport - .execute('eth_hashrate') - .then(outNumber); - } - - inspectTransaction () { - return this._transport - .execute('eth_inspectTransaction'); - } - - mining () { - return this._transport - .execute('eth_mining'); - } - - newBlockFilter () { - return this._transport - .execute('eth_newBlockFilter'); - } - - newFilter (options) { - return this._transport - .execute('eth_newFilter', inFilter(options)); - } - - newFilterEx (options) { - return this._transport - .execute('eth_newFilterEx', inFilter(options)); - } - - newPendingTransactionFilter () { - return this._transport - .execute('eth_newPendingTransactionFilter'); - } - - notePassword () { - return this._transport - .execute('eth_notePassword'); - } - - pendingTransactions () { - return this._transport - .execute('eth_pendingTransactions'); - } - - protocolVersion () { - return this._transport - .execute('eth_protocolVersion'); - } - - register () { - return this._transport - .execute('eth_register'); - } - - sendRawTransaction (data) { - return this._transport - .execute('eth_sendRawTransaction', inData(data)); - } - - sendTransaction (options) { - return this._transport - .execute('eth_sendTransaction', inOptions(options)); - } - - sign (address, hash) { - return this._transport - .execute('eth_sign', inAddress(address), inHash(hash)); - } - - signTransaction (options) { - return this._transport - .execute('eth_signTransaction', inOptions(options)); - } - - submitHashrate (hashrate, clientId) { - return this._transport - .execute('eth_submitHashrate', inNumber16(hashrate), clientId); - } - - submitWork (nonce, powHash, mixDigest) { - return this._transport - .execute('eth_submitWork', inNumber16(nonce), powHash, mixDigest); - } - - syncing () { - return this._transport - .execute('eth_syncing') - .then(outSyncing); - } - - uninstallFilter (filterId) { - return this._transport - .execute('eth_uninstallFilter', inHex(filterId)); - } - - unregister () { - return this._transport - .execute('eth_unregister'); - } -} diff --git a/js-old/src/api/rpc/eth/eth.spec.js b/js-old/src/api/rpc/eth/eth.spec.js deleted file mode 100644 index 2738fd2de..000000000 --- a/js-old/src/api/rpc/eth/eth.spec.js +++ /dev/null @@ -1,474 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; -import { isBigNumber } from '../../../../test/types'; - -import Http from '../../transport/http'; -import Eth from './eth'; - -const instance = new Eth(new Http(TEST_HTTP_URL, -1)); - -describe('rpc/Eth', () => { - const address = '0x63Cf90D3f0410092FC0fca41846f596223979195'; - let scope; - - describe('accounts', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_accounts', reply: { result: [address.toLowerCase()] } }]); - }); - - it('returns a list of accounts, formatted', () => { - return instance.accounts().then((accounts) => { - expect(accounts).to.deep.equal([address]); - }); - }); - }); - - describe('blockNumber', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_blockNumber', reply: { result: '0x123456' } }]); - }); - - it('returns the current blockNumber, formatted', () => { - return instance.blockNumber().then((blockNumber) => { - expect(isBigNumber(blockNumber)).to.be.true; - expect(blockNumber.toString(16)).to.equal('123456'); - }); - }); - }); - - describe('call', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_call', reply: { result: [] } }]); - }); - - it('formats the input options & blockNumber', () => { - return instance.call({ data: '12345678' }, 'earliest').then(() => { - expect(scope.body.eth_call.params).to.deep.equal([{ data: '0x12345678' }, 'earliest']); - }); - }); - - it('provides a latest blockNumber when not specified', () => { - return instance.call({ data: '12345678' }).then(() => { - expect(scope.body.eth_call.params).to.deep.equal([{ data: '0x12345678' }, 'latest']); - }); - }); - }); - - describe('coinbase', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_coinbase', reply: { result: address.toLowerCase() } }]); - }); - - it('returns the coinbase, formatted', () => { - return instance.coinbase().then((account) => { - expect(account).to.deep.equal(address); - }); - }); - }); - - ['LLL', 'Serpent', 'Solidity'].forEach((type) => { - const method = `compile${type}`; - - describe(method, () => { - beforeEach(() => { - scope = mockHttp([{ method: `eth_${method}`, reply: { result: '0x123' } }]); - }); - - it('formats the input as data, returns the output', () => { - return instance[method]('0xabcdef').then((result) => { - expect(scope.body[`eth_${method}`].params).to.deep.equal(['0xabcdef']); - expect(result).to.equal('0x123'); - }); - }); - }); - }); - - describe('estimateGas', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_estimateGas', reply: { result: '0x123' } }]); - }); - - it('converts the options correctly', () => { - return instance.estimateGas({ gas: 21000 }).then(() => { - expect(scope.body.eth_estimateGas.params).to.deep.equal([{ gas: '0x5208' }]); - }); - }); - - it('returns the gas used', () => { - return instance.estimateGas({}).then((gas) => { - expect(isBigNumber(gas)).to.be.true; - expect(gas.toString(16)).to.deep.equal('123'); - }); - }); - }); - - describe('gasPrice', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_gasPrice', reply: { result: '0x123' } }]); - }); - - it('returns the fomratted price', () => { - return instance.gasPrice().then((price) => { - expect(isBigNumber(price)).to.be.true; - expect(price.toString(16)).to.deep.equal('123'); - }); - }); - }); - - describe('getBalance', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getBalance', reply: { result: '0x123' } }]); - }); - - it('passes in the address (default blockNumber)', () => { - return instance.getBalance(address).then(() => { - expect(scope.body.eth_getBalance.params).to.deep.equal([address.toLowerCase(), 'latest']); - }); - }); - - it('passes in the address & blockNumber', () => { - return instance.getBalance(address, 0x456).then(() => { - expect(scope.body.eth_getBalance.params).to.deep.equal([address.toLowerCase(), '0x456']); - }); - }); - - it('returns the balance', () => { - return instance.getBalance(address, 0x123).then((balance) => { - expect(isBigNumber(balance)).to.be.true; - expect(balance.toString(16)).to.deep.equal('123'); - }); - }); - }); - - describe('getBlockByHash', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getBlockByHash', reply: { result: { miner: address.toLowerCase() } } }]); - }); - - it('formats the input hash as a hash, default full', () => { - return instance.getBlockByHash('1234').then(() => { - expect(scope.body.eth_getBlockByHash.params).to.deep.equal(['0x1234', false]); - }); - }); - - it('formats the input hash as a hash, full true', () => { - return instance.getBlockByHash('1234', true).then(() => { - expect(scope.body.eth_getBlockByHash.params).to.deep.equal(['0x1234', true]); - }); - }); - - it('formats the output into block', () => { - return instance.getBlockByHash('1234').then((block) => { - expect(block.miner).to.equal(address); - }); - }); - }); - - describe('getBlockByNumber', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getBlockByNumber', reply: { result: { miner: address.toLowerCase() } } }]); - }); - - it('assumes blockNumber latest & full false', () => { - return instance.getBlockByNumber().then(() => { - expect(scope.body.eth_getBlockByNumber.params).to.deep.equal(['latest', false]); - }); - }); - - it('uses input blockNumber & full false', () => { - return instance.getBlockByNumber('0x1234').then(() => { - expect(scope.body.eth_getBlockByNumber.params).to.deep.equal(['0x1234', false]); - }); - }); - - it('formats the input blockNumber, full true', () => { - return instance.getBlockByNumber(0x1234, true).then(() => { - expect(scope.body.eth_getBlockByNumber.params).to.deep.equal(['0x1234', true]); - }); - }); - - it('formats the output into block', () => { - return instance.getBlockByNumber(0x1234).then((block) => { - expect(block.miner).to.equal(address); - }); - }); - }); - - describe('getBlockTransactionCountByHash', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getBlockTransactionCountByHash', reply: { result: '0x123' } }]); - }); - - it('formats input hash properly', () => { - return instance.getBlockTransactionCountByHash('abcdef').then(() => { - expect(scope.body.eth_getBlockTransactionCountByHash.params).to.deep.equal(['0xabcdef']); - }); - }); - - it('formats the output number', () => { - return instance.getBlockTransactionCountByHash('0x1234').then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.toString(16)).to.equal('123'); - }); - }); - }); - - describe('getBlockTransactionCountByNumber', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getBlockTransactionCountByNumber', reply: { result: '0x123' } }]); - }); - - it('specified blockNumber latest when none specified', () => { - return instance.getBlockTransactionCountByNumber().then(() => { - expect(scope.body.eth_getBlockTransactionCountByNumber.params).to.deep.equal(['latest']); - }); - }); - - it('formats input blockNumber properly', () => { - return instance.getBlockTransactionCountByNumber(0xabcdef).then(() => { - expect(scope.body.eth_getBlockTransactionCountByNumber.params).to.deep.equal(['0xabcdef']); - }); - }); - - it('formats the output number', () => { - return instance.getBlockTransactionCountByNumber('0x1234').then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.toString(16)).to.equal('123'); - }); - }); - }); - - describe('getCode', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getCode', reply: { result: '0x1234567890' } }]); - }); - - it('passes in the address (default blockNumber)', () => { - return instance.getCode(address).then(() => { - expect(scope.body.eth_getCode.params).to.deep.equal([address.toLowerCase(), 'latest']); - }); - }); - - it('passes in the address & blockNumber', () => { - return instance.getCode(address, 0x456).then(() => { - expect(scope.body.eth_getCode.params).to.deep.equal([address.toLowerCase(), '0x456']); - }); - }); - - it('returns the code', () => { - return instance.getCode(address, 0x123).then((code) => { - expect(code).to.equal('0x1234567890'); - }); - }); - }); - - describe('getStorageAt', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getStorageAt', reply: { result: '0x1234567890' } }]); - }); - - it('passes in the address (default index& blockNumber)', () => { - return instance.getStorageAt(address).then(() => { - expect(scope.body.eth_getStorageAt.params).to.deep.equal([address.toLowerCase(), '0x0', 'latest']); - }); - }); - - it('passes in the address, index & blockNumber', () => { - return instance.getStorageAt(address, 15, 0x456).then(() => { - expect(scope.body.eth_getStorageAt.params).to.deep.equal([address.toLowerCase(), '0xf', '0x456']); - }); - }); - - it('returns the storage', () => { - return instance.getStorageAt(address, 0x123).then((storage) => { - expect(storage).to.equal('0x1234567890'); - }); - }); - }); - - describe('getTransactionByBlockHashAndIndex', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getTransactionByBlockHashAndIndex', reply: { result: { to: address.toLowerCase() } } }]); - }); - - it('passes in the hash (default index)', () => { - return instance.getTransactionByBlockHashAndIndex('12345').then(() => { - expect(scope.body.eth_getTransactionByBlockHashAndIndex.params).to.deep.equal(['0x12345', '0x0']); - }); - }); - - it('passes in the hash & specified index', () => { - return instance.getTransactionByBlockHashAndIndex('6789', 0x456).then(() => { - expect(scope.body.eth_getTransactionByBlockHashAndIndex.params).to.deep.equal(['0x6789', '0x456']); - }); - }); - - it('returns the formatted transaction', () => { - return instance.getTransactionByBlockHashAndIndex('6789', 0x123).then((tx) => { - expect(tx).to.deep.equal({ to: address }); - }); - }); - }); - - describe('getTransactionByBlockNumberAndIndex', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getTransactionByBlockNumberAndIndex', reply: { result: { to: address.toLowerCase() } } }]); - }); - - it('passes in the default parameters', () => { - return instance.getTransactionByBlockNumberAndIndex().then(() => { - expect(scope.body.eth_getTransactionByBlockNumberAndIndex.params).to.deep.equal(['latest', '0x0']); - }); - }); - - it('passes in the blockNumber & specified index', () => { - return instance.getTransactionByBlockNumberAndIndex('0x6789', 0x456).then(() => { - expect(scope.body.eth_getTransactionByBlockNumberAndIndex.params).to.deep.equal(['0x6789', '0x456']); - }); - }); - - it('returns the formatted transaction', () => { - return instance.getTransactionByBlockNumberAndIndex('0x6789', 0x123).then((tx) => { - expect(tx).to.deep.equal({ to: address }); - }); - }); - }); - - describe('getTransactionByHash', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getTransactionByHash', reply: { result: { to: address.toLowerCase() } } }]); - }); - - it('passes in the hash', () => { - return instance.getTransactionByHash('12345').then(() => { - expect(scope.body.eth_getTransactionByHash.params).to.deep.equal(['0x12345']); - }); - }); - - it('returns the formatted transaction', () => { - return instance.getTransactionByHash('6789').then((tx) => { - expect(tx).to.deep.equal({ to: address }); - }); - }); - }); - - describe('getTransactionCount', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getTransactionCount', reply: { result: '0x123' } }]); - }); - - it('passes in the address (default blockNumber)', () => { - return instance.getTransactionCount(address).then(() => { - expect(scope.body.eth_getTransactionCount.params).to.deep.equal([address.toLowerCase(), 'latest']); - }); - }); - - it('passes in the address & blockNumber', () => { - return instance.getTransactionCount(address, 0x456).then(() => { - expect(scope.body.eth_getTransactionCount.params).to.deep.equal([address.toLowerCase(), '0x456']); - }); - }); - - it('returns the count, formatted', () => { - return instance.getTransactionCount(address, 0x123).then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.toString(16)).to.equal('123'); - }); - }); - }); - - describe('getUncleByBlockHashAndIndex', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getUncleByBlockHashAndIndex', reply: { result: [] } }]); - }); - - it('passes in the hash (default index)', () => { - return instance.getUncleByBlockHashAndIndex('12345').then(() => { - expect(scope.body.eth_getUncleByBlockHashAndIndex.params).to.deep.equal(['0x12345', '0x0']); - }); - }); - - it('passes in the hash & specified index', () => { - return instance.getUncleByBlockHashAndIndex('6789', 0x456).then(() => { - expect(scope.body.eth_getUncleByBlockHashAndIndex.params).to.deep.equal(['0x6789', '0x456']); - }); - }); - }); - - describe('getUncleByBlockNumberAndIndex', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getUncleByBlockNumberAndIndex', reply: { result: [] } }]); - }); - - it('passes in the default parameters', () => { - return instance.getUncleByBlockNumberAndIndex().then(() => { - expect(scope.body.eth_getUncleByBlockNumberAndIndex.params).to.deep.equal(['latest', '0x0']); - }); - }); - - it('passes in the blockNumber & specified index', () => { - return instance.getUncleByBlockNumberAndIndex('0x6789', 0x456).then(() => { - expect(scope.body.eth_getUncleByBlockNumberAndIndex.params).to.deep.equal(['0x6789', '0x456']); - }); - }); - }); - - describe('getUncleCountByBlockHash', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getUncleCountByBlockHash', reply: { result: '0x123' } }]); - }); - - it('passes in the hash', () => { - return instance.getUncleCountByBlockHash('12345').then(() => { - expect(scope.body.eth_getUncleCountByBlockHash.params).to.deep.equal(['0x12345']); - }); - }); - - it('formats the output number', () => { - return instance.getUncleCountByBlockHash('0x1234').then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.toString(16)).to.equal('123'); - }); - }); - }); - - describe('getUncleCountByBlockNumber', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'eth_getUncleCountByBlockNumber', reply: { result: '0x123' } }]); - }); - - it('passes in the default parameters', () => { - return instance.getUncleCountByBlockNumber().then(() => { - expect(scope.body.eth_getUncleCountByBlockNumber.params).to.deep.equal(['latest']); - }); - }); - - it('passes in the blockNumber', () => { - return instance.getUncleCountByBlockNumber('0x6789').then(() => { - expect(scope.body.eth_getUncleCountByBlockNumber.params).to.deep.equal(['0x6789']); - }); - }); - - it('formats the output number', () => { - return instance.getUncleCountByBlockNumber('0x1234').then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.toString(16)).to.equal('123'); - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/eth/index.js b/js-old/src/api/rpc/eth/index.js deleted file mode 100644 index 25a7b3cb4..000000000 --- a/js-old/src/api/rpc/eth/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './eth'; diff --git a/js-old/src/api/rpc/index.js b/js-old/src/api/rpc/index.js deleted file mode 100644 index c8fa0032b..000000000 --- a/js-old/src/api/rpc/index.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export Db from './db'; -export Eth from './eth'; -export Parity from './parity'; -export Net from './net'; -export Personal from './personal'; -export Shh from './shh'; -export Signer from './signer'; -export Trace from './trace'; -export Web3 from './web3'; diff --git a/js-old/src/api/rpc/net/index.js b/js-old/src/api/rpc/net/index.js deleted file mode 100644 index 457eeed79..000000000 --- a/js-old/src/api/rpc/net/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './net'; diff --git a/js-old/src/api/rpc/net/net.e2e.js b/js-old/src/api/rpc/net/net.e2e.js deleted file mode 100644 index c477e2605..000000000 --- a/js-old/src/api/rpc/net/net.e2e.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { createHttpApi } from '../../../../test/e2e/ethapi'; -import { isBoolean } from '../../../../test/types'; - -describe('ethapi.net', () => { - const ethapi = createHttpApi(); - - describe('listening', () => { - it('returns the listening status', () => { - return ethapi.net.listening().then((status) => { - expect(isBoolean(status)).to.be.true; - }); - }); - }); - - describe('peerCount', () => { - it('returns the peer count', () => { - return ethapi.net.peerCount().then((count) => { - expect(count.gte(0)).to.be.true; - }); - }); - }); - - describe('version', () => { - it('returns the version', () => { - return ethapi.net.version().then((version) => { - expect(version).to.be.ok; - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/net/net.js b/js-old/src/api/rpc/net/net.js deleted file mode 100644 index 9b14f69d5..000000000 --- a/js-old/src/api/rpc/net/net.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { outNumber } from '../../format/output'; - -export default class Net { - constructor (transport) { - this._transport = transport; - } - - listening () { - return this._transport - .execute('net_listening'); - } - - peerCount () { - return this._transport - .execute('net_peerCount') - .then(outNumber); - } - - version () { - return this._transport - .execute('net_version'); - } -} diff --git a/js-old/src/api/rpc/net/net.spec.js b/js-old/src/api/rpc/net/net.spec.js deleted file mode 100644 index 07ad52076..000000000 --- a/js-old/src/api/rpc/net/net.spec.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; -import { isBigNumber } from '../../../../test/types'; - -import Http from '../../transport/http'; -import Net from './net'; - -const instance = new Net(new Http(TEST_HTTP_URL, -1)); - -describe('api/rpc/Net', () => { - describe('peerCount', () => { - it('returns the connected peers, formatted', () => { - mockHttp([{ method: 'net_peerCount', reply: { result: '0x123456' } }]); - - return instance.peerCount().then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.eq(0x123456)).to.be.true; - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/parity/index.js b/js-old/src/api/rpc/parity/index.js deleted file mode 100644 index 7fe520c60..000000000 --- a/js-old/src/api/rpc/parity/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './parity'; diff --git a/js-old/src/api/rpc/parity/parity.e2e.js b/js-old/src/api/rpc/parity/parity.e2e.js deleted file mode 100644 index 8820d570a..000000000 --- a/js-old/src/api/rpc/parity/parity.e2e.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { createHttpApi } from '../../../../test/e2e/ethapi'; - -describe('ethapi.parity', () => { - const ethapi = createHttpApi(); - - describe('chainStatus', () => { - it('returns and translates the status', () => { - return ethapi.parity.chainStatus().then((value) => { - expect(value).to.be.ok; - }); - }); - }); - - describe('gasFloorTarget', () => { - it('returns and translates the target', () => { - return ethapi.parity.gasFloorTarget().then((value) => { - expect(value.gt(0)).to.be.true; - }); - }); - }); - - describe('gasPriceHistogram', () => { - it('returns and translates the target', () => { - return ethapi.parity.gasPriceHistogram().then((result) => { - expect(Object.keys(result)).to.deep.equal(['bucketBounds', 'counts']); - expect(result.bucketBounds.length > 0).to.be.true; - expect(result.counts.length > 0).to.be.true; - }); - }); - }); - - describe('netChain', () => { - it('returns and the chain', () => { - return ethapi.parity.netChain().then((value) => { - expect(value).to.equal('morden'); - }); - }); - }); - - describe('netPort', () => { - it('returns and translates the port', () => { - return ethapi.parity.netPort().then((value) => { - expect(value.gt(0)).to.be.true; - }); - }); - }); - - describe('transactionsLimit', () => { - it('returns and translates the limit', () => { - return ethapi.parity.transactionsLimit().then((value) => { - expect(value.gt(0)).to.be.true; - }); - }); - }); - - describe('rpcSettings', () => { - it('returns and translates the settings', () => { - return ethapi.parity.rpcSettings().then((value) => { - expect(value).to.be.ok; - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/parity/parity.js b/js-old/src/api/rpc/parity/parity.js deleted file mode 100644 index 59ccb5884..000000000 --- a/js-old/src/api/rpc/parity/parity.js +++ /dev/null @@ -1,578 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { inAddress, inAddresses, inBlockNumber, inData, inDeriveHash, inDeriveIndex, inHex, inNumber16, inOptions } from '../../format/input'; -import { outAccountInfo, outAddress, outAddresses, outBlock, outChainStatus, outHistogram, outHwAccountInfo, outNodeKind, outNumber, outPeers, outRecentDapps, outTransaction, outVaultMeta } from '../../format/output'; - -export default class Parity { - constructor (transport) { - this._transport = transport; - } - - acceptNonReservedPeers () { - return this._transport - .execute('parity_acceptNonReservedPeers'); - } - - accountsInfo () { - return this._transport - .execute('parity_accountsInfo') - .then(outAccountInfo); - } - - allAccountsInfo () { - return this._transport - .execute('parity_allAccountsInfo') - .then(outAccountInfo); - } - - addReservedPeer (enode) { - return this._transport - .execute('parity_addReservedPeer', enode); - } - - chainStatus () { - return this._transport - .execute('parity_chainStatus') - .then(outChainStatus); - } - - changePassword (account, password, newPassword) { - return this._transport - .execute('parity_changePassword', inAddress(account), password, newPassword); - } - - changeVault (account, vaultName) { - return this._transport - .execute('parity_changeVault', inAddress(account), vaultName); - } - - changeVaultPassword (vaultName, password) { - return this._transport - .execute('parity_changeVaultPassword', vaultName, password); - } - - checkRequest (requestId) { - return this._transport - .execute('parity_checkRequest', inNumber16(requestId)); - } - - cidV0 (data) { - return this._transport - .execute('parity_cidV0', inData(data)); - } - - closeVault (vaultName) { - return this._transport - .execute('parity_closeVault', vaultName); - } - - composeTransaction (options) { - return this._transport - .execute('parity_composeTransaction', inOptions(options)); - } - - consensusCapability () { - return this._transport - .execute('parity_consensusCapability'); - } - - dappsList () { - return this._transport - .execute('parity_dappsList'); - } - - dappsRefresh () { - return this._transport - .execute('parity_dappsRefresh'); - } - - dappsUrl () { - return this._transport - .execute('parity_dappsUrl'); - } - - decryptMessage (address, data) { - return this._transport - .execute('parity_decryptMessage', inAddress(address), inHex(data)); - } - - defaultAccount () { - return this._transport - .execute('parity_defaultAccount') - .then(outAddress); - } - - defaultExtraData () { - return this._transport - .execute('parity_defaultExtraData'); - } - - devLogs () { - return this._transport - .execute('parity_devLogs'); - } - - devLogsLevels () { - return this._transport - .execute('parity_devLogsLevels'); - } - - deriveAddressHash (address, password, hash, shouldSave) { - return this._transport - .execute('parity_deriveAddressHash', inAddress(address), password, inDeriveHash(hash), !!shouldSave) - .then(outAddress); - } - - deriveAddressIndex (address, password, index, shouldSave) { - return this._transport - .execute('parity_deriveAddressIndex', inAddress(address), password, inDeriveIndex(index), !!shouldSave) - .then(outAddress); - } - - dropNonReservedPeers () { - return this._transport - .execute('parity_dropNonReservedPeers'); - } - - enode () { - return this._transport - .execute('parity_enode'); - } - - encryptMessage (pubkey, data) { - return this._transport - .execute('parity_encryptMessage', inHex(pubkey), inHex(data)); - } - - executeUpgrade () { - return this._transport - .execute('parity_executeUpgrade'); - } - - exportAccount (address, password) { - return this._transport - .execute('parity_exportAccount', inAddress(address), password); - } - - extraData () { - return this._transport - .execute('parity_extraData'); - } - - futureTransactions () { - return this._transport - .execute('parity_futureTransactions'); - } - - gasCeilTarget () { - return this._transport - .execute('parity_gasCeilTarget') - .then(outNumber); - } - - gasFloorTarget () { - return this._transport - .execute('parity_gasFloorTarget') - .then(outNumber); - } - - gasPriceHistogram () { - return this._transport - .execute('parity_gasPriceHistogram') - .then(outHistogram); - } - - generateSecretPhrase () { - return this._transport - .execute('parity_generateSecretPhrase'); - } - - getBlockHeaderByNumber (blockNumber = 'latest') { - return this._transport - .execute('parity_getBlockHeaderByNumber', inBlockNumber(blockNumber)) - .then(outBlock); - } - - getDappAddresses (dappId) { - return this._transport - .execute('parity_getDappAddresses', dappId) - .then(outAddresses); - } - - getDappDefaultAddress (dappId) { - return this._transport - .execute('parity_getDappDefaultAddress', dappId) - .then(outAddress); - } - - getNewDappsAddresses () { - return this._transport - .execute('parity_getNewDappsAddresses') - .then((addresses) => addresses ? addresses.map(outAddress) : null); - } - - getNewDappsDefaultAddress () { - return this._transport - .execute('parity_getNewDappsDefaultAddress') - .then(outAddress); - } - - getVaultMeta (vaultName) { - return this._transport - .execute('parity_getVaultMeta', vaultName) - .then(outVaultMeta); - } - - hardwareAccountsInfo () { - return this._transport - .execute('parity_hardwareAccountsInfo') - .then(outHwAccountInfo); - } - - hashContent (url) { - return this._transport - .execute('parity_hashContent', url); - } - - importGethAccounts (accounts) { - return this._transport - .execute('parity_importGethAccounts', inAddresses(accounts)) - .then(outAddresses); - } - - killAccount (account, password) { - return this._transport - .execute('parity_killAccount', inAddress(account), password); - } - - listAccounts (count, offset = null, blockNumber = 'latest') { - return this._transport - .execute('parity_listAccounts', count, inAddress(offset), inBlockNumber(blockNumber)) - .then((accounts) => (accounts || []).map(outAddress)); - } - - listOpenedVaults () { - return this._transport - .execute('parity_listOpenedVaults'); - } - - listVaults () { - return this._transport - .execute('parity_listVaults'); - } - - listRecentDapps () { - return this._transport - .execute('parity_listRecentDapps') - .then(outRecentDapps); - } - - listStorageKeys (address, count, hash = null, blockNumber = 'latest') { - return this._transport - .execute('parity_listStorageKeys', inAddress(address), count, inHex(hash), inBlockNumber(blockNumber)); - } - - removeAddress (address) { - return this._transport - .execute('parity_removeAddress', inAddress(address)); - } - - listGethAccounts () { - return this._transport - .execute('parity_listGethAccounts') - .then(outAddresses); - } - - localTransactions () { - return this._transport - .execute('parity_localTransactions') - .then(transactions => { - Object.values(transactions) - .filter(tx => tx.transaction) - .map(tx => { - tx.transaction = outTransaction(tx.transaction); - }); - return transactions; - }); - } - - minGasPrice () { - return this._transport - .execute('parity_minGasPrice') - .then(outNumber); - } - - mode () { - return this._transport - .execute('parity_mode'); - } - - // DEPRECATED - use chain instead. - netChain () { - return this._transport - .execute('parity_chain'); - } - - nodeKind () { - return this._transport - .execute('parity_nodeKind') - .then(outNodeKind); - } - - chain () { - return this._transport - .execute('parity_chain'); - } - - netPeers () { - return this._transport - .execute('parity_netPeers') - .then(outPeers); - } - - netMaxPeers () { - return this._transport - .execute('parity_netMaxPeers') - .then(outNumber); - } - - netPort () { - return this._transport - .execute('parity_netPort') - .then(outNumber); - } - - newAccountFromPhrase (phrase, password) { - return this._transport - .execute('parity_newAccountFromPhrase', phrase, password) - .then(outAddress); - } - - newAccountFromSecret (secret, password) { - return this._transport - .execute('parity_newAccountFromSecret', inHex(secret), password) - .then(outAddress); - } - - newAccountFromWallet (json, password) { - return this._transport - .execute('parity_newAccountFromWallet', json, password) - .then(outAddress); - } - - newVault (vaultName, password) { - return this._transport - .execute('parity_newVault', vaultName, password); - } - - nextNonce (account) { - return this._transport - .execute('parity_nextNonce', inAddress(account)) - .then(outNumber); - } - - nodeHealth () { - return this._transport - .execute('parity_nodeHealth'); - } - - nodeName () { - return this._transport - .execute('parity_nodeName'); - } - - openVault (vaultName, password) { - return this._transport - .execute('parity_openVault', vaultName, password); - } - - pendingTransactions () { - return this._transport - .execute('parity_pendingTransactions') - .then(data => data.map(outTransaction)); - } - - pendingTransactionsStats () { - return this._transport - .execute('parity_pendingTransactionsStats'); - } - - phraseToAddress (phrase) { - return this._transport - .execute('parity_phraseToAddress', phrase) - .then(outAddress); - } - - postSign (address, hash) { - return this._transport - .execute('parity_postSign', inAddress(address), inHex(hash)); - } - - postTransaction (options = {}) { - return this._transport - .execute('parity_postTransaction', inOptions(options)); - } - - registryAddress () { - return this._transport - .execute('parity_registryAddress') - .then(outAddress); - } - - releasesInfo () { - return this._transport - .execute('parity_releasesInfo'); - } - - removeReservedPeer (enode) { - return this._transport - .execute('parity_removeReservedPeer', enode); - } - - removeTransaction (hash) { - return this._transport - .execute('parity_removeTransaction', inHex(hash)) - .then(outTransaction); - } - - rpcSettings () { - return this._transport - .execute('parity_rpcSettings'); - } - - setAccountName (address, name) { - return this._transport - .execute('parity_setAccountName', inAddress(address), name); - } - - setAccountMeta (address, meta) { - return this._transport - .execute('parity_setAccountMeta', inAddress(address), JSON.stringify(meta)); - } - - setAuthor (address) { - return this._transport - .execute('parity_setAuthor', inAddress(address)); - } - - setDappAddresses (dappId, addresses) { - return this._transport - .execute('parity_setDappAddresses', dappId, inAddresses(addresses)); - } - - setDappDefaultAddress (dappId, address) { - return this._transport - .execute('parity_setDappDefaultAddress', dappId, address ? inAddress(address) : null); - } - - setEngineSigner (address, password) { - return this._transport - .execute('parity_setEngineSigner', inAddress(address), password); - } - - setExtraData (data) { - return this._transport - .execute('parity_setExtraData', inData(data)); - } - - setGasCeilTarget (quantity) { - return this._transport - .execute('parity_setGasCeilTarget', inNumber16(quantity)); - } - - setGasFloorTarget (quantity) { - return this._transport - .execute('parity_setGasFloorTarget', inNumber16(quantity)); - } - - setMaxTransactionGas (quantity) { - return this._transport - .execute('parity_setMaxTransactionGas', inNumber16(quantity)); - } - - setMinGasPrice (quantity) { - return this._transport - .execute('parity_setMinGasPrice', inNumber16(quantity)); - } - - setMode (mode) { - return this._transport - .execute('parity_setMode', mode); - } - - setChain (specName) { - return this._transport - .execute('parity_setChain', specName); - } - - setNewDappsAddresses (addresses) { - return this._transport - .execute('parity_setNewDappsAddresses', addresses ? inAddresses(addresses) : null); - } - - setNewDappsDefaultAddress (address) { - return this._transport - .execute('parity_setNewDappsDefaultAddress', inAddress(address)); - } - - setTransactionsLimit (quantity) { - return this._transport - .execute('parity_setTransactionsLimit', inNumber16(quantity)); - } - - setVaultMeta (vaultName, meta) { - return this._transport - .execute('parity_setVaultMeta', vaultName, JSON.stringify(meta)); - } - - signMessage (address, password, messageHash) { - return this._transport - .execute('parity_signMessage', inAddress(address), password, inHex(messageHash)); - } - - testPassword (account, password) { - return this._transport - .execute('parity_testPassword', inAddress(account), password); - } - - transactionsLimit () { - return this._transport - .execute('parity_transactionsLimit') - .then(outNumber); - } - - unsignedTransactionsCount () { - return this._transport - .execute('parity_unsignedTransactionsCount') - .then(outNumber); - } - - upgradeReady () { - return this._transport - .execute('parity_upgradeReady'); - } - - versionInfo () { - return this._transport - .execute('parity_versionInfo'); - } - - wsUrl () { - return this._transport - .execute('parity_wsUrl'); - } -} diff --git a/js-old/src/api/rpc/parity/parity.spec.js b/js-old/src/api/rpc/parity/parity.spec.js deleted file mode 100644 index 6ba7a1c83..000000000 --- a/js-old/src/api/rpc/parity/parity.spec.js +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; -import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; -import { isBigNumber } from '../../../../test/types'; - -import Http from '../../transport/http'; -import Parity from './parity'; - -const instance = new Parity(new Http(TEST_HTTP_URL, -1)); - -describe('api/rpc/parity', () => { - describe('accountsInfo', () => { - it('retrieves the available account info', () => { - mockHttp([{ method: 'parity_accountsInfo', reply: { - result: { - '0x63cf90d3f0410092fc0fca41846f596223979195': { - name: 'name', uuid: 'uuid', meta: '{"data":"data"}' - } - } - } }]); - - return instance.accountsInfo().then((result) => { - expect(result).to.deep.equal({ - '0x63Cf90D3f0410092FC0fca41846f596223979195': { - name: 'name', uuid: 'uuid', meta: { - data: 'data' - } - } - }); - }); - }); - }); - - describe('chainStatus', () => { - it('retrieves the chain status', () => { - mockHttp([{ method: 'parity_chainStatus', reply: { - result: { - 'blockGap': [0x123, 0x456] - } - } }]); - - return instance.chainStatus().then((result) => { - expect(result).to.deep.equal({ - 'blockGap': [new BigNumber(0x123), new BigNumber(0x456)] - }); - }); - }); - }); - - describe('gasFloorTarget', () => { - it('returns the gasfloor, formatted', () => { - mockHttp([{ method: 'parity_gasFloorTarget', reply: { result: '0x123456' } }]); - - return instance.gasFloorTarget().then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.eq(0x123456)).to.be.true; - }); - }); - }); - - describe('importGethAccounts', () => { - const ACCOUNTS = ['0x63cf90d3f0410092fc0fca41846f596223979195']; - let scope; - - beforeEach(() => { - scope = mockHttp([{ method: 'parity_importGethAccounts', reply: { result: ACCOUNTS } }]); - }); - - it('passes the addresses through', () => { - return instance.importGethAccounts(ACCOUNTS).then((result) => { - expect(scope.body['parity_importGethAccounts'].params).to.deep.equal([ACCOUNTS]); - }); - }); - }); - - describe('minGasPrice', () => { - it('returns the min gasprice, formatted', () => { - mockHttp([{ method: 'parity_minGasPrice', reply: { result: '0x123456' } }]); - - return instance.minGasPrice().then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.eq(0x123456)).to.be.true; - }); - }); - }); - - describe('netMaxPeers', () => { - it('returns the max peers, formatted', () => { - mockHttp([{ method: 'parity_netMaxPeers', reply: { result: 25 } }]); - - return instance.netMaxPeers().then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.eq(25)).to.be.true; - }); - }); - }); - - describe('netPeers', () => { - it('returns the peer structure, formatted', () => { - mockHttp([{ method: 'parity_netPeers', reply: { result: { active: 123, connected: 456, max: 789, peers: [] } } }]); - - return instance.netPeers().then((peers) => { - expect(peers.active.eq(123)).to.be.true; - expect(peers.connected.eq(456)).to.be.true; - expect(peers.max.eq(789)).to.be.true; - }); - }); - }); - - describe('netPort', () => { - it('returns the connected port, formatted', () => { - mockHttp([{ method: 'parity_netPort', reply: { result: 33030 } }]); - - return instance.netPort().then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.eq(33030)).to.be.true; - }); - }); - }); - - describe('transactionsLimit', () => { - it('returns the tx limit, formatted', () => { - mockHttp([{ method: 'parity_transactionsLimit', reply: { result: 1024 } }]); - - return instance.transactionsLimit().then((count) => { - expect(isBigNumber(count)).to.be.true; - expect(count.eq(1024)).to.be.true; - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/personal/index.js b/js-old/src/api/rpc/personal/index.js deleted file mode 100644 index ec9993442..000000000 --- a/js-old/src/api/rpc/personal/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './personal'; diff --git a/js-old/src/api/rpc/personal/personal.e2e.js b/js-old/src/api/rpc/personal/personal.e2e.js deleted file mode 100644 index d83e9b811..000000000 --- a/js-old/src/api/rpc/personal/personal.e2e.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { createHttpApi } from '../../../../test/e2e/ethapi'; -import { isAddress, isBoolean } from '../../../../test/types'; - -describe.skip('ethapi.personal', () => { - const ethapi = createHttpApi(); - const password = 'P@55word'; - let address; - - describe('newAccount', () => { - it('creates a new account', () => { - return ethapi.personal.newAccount(password).then((_address) => { - address = _address; - expect(isAddress(address)).to.be.ok; - }); - }); - }); - - describe('listAccounts', () => { - it('has the newly-created account', () => { - return ethapi.personal.listAccounts(password).then((accounts) => { - expect(accounts.filter((_address) => _address === address)).to.deep.equal([address]); - accounts.forEach((account) => { - expect(isAddress(account)).to.be.true; - }); - }); - }); - }); - - describe('unlockAccount', () => { - it('unlocks the newly-created account', () => { - return ethapi.personal.unlockAccount(address, password).then((result) => { - expect(isBoolean(result)).to.be.true; - expect(result).to.be.true; - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/personal/personal.js b/js-old/src/api/rpc/personal/personal.js deleted file mode 100644 index dd9c40f62..000000000 --- a/js-old/src/api/rpc/personal/personal.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { inAddress, inNumber10, inOptions } from '../../format/input'; -import { outAddress } from '../../format/output'; - -export default class Personal { - constructor (transport) { - this._transport = transport; - } - - listAccounts () { - return this._transport - .execute('personal_listAccounts') - .then((accounts) => (accounts || []).map(outAddress)); - } - - newAccount (password) { - return this._transport - .execute('personal_newAccount', password) - .then(outAddress); - } - - sendTransaction (options, password) { - return this._transport - .execute('personal_sendTransaction', inOptions(options), password); - } - - unlockAccount (account, password, duration = 1) { - return this._transport - .execute('personal_unlockAccount', inAddress(account), password, inNumber10(duration)); - } -} diff --git a/js-old/src/api/rpc/personal/personal.spec.js b/js-old/src/api/rpc/personal/personal.spec.js deleted file mode 100644 index d67bb9dec..000000000 --- a/js-old/src/api/rpc/personal/personal.spec.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; - -import Http from '../../transport/http'; -import Personal from './personal'; - -const instance = new Personal(new Http(TEST_HTTP_URL, -1)); - -describe('rpc/Personal', () => { - const account = '0x63cf90d3f0410092fc0fca41846f596223979195'; - const checksum = '0x63Cf90D3f0410092FC0fca41846f596223979195'; - let scope; - - describe('listAccounts', () => { - it('retrieves a list of available accounts', () => { - scope = mockHttp([{ method: 'personal_listAccounts', reply: { result: [account] } }]); - - return instance.listAccounts().then((result) => { - expect(result).to.deep.equal([checksum]); - }); - }); - - it('returns an empty list when none available', () => { - scope = mockHttp([{ method: 'personal_listAccounts', reply: { result: null } }]); - - return instance.listAccounts().then((result) => { - expect(result).to.deep.equal([]); - }); - }); - }); - - describe('newAccount', () => { - it('passes the password, returning the address', () => { - scope = mockHttp([{ method: 'personal_newAccount', reply: { result: account } }]); - - return instance.newAccount('password').then((result) => { - expect(scope.body.personal_newAccount.params).to.deep.equal(['password']); - expect(result).to.equal(checksum); - }); - }); - }); - - describe('unlockAccount', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'personal_unlockAccount', reply: { result: [] } }]); - }); - - it('passes account, password & duration', () => { - return instance.unlockAccount(account, 'password', 0xf).then(() => { - expect(scope.body.personal_unlockAccount.params).to.deep.equal([account, 'password', 15]); - }); - }); - - it('provides a default duration when not specified', () => { - return instance.unlockAccount(account, 'password').then(() => { - expect(scope.body.personal_unlockAccount.params).to.deep.equal([account, 'password', 1]); - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/shh/index.js b/js-old/src/api/rpc/shh/index.js deleted file mode 100644 index 1094fe437..000000000 --- a/js-old/src/api/rpc/shh/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './shh'; diff --git a/js-old/src/api/rpc/shh/shh.js b/js-old/src/api/rpc/shh/shh.js deleted file mode 100644 index c58754abf..000000000 --- a/js-old/src/api/rpc/shh/shh.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default class Shh { - constructor (transport) { - this._transport = transport; - } - - info () { - return this._transport - .execute('shh_info'); - } - - newKeyPair () { - return this._transport - .execute('shh_newKeyPair'); - } - - addPrivateKey (privKey) { - return this._transport - .execute('shh_addPrivateKey', privKey); - } - - newSymKey () { - return this._transport - .execute('shh_newSymKey'); - } - - getPublicKey (identity) { - return this._transport - .execute('shh_getPublicKey', identity); - } - - getPrivateKey (identity) { - return this._transport - .execute('shh_getPrivateKey', identity); - } - - getSymKey (identity) { - return this._transport - .execute('shh_getSymKey', identity); - } - - deleteKey (identity) { - return this._transport - .execute('shh_deleteKey', identity); - } - - post (messageObj) { - return this._transport - .execute('shh_post', messageObj); - } - - newMessageFilter (filterObj) { - return this._transport - .execute('shh_newMessageFilter', filterObj); - } - - getFilterMessages (filterId) { - return this._transport - .execute('shh_getFilterMessages', filterId); - } - - deleteMessageFilter (filterId) { - return this._transport - .execute('shh_deleteMessageFilter', filterId); - } - - subscribe (filterObj, callback) { - return this._transport - .subscribe('shh', callback, filterObj); - } - - unsubscribe (subscriptionId) { - return this._transport - .unsubscribe(subscriptionId); - } -} diff --git a/js-old/src/api/rpc/signer/index.js b/js-old/src/api/rpc/signer/index.js deleted file mode 100644 index cc1e4dc1c..000000000 --- a/js-old/src/api/rpc/signer/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './signer'; diff --git a/js-old/src/api/rpc/signer/signer.js b/js-old/src/api/rpc/signer/signer.js deleted file mode 100644 index 915b81158..000000000 --- a/js-old/src/api/rpc/signer/signer.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { inData, inNumber16, inOptions } from '../../format/input'; -import { outSignerRequest } from '../../format/output'; - -export default class Signer { - constructor (transport) { - this._transport = transport; - } - - confirmRequest (requestId, options, password) { - return this._transport - .execute('signer_confirmRequest', inNumber16(requestId), inOptions(options), password); - } - - confirmRequestRaw (requestId, data) { - return this._transport - .execute('signer_confirmRequestRaw', inNumber16(requestId), inData(data)); - } - - confirmRequestWithToken (requestId, options, password) { - return this._transport - .execute('signer_confirmRequestWithToken', inNumber16(requestId), inOptions(options), password); - } - - generateAuthorizationToken () { - return this._transport - .execute('signer_generateAuthorizationToken'); - } - - generateWebProxyAccessToken (domain) { - return this._transport - .execute('signer_generateWebProxyAccessToken', domain); - } - - rejectRequest (requestId) { - return this._transport - .execute('signer_rejectRequest', inNumber16(requestId)); - } - - requestsToConfirm () { - return this._transport - .execute('signer_requestsToConfirm') - .then((requests) => (requests || []).map(outSignerRequest)); - } - - signerEnabled () { - return this._transport - .execute('signer_signerEnabled'); - } -} diff --git a/js-old/src/api/rpc/trace/index.js b/js-old/src/api/rpc/trace/index.js deleted file mode 100644 index 8d02aed45..000000000 --- a/js-old/src/api/rpc/trace/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './trace'; diff --git a/js-old/src/api/rpc/trace/trace.e2e.js b/js-old/src/api/rpc/trace/trace.e2e.js deleted file mode 100644 index ffbef0ed6..000000000 --- a/js-old/src/api/rpc/trace/trace.e2e.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { createHttpApi } from '../../../../test/e2e/ethapi'; - -describe('ethapi.trace', () => { - const ethapi = createHttpApi(); - - describe('block', () => { - it('returns the latest block traces', () => { - return ethapi.trace.block().then((traces) => { - expect(traces).to.be.ok; - }); - }); - - it('returns traces for a specified block', () => { - return ethapi.trace.block('0x65432').then((traces) => { - expect(traces).to.be.ok; - }); - }); - }); - - describe('replayTransaction', () => { - it('returns traces for a specific transaction', () => { - return ethapi.eth.getBlockByNumber().then((latestBlock) => { - return ethapi.trace.replayTransaction(latestBlock.transactions[0]).then((traces) => { - expect(traces).to.be.ok; - }); - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/trace/trace.js b/js-old/src/api/rpc/trace/trace.js deleted file mode 100644 index 26b19b378..000000000 --- a/js-old/src/api/rpc/trace/trace.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { inBlockNumber, inData, inHex, inNumber16, inOptions, inTraceFilter, inTraceType } from '../../format/input'; -import { outTraces, outTraceReplay } from '../../format/output'; - -export default class Trace { - constructor (transport) { - this._transport = transport; - } - - block (blockNumber = 'latest') { - return this._transport - .execute('trace_block', inBlockNumber(blockNumber)) - .then(outTraces); - } - - call (options, whatTrace = ['trace'], blockNumber = 'latest') { - return this._transport - .execute('trace_call', inOptions(options), inTraceType(whatTrace), inBlockNumber(blockNumber)) - .then(outTraceReplay); - } - - filter (filterObj) { - return this._transport - .execute('trace_filter', inTraceFilter(filterObj)) - .then(outTraces); - } - - get (txHash, position) { - return this._transport - .execute('trace_get', inHex(txHash), inNumber16(position)) - .then(outTraces); - } - - rawTransaction (data, whatTrace = ['trace']) { - return this._transport - .execute('trace_rawTransaction', inData(data), inTraceType(whatTrace)) - .then(outTraceReplay); - } - - replayTransaction (txHash, whatTrace = ['trace']) { - return this._transport - .execute('trace_replayTransaction', txHash, inTraceType(whatTrace)) - .then(outTraceReplay); - } - - transaction (txHash) { - return this._transport - .execute('trace_transaction', inHex(txHash)) - .then(outTraces); - } -} diff --git a/js-old/src/api/rpc/trace/trace.spec.js b/js-old/src/api/rpc/trace/trace.spec.js deleted file mode 100644 index 267d1240f..000000000 --- a/js-old/src/api/rpc/trace/trace.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; - -import Http from '../../transport/http'; -import Trace from './trace'; - -const instance = new Trace(new Http(TEST_HTTP_URL, -1)); - -describe('api/rpc/Trace', () => { - let scope; - - describe('block', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'trace_block', reply: { result: [] } }]); - }); - - it('assumes latest blockNumber when not specified', () => { - return instance.block().then(() => { - expect(scope.body.trace_block.params).to.deep.equal(['latest']); - }); - }); - - it('passed specified blockNumber', () => { - return instance.block(0x123).then(() => { - expect(scope.body.trace_block.params).to.deep.equal(['0x123']); - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/web3/index.js b/js-old/src/api/rpc/web3/index.js deleted file mode 100644 index c2590ec11..000000000 --- a/js-old/src/api/rpc/web3/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './web3'; diff --git a/js-old/src/api/rpc/web3/web3.e2e.js b/js-old/src/api/rpc/web3/web3.e2e.js deleted file mode 100644 index 2c8243a4f..000000000 --- a/js-old/src/api/rpc/web3/web3.e2e.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { createHttpApi } from '../../../../test/e2e/ethapi'; -import { isHexNumber } from '../../../../test/types'; - -describe('ethapi.web3', () => { - const ethapi = createHttpApi(); - - describe('clientVersion', () => { - it('returns the client version', () => { - return ethapi.web3.clientVersion().then((version) => { - const [client] = version.split('/'); - - expect(client === 'Parity' || client === 'Geth').to.be.ok; - }); - }); - }); - - describe('sha3', () => { - it('returns a keccak256 sha', () => { - const sha = '0xa7916fac4f538170f7cd12c148552e2cba9fcd72329a2dd5b07a6fa906488ddf'; - const hexStr = 'baz()'.split('').map((char) => char.charCodeAt(0).toString(16)).join(''); - - return ethapi.web3.sha3(`0x${hexStr}`).then((hash) => { - expect(isHexNumber(hash)).to.be.true; - expect(hash).to.equal(sha); - }); - }); - }); -}); diff --git a/js-old/src/api/rpc/web3/web3.js b/js-old/src/api/rpc/web3/web3.js deleted file mode 100644 index 21b2d77f1..000000000 --- a/js-old/src/api/rpc/web3/web3.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { inHex } from '../../format/input'; - -export default class Web3 { - constructor (transport) { - this._transport = transport; - } - - clientVersion () { - return this._transport - .execute('web3_clientVersion'); - } - - sha3 (hexStr) { - return this._transport - .execute('web3_sha3', inHex(hexStr)); - } -} diff --git a/js-old/src/api/rpc/web3/web3.spec.js b/js-old/src/api/rpc/web3/web3.spec.js deleted file mode 100644 index b46679b82..000000000 --- a/js-old/src/api/rpc/web3/web3.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; - -import Http from '../../transport/http'; -import Web3 from './web3'; - -const instance = new Web3(new Http(TEST_HTTP_URL, -1)); - -describe('api/rpc/Web3', () => { - let scope; - - describe('sha3', () => { - beforeEach(() => { - scope = mockHttp([{ method: 'web3_sha3', reply: { result: [] } }]); - }); - - it('formats the inputs correctly', () => { - return instance.sha3('1234').then(() => { - expect(scope.body.web3_sha3.params).to.deep.equal(['0x1234']); - }); - }); - }); -}); diff --git a/js-old/src/api/subscriptions/eth.js b/js-old/src/api/subscriptions/eth.js deleted file mode 100644 index 8e56f335f..000000000 --- a/js-old/src/api/subscriptions/eth.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -export default class Eth { - constructor (updateSubscriptions, api) { - this._api = api; - this._updateSubscriptions = updateSubscriptions; - this._started = false; - - this._lastBlock = new BigNumber(-1); - this._pollTimerId = null; - } - - get isStarted () { - return this._started; - } - - start () { - this._started = true; - - return this._blockNumber(); - } - - _blockNumber = () => { - const nextTimeout = (timeout = 1000) => { - this._pollTimerId = setTimeout(() => { - this._blockNumber(); - }, timeout); - }; - - if (!this._api.transport.isConnected) { - nextTimeout(500); - return; - } - - return this._api.eth - .blockNumber() - .then((blockNumber) => { - if (!blockNumber.eq(this._lastBlock)) { - this._lastBlock = blockNumber; - this._updateSubscriptions('eth_blockNumber', null, blockNumber); - } - - nextTimeout(); - }) - .catch(() => nextTimeout()); - } -} diff --git a/js-old/src/api/subscriptions/eth.spec.js b/js-old/src/api/subscriptions/eth.spec.js deleted file mode 100644 index 3f5ee81d6..000000000 --- a/js-old/src/api/subscriptions/eth.spec.js +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; -import sinon from 'sinon'; - -import Eth from './eth'; - -const START_BLOCK = 5000; - -function stubApi (blockNumber) { - const _calls = { - blockNumber: [] - }; - - return { - _calls, - transport: { - isConnected: true - }, - eth: { - blockNumber: () => { - const stub = sinon.stub().resolves(new BigNumber(blockNumber || START_BLOCK))(); - - _calls.blockNumber.push(stub); - return stub; - } - } - }; -} - -describe('api/subscriptions/eth', () => { - let api; - let eth; - let cb; - - beforeEach(() => { - api = stubApi(); - cb = sinon.stub(); - eth = new Eth(cb, api); - }); - - describe('constructor', () => { - it('starts the instance in a stopped state', () => { - expect(eth.isStarted).to.be.false; - }); - }); - - describe('start', () => { - describe('blockNumber available', () => { - beforeEach(() => { - return eth.start(); - }); - - it('sets the started status', () => { - expect(eth.isStarted).to.be.true; - }); - - it('calls eth_blockNumber', () => { - expect(api._calls.blockNumber.length).to.be.ok; - }); - - it('updates subscribers', () => { - expect(cb).to.have.been.calledWith('eth_blockNumber', null, new BigNumber(START_BLOCK)); - }); - }); - - describe('blockNumber not available', () => { - beforeEach(() => { - api = stubApi(-1); - eth = new Eth(cb, api); - return eth.start(); - }); - - it('sets the started status', () => { - expect(eth.isStarted).to.be.true; - }); - - it('calls eth_blockNumber', () => { - expect(api._calls.blockNumber.length).to.be.ok; - }); - - it('does not update subscribers', () => { - expect(cb).not.to.been.called; - }); - }); - }); -}); diff --git a/js-old/src/api/subscriptions/index.js b/js-old/src/api/subscriptions/index.js deleted file mode 100644 index 07856faef..000000000 --- a/js-old/src/api/subscriptions/index.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export Logging from './logging'; - -export default from './manager'; diff --git a/js-old/src/api/subscriptions/logging.js b/js-old/src/api/subscriptions/logging.js deleted file mode 100644 index 545742dff..000000000 --- a/js-old/src/api/subscriptions/logging.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -let instance = null; - -export default class Logging { - constructor (updateSubscriptions) { - this._updateSubscriptions = updateSubscriptions; - - instance = this; - } - - get isStarted () { - return true; - } - - start () { - } - - static send (method, params, json) { - if (!instance) { - return; - } - - return instance._updateSubscriptions('logging', null, { - method, - params, - json - }); - } -} diff --git a/js-old/src/api/subscriptions/logging.spec.js b/js-old/src/api/subscriptions/logging.spec.js deleted file mode 100644 index f155696b7..000000000 --- a/js-old/src/api/subscriptions/logging.spec.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import sinon from 'sinon'; - -import Logging from './logging'; - -describe('api/subscriptions/logging', () => { - let cb; - let logging; - - beforeEach(() => { - cb = sinon.stub(); - logging = new Logging(cb); - }); - - describe('constructor', () => { - it('starts the instance in a started state', () => { - expect(logging.isStarted).to.be.true; - }); - }); - - describe('send', () => { - const method = 'method'; - const params = 'params'; - const json = 'json'; - - beforeEach(() => { - Logging.send(method, params, json); - }); - - it('calls the subscription update', () => { - expect(cb).to.have.been.calledWith('logging', null, { method, params, json }); - }); - }); -}); diff --git a/js-old/src/api/subscriptions/manager.js b/js-old/src/api/subscriptions/manager.js deleted file mode 100644 index 6ca2f4015..000000000 --- a/js-old/src/api/subscriptions/manager.js +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { isError } from '../util/types'; - -import Eth from './eth'; -import Logging from './logging'; -import Personal from './personal'; -import Signer from './signer'; - -const events = { - 'logging': { module: 'logging' }, - 'eth_blockNumber': { module: 'eth' }, - 'parity_accountsInfo': { module: 'personal' }, - 'parity_allAccountsInfo': { module: 'personal' }, - 'parity_defaultAccount': { module: 'personal' }, - 'parity_postTransaction': { module: 'signer' }, - 'eth_accounts': { module: 'personal' }, - 'signer_requestsToConfirm': { module: 'signer' } -}; - -export default class Manager { - constructor (api) { - this._api = api; - - this.subscriptions = []; - this.values = {}; - - Object.keys(events).forEach((subscriptionName) => { - this.values[subscriptionName] = { - error: null, - data: null - }; - }); - - this._logging = new Logging(this._updateSubscriptions); - this._eth = new Eth(this._updateSubscriptions, api); - this._personal = new Personal(this._updateSubscriptions, api, this); - this._signer = new Signer(this._updateSubscriptions, api, this); - } - - _validateType (subscriptionName) { - const subscription = events[subscriptionName]; - - if (!subscription) { - return new Error(`${subscriptionName} is not a valid interface, subscribe using one of ${Object.keys(events).join(', ')}`); - } - - return subscription; - } - - subscribe (subscriptionName, callback, autoRemove = false) { - return new Promise((resolve, reject) => { - const subscription = this._validateType(subscriptionName); - - if (isError(subscription)) { - reject(subscription); - return; - } - - const subscriptionId = this.subscriptions.length; - const { error, data } = this.values[subscriptionName]; - const engine = this[`_${subscription.module}`]; - - this.subscriptions[subscriptionId] = { - name: subscriptionName, - id: subscriptionId, - autoRemove, - callback - }; - - if (!engine.isStarted) { - engine.start(); - } else if (error !== null || data !== null) { - this._sendData(subscriptionId, error, data); - } - - resolve(subscriptionId); - }); - } - - unsubscribe (subscriptionId) { - return new Promise((resolve, reject) => { - if (!this.subscriptions[subscriptionId]) { - reject(new Error(`Cannot find subscription ${subscriptionId}`)); - return; - } - - delete this.subscriptions[subscriptionId]; - resolve(); - }); - } - - _sendData (subscriptionId, error, data) { - const { autoRemove, callback } = this.subscriptions[subscriptionId]; - let result = true; - - try { - result = callback(error, data); - } catch (error) { - console.error(`Unable to update callback for subscriptionId ${subscriptionId}`, error); - } - - if (autoRemove && result && typeof result === 'boolean') { - this.unsubscribe(subscriptionId); - } - } - - _updateSubscriptions = (subscriptionName, error, data) => { - const subscriptions = this.subscriptions - .filter(subscription => subscription.name === subscriptionName); - - this.values[subscriptionName] = { error, data }; - - subscriptions - .forEach((subscription) => { - this._sendData(subscription.id, error, data); - }); - } -} - -export { - events -}; diff --git a/js-old/src/api/subscriptions/manager.spec.js b/js-old/src/api/subscriptions/manager.spec.js deleted file mode 100644 index df708a36d..000000000 --- a/js-old/src/api/subscriptions/manager.spec.js +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import sinon from 'sinon'; - -import Manager, { events } from './manager'; - -function newStub () { - const start = () => manager._updateSubscriptions(manager.__test, null, 'test'); - - const manager = new Manager({ - transport: { - isConnected: true - } - }); - - manager._eth = { - isStarted: false, - start - }; - - manager._personal = { - isStarted: false, - start - }; - - manager._signer = { - isStarted: false, - start - }; - - return manager; -} - -describe('api/subscriptions/manager', () => { - let manager; - - beforeEach(() => { - manager = newStub(); - }); - - describe('constructor', () => { - it('sets up the subscription types & defaults', () => { - expect(manager.subscriptions).to.be.an.array; - expect(Object.keys(manager.values)).to.deep.equal(Object.keys(events)); - }); - }); - - describe('subscriptions', () => { - Object - .keys(events) - .filter((eventName) => eventName.indexOf('_') !== -1) - .forEach((eventName) => { - const { module } = events[eventName]; - let engine; - let cb; - let subscriptionId; - - describe(eventName, () => { - beforeEach(() => { - engine = manager[`_${module}`]; - manager.__test = eventName; - cb = sinon.stub(); - sinon.spy(engine, 'start'); - - return manager - .subscribe(eventName, cb) - .then((_subscriptionId) => { - subscriptionId = _subscriptionId; - }); - }); - - it(`puts the ${module} engine in a started state`, () => { - expect(engine.start).to.have.been.called; - }); - - it('returns a subscriptionId', () => { - expect(subscriptionId).to.be.a.number; - }); - - it('calls the subscription callback with updated values', () => { - expect(cb).to.have.been.calledWith(null, 'test'); - }); - }); - }); - }); - - describe('unsubscriptions', () => { - Object - .keys(events) - .filter((eventName) => eventName.indexOf('_') !== -1) - .forEach((eventName) => { - const { module } = events[eventName]; - let engine; - let cb; - - describe(eventName, () => { - beforeEach(() => { - engine = manager[`_${module}`]; - manager.__test = eventName; - cb = sinon.stub(); - sinon.spy(engine, 'start'); - - return manager - .subscribe(eventName, cb) - .then((_subscriptionId) => { - manager.unsubscribe(_subscriptionId); - }) - .then(() => { - manager._updateSubscriptions(manager.__test, null, 'test2'); - }); - }); - - it('does not call the callback after unsubscription', () => { - expect(cb).to.have.been.calledWith(null, 'test'); - expect(cb).to.not.have.been.calledWith(null, 'test2'); - }); - }); - }); - }); -}); diff --git a/js-old/src/api/subscriptions/personal.js b/js-old/src/api/subscriptions/personal.js deleted file mode 100644 index fa7ae823c..000000000 --- a/js-old/src/api/subscriptions/personal.js +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default class Personal { - constructor (updateSubscriptions, api, subscriber) { - this._subscriber = subscriber; - this._api = api; - this._updateSubscriptions = updateSubscriptions; - this._started = false; - - this._lastDefaultAccount = '0x0'; - this._pollTimerId = null; - } - - get isStarted () { - return this._started; - } - - start () { - this._started = true; - - return Promise.all([ - this._defaultAccount(), - this._listAccounts(), - this._accountsInfo(), - this._loggingSubscribe() - ]); - } - - // FIXME: Because of the different API instances, the "wait for valid changes" approach - // doesn't work. Since the defaultAccount is critical to operation, we poll in exactly - // same way we do in ../eth (ala eth_blockNumber) and update. This should be moved - // to pub-sub as it becomes available - _defaultAccount = (timerDisabled = false) => { - const nextTimeout = (timeout = 1000) => { - if (!timerDisabled) { - this._pollTimerId = setTimeout(() => { - this._defaultAccount(); - }, timeout); - } - }; - - if (!this._api.transport.isConnected) { - nextTimeout(500); - return; - } - - return this._api.parity - .defaultAccount() - .then((defaultAccount) => { - if (this._lastDefaultAccount !== defaultAccount) { - this._lastDefaultAccount = defaultAccount; - this._updateSubscriptions('parity_defaultAccount', null, defaultAccount); - } - - nextTimeout(); - }) - .catch(() => nextTimeout()); - } - - _listAccounts = () => { - return this._api.eth - .accounts() - .then((accounts) => { - this._updateSubscriptions('eth_accounts', null, accounts); - }); - } - - _accountsInfo = () => { - return this._api.parity - .accountsInfo() - .then((info) => { - this._updateSubscriptions('parity_accountsInfo', null, info); - - return this._api.parity - .allAccountsInfo() - .catch(() => { - // NOTE: This fails on non-secure APIs, swallow error - return {}; - }) - .then((allInfo) => { - this._updateSubscriptions('parity_allAccountsInfo', null, allInfo); - }); - }); - } - - _loggingSubscribe () { - return this._subscriber.subscribe('logging', (error, data) => { - if (error || !data) { - return; - } - - switch (data.method) { - case 'parity_closeVault': - case 'parity_openVault': - case 'parity_killAccount': - case 'parity_importGethAccounts': - case 'parity_newAccountFromPhrase': - case 'parity_newAccountFromWallet': - case 'personal_newAccount': - this._defaultAccount(true); - this._listAccounts(); - this._accountsInfo(); - return; - - case 'parity_removeAddress': - case 'parity_setAccountName': - case 'parity_setAccountMeta': - this._accountsInfo(); - return; - - case 'parity_setDappAddresses': - case 'parity_setDappDefaultAddress': - case 'parity_setNewDappsAddresses': - case 'parity_setNewDappsDefaultAddress': - this._defaultAccount(true); - this._listAccounts(); - return; - } - }); - } -} diff --git a/js-old/src/api/subscriptions/personal.spec.js b/js-old/src/api/subscriptions/personal.spec.js deleted file mode 100644 index ac046d250..000000000 --- a/js-old/src/api/subscriptions/personal.spec.js +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import sinon from 'sinon'; - -import Personal from './personal'; - -const TEST_DEFAULT = '0xfa64203C044691aA57251aF95f4b48d85eC00Dd5'; -const TEST_INFO = { - [TEST_DEFAULT]: { - name: 'test' - } -}; -const TEST_LIST = [TEST_DEFAULT]; - -function stubApi (accounts, info) { - const _calls = { - accountsInfo: [], - allAccountsInfo: [], - listAccounts: [], - defaultAccount: [] - }; - - return { - _calls, - transport: { - isConnected: true - }, - parity: { - accountsInfo: () => { - const stub = sinon.stub().resolves(info || TEST_INFO)(); - - _calls.accountsInfo.push(stub); - return stub; - }, - allAccountsInfo: () => { - const stub = sinon.stub().resolves(info || TEST_INFO)(); - - _calls.allAccountsInfo.push(stub); - return stub; - }, - defaultAccount: () => { - const stub = sinon.stub().resolves(Object.keys(info || TEST_INFO)[0])(); - - _calls.defaultAccount.push(stub); - return stub; - } - }, - eth: { - accounts: () => { - const stub = sinon.stub().resolves(accounts || TEST_LIST)(); - - _calls.listAccounts.push(stub); - return stub; - } - } - }; -} - -function stubLogging () { - return { - subscribe: sinon.stub() - }; -} - -describe('api/subscriptions/personal', () => { - let api; - let cb; - let logging; - let personal; - - beforeEach(() => { - api = stubApi(); - cb = sinon.stub(); - logging = stubLogging(); - personal = new Personal(cb, api, logging); - }); - - describe('constructor', () => { - it('starts the instance in a stopped state', () => { - expect(personal.isStarted).to.be.false; - }); - }); - - describe('start', () => { - describe('info available', () => { - beforeEach(() => { - return personal.start(); - }); - - it('sets the started status', () => { - expect(personal.isStarted).to.be.true; - }); - - it('calls parity_accountsInfo', () => { - expect(api._calls.accountsInfo.length).to.be.ok; - }); - - it('calls parity_allAccountsInfo', () => { - expect(api._calls.allAccountsInfo.length).to.be.ok; - }); - - it('calls eth_accounts', () => { - expect(api._calls.listAccounts.length).to.be.ok; - }); - - it('updates subscribers', () => { - expect(cb).to.have.been.calledWith('parity_defaultAccount', null, TEST_DEFAULT); - expect(cb).to.have.been.calledWith('eth_accounts', null, TEST_LIST); - expect(cb).to.have.been.calledWith('parity_accountsInfo', null, TEST_INFO); - expect(cb).to.have.been.calledWith('parity_allAccountsInfo', null, TEST_INFO); - }); - }); - - describe('info not available', () => { - beforeEach(() => { - api = stubApi([], {}); - personal = new Personal(cb, api, logging); - return personal.start(); - }); - - it('sets the started status', () => { - expect(personal.isStarted).to.be.true; - }); - - it('calls parity_defaultAccount', () => { - expect(api._calls.defaultAccount.length).to.be.ok; - }); - - it('calls personal_accountsInfo', () => { - expect(api._calls.accountsInfo.length).to.be.ok; - }); - - it('calls personal_allAccountsInfo', () => { - expect(api._calls.allAccountsInfo.length).to.be.ok; - }); - - it('calls personal_listAccounts', () => { - expect(api._calls.listAccounts.length).to.be.ok; - }); - }); - }); -}); diff --git a/js-old/src/api/subscriptions/signer.js b/js-old/src/api/subscriptions/signer.js deleted file mode 100644 index 2215ed7f3..000000000 --- a/js-old/src/api/subscriptions/signer.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { outTransaction } from '../format/output'; - -export default class Signer { - constructor (updateSubscriptions, api, subscriber) { - this._subscriber = subscriber; - this._api = api; - this._updateSubscriptions = updateSubscriptions; - this._started = false; - } - - get isStarted () { - return this._started; - } - - start () { - this._started = true; - - return Promise.all([ - this._listRequests(true), - this._loggingSubscribe() - ]); - } - - _listRequests = (doTimeout) => { - const nextTimeout = (timeout = 1000) => { - if (doTimeout) { - setTimeout(() => { - this._listRequests(true); - }, timeout); - } - }; - - if (!this._api.transport.isConnected) { - nextTimeout(500); - return; - } - - return this._api.signer - .requestsToConfirm() - .then((requests) => { - this._updateSubscriptions('signer_requestsToConfirm', null, requests); - nextTimeout(); - }) - .catch(() => nextTimeout()); - } - - _postTransaction (data) { - const request = { - transaction: outTransaction(data.params[0]), - requestId: data.json.result.result - }; - - this._updateSubscriptions('parity_postTransaction', null, request); - } - - _loggingSubscribe () { - return this._subscriber.subscribe('logging', (error, data) => { - if (error || !data) { - return; - } - - switch (data.method) { - case 'eth_sendTransaction': - case 'eth_sendRawTransaction': - this._listRequests(false); - return; - - case 'parity_postTransaction': - this._postTransaction(data); - this._listRequests(false); - return; - } - }); - } -} diff --git a/js-old/src/api/transport/error.js b/js-old/src/api/transport/error.js deleted file mode 100644 index 9049705fa..000000000 --- a/js-old/src/api/transport/error.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import ExtendableError from 'es6-error'; - -export const ERROR_CODES = { - UNSUPPORTED_REQUEST: -32000, - NO_WORK: -32001, - NO_AUTHOR: -32002, - NO_NEW_WORK: -32003, - NO_WORK_REQUIRED: -32004, - NOT_ENOUGH_DATA: -32006, - UNKNOWN_ERROR: -32009, - TRANSACTION_ERROR: -32010, - EXECUTION_ERROR: -32015, - EXCEPTION_ERROR: -32016, - ACCOUNT_LOCKED: -32020, - PASSWORD_INVALID: -32021, - ACCOUNT_ERROR: -32023, - SIGNER_DISABLED: -32030, - DAPPS_DISABLED: -32031, - NETWORK_DISABLED: -32035, - REQUEST_REJECTED: -32040, - REQUEST_REJECTED_LIMIT: -32041, - REQUEST_NOT_FOUND: -32042, - COMPILATION_ERROR: -32050, - ENCRYPTION_ERROR: -32055, - FETCH_ERROR: -32060, - INVALID_PARAMS: -32602 -}; - -export default class TransportError extends ExtendableError { - static requestRejected (method = null) { - return new TransportError(method, ERROR_CODES.REQUEST_REJECTED, 'Request has been rejected.'); - } - - constructor (method, code, message) { - const m = `${method}: ${code}: ${message}`; - - super(m); - - this.code = code; - this.type = Object.keys(ERROR_CODES).find((k) => ERROR_CODES[k] === code) || ''; - - this.method = method; - this.text = message; - } -} diff --git a/js-old/src/api/transport/http/http.e2e.js b/js-old/src/api/transport/http/http.e2e.js deleted file mode 100644 index af2fb1fbb..000000000 --- a/js-old/src/api/transport/http/http.e2e.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Http from './http'; - -const http = new Http('http://localhost:8545'); - -describe('transport/Http', () => { - it('connects and makes a call to web3_clientVersion', () => { - return http.execute('web3_clientVersion').then((version) => { - const [client] = version.split('/'); - - expect(client === 'Geth' || client === 'Parity').to.be.ok; - }); - }); -}); diff --git a/js-old/src/api/transport/http/http.js b/js-old/src/api/transport/http/http.js deleted file mode 100644 index 66ef2dec7..000000000 --- a/js-old/src/api/transport/http/http.js +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { Logging } from '../../subscriptions'; -import JsonRpcBase from '../jsonRpcBase'; -import TransportError from '../error'; - -/* global fetch */ -export default class Http extends JsonRpcBase { - constructor (url, connectTimeout = 1000) { - super(); - - this._connected = true; - this._url = url; - this._connectTimeout = connectTimeout; - - this._pollConnection(); - } - - _encodeOptions (method, params) { - const json = this.encode(method, params); - - this.log(json); - - return { - method: 'POST', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Content-Length': json.length - }, - body: json - }; - } - - _execute (method, params) { - const request = this._encodeOptions(method, params); - - return fetch(this._url, request) - .catch((error) => { - this._setDisconnected(); - throw error; - }) - .then((response) => { - this._setConnected(); - - if (response.status !== 200) { - this._setDisconnected(); - this.error(JSON.stringify({ status: response.status, statusText: response.statusText })); - console.error(`${method}(${JSON.stringify(params)}): ${response.status}: ${response.statusText}`); - - throw new Error(`${response.status}: ${response.statusText}`); - } - - return response.json(); - }) - .then((response) => { - Logging.send(method, params, { request, response }); - - if (response.error) { - this.error(JSON.stringify(response)); - console.error(`${method}(${JSON.stringify(params)}): ${response.error.code}: ${response.error.message}`); - - const error = new TransportError(method, response.error.code, response.error.message); - - throw error; - } - - this.log(JSON.stringify(response)); - return response.result; - }); - } - - _pollConnection = () => { - if (this._connectTimeout <= 0) { - return; - } - - const nextTimeout = () => setTimeout(this._pollConnection, this._connectTimeout); - - this - .execute('net_listening') - .then(() => nextTimeout()) - .catch(() => nextTimeout()); - } - - set url (url) { - this._url = url; - } -} diff --git a/js-old/src/api/transport/http/http.spec.js b/js-old/src/api/transport/http/http.spec.js deleted file mode 100644 index 3d08e17a4..000000000 --- a/js-old/src/api/transport/http/http.spec.js +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; -import Http from './http'; - -const transport = new Http(TEST_HTTP_URL, -1); - -describe('api/transport/Http', () => { - describe('instance', () => { - it('encodes the options correctly', () => { - const opt = transport._encodeOptions('someMethod', ['param']); - const enc = { - method: 'POST', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Content-Length': 65 - }, - body: `{"jsonrpc":"2.0","method":"someMethod","params":["param"],"id":${transport._id - 1}}` - }; - - expect(opt).to.deep.equal(enc); - }); - }); - - describe('transport emitter', () => { - it('emits close event', (done) => { - transport.once('close', () => { - done(); - }); - - transport.execute('eth_call'); - }); - - it('emits open event', (done) => { - mockHttp([{ method: 'eth_call', reply: { result: '' } }]); - - transport.once('open', () => { - done(); - }); - - transport.execute('eth_call'); - }); - }); - - describe('transport', () => { - const RESULT = ['this is some result']; - - let scope; - let result; - - beforeEach(() => { - scope = mockHttp([{ method: 'eth_call', reply: { result: RESULT } }]); - - return transport - .execute('eth_call', 1, 2, 3, 'test') - .then((_result) => { - result = _result; - }); - }); - - it('makes POST', () => { - expect(scope.isDone()).to.be.true; - }); - - it('sets jsonrpc', () => { - expect(scope.body.eth_call.jsonrpc).to.equal('2.0'); - }); - - it('sets the method', () => { - expect(scope.body.eth_call.method).to.equal('eth_call'); - }); - - it('passes the params', () => { - expect(scope.body.eth_call.params).to.deep.equal([1, 2, 3, 'test']); - }); - - it('increments the id', () => { - expect(scope.body.eth_call.id).not.to.equal(0); - }); - - it('passes the actual result back', () => { - expect(result).to.deep.equal(RESULT); - }); - }); - - describe('HTTP errors', () => { - let scope; - let error; - - beforeEach(() => { - scope = mockHttp([{ method: 'eth_call', reply: {}, code: 500 }]); - - return transport - .execute('eth_call') - .catch((_error) => { - error = _error; - }); - }); - - it('returns HTTP errors as throws', () => { - expect(scope.isDone()).to.be.true; - expect(error.message).to.match(/Internal Server Error/); - }); - }); - - describe('RPC errors', () => { - const ERROR = { code: -1, message: 'ERROR: RPC failure' }; - - let scope; - let error; - - beforeEach(() => { - scope = mockHttp([{ method: 'eth_call', reply: { error: ERROR } }]); - - return transport - .execute('eth_call') - .catch((_error) => { - error = _error; - }); - }); - - it('returns RPC errors as throws', () => { - expect(scope.isDone()).to.be.true; - expect(error.message).to.match(/RPC failure/); - }); - }); -}); diff --git a/js-old/src/api/transport/http/index.js b/js-old/src/api/transport/http/index.js deleted file mode 100644 index dfd172165..000000000 --- a/js-old/src/api/transport/http/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './http'; diff --git a/js-old/src/api/transport/index.js b/js-old/src/api/transport/index.js deleted file mode 100644 index fdd3861a8..000000000 --- a/js-old/src/api/transport/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export Http from './http'; -export Ws from './ws'; -export TransportError from './error'; -export Middleware from './middleware'; diff --git a/js-old/src/api/transport/jsonRpcBase.js b/js-old/src/api/transport/jsonRpcBase.js deleted file mode 100644 index 819e1f496..000000000 --- a/js-old/src/api/transport/jsonRpcBase.js +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import EventEmitter from 'eventemitter3'; -import { Logging } from '../subscriptions'; - -export default class JsonRpcBase extends EventEmitter { - constructor () { - super(); - - this._id = 1; - this._debug = false; - this._connected = false; - this._middlewareList = Promise.resolve([]); - } - - encode (method, params) { - const json = JSON.stringify({ - jsonrpc: '2.0', - method: method, - params: params, - id: this._id++ - }); - - return json; - } - - addMiddleware (Middleware) { - this._middlewareList = Promise - .all([ - Middleware, - this._middlewareList - ]) - .then(([Middleware, middlewareList]) => { - // Do nothing if `handlerPromise` resolves to a null-y value. - if (Middleware == null) { - return middlewareList; - } - - // don't mutate the original array - return middlewareList.concat([new Middleware(this)]); - }); - } - - _wrapSuccessResult (result) { - return { - id: this._id, - jsonrpc: '2.0', - result - }; - } - - _wrapErrorResult (error) { - return { - id: this._id, - jsonrpc: '2.0', - error: { - code: error.code, - message: error.text - } - }; - } - - execute (method, ...params) { - return this._middlewareList.then((middlewareList) => { - for (const middleware of middlewareList) { - const res = middleware.handle(method, params); - - if (res != null) { - return Promise - .resolve(res) - .then((res) => { - const result = this._wrapSuccessResult(res); - const json = this.encode(method, params); - - Logging.send(method, params, { json, result }); - - return res; - }); - } - } - - return this._execute(method, params); - }); - } - - _execute () { - throw new Error('Missing implementation of JsonRpcBase#_execute'); - } - - _setConnected () { - if (!this._connected) { - this._connected = true; - this.emit('open'); - } - } - - _setDisconnected () { - if (this._connected) { - this._connected = false; - this.emit('close'); - } - } - - get id () { - return this._id; - } - - get isDebug () { - return this._debug; - } - - get isConnected () { - return this._connected; - } - - setDebug (flag) { - this._debug = flag; - } - - error (error) { - if (this.isDebug) { - console.error(error); - } - } - - log (log) { - if (this.isDebug) { - console.log(log); - } - } -} diff --git a/js-old/src/api/transport/jsonRpcBase.spec.js b/js-old/src/api/transport/jsonRpcBase.spec.js deleted file mode 100644 index 6c3b95564..000000000 --- a/js-old/src/api/transport/jsonRpcBase.spec.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import sinon from 'sinon'; - -import JsonRpcBase from './jsonRpcBase'; - -const base = new JsonRpcBase(); - -describe('api/transport/JsonRpcBase', () => { - describe('encode', () => { - it('encodes the body correctly, incrementing id', () => { - const id = base.id; - const bdy = base.encode('someMethod', ['param1', 'param2']); - const enc = `{"jsonrpc":"2.0","method":"someMethod","params":["param1","param2"],"id":${id}}`; - - expect(bdy).to.equal(enc); - expect(base.id - id).to.equal(1); - }); - }); - - describe('setDebug', () => { - it('starts with disabled flag', () => { - expect(base.isDebug).to.be.false; - }); - - it('true flag switches on', () => { - base.setDebug(true); - expect(base.isDebug).to.be.true; - }); - - it('false flag switches off', () => { - base.setDebug(true); - expect(base.isDebug).to.be.true; - base.setDebug(false); - expect(base.isDebug).to.be.false; - }); - - describe('logging', () => { - beforeEach(() => { - sinon.spy(console, 'log'); - sinon.spy(console, 'error'); - }); - - afterEach(() => { - console.log.restore(); - console.error.restore(); - }); - - it('does not log errors with flag off', () => { - base.setDebug(false); - base.log('error'); - expect(console.log).to.not.be.called; - }); - - it('does not log errors with flag off', () => { - base.setDebug(false); - base.error('error'); - expect(console.error).to.not.be.called; - }); - - it('does log errors with flag on', () => { - base.setDebug(true); - base.log('error'); - expect(console.log).to.be.called; - }); - - it('does log errors with flag on', () => { - base.setDebug(true); - base.error('error'); - expect(console.error).to.be.called; - }); - }); - }); -}); diff --git a/js-old/src/api/transport/middleware.js b/js-old/src/api/transport/middleware.js deleted file mode 100644 index ef029b1cb..000000000 --- a/js-old/src/api/transport/middleware.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default class Middleware { - constructor (transport) { - this._transport = transport; - this._handlers = {}; - } - - register (method, handler) { - if (method in this._handlers) { - throw new Error(`${method} is already defined in the middleware!`); - } - - this._handlers[method] = handler; - } - - handle (method, params) { - const handler = this._handlers[method]; - - if (handler != null) { - return handler(params); - } - - return null; - } - - rpcRequest (method, params) { - return this._transport._execute(method, params); - } -} diff --git a/js-old/src/api/transport/middleware.spec.js b/js-old/src/api/transport/middleware.spec.js deleted file mode 100644 index 4ae894135..000000000 --- a/js-old/src/api/transport/middleware.spec.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Middleware from './middleware'; -import JsonRpcBase from './jsonRpcBase'; - -const MOCKED = 'mocked!'; - -class MockTransport extends JsonRpcBase { - _execute () { - return Promise.resolve(MOCKED); - } -} - -class MockMiddleware extends Middleware { - constructor (transport) { - super(transport); - - this.register('mock_rpc', ([num]) => num); - this.register('mock_null', () => null); - } -} - -describe('api/transport/Middleware', () => { - let transport; - - beforeEach(() => { - transport = new MockTransport(); - transport.addMiddleware(MockMiddleware); - }); - - it('Routes requests to middleware', () => { - return transport.execute('mock_rpc', 100).then((num) => { - expect(num).to.be.equal(100); - }); - }); - - it('Passes non-mocked requests through', () => { - return transport.execute('not_moced', 200).then((result) => { - expect(result).to.be.equal(MOCKED); - }); - }); - - it('Passes mocked requests through, if middleware returns null', () => { - return transport.execute('mock_null', 300).then((result) => { - expect(result).to.be.equal(MOCKED); - }); - }); -}); diff --git a/js-old/src/api/transport/ws/index.js b/js-old/src/api/transport/ws/index.js deleted file mode 100644 index 7ab0be131..000000000 --- a/js-old/src/api/transport/ws/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './ws'; diff --git a/js-old/src/api/transport/ws/ws.e2e.js b/js-old/src/api/transport/ws/ws.e2e.js deleted file mode 100644 index 42e47451c..000000000 --- a/js-old/src/api/transport/ws/ws.e2e.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Ws from './ws'; - -const ws = new Ws('ws://localhost:8546/'); - -describe('transport/Ws', () => { - it('connects and makes a call to web3_clientVersion', () => { - return ws.execute('web3_clientVersion').then((version) => { - const [client] = version.split('/'); - - expect(client === 'Geth' || client === 'Parity').to.be.ok; - }); - }); -}); diff --git a/js-old/src/api/transport/ws/ws.js b/js-old/src/api/transport/ws/ws.js deleted file mode 100644 index 9c276772d..000000000 --- a/js-old/src/api/transport/ws/ws.js +++ /dev/null @@ -1,387 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { keccak_256 } from 'js-sha3'; // eslint-disable-line camelcase - -import { Logging } from '../../subscriptions'; -import JsonRpcBase from '../jsonRpcBase'; -import TransportError from '../error'; - -/* global WebSocket */ -export default class Ws extends JsonRpcBase { - // token is optional (secure API) - constructor (url, token = null, autoconnect = true) { - super(); - - this._url = url; - this._token = token; - this._messages = {}; - this._subscriptions = { 'eth_subscription': [], 'parity_subscription': [], 'shh_subscription': [] }; - this._sessionHash = null; - - this._connecting = false; - this._connected = false; - this._lastError = null; - this._autoConnect = autoconnect; - this._retries = 0; - this._reconnectTimeoutId = null; - - this._connectPromise = null; - this._connectPromiseFunctions = {}; - - if (autoconnect) { - this.connect(); - } - } - - updateToken (token, connect = true) { - this._token = token; - // this._autoConnect = true; - - if (connect) { - this.connect(); - } - } - - connect () { - if (this._connected) { - return Promise.resolve(); - } - - if (this._connecting) { - return this._connectPromise || Promise.resolve(); - } - - if (this._reconnectTimeoutId) { - window.clearTimeout(this._reconnectTimeoutId); - this._reconnectTimeoutId = null; - } - - if (this._ws) { - this._ws.onerror = null; - this._ws.onopen = null; - this._ws.onclose = null; - this._ws.onmessage = null; - this._ws.close(); - this._ws = null; - this._sessionHash = null; - } - this._connecting = true; - this._connected = false; - this._lastError = null; - - // rpc secure API - if (this._token) { - const time = parseInt(new Date().getTime() / 1000, 10); - const sha3 = keccak_256(`${this._token}:${time}`); - const hash = `${sha3}_${time}`; - - this._sessionHash = sha3; - this._ws = new WebSocket(this._url, hash); - // non-secure API - } else { - this._ws = new WebSocket(this._url); - } - - this._ws.onerror = this._onError; - this._ws.onopen = this._onOpen; - this._ws.onclose = this._onClose; - this._ws.onmessage = this._onMessage; - - // Get counts in dev mode only - if (process.env.NODE_ENV === 'development') { - this._count = 0; - this._lastCount = { - timestamp: Date.now(), - count: 0 - }; - - window.setInterval(() => { - const n = this._count - this._lastCount.count; - const t = (Date.now() - this._lastCount.timestamp) / 1000; - const s = Math.round(1000 * n / t) / 1000; - - if (this._debug) { - console.log('::parityWS', `speed: ${s} req/s`, `count: ${this._count}`, `(+${n})`); - } - - this._lastCount = { - timestamp: Date.now(), - count: this._count - }; - }, 5000); - - window._parityWS = this; - } - - this._connectPromise = new Promise((resolve, reject) => { - this._connectPromiseFunctions = { resolve, reject }; - }); - - return this._connectPromise; - } - - _onOpen = (event) => { - this._setConnected(); - this._connecting = false; - this._retries = 0; - - Object.keys(this._messages) - .filter((id) => this._messages[id].queued) - .forEach(this._send); - - this._connectPromiseFunctions.resolve(); - - this._connectPromise = null; - this._connectPromiseFunctions = {}; - } - - _onClose = (event) => { - this._setDisconnected(); - this._connecting = false; - - event.timestamp = Date.now(); - this._lastError = event; - - if (this._autoConnect) { - const timeout = this.retryTimeout; - - const time = timeout < 1000 - ? Math.round(timeout) + 'ms' - : (Math.round(timeout / 10) / 100) + 's'; - - console.log('ws:onClose', `trying again in ${time}...`); - - this._reconnectTimeoutId = setTimeout(() => { - this.connect(); - }, timeout); - - return; - } - - if (this._connectPromise) { - this._connectPromiseFunctions.reject(event); - - this._connectPromise = null; - this._connectPromiseFunctions = {}; - } - - console.log('ws:onClose'); - } - - _onError = (event) => { - // Only print error if the WS is connected - // ie. don't print if error == closed - window.setTimeout(() => { - if (this._connected) { - console.error('ws:onError'); - - event.timestamp = Date.now(); - this._lastError = event; - - if (this._connectPromise) { - this._connectPromiseFunctions.reject(event); - - this._connectPromise = null; - this._connectPromiseFunctions = {}; - } - } - }, 50); - } - - _extract = (result) => { - const { result: res, id, method, params } = result; - const msg = this._messages[id]; - - // initial pubsub ACK - if (id && msg.subscription) { - // save subscription to map subId -> messageId - this._subscriptions[msg.subscription][res] = id; - // resolve promise with messageId because subId's can collide (eth/parity) - msg.resolve(id); - // save subId for unsubscribing later - msg.subId = res; - return msg; - } - - // normal message - if (id) { - return msg; - } - - // pubsub format - if (method.includes('subscription')) { - const messageId = this._messages[this._subscriptions[method][params.subscription]]; - - if (messageId) { - return messageId; - } else { - throw Error(`Received Subscription which is already unsubscribed ${JSON.stringify(result)}`); - } - } - - throw Error(`Unknown message format: No ID or subscription ${JSON.stringify(result)}`); - } - - _onMessage = (event) => { - try { - const result = JSON.parse(event.data); - const { method, params, json, resolve, reject, callback, subscription } = this._extract(result); - - Logging.send(method, params, { json, result }); - - result.error = (result.params && result.params.error) || result.error; - if (result.error) { - this.error(event.data); - - // Don't print error if request rejected or not is not yet up... - if (!/(rejected|not yet up)/.test(result.error.message)) { - console.error(`${method}(${JSON.stringify(params)}): ${result.error.code}: ${result.error.message}`); - } - - const error = new TransportError(method, result.error.code, result.error.message); - - if (result.id) { - reject(error); - } else { - callback(error); - } - - delete this._messages[result.id]; - return; - } - - // if not initial subscription message resolve & delete - if (result.id && !subscription) { - resolve(result.result); - delete this._messages[result.id]; - } else if (result.params) { - callback(null, result.params.result); - } - } catch (e) { - console.error('ws::_onMessage', event.data, e); - } - } - - _send = (id) => { - const message = this._messages[id]; - - if (this._connected) { - if (process.env.NODE_ENV === 'development') { - this._count++; - } - - return this._ws.send(message.json); - } - - message.queued = !this._connected; - message.timestamp = Date.now(); - } - - _execute (method, params) { - return new Promise((resolve, reject) => { - const id = this.id; - const json = this.encode(method, params); - - this._messages[id] = { id, method, params, json, resolve, reject }; - this._send(id); - }); - } - - _methodsFromApi (api) { - const method = `${api}_subscribe`; - const uMethod = `${api}_unsubscribe`; - const subscription = `${api}_subscription`; - - return { method, uMethod, subscription }; - } - - subscribe (api, callback, ...params) { - return new Promise((resolve, reject) => { - const id = this.id; - const { method, uMethod, subscription } = this._methodsFromApi(api); - const json = this.encode(method, params); - - this._messages[id] = { id, method, uMethod, params, json, resolve, reject, callback, subscription }; - - this._send(id); - }); - } - - unsubscribe (messageId) { - return new Promise((resolve, reject) => { - const id = this.id; - const { subId, uMethod, subscription } = this._messages[messageId]; - const params = [subId]; - const json = this.encode(uMethod, params); - const uResolve = (v) => { - delete this._messages[messageId]; - delete this._subscriptions[subscription][subId]; - resolve(v); - }; - - this._messages[id] = { id, method: uMethod, params, json, resolve: uResolve, reject }; - this._send(id); - }); - } - - set url (url) { - this._url = url; - } - - get token () { - return this._token; - } - - get sessionHash () { - return this._sessionHash; - } - - get isAutoConnect () { - return this._autoConnect; - } - - get isConnecting () { - return this._connecting; - } - - get lastError () { - return this._lastError; - } - - /** - * Exponential Timeout for Retries - * - * @see http://dthain.blogspot.de/2009/02/exponential-backoff-in-distributed.html - */ - get retryTimeout () { - // R between 1 and 2 - const R = Math.random() + 1; - // Initial timeout (100ms) - const T = 100; - // Exponential Factor - const F = 2; - // Max timeout (4s) - const M = 4000; - // Current number of retries - const N = this._retries; - - // Increase retries number - this._retries++; - - return Math.min(R * T * Math.pow(F, N), M); - } -} diff --git a/js-old/src/api/transport/ws/ws.spec.js b/js-old/src/api/transport/ws/ws.spec.js deleted file mode 100644 index 0d3c9836f..000000000 --- a/js-old/src/api/transport/ws/ws.spec.js +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { TEST_WS_URL, mockWs } from '../../../../test/mockRpc'; -import Ws from './ws'; - -describe('api/transport/Ws', () => { - let transport; - let scope; - - describe('transport emitter', () => { - const connect = () => { - const scope = mockWs(); - const transport = new Ws(TEST_WS_URL); - - return { transport, scope }; - }; - - it('emits open event', (done) => { - const { transport, scope } = connect(); - - transport.once('open', () => { - done(); - }); - - scope.stop(); - }); - - it('emits close event', (done) => { - const { transport, scope } = connect(); - - transport.once('open', () => { - scope.server.close(); - }); - - transport.once('close', () => { - done(); - }); - }); - }); - - describe('transport', () => { - let result; - - beforeEach(() => { - scope = mockWs([{ method: 'test_anyCall', reply: 'TestResult' }]); - transport = new Ws(TEST_WS_URL); - - return transport - .execute('test_anyCall', 1, 2, 3) - .then((_result) => { - result = _result; - }); - }); - - afterEach(() => { - scope.stop(); - }); - - it('makes call', () => { - expect(scope.isDone()).to.be.true; - }); - - it('sets jsonrpc', () => { - expect(scope.body.test_anyCall.jsonrpc).to.equal('2.0'); - }); - - it('sets the method', () => { - expect(scope.body.test_anyCall.method).to.equal('test_anyCall'); - }); - - it('passes the params', () => { - expect(scope.body.test_anyCall.params).to.deep.equal([1, 2, 3]); - }); - - it('increments the id', () => { - expect(scope.body.test_anyCall.id).not.to.equal(0); - }); - - it('passes the actual result back', () => { - expect(result).to.equal('TestResult'); - }); - }); - - describe('errors', () => { - beforeEach(() => { - scope = mockWs([{ method: 'test_anyCall', reply: { error: { code: 1, message: 'TestError' } } }]); - transport = new Ws(TEST_WS_URL); - }); - - afterEach(() => { - scope.stop(); - }); - - it('returns RPC errors when encountered', () => { - return transport - .execute('test_anyCall') - .catch((error) => { - expect(error).to.match(/TestError/); - }); - }); - }); -}); diff --git a/js-old/src/api/util/decode.js b/js-old/src/api/util/decode.js deleted file mode 100644 index 926a5a8a1..000000000 --- a/js-old/src/api/util/decode.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { isHex } from './types'; - -import Func from '../../abi/spec/function'; -import { fromParamType, toParamType } from '../../abi/spec/paramType/format'; - -export function decodeCallData (data) { - if (!isHex(data)) { - throw new Error('Input to decodeCallData should be a hex value'); - } - - if (data.substr(0, 2) === '0x') { - return decodeCallData(data.slice(2)); - } - - if (data.length < 8) { - throw new Error('Input to decodeCallData should be method signature + data'); - } - - const signature = data.substr(0, 8); - const paramdata = data.substr(8); - - return { - signature: `0x${signature}`, - paramdata: `0x${paramdata}` - }; -} - -export function decodeMethodInput (methodAbi, paramdata) { - if (!methodAbi) { - throw new Error('decodeMethodInput should receive valid method-specific ABI'); - } - - if (paramdata && paramdata.length) { - if (!isHex(paramdata)) { - throw new Error('Input to decodeMethodInput should be a hex value'); - } - - if (paramdata.substr(0, 2) === '0x') { - return decodeMethodInput(methodAbi, paramdata.slice(2)); - } - } - - return new Func(methodAbi).decodeInput(paramdata).map((decoded) => decoded.value); -} - -// takes a method in form name(...,types) and returns the inferred abi definition -export function methodToAbi (method) { - const length = method.length; - const typesStart = method.indexOf('('); - const typesEnd = method.indexOf(')'); - - if (typesStart === -1) { - throw new Error(`Missing start ( in call to decodeMethod with ${method}`); - } else if (typesEnd === -1) { - throw new Error(`Missing end ) in call to decodeMethod with ${method}`); - } else if (typesEnd < typesStart) { - throw new Error(`End ) is before start ( in call to decodeMethod with ${method}`); - } else if (typesEnd !== length - 1) { - throw new Error(`Extra characters after end ) in call to decodeMethod with ${method}`); - } - - const name = method.substr(0, typesStart); - const types = method.substr(typesStart + 1, length - (typesStart + 1) - 1).split(','); - const inputs = types.filter((_type) => _type.length).map((_type) => { - const type = fromParamType(toParamType(_type)); - - return { type }; - }); - - return { type: 'function', name, inputs }; -} - -export function abiDecode (inputTypes, data) { - return decodeMethodInput({ - inputs: inputTypes.map((type) => { - return { type }; - }) - }, data); -} diff --git a/js-old/src/api/util/decode.spec.js b/js-old/src/api/util/decode.spec.js deleted file mode 100644 index 006c6a863..000000000 --- a/js-old/src/api/util/decode.spec.js +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; -import { abiDecode, decodeCallData, decodeMethodInput, methodToAbi } from './decode'; - -describe('api/util/decode', () => { - const METH = '0x70a08231'; - const ENCO = '0x70a082310000000000000000000000005A5eFF38DA95b0D58b6C616f2699168B480953C9'; - const DATA = '0x0000000000000000000000005A5eFF38DA95b0D58b6C616f2699168B480953C9'; - - describe('decodeCallData', () => { - it('throws on non-hex inputs', () => { - expect(() => decodeCallData('invalid')).to.throw(/should be a hex value/); - }); - - it('throws when invalid signature length', () => { - expect(() => decodeCallData(METH.slice(-6))).to.throw(/should be method signature/); - }); - - it('splits valid inputs properly', () => { - expect(decodeCallData(ENCO)).to.deep.equal({ - signature: METH, - paramdata: DATA - }); - }); - }); - - describe('decodeMethodInput', () => { - it('expects a valid ABI', () => { - expect(() => decodeMethodInput(null, null)).to.throw(/should receive valid method/); - }); - - it('expect valid hex parameter data', () => { - expect(() => decodeMethodInput({}, 'invalid')).to.throw(/should be a hex value/); - }); - - it('correctly decodes valid inputs', () => { - expect( - decodeMethodInput({ - type: 'function', - inputs: [ - { type: 'uint' } - ] - }, DATA) - ).to.deep.equal( - [ new BigNumber('0x5a5eff38da95b0d58b6c616f2699168b480953c9') ] - ); - }); - }); - - describe('methodToAbi', () => { - it('throws when no start ( specified', () => { - expect(() => methodToAbi('invalid,uint,bool)')).to.throw(/Missing start \(/); - }); - - it('throws when no end ) specified', () => { - expect(() => methodToAbi('invalid(uint,bool')).to.throw(/Missing end \)/); - }); - - it('throws when end ) is not in the last position', () => { - expect(() => methodToAbi('invalid(uint,bool)2')).to.throw(/Extra characters after end \)/); - }); - - it('throws when start ( is after end )', () => { - expect(() => methodToAbi('invalid)uint,bool(')).to.throw(/End \) is before start \(/); - }); - - it('throws when invalid types are present', () => { - expect(() => methodToAbi('method(invalidType,bool,uint)')).to.throw(/Cannot convert invalidType/); - }); - - it('returns a valid methodabi for a valid method', () => { - expect(methodToAbi('valid(uint,bool)')).to.deep.equals({ - type: 'function', - name: 'valid', - inputs: [ - { type: 'uint256' }, - { type: 'bool' } - ] - }); - }); - }); - - describe('abiDecode', () => { - it('correctly decodes valid inputs', () => { - expect(abiDecode(['uint'], DATA)).to.deep.equal( - [ new BigNumber('0x5a5eff38da95b0d58b6c616f2699168b480953c9') ] - ); - }); - }); -}); diff --git a/js-old/src/api/util/encode.js b/js-old/src/api/util/encode.js deleted file mode 100644 index f18fbbe2b..000000000 --- a/js-old/src/api/util/encode.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import Abi from '~/abi'; -import Func from '~/abi/spec/function'; - -import { abiDecode } from './decode'; -import { cleanupValue } from './format'; -import { sha3 } from './sha3'; - -export function encodeMethodCallAbi (methodAbi = {}, values = []) { - const func = new Func(methodAbi); - const tokens = Abi.encodeTokens(func.inputParamTypes(), values); - const call = func.encodeCall(tokens); - - return `0x${call}`; -} - -export function abiEncode (methodName, inputTypes, data) { - const result = encodeMethodCallAbi({ - name: methodName || '', - type: 'function', - inputs: inputTypes.map((type) => { - return { type }; - }) - }, data); - - return result; -} - -export function abiUnencode (abi, data) { - const callsig = data.substr(2, 8); - const op = abi.find((field) => { - return field.type === 'function' && - abiSignature(field.name, field.inputs.map((input) => input.type)).substr(2, 8) === callsig; - }); - - if (!op) { - console.warn(`Unknown function ID: ${callsig}`); - return null; - } - - let argsByIndex = abiDecode(op.inputs.map((field) => field.type), '0x' + data.substr(10)) - .map((value, index) => cleanupValue(value, op.inputs[index].type)); - const argsByName = op.inputs.reduce((result, field, index) => { - result[field.name] = argsByIndex[index]; - - return result; - }, {}); - - return [op.name, argsByName, argsByIndex]; -} - -export function abiSignature (name, inputs) { - return sha3(`${name}(${inputs.join()})`); -} diff --git a/js-old/src/api/util/encode.spec.js b/js-old/src/api/util/encode.spec.js deleted file mode 100644 index 7847f06ec..000000000 --- a/js-old/src/api/util/encode.spec.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { abiEncode, abiUnencode, abiSignature, encodeMethodCallAbi } from './encode'; - -const ABI = { - type: 'function', - name: 'valid', - inputs: [ - { type: 'uint256' }, - { type: 'bool' } - ] -}; - -const RESULT = [ - 'f87fa141', - '0000000000000000000000000000000000000000000000000000000000000123', - '0000000000000000000000000000000000000000000000000000000000000001' -].join(''); -const VARIABLE = [ - '5a6fbce0', - 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470', - '0000000000000000000000000000000000000000000000000000000000000040', - '000000000000000000000000000000000000000000000000000000000000000f', - '687474703a2f2f666f6f2e6261722f0000000000000000000000000000000000' -].join(''); - -describe('api/util/encode', () => { - describe('encodeMethodCallAbi', () => { - it('encodes calls with the correct result', () => { - expect(encodeMethodCallAbi(ABI, [0x123, true])).to.equal(`0x${RESULT}`); - }); - }); - - describe('abiEncode', () => { - it('encodes calls with the correct result', () => { - expect(abiEncode('valid', ['uint256', 'bool'], [0x123, true])).to.equal(`0x${RESULT}`); - }); - - it('encodes variable values', () => { - expect( - abiEncode( - 'hintUrl', ['bytes32', 'string'], ['0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470', 'http://foo.bar/'] - ) - ).to.equal(`0x${VARIABLE}`); - }); - - it('encodes only the data with null name', () => { - expect( - abiEncode(null, ['uint256', 'bool'], [0x123, true]) - ).to.equal(`0x${RESULT.substr(8)}`); - }); - }); - - describe('abiUnencode', () => { - it('decodes data correctly from abi', () => { - expect( - abiUnencode([{ - name: 'test', - type: 'function', - inputs: [ - { type: 'uint', name: 'arga' } - ] - }], '0x1acb6f7700000000000000000000000000000038') - ).to.deep.equal(['test', { arga: 56 }, [56]]); - }); - }); - - // Same example as in abi/util/signature.spec.js - describe('abiSignature', () => { - it('encodes baz(uint32,bool) correctly', () => { - expect( - abiSignature('baz', ['uint32', 'bool']) - ).to.equal('0xcdcd77c0992ec5bbfc459984220f8c45084cc24d9b6efed1fae540db8de801d2'); - }); - }); -}); diff --git a/js-old/src/api/util/format.js b/js-old/src/api/util/format.js deleted file mode 100644 index 6a4a81d40..000000000 --- a/js-old/src/api/util/format.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { range } from 'lodash'; - -export function bytesToHex (bytes) { - return '0x' + Buffer.from(bytes).toString('hex'); -} - -export function cleanupValue (value, type) { - // TODO: make work with arbitrary depth arrays - if (value instanceof Array && type.match(/bytes[0-9]+/)) { - // figure out if it's an ASCII string hiding in there: - let ascii = ''; - - for (let index = 0, ended = false; index < value.length && ascii !== null; ++index) { - const val = value[index]; - - if (val === 0) { - ended = true; - } else { - ascii += String.fromCharCode(val); - } - - if ((ended && val !== 0) || (!ended && (val < 32 || val >= 128))) { - ascii = null; - } - } - - value = ascii === null - ? bytesToHex(value) - : ascii; - } - - if (type.substr(0, 4) === 'uint' && +type.substr(4) <= 48) { - value = +value; - } - - return value; -} - -export function hexToBytes (hex) { - const raw = toHex(hex).slice(2); - const bytes = []; - - for (let i = 0; i < raw.length; i += 2) { - bytes.push(parseInt(raw.substr(i, 2), 16)); - } - - return bytes; -} - -export function hexToAscii (hex) { - const bytes = hexToBytes(hex); - const str = bytes.map((byte) => String.fromCharCode(byte)).join(''); - - return str; -} - -export function bytesToAscii (bytes) { - return bytes.map((b) => String.fromCharCode(b % 512)).join(''); -} - -export function asciiToHex (string) { - return '0x' + string.split('') - .map(s => s.charCodeAt(0)) - .map(s => s < 0x10 ? '0' + s.toString(16) : s.toString(16)) - .join(''); -} - -export function padRight (input, length) { - const value = toHex(input).substr(2, length * 2); - - return '0x' + value + range(length * 2 - value.length).map(() => '0').join(''); -} - -export function padLeft (input, length) { - const value = toHex(input).substr(2, length * 2); - - return '0x' + range(length * 2 - value.length).map(() => '0').join('') + value; -} - -export function toHex (str) { - if (str && str.toString) { - str = str.toString(16); - } - - if (str && str.substr(0, 2) === '0x') { - return str.toLowerCase(); - } - - return `0x${(str || '').toLowerCase()}`; -} diff --git a/js-old/src/api/util/format.spec.js b/js-old/src/api/util/format.spec.js deleted file mode 100644 index ba7a3994e..000000000 --- a/js-old/src/api/util/format.spec.js +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { bytesToHex, cleanupValue, hexToBytes, hexToAscii, bytesToAscii, asciiToHex } from './format'; - -describe('api/util/format', () => { - describe('bytesToHex', () => { - it('correctly converts an empty array', () => { - expect(bytesToHex([])).to.equal('0x'); - }); - - it('correctly converts a non-empty array', () => { - expect(bytesToHex([0, 15, 16])).to.equal('0x000f10'); - }); - }); - - describe('cleanupValue', () => { - it('returns unknown values as the original', () => { - expect(cleanupValue('original', 'unknown')).to.equal('original'); - }); - - it('returns ascii arrays as ascii', () => { - expect(cleanupValue([97, 115, 99, 105, 105, 0], 'bytes32')).to.equal('ascii'); - }); - - it('returns non-ascii arrays as hex strings', () => { - expect(cleanupValue([97, 200, 0, 0], 'bytes4')).to.equal('0x61c80000'); - }); - - it('returns uint (>48) as the original', () => { - expect(cleanupValue('original', 'uint49')).to.equal('original'); - }); - - it('returns uint (<=48) as the number value', () => { - expect(cleanupValue('12345', 'uint48')).to.equal(12345); - }); - }); - - describe('hexToBytes', () => { - it('correctly converts an empty string', () => { - expect(hexToBytes('')).to.deep.equal([]); - expect(hexToBytes('0x')).to.deep.equal([]); - }); - - it('correctly converts a non-empty string', () => { - expect(hexToBytes('0x000f10')).to.deep.equal([0, 15, 16]); - }); - }); - - describe('asciiToHex', () => { - it('correctly converts an empty string', () => { - expect(asciiToHex('')).to.equal('0x'); - }); - - it('correctly converts a non-empty string', () => { - expect(asciiToHex('abc')).to.equal('0x616263'); - expect(asciiToHex('a\nb')).to.equal('0x610a62'); - }); - }); - - describe('hexToAscii', () => { - it('correctly converts an empty string', () => { - expect(hexToAscii('')).to.equal(''); - expect(hexToAscii('0x')).to.equal(''); - }); - - it('correctly converts a non-empty string', () => { - expect(hexToAscii('0x616263')).to.equal('abc'); - }); - }); - - describe('bytesToAscii', () => { - it('correctly converts an empty string', () => { - expect(bytesToAscii([])).to.equal(''); - }); - - it('correctly converts a non-empty string', () => { - expect(bytesToAscii([97, 98, 99])).to.equal('abc'); - }); - }); -}); diff --git a/js-old/src/api/util/identity.js b/js-old/src/api/util/identity.js deleted file mode 100644 index 4df7ab9bb..000000000 --- a/js-old/src/api/util/identity.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import blockies from 'blockies'; - -// jsdom doesn't have all the browser features, blockies fail -const TEST_ENV = process.env.NODE_ENV === 'test'; - -export function createIdentityImg (address, scale = 8) { - return TEST_ENV - ? 'test-createIdentityImg' - : blockies({ - seed: (address || '').toLowerCase(), - size: 8, - scale - }).toDataURL(); -} diff --git a/js-old/src/api/util/index.js b/js-old/src/api/util/index.js deleted file mode 100644 index 30328856b..000000000 --- a/js-old/src/api/util/index.js +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { isAddress as isAddressValid, toChecksumAddress } from '../../abi/util/address'; -import { abiDecode, decodeCallData, decodeMethodInput, methodToAbi } from './decode'; -import { abiEncode, abiUnencode, abiSignature, encodeMethodCallAbi } from './encode'; -import { bytesToHex, hexToAscii, hexToBytes, asciiToHex, cleanupValue } from './format'; -import { fromWei, toWei } from './wei'; -import { sha3 } from './sha3'; -import { isArray, isFunction, isHex, isInstanceOf, isString } from './types'; -import { createIdentityImg } from './identity'; - -export default { - abiDecode, - abiEncode, - abiUnencode, - abiSignature, - cleanupValue, - isAddressValid, - isArray, - isFunction, - isHex, - isInstanceOf, - isString, - bytesToHex, - hexToAscii, - hexToBytes, - asciiToHex, - createIdentityImg, - decodeCallData, - decodeMethodInput, - encodeMethodCallAbi, - methodToAbi, - fromWei, - toChecksumAddress, - toWei, - sha3 -}; diff --git a/js-old/src/api/util/sha3.js b/js-old/src/api/util/sha3.js deleted file mode 100644 index 3ca49cc8e..000000000 --- a/js-old/src/api/util/sha3.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { keccak_256 } from 'js-sha3'; // eslint-disable-line - -import { hexToBytes } from './format'; -import { isHex } from './types'; - -export function sha3 (value, options) { - const forceHex = options && options.encoding === 'hex'; - - if (forceHex || (!options && isHex(value))) { - const bytes = hexToBytes(value); - - return sha3(bytes); - } - - const hash = keccak_256(value); - - return `0x${hash}`; -} - -sha3.text = (val) => sha3(val, { encoding: 'raw' }); diff --git a/js-old/src/api/util/sha3.spec.js b/js-old/src/api/util/sha3.spec.js deleted file mode 100644 index a5c93d940..000000000 --- a/js-old/src/api/util/sha3.spec.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { sha3 } from './sha3'; - -describe('api/util/sha3', () => { - describe('sha3', () => { - it('constructs a correct sha3 value', () => { - expect(sha3('jacogr')).to.equal('0x2f4ff4b5a87abbd2edfed699db48a97744e028c7f7ce36444d40d29d792aa4dc'); - }); - - it('constructs a correct sha3 encoded as hex', () => { - const key = '000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298' + '0000000000000000000000000000000000000000000000000000000000000001'; - - expect(sha3(key, { encoding: 'hex' })).to.equal('0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9'); - expect(sha3(`0x${key}`, { encoding: 'hex' })).to.equal('0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9'); - }); - - it('constructs a correct sha3 from Uint8Array', () => { - expect(sha3('01020304', { encoding: 'hex' })).to.equal('0xa6885b3731702da62e8e4a8f584ac46a7f6822f4e2ba50fba902f67b1588d23b'); - expect(sha3(Uint8Array.from([1, 2, 3, 4]))).to.equal('0xa6885b3731702da62e8e4a8f584ac46a7f6822f4e2ba50fba902f67b1588d23b'); - }); - - it('should interpret as bytes by default', () => { - expect(sha3('0x01020304')).to.equal('0xa6885b3731702da62e8e4a8f584ac46a7f6822f4e2ba50fba902f67b1588d23b'); - }); - - it('should force text if option is passed', () => { - expect(sha3('0x01020304', { encoding: 'raw' })).to.equal('0x16bff43de576d28857dcba65a56fc17c5e93c09bd6a709268eff8e62025ae869'); - expect(sha3.text('0x01020304')).to.equal('0x16bff43de576d28857dcba65a56fc17c5e93c09bd6a709268eff8e62025ae869'); - }); - }); -}); diff --git a/js-old/src/api/util/types.js b/js-old/src/api/util/types.js deleted file mode 100644 index f4278cb51..000000000 --- a/js-old/src/api/util/types.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -const HEXDIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; - -export function isArray (test) { - return Object.prototype.toString.call(test) === '[object Array]'; -} - -export function isError (test) { - return Object.prototype.toString.call(test) === '[object Error]'; -} - -export function isFunction (test) { - return Object.prototype.toString.call(test) === '[object Function]'; -} - -export function isHex (_test) { - if (!isString(_test)) { - return false; - } - - if (_test.substr(0, 2) === '0x') { - return isHex(_test.slice(2)); - } - - const test = _test.toLowerCase(); - let hex = true; - - for (let idx = 0; hex && idx < test.length; idx++) { - hex = HEXDIGITS.includes(test[idx]); - } - - return hex; -} - -export function isObject (test) { - return Object.prototype.toString.call(test) === '[object Object]'; -} - -export function isString (test) { - return Object.prototype.toString.call(test) === '[object String]'; -} - -export function isInstanceOf (test, clazz) { - return test instanceof clazz; -} diff --git a/js-old/src/api/util/types.spec.js b/js-old/src/api/util/types.spec.js deleted file mode 100644 index c8672f888..000000000 --- a/js-old/src/api/util/types.spec.js +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import sinon from 'sinon'; - -import { isArray, isError, isFunction, isHex, isInstanceOf, isObject, isString } from './types'; -import Eth from '../rpc/eth'; - -describe('api/util/types', () => { - describe('isArray', () => { - it('correctly identifies null as false', () => { - expect(isArray(null)).to.be.false; - }); - - it('correctly identifies empty array as true', () => { - expect(isArray([])).to.be.true; - }); - - it('correctly identifies array as true', () => { - expect(isArray([1, 2, 3])).to.be.true; - }); - }); - - describe('isError', () => { - it('correctly identifies null as false', () => { - expect(isError(null)).to.be.false; - }); - - it('correctly identifies Error as true', () => { - expect(isError(new Error('an error'))).to.be.true; - }); - }); - - describe('isFunction', () => { - it('correctly identifies null as false', () => { - expect(isFunction(null)).to.be.false; - }); - - it('correctly identifies function as true', () => { - expect(isFunction(sinon.stub())).to.be.true; - }); - }); - - describe('isHex', () => { - it('correctly identifies hex by leading 0x', () => { - expect(isHex('0x123')).to.be.true; - }); - - it('correctly identifies hex without leading 0x', () => { - expect(isHex('123')).to.be.true; - }); - - it('correctly identifies non-hex values', () => { - expect(isHex('123j')).to.be.false; - }); - - it('correctly indentifies non-string values', () => { - expect(isHex(false)).to.be.false; - expect(isHex()).to.be.false; - expect(isHex([1, 2, 3])).to.be.false; - }); - }); - - describe('isInstanceOf', () => { - it('correctly identifies build-in instanceof', () => { - expect(isInstanceOf(new String('123'), String)).to.be.true; // eslint-disable-line no-new-wrappers - }); - - it('correctly identifies own instanceof', () => { - expect(isInstanceOf(new Eth({}), Eth)).to.be.true; - }); - - it('correctly reports false for own', () => { - expect(isInstanceOf({}, Eth)).to.be.false; - }); - }); - - describe('isObject', () => { - it('correctly identifies empty object as object', () => { - expect(isObject({})).to.be.true; - }); - - it('correctly identifies non-empty object as object', () => { - expect(isObject({ data: '123' })).to.be.true; - }); - - it('correctly identifies Arrays as non-objects', () => { - expect(isObject([1, 2, 3])).to.be.false; - }); - - it('correctly identifies Strings as non-objects', () => { - expect(isObject('123')).to.be.false; - }); - }); - - describe('isString', () => { - it('correctly identifies empty string as string', () => { - expect(isString('')).to.be.true; - }); - - it('correctly identifies string as string', () => { - expect(isString('123')).to.be.true; - }); - }); -}); diff --git a/js-old/src/api/util/wei.js b/js-old/src/api/util/wei.js deleted file mode 100644 index d17df6958..000000000 --- a/js-old/src/api/util/wei.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -const UNITS = ['wei', 'ada', 'babbage', 'shannon', 'szabo', 'finney', 'ether', 'kether', 'mether', 'gether', 'tether']; - -export function _getUnitMultiplier (unit) { - const position = UNITS.indexOf(unit.toLowerCase()); - - if (position === -1) { - throw new Error(`Unknown unit ${unit} passed to wei formatter`); - } - - return 10 ** (position * 3); -} - -export function fromWei (value, unit = 'ether') { - return new BigNumber(value).div(_getUnitMultiplier(unit)); -} - -export function toWei (value, unit = 'ether') { - return new BigNumber(value).mul(_getUnitMultiplier(unit)); -} diff --git a/js-old/src/api/util/wei.spec.js b/js-old/src/api/util/wei.spec.js deleted file mode 100644 index 4476a4db6..000000000 --- a/js-old/src/api/util/wei.spec.js +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { _getUnitMultiplier, fromWei, toWei } from './wei'; - -describe('api/util/wei', () => { - describe('_getUnitMultiplier', () => { - it('returns 10^0 for wei', () => { - expect(_getUnitMultiplier('wei')).to.equal(10 ** 0); - }); - - it('returns 10^15 for finney', () => { - expect(_getUnitMultiplier('finney')).to.equal(10 ** 15); - }); - - it('returns 10^18 for ether', () => { - expect(_getUnitMultiplier('ether')).to.equal(10 ** 18); - }); - - it('throws an error on invalid units', () => { - expect(() => _getUnitMultiplier('invalid')).to.throw(/passed to wei formatter/); - }); - }); - - describe('fromWei', () => { - it('formats into ether when nothing specified', () => { - expect(fromWei('1230000000000000000').toString()).to.equal('1.23'); - }); - - it('formats into finney when specified', () => { - expect(fromWei('1230000000000000000', 'finney').toString()).to.equal('1230'); - }); - }); - - describe('toWei', () => { - it('formats from ether when nothing specified', () => { - expect(toWei(1.23).toString()).to.equal('1230000000000000000'); - }); - - it('formats from finney when specified', () => { - expect(toWei(1230, 'finney').toString()).to.equal('1230000000000000000'); - }); - }); -}); diff --git a/js-old/src/contracts/badgereg.js b/js-old/src/contracts/badgereg.js index a1782cb30..0e64583fb 100644 --- a/js-old/src/contracts/badgereg.js +++ b/js-old/src/contracts/badgereg.js @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import { bytesToHex, hexToAscii } from '~/api/util/format'; +import { bytesToHex, hexToAscii } from '@parity/api/lib/util/format'; import ABI from './abi/certifier.json'; diff --git a/js-old/src/contracts/registry.spec.js b/js-old/src/contracts/registry.spec.js index cf81a2b72..e9fddd8c6 100644 --- a/js-old/src/contracts/registry.spec.js +++ b/js-old/src/contracts/registry.spec.js @@ -16,7 +16,7 @@ import sinon from 'sinon'; -import apiutil from '~/api/util'; +import apiutil from '@parity/api/lib/util'; import Registry from './registry'; diff --git a/js-old/src/dapps/chaindeploy.js b/js-old/src/dapps/chaindeploy.js deleted file mode 100644 index c3dd42008..000000000 --- a/js-old/src/dapps/chaindeploy.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import ReactDOM from 'react-dom'; -import React from 'react'; - -import Application from './chaindeploy/Application'; - -import '../../assets/fonts/Roboto/font.css'; -import '../../assets/fonts/RobotoMono/font.css'; -import './style.css'; - -ReactDOM.render( - , - document.querySelector('#container') -); diff --git a/js-old/src/dapps/chaindeploy/Application/application.css b/js-old/src/dapps/chaindeploy/Application/application.css deleted file mode 100644 index f6db5da29..000000000 --- a/js-old/src/dapps/chaindeploy/Application/application.css +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (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 . -*/ - -.body { - font-size: 0.8em; - - .buttons { - position: fixed; - right: 0.5em; - top: 0.5em; - z-index: 100; - - button { - background: rgb(0, 200, 255); - border: 2px solid rgba(0, 200, 255, 0.5); - border-radius: 0.25em; - color: white; - cursor: pointer; - font-size: 1em; - margin: 0 0 0 0.5em; - outline: none; - padding: 0.75em 1.5em; - white-space: nowrap; - - &:disabled { - background: rgb(230, 230, 230); - border: 2px solid rgba(230, 230, 230, 0.5); - cursor: default; - } - - .icon { - fill: white !important; - margin-right: 0.5em; - } - - .text { - display: inline-block; - line-height: 24px; - vertical-align: top; - } - } - } - - .section { - margin: 0 1em 3em 1em; - - h3 { - background: rgba(0, 0, 0, 0.025); - border-radius: 0.25em; - padding: 0.75em 1em; - margin-bottom: 0.5em; - - small { - vertical-align: middle; - } - } - - .list { - display: flex; - flex-direction: row; - flex-wrap: wrap; - } - } -} diff --git a/js-old/src/dapps/chaindeploy/Application/application.js b/js-old/src/dapps/chaindeploy/Application/application.js deleted file mode 100644 index 9e6fa588f..000000000 --- a/js-old/src/dapps/chaindeploy/Application/application.js +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { observer } from 'mobx-react'; -import React, { Component } from 'react'; - -import Contract from '../Contract'; -import Dapp from '../Dapp'; -import Store from '../store'; - -import styles from './application.css'; - -@observer -export default class Application extends Component { - store = new Store(); - - render () { - return ( -
- { this.renderContracts(false) } - { this.renderContracts(true) } - { this.renderApps() } - { this.renderContracts(false, true) } - { this.renderApps(true) } - { this.renderButtons() } -
- ); - } - - renderButton (text, clickHandler, disabled) { - const onClick = (event) => { - if (!disabled) { - clickHandler(event); - } - }; - - return ( - - ); - } - - renderButtons () { - const { contractBadgereg, contractDappreg, isBadgeDeploying, isContractDeploying, isDappDeploying, haveAllBadges, haveAllContracts, haveAllDapps, registry } = this.store; - const disableRegistry = registry.address || registry.isDeploying; - const disableContracts = !registry.address || isContractDeploying || haveAllContracts; - const disableDapps = !contractDappreg.address || isDappDeploying || haveAllDapps; - const disableBadges = !registry.address || !contractBadgereg.address || isBadgeDeploying || haveAllBadges; - - return ( -
- { this.renderButton('registry', this.deployRegistry, disableRegistry) } - { this.renderButton('contracts', this.deployContracts, disableContracts) } - { this.renderButton('badges', this.deployBadges, disableBadges) } - { this.renderButton('apps', this.deployApps, disableDapps) } -
- ); - } - - renderContracts (isBadges, isExternal) { - const { badges, contracts, contractBadgereg, registry } = this.store; - const regaddress = isBadges - ? contractBadgereg.address - : registry.address; - - return ( -
-

- { - isExternal - ? 'External ' - : '' - }{ - isBadges - ? 'Badges ' - : 'Contracts ' - }(registry { regaddress || 'unknown' }) -

-
- { - isExternal || isBadges - ? null - : ( - - ) - } - { - (isBadges ? badges : contracts) - .filter((contract) => contract.isExternal === isExternal) - .map((contract) => { - return ( - - ); - }) - } -
-
- ); - } - - renderApps (isExternal) { - const { apps, contractDappreg, contractGithubhint } = this.store; - const isDisabled = !contractDappreg.isOnChain || !contractGithubhint.isOnChain; - - return ( -
-

- { - isExternal - ? 'External ' - : '' - }Applications (registry { - contractDappreg.address - ? contractDappreg.address - : 'unknown' - }) -

-
- { - apps - .filter((app) => app.isExternal === isExternal) - .map((app) => { - return ( - - ); - }) - } -
-
- ); - } - - deployApps = () => { - return this.store.deployApps(); - } - - deployBadges = () => { - return this.store.deployBadges(); - } - - deployContracts = () => { - return this.store.deployContracts(); - } - - deployRegistry = () => { - return this.store.deployRegistry(); - } -} diff --git a/js-old/src/dapps/chaindeploy/Application/index.js b/js-old/src/dapps/chaindeploy/Application/index.js deleted file mode 100644 index 3d8d1ca3b..000000000 --- a/js-old/src/dapps/chaindeploy/Application/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './application'; diff --git a/js-old/src/dapps/chaindeploy/Contract/contract.js b/js-old/src/dapps/chaindeploy/Contract/contract.js deleted file mode 100644 index 1f0b158d2..000000000 --- a/js-old/src/dapps/chaindeploy/Contract/contract.js +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import React, { Component, PropTypes } from 'react'; - -import ListItem, { Header, Row } from '../ListItem'; - -export default class Contract extends Component { - static propTypes = { - contract: PropTypes.object.isRequired, - disabled: PropTypes.bool - } - - render () { - const { contract, disabled } = this.props; - const location = contract.id === 'registry' - ? 'chain' - : 'registry'; - - return ( - -
- { contract.id } was { - contract.address - ? 'deployed' - : 'not found' - } -
- - { - contract.address - ? contract.address - : 'no address' - } - - - { - contract.hasLatestCode - ? 'has latest available code' - : 'does not have latest code' - } - - - { - contract.isOnChain - ? `registered on ${location}` - : `not registered on ${location}` - } - - { this.renderBadgeInfo() } -
- ); - } - - renderBadgeInfo () { - const { contract } = this.props; - - if (!contract.isBadge) { - return null; - } - - return [ - - { - contract.isBadgeRegistered - ? 'found in badgereg' - : 'not found in badgereg' - } - , - - { - contract.badgeImageHash - ? `badge imageHash ${contract.badgeImageHash}` - : 'has not registered a badge imageHash' - } - , - - { - contract.badgeImageMatch - ? 'has latest badge imageHash' - : 'does not have latest badge imageHash' - } - - ]; - } -} diff --git a/js-old/src/dapps/chaindeploy/Contract/index.js b/js-old/src/dapps/chaindeploy/Contract/index.js deleted file mode 100644 index 74c58e942..000000000 --- a/js-old/src/dapps/chaindeploy/Contract/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './contract'; diff --git a/js-old/src/dapps/chaindeploy/Dapp/dapp.js b/js-old/src/dapps/chaindeploy/Dapp/dapp.js deleted file mode 100644 index 5a997c295..000000000 --- a/js-old/src/dapps/chaindeploy/Dapp/dapp.js +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import React, { Component, PropTypes } from 'react'; - -import ListItem, { Header, Row } from '../ListItem'; - -export default class Dapp extends Component { - static propTypes = { - dapp: PropTypes.object.isRequired, - disabled: PropTypes.bool - } - - render () { - const { dapp, disabled } = this.props; - - return ( - -
- { dapp.name } -
- - { - dapp.isOnChain - ? 'found in dappreg' - : 'not found in dappreg' - } - - { this.renderHash(dapp, 'image') } - { this.renderHash(dapp, 'manifest') } - { this.renderHash(dapp, 'content') } -
- ); - } - - renderHash (dapp, type) { - if (!dapp.source[`${type}Hash`]) { - return null; - } - - const isMatch = dapp[`${type}Match`]; - const hash = dapp[`${type}Hash`]; - - return [ - - { - hash - ? `${type}Hash ${hash}` - : `has not registered an ${type}Hash` - } - , - - { - isMatch - ? `has latest ${type}Hash` - : `does not have latest ${type}Hash` - } - - ]; - } -} diff --git a/js-old/src/dapps/chaindeploy/Dapp/index.js b/js-old/src/dapps/chaindeploy/Dapp/index.js deleted file mode 100644 index 3d3281389..000000000 --- a/js-old/src/dapps/chaindeploy/Dapp/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './dapp'; diff --git a/js-old/src/dapps/chaindeploy/ListItem/Header/header.js b/js-old/src/dapps/chaindeploy/ListItem/Header/header.js deleted file mode 100644 index e9be01eea..000000000 --- a/js-old/src/dapps/chaindeploy/ListItem/Header/header.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import React, { Component, PropTypes } from 'react'; - -import Icon from '../Icon'; - -import styles from '../listItem.css'; - -export default class Header extends Component { - static propTypes = { - children: PropTypes.node.isRequired, - isBusy: PropTypes.bool, - isOk: PropTypes.bool - } - - render () { - const { children, isBusy, isOk } = this.props; - - return ( -
- -
- { children } -
-
- ); - } -} diff --git a/js-old/src/dapps/chaindeploy/ListItem/Header/index.js b/js-old/src/dapps/chaindeploy/ListItem/Header/index.js deleted file mode 100644 index aef90266f..000000000 --- a/js-old/src/dapps/chaindeploy/ListItem/Header/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './header'; diff --git a/js-old/src/dapps/chaindeploy/ListItem/Icon/icon.js b/js-old/src/dapps/chaindeploy/ListItem/Icon/icon.js deleted file mode 100644 index 1f32622e5..000000000 --- a/js-old/src/dapps/chaindeploy/ListItem/Icon/icon.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import React, { Component, PropTypes } from 'react'; - -import styles from '../listItem.css'; - -export default class Icon extends Component { - static propTypes = { - isBusy: PropTypes.bool, - isOk: PropTypes.bool - } - - render () { - const { isBusy, isOk } = this.props; - - return ( -
- { - isOk - ? '\u2714' - : ( - isBusy - ? '\u29d6' - : '\u2716' - ) - } -
- ); - } -} diff --git a/js-old/src/dapps/chaindeploy/ListItem/Icon/index.js b/js-old/src/dapps/chaindeploy/ListItem/Icon/index.js deleted file mode 100644 index f43e02c49..000000000 --- a/js-old/src/dapps/chaindeploy/ListItem/Icon/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './icon'; diff --git a/js-old/src/dapps/chaindeploy/ListItem/Row/index.js b/js-old/src/dapps/chaindeploy/ListItem/Row/index.js deleted file mode 100644 index 5f2c62dee..000000000 --- a/js-old/src/dapps/chaindeploy/ListItem/Row/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './row'; diff --git a/js-old/src/dapps/chaindeploy/ListItem/Row/row.js b/js-old/src/dapps/chaindeploy/ListItem/Row/row.js deleted file mode 100644 index 0982e0321..000000000 --- a/js-old/src/dapps/chaindeploy/ListItem/Row/row.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import React, { Component, PropTypes } from 'react'; - -import Icon from '../Icon'; - -import styles from '../listItem.css'; - -export default class Row extends Component { - static propTypes = { - children: PropTypes.node.isRequired, - disabled: PropTypes.bool, - isBusy: PropTypes.bool, - isOk: PropTypes.bool - } - - render () { - const { children, disabled, isBusy, isOk } = this.props; - - return ( -
- -
- { children } -
-
- ); - } -} diff --git a/js-old/src/dapps/chaindeploy/ListItem/index.js b/js-old/src/dapps/chaindeploy/ListItem/index.js deleted file mode 100644 index 7c79e3241..000000000 --- a/js-old/src/dapps/chaindeploy/ListItem/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export Header from './Header'; -export Row from './Row'; - -export default from './listItem'; diff --git a/js-old/src/dapps/chaindeploy/ListItem/listItem.css b/js-old/src/dapps/chaindeploy/ListItem/listItem.css deleted file mode 100644 index 47d6d481d..000000000 --- a/js-old/src/dapps/chaindeploy/ListItem/listItem.css +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (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 . -*/ - -.listItem { - box-sizing: border-box; - flex: 0 1 33.33%; - max-width: 33.33%; - padding: 0.5em; - position: relative; - - .body { - background: rgba(0, 0, 0, 0.025); - border-radius: 0.25em; - box-sizing: border-box; - display: flex; - flex-direction: column; - flex-wrap: nowrap; - overflow: hidden; - padding: 0.75em; - } - - .status { - background: #f80; - border-radius: 0.25em; - color: white; - font-size: 0.75em; - line-height: 1em; - opacity: 0.9; - padding: 0.5em; - position: absolute; - right: 1em; - top: 1em; - } -} - -.header, -.details { - display: flex; - line-height: 1.5em; - padding: 0.125em 0; - position: relative; - white-space: nowrap; - - .title { - display: inline-block; - overflow: hidden; - text-overflow: ellipsis; - vertical-align: top; - } -} - -.details { - margin-left: 2em; -} - -.icon { - border-radius: 0.25em; - display: inline-block; - flex: 0 0 1.5em; - height: 1.5em; - margin-right: 0.5em; - opacity: 0.75; - text-align: center; - vertical-align: middle; - width: 1.5em; - - &.error { - box-shadow: inset 0 0 0 2px rgb(200, 0, 0); - color: rgb(200, 0, 0); - } - - &.ok { - box-shadow: inset 0 0 0 2px rgb(0, 200, 0); - color: rgb(0, 200, 0); - } -} - -.muted { - opacity: 0.25; -} diff --git a/js-old/src/dapps/chaindeploy/ListItem/listItem.js b/js-old/src/dapps/chaindeploy/ListItem/listItem.js deleted file mode 100644 index c670123f9..000000000 --- a/js-old/src/dapps/chaindeploy/ListItem/listItem.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import React, { Component, PropTypes } from 'react'; - -import styles from './listItem.css'; - -export default class ListItem extends Component { - static propTypes = { - children: PropTypes.node.isRequired, - disabled: PropTypes.bool, - status: PropTypes.string - } - - render () { - const { children, disabled } = this.props; - - return ( -
-
- { children } -
- { this.renderStatus() } -
- ); - } - - renderStatus () { - const { status } = this.props; - - if (!status) { - return null; - } - - return ( -
- { status } -
- ); - } -} diff --git a/js-old/src/dapps/chaindeploy/_dapps.js b/js-old/src/dapps/chaindeploy/_dapps.js deleted file mode 100644 index 4a8da242f..000000000 --- a/js-old/src/dapps/chaindeploy/_dapps.js +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtinsJson from '~/views/Dapps/builtin.json'; - -const REGISTER_URLS = { - console: 'https://raw.githubusercontent.com/paritytech/console/3ea0dbfefded359ccdbea37bc4cf350c0aa16948/console.jpeg', - dappreg: 'https://raw.githubusercontent.com/paritytech/dapp-assets/cdd6ac4f1e2f11619bed72a53ae71217dffe19ad/dapps/legos-64x64.png', - githubhint: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/link-64x64.jpg', - localtx: 'https://raw.githubusercontent.com/paritytech/dapp-assets/cdd6ac4f1e2f11619bed72a53ae71217dffe19ad/dapps/stack-64x64.png', - registry: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/register-64x64.jpg', - signaturereg: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/hex-64x64.jpg', - tokendeploy: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/interlock-64x64.png', - tokenreg: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/coins-64x64.jpg', - web: 'https://raw.githubusercontent.com/paritytech/dapp-assets/ec6138115d0e1f45258969cd90b3b274e0ff2258/dapps/earth-64x64.jpg' -}; - -const builtins = builtinsJson - .filter((app) => app.id) - .map((app) => { - app.source = { - imageUrl: REGISTER_URLS[app.id] - }; - - return app; - }); - -export { - builtins -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/abi/jg-voting.json b/js-old/src/dapps/chaindeploy/contracts/abi/jg-voting.json deleted file mode 100644 index 83a07ef7c..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/abi/jg-voting.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"count","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalVotes","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_index","type":"uint256"}],"name":"hasSenderVoted","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_index","type":"uint256"},{"name":"_answer","type":"uint256"}],"name":"newAnswer","outputs":[{"name":"","type":"bool"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_fee","type":"uint256"}],"name":"setQuestionFee","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"questionFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_index","type":"uint256"}],"name":"get","outputs":[{"name":"closed","type":"bool"},{"name":"owner","type":"address"},{"name":"question","type":"string"},{"name":"balanceNo","type":"uint256"},{"name":"balanceYes","type":"uint256"},{"name":"balanceMaybe","type":"uint256"},{"name":"votesNo","type":"uint256"},{"name":"votesYes","type":"uint256"},{"name":"votesMaybe","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"drain","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_question","type":"string"}],"name":"newQuestion","outputs":[{"name":"","type":"bool"}],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"totalBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"answerFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_index","type":"uint256"}],"name":"closeQuestion","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_fee","type":"uint256"}],"name":"setAnswerFee","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"index","type":"uint256"},{"indexed":false,"name":"question","type":"string"}],"name":"NewQuestion","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"index","type":"uint256"},{"indexed":true,"name":"answer","type":"uint256"},{"indexed":false,"name":"value","type":"uint256"}],"name":"NewAnswer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"old","type":"address"},{"indexed":true,"name":"current","type":"address"}],"name":"NewOwner","type":"event"}] diff --git a/js-old/src/dapps/chaindeploy/contracts/badgereg.js b/js-old/src/dapps/chaindeploy/contracts/badgereg.js deleted file mode 100644 index ccd6b28c1..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/badgereg.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/badgereg'; -import { compiler, source as sourceUrl, output as byteCode } from './code/badgereg'; - -const id = 'badgereg'; -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/code/badgereg.json b/js-old/src/dapps/chaindeploy/contracts/code/badgereg.json deleted file mode 100644 index e7801722a..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/badgereg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/BadgeReg.sol", - "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055670de0b6b3a7640000600455341561003357fe5b5b610a6f806100436000396000f300606060405236156100bf5763ffffffff60e060020a60003504166313af403581146100c15780631e7a505f146100df5780632c0f5f591461010a5780635b8066451461014557806369fe0e2d146101675780637958533a1461017c5780638da5cb5b146101a45780639890220b146101d0578063a02b161e146101e2578063ac4ce2c6146101f7578063b72e717d14610218578063c0f6faed1461025b578063dd93890b14610299578063ddbcb5cb146102b4578063ddca3f43146102e6575bfe5b34156100c957fe5b6100dd600160a060020a0360043516610308565b005b6100f6600160a060020a036004351660243561037c565b604080519115158252519081900360200190f35b341561011257fe5b61011d600435610392565b60408051938452600160a060020a039283166020850152911682820152519081900360600190f35b341561014d57fe5b6101556103ef565b60408051918252519081900360200190f35b341561016f57fe5b6100dd6004356103f6565b005b341561018457fe5b61015560043560243561041b565b60408051918252519081900360200190f35b34156101ac57fe5b6101b461045a565b60408051600160a060020a039092168252519081900360200190f35b34156101d857fe5b6100dd610469565b005b34156101ea57fe5b6100dd6004356104bc565b005b34156101ff57fe5b6100dd600435600160a060020a03602435166105ee565b005b341561022057fe5b610234600160a060020a0360043516610721565b604080519384526020840192909252600160a060020a031682820152519081900360600190f35b341561026357fe5b61026e600435610789565b60408051600160a060020a039485168152602081019390935292168183015290519081900360600190f35b34156102a157fe5b6100dd6004356024356044356107dc565b005b6100f6600160a060020a036004358116906024359060443516610899565b604080519115158252519081900360200190f35b34156102ee57fe5b6101556109cc565b60408051918252519081900360200190f35b60005433600160a060020a0390811691161461032357610378565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a360008054600160a060020a031916600160a060020a0383161790555b5b50565b6000610389838333610899565b90505b92915050565b60008181526002602052604081205460038054600019909201929182918291859081106103bb57fe5b906000526020600020906004020160005b5080546002820154600160a060020a03918216955016925090505b509193909250565b6003545b90565b60005433600160a060020a0390811691161461041157610378565b60048190555b5b50565b600060038381548110151561042c57fe5b906000526020600020906004020160005b506000838152600391909101602052604090205490505b92915050565b600054600160a060020a031681565b60005433600160a060020a03908116911614610484576104b8565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156104b857610000565b5b5b565b60005433600160a060020a039081169116146104d757610378565b806003828154811015156104e757fe5b906000526020600020906004020160005b50600101546040517f844e89a9d524dabb877007aa0e9c395e8938fcfee93ece70c2cd0353db79c8e590600090a36001600060038381548110151561053957fe5b906000526020600020906004020160005b5054600160a060020a03168152602081019190915260400160009081208190556003805460029291908490811061057d57fe5b906000526020600020906004020160005b50600101548152602081019190915260400160009081205560038054829081106105b457fe5b906000526020600020906004020160005b508054600160a060020a03199081168255600060018301556002909101805490911690555b5b50565b60008233600160a060020a031660038281548110151561060a57fe5b906000526020600020906004020160005b5060020154600160a060020a0316146106335761071b565b600160a060020a03831660009081526001602052604090205483901561065857610718565b600380548690811061066657fe5b906000526020600020906004020160005b505460038054600160a060020a03909216945085918790811061069657fe5b906000526020600020906004020160005b508054600160a060020a031916600160a060020a039283161790558381166000908152600160209081526040808320839055928716808352918390208890558251918252915187927fa5d871c0e725767cd5aefc99c53aeca35f09dcc268145cbb13b74a7e2f48f196928290030190a25b5b505b50505050565b600160a060020a038116600090815260016020526040812054600380546000199092019291829182918590811061075457fe5b906000526020600020906004020160005b5060018101546002820154909450600160a060020a0316925090505b509193909250565b60006000600060006003858154811015156107a057fe5b906000526020600020906004020160005b50805460018201546002830154600160a060020a03928316975090955016925090505b509193909250565b8233600160a060020a03166003828154811015156107f657fe5b906000526020600020906004020160005b5060020154600160a060020a03161461081f5761071b565b8160038581548110151561082f57fe5b906000526020600020906004020160005b50600085815260039190910160209081526040918290209290925580518481529051859287927f7991c63a749706fd298fc2387764d640be6e714307b6357b1d3c2ce35cba3b52929081900390910190a35b5b50505050565b60006004543410156108aa576109c5565b600160a060020a0384166000908152600160205260409020548490156108cf576109c3565b6000848152600260205260409020548490156108ea576109c0565b60038054600181016108fc83826109d2565b916000526020600020906004020160005b5060408051606081018252600160a060020a03808b1680835260208084018c9052918a169284018390528454600160a060020a03199081168217865560018087018d905560029687018054909216909417905560035460008281529383528484208190558b8452948252918390208490558251918252915160001993909301935088927febbfb6376bef000063e6e33494e4c543a6197091a04eb6a6f55013d85a1c5386929181900390910190a3600192505b5b505b505b9392505050565b60045481565b8154818355818115116109fe576004028160040283600052602060002091820191016109fe9190610a04565b5b505050565b6103f391905b80821115610a3c578054600160a060020a03199081168255600060018301556002820180549091169055600401610a0a565b5090565b905600a165627a7a72305820526fc95faec325cec5dd3e1bb67c165265282c5fc6db21e96197060b823aaa490029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/dappreg.json b/js-old/src/dapps/chaindeploy/contracts/code/dappreg.json deleted file mode 100644 index 48739a59d..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/dappreg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/225bf022ddd967af2b9ea188e8f611489ca5d7fe/DappReg.sol", - "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055670de0b6b3a7640000600355341561003357fe5b5b6106ee806100436000396000f300606060405236156100a95763ffffffff60e060020a6000350416630257c48c81146100ab57806306661abd146100d357806313af4035146100f55780631a0919dc1461011357806369fe0e2d146101285780638da5cb5b1461013d5780638eaa6ac01461016957806391cd242d1461019d5780639890220b146101b8578063c52bd836146101ca578063ddca3f43146101eb578063e0886f901461020d578063e1fa8e8414610241575bfe5b34156100b357fe5b6100c160043560243561024e565b60408051918252519081900360200190f35b34156100db57fe5b6100c1610272565b60408051918252519081900360200190f35b34156100fd57fe5b610111600160a060020a0360043516610279565b005b341561011b57fe5b6101116004356102ed565b005b341561013057fe5b610111600435610388565b005b341561014557fe5b61014d6103ad565b60408051600160a060020a039092168252519081900360200190f35b341561017157fe5b61017c6004356103bc565b60408051928352600160a060020a0390911660208301528051918290030190f35b34156101a557fe5b6101116004356024356044356103e4565b005b34156101c057fe5b61011161046d565b005b34156101d257fe5b610111600435600160a060020a03602435166104c0565b005b34156101f357fe5b6100c161054e565b60408051918252519081900360200190f35b341561021557fe5b61017c600435610554565b60408051928352600160a060020a0390911660208301528051918290030190f35b6101116004356105ab565b005b60008281526001602090815260408083208484526002019091529020545b92915050565b6002545b90565b60005433600160a060020a0390811691161461029457610000565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a360008054600160a060020a031916600160a060020a0383161790555b5b50565b60008181526001602081905260409091200154819033600160a060020a0390811691161480159061032d575060005433600160a060020a03908116911614155b1561033757610000565b60008281526001602081905260408083208381559091018054600160a060020a03191690555183917fe17fec26316aebe957e188549d659a89f359c49766bcc0ae2fb7ded274ffe14691a25b5b5050565b60005433600160a060020a039081169116146103a357610000565b60038190555b5b50565b600054600160a060020a031681565b6000818152600160208190526040909120805491810154600160a060020a0316905b50915091565b60008381526001602081905260409091200154839033600160a060020a0390811691161461041157610000565b600084815260016020908152604080832086845260020182529182902084905581518481529151859287927f4dcd4fb147bb133a0da8fbf4e5fc3ddd64f04d4b3f6cbee584374b889d28c78d92918290030190a35b5b50505050565b60005433600160a060020a0390811691161461048857610000565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156104bc57610000565b5b5b565b60008281526001602081905260409091200154829033600160a060020a039081169116146104ed57610000565b60008381526001602081905260408083209091018054600160a060020a031916600160a060020a0386169081179091559051909185917fd3d10d874a10020c2bce719499d1fd8756d880b128eb2945dd01b3830854e7169190a35b5b505050565b60035481565b6000600060006001600060028681548110151561056d57fe5b906000526020600020900160005b50548152602081019190915260400160002080546001820154909450600160a060020a0316925090505b50915091565b6003543410156105ba57610000565b6000818152600160205260409020548190156105d557610000565b60028054600181016105e78382610677565b916000526020600020900160005b508390555060408051808201825283815233600160a060020a0390811660208084018281526000888152600192839052868120955186559051949091018054600160a060020a0319169490931693909317909155915184917f7d917fcbc9a29a9705ff9936ffa599500e4fd902e4486bae317414fe967b307c91a35b5b505b50565b815481835581811511610548576000838152602090206105489181019083016106a1565b5b505050565b61027691905b808211156106bb57600081556001016106a7565b5090565b905600a165627a7a7230582011d8a45e381635e9de17e14cc4de97a1e17758cfac1fd25e8a5bc1d5f4d1da9d0029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/gavcoin.json b/js-old/src/dapps/chaindeploy/contracts/code/gavcoin.json deleted file mode 100644 index f0ead4a35..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/gavcoin.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/GavCoin.sol", - "output": "0x606060405266038d7ea4c680006002556305f5e100600355341561001f57fe5b5b6108008061002f6000396000f300606060405236156100885763ffffffff60e060020a600035041663095ea7b3811461009f57806318160ddd146100d257806323b872dd146100f457806329cbdc861461012d57806355234ec0146101465780635af36e3e1461016857806370a0823114610192578063a035b1fe146101c0578063a9059cbb146101e2578063dd62ed3e14610215575b61009d5b61009a3360ff60020a610249565b5b565b005b34156100a757fe5b6100be600160a060020a0360043516602435610390565b604080519115158252519081900360200190f35b34156100da57fe5b6100e2610416565b60408051918252519081900360200190f35b34156100fc57fe5b6100be600160a060020a036004358116906024351660443561041c565b604080519115158252519081900360200190f35b61009d600160a060020a036004351660243561052a565b005b341561014e57fe5b6100e2610539565b60408051918252519081900360200190f35b341561017057fe5b6100be60043560243561053f565b604080519115158252519081900360200190f35b341561019a57fe5b6100e2600160a060020a03600435166106d0565b60408051918252519081900360200190f35b34156101c857fe5b6100e26106ef565b60408051918252519081900360200190f35b34156101ea57fe5b6100be600160a060020a03600435166024356106f5565b604080519115158252519081900360200190f35b341561021d57fe5b6100e2600160a060020a03600435811690602435166107a3565b60408051918252519081900360200190f35b34600080805b60008411801561026157508460025411155b1561038757600354600254620f424091025b0492508284116102835783610285565b825b9150600254620f4240830281151561029957fe5b33600160a060020a03166000818152600160208181526040808420805497909604968701865560028054855295830190915280832080548701905584548352808320909101805463ffffffff191662093a80420163ffffffff161790558154850182559254925193945084937f689dcb02b6a65e0e2f1d23ef47c1ec86604ffbed0bcb65f20150cfc7d5e5a9489190a4600380548290039081905593829003931515610382576002805466038d7ea4c6800001908190556305f5e1006003556040517f23c3dae768238f239632b5c4acb89485b440e0fa72481c4aad9f9b4f9b5a0a5f90600090a25b61024f565b5b505050505050565b600082600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a350600160a060020a0333811660009081526001602081815260408084209487168452600290940190529190208054830190555b92915050565b60005481565b600160a060020a038316600090815260016020526040812054849083908190101561044657610521565b600160a060020a0380871660009081526001602090815260408083203394851684526002019091529020548791908690819010156104835761051c565b87600160a060020a031689600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef896040518082815260200191505060405180910390a3600160a060020a03808a166000908152600160208181526040808420338616855260028101835281852080548e900390559183905281548c9003909155928b16825291902080548901905595505b5b5050505b50509392505050565b6105348282610249565b5b5050565b60035481565b600160a060020a0333166000908152600160208181526040808420868552909201905281205483908390819010806105a35750600160a060020a03331660009081526001602081815260408084208685528301909152909120015463ffffffff1642105b156105ad576106c8565b33600160a060020a0381166000908152600160205260409020548590819010156105d6576106c4565b60405186908890600160a060020a033316907f73f04af9dcc582a923ec15d3eea990fe34adabfff2879e28d44572e01a54abb690600090a433600160a060020a0316600090815260016020818152604080842080548b9003815584548b0185558b855290920190529020805487900390819055151561068457600160a060020a03331660009081526001602081815260408084208b85528301909152822091825501805463ffffffff191690555b600160a060020a0333166108fc620f4240888a025b604051919004801590920291906000818181858888f1935050505015156106bf57610000565b600194505b5b50505b505092915050565b600160a060020a0381166000908152600160205260409020545b919050565b60025481565b33600160a060020a038116600090815260016020526040812054909190839081901015610721576106c8565b84600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600160a060020a03338116600090815260016020526040808220805488900390559187168152208054850190555b5b505092915050565b600160a060020a03808316600090815260016020908152604080832093851683526002909301905220545b929150505600a165627a7a72305820ca533a37c92e41888bda66ae0e66415d21a61c60027b269bca633d85b727875c0029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/githubhint.json b/js-old/src/dapps/chaindeploy/contracts/code/githubhint.json deleted file mode 100644 index 3470ccef0..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/githubhint.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/GithubHint.sol", - "output": "0x6060604052341561000c57fe5b5b6105868061001c6000396000f300606060405263ffffffff60e060020a60003504166302f2008d81146100425780632196ae0d1461009b578063267b6922146101055780637c8c6643146101c9575bfe5b341561004a57fe5b60408051602060046024803582810135601f810185900485028601850190965285855261009995833595939460449493929092019181908401838280828437509496506101de95505050505050565b005b34156100a357fe5b60408051602060046024803582810135601f81018590048502860185019096528585526100999583359593946044949392909201918190840183828082843750949650505092356bffffffffffffffffffffffff191692506102be915050565b005b341561010d57fe5b6101186004356103b1565b604080516bffffffffffffffffffffffff1984166020820152600160a060020a03831691810191909152606080825284546002600019610100600184161502019091160490820181905281906080820190869080156101b85780601f1061018d576101008083540402835291602001916101b8565b820191906000526020600020905b81548152906001019060200180831161019b57829003601f168201915b505094505050505060405180910390f35b34156101d157fe5b6100996004356103de565b005b6000828152602081905260409020600201548290600160a060020a031615801590610227575060008181526020819052604090206002015433600160a060020a03908116911614155b15610231576102b8565b6040805160608101825283815260006020808301829052600160a060020a0333168385015286825281815292902081518051929391926102749284920190610472565b506020820151600182018054606060020a909204600160a060020a031992831617905560409092015160029091018054600160a060020a0392909216919092161790555b5b505050565b6000838152602081905260409020600201548390600160a060020a031615801590610307575060008181526020819052604090206002015433600160a060020a03908116911614155b15610311576103aa565b604080516060810182528481526bffffffffffffffffffffffff198416602080830191909152600160a060020a0333168284015260008781528082529290922081518051929391926103669284920190610472565b506020820151600182018054606060020a909204600160a060020a031992831617905560409092015160029091018054600160a060020a0392909216919092161790555b5b50505050565b600060208190529081526040902060018101546002820154606060020a90910290600160a060020a031683565b6000818152602081905260409020600201548190600160a060020a031615801590610427575060008181526020819052604090206002015433600160a060020a03908116911614155b156104315761046d565b60008281526020819052604081209061044a82826104f1565b50600181018054600160a060020a03199081169091556002909101805490911690555b5b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104b357805160ff19168380011785556104e0565b828001600101855582156104e0579182015b828111156104e05782518255916020019190600101906104c5565b5b506104ed929150610539565b5090565b50805460018160011615610100020316600290046000825580601f106105175750610535565b601f0160209004906000526020600020908101906105359190610539565b5b50565b61055791905b808211156104ed576000815560010161053f565b5090565b905600a165627a7a72305820a83571409e7b0cc4fe48edd09087f315930ab4e017c62b6d100462285a8f4ae70029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/jg-voting.json b/js-old/src/dapps/chaindeploy/contracts/code/jg-voting.json deleted file mode 100644 index 08ec4d0ed..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/jg-voting.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/jacogr/dapp-voting/blob/9b20754b13b9a387704c0955d88b51d2e0e1896d/src/solidity/Voting.sol", - "output": "0x606060405260008054600160a060020a03191633600160a060020a0316178155600281905560038190556004556611c37937e0800060055534156200004057fe5b5b60408051808201909152600781527f48756e6772793f0000000000000000000000000000000000000000000000000060208201526200008e906401000000006200090a6200009682021704565b505b620003af565b60008054819033600160a060020a03908116911614801590620000ba575060055434105b15620000c65762000000565b82600481511080620000d9575060a08151115b15620000e55762000000565b60018054925082810190620000fb908262000244565b50336001838154811015156200010d57fe5b906000526020600020906005020160005b508054600160a060020a03929092166101000261010060a860020a031990921691909117905560018054859190849081106200015657fe5b906000526020600020906005020160005b5060010190805190602001906200018092919062000279565b508133600160a060020a03167f7793f929911ad07e07894a20378f1eccce0fb493486c569d74045731fb583b8e866040518080602001828103825283818151815260200191508051906020019080838360008314620001fc575b805182526020831115620001fc57601f199092019160209182019101620001da565b505050905090810190601f168015620002295780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600192505b5b505b50919050565b8154818355818115116200027357600502816005028360005260206000209182019101620002739190620002ff565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002bc57805160ff1916838001178555620002ec565b82800160010185558215620002ec579182015b82811115620002ec578251825591602001919060010190620002cf565b5b50620002fb9291506200033f565b5090565b6200033c91905b80821115620002fb578054600160a860020a031916815560006200032e600183018262000363565b5060050162000306565b5090565b90565b6200033c91905b80821115620002fb576000815560010162000346565b5090565b90565b50805460018160011615610100020316600290046000825580601f106200038b5750620003ab565b601f016020900490600052602060002090810190620003ab91906200033f565b5b50565b610d2f80620003bf6000396000f300606060405236156100bf5763ffffffff60e060020a60003504166306661abd81146100c15780630d15fd77146100e357806313af40351461010557806331d3164714610123578063476c494c1461014a5780634df6ca2a1461016c5780638a55b54d146101935780638da5cb5b146101b55780639507d39a146101e15780639890220b146102c7578063a3f66b46146102eb578063ad7a672f1461034d578063bd12b4b51461036f578063c09f32e814610391578063f41c1c93146103b8575bfe5b34156100c957fe5b6100d16103df565b60408051918252519081900360200190f35b34156100eb57fe5b6100d16103e6565b60408051918252519081900360200190f35b341561010d57fe5b610121600160a060020a03600435166103ec565b005b341561012b57fe5b61013660043561046d565b604080519115158252519081900360200190f35b6101366004356024356104b8565b604080519115158252519081900360200190f35b341561017457fe5b6101366004356106c3565b604080519115158252519081900360200190f35b341561019b57fe5b6100d16106ee565b60408051918252519081900360200190f35b34156101bd57fe5b6101c56106f4565b60408051600160a060020a039092168252519081900360200190f35b34156101e957fe5b6101f4600435610703565b604051808a15151515815260200189600160a060020a0316600160a060020a0316815260200180602001888152602001878152602001868152602001858152602001848152602001838152602001828103825289818151815260200191508051906020019080838360008314610285575b80518252602083111561028557601f199092019160209182019101610265565b505050905090810190601f1680156102b15780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b34156102cf57fe5b6101366108b2565b604080519115158252519081900360200190f35b610136600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061090a95505050505050565b604080519115158252519081900360200190f35b341561035557fe5b6100d1610ab5565b60408051918252519081900360200190f35b341561037757fe5b6100d1610abb565b60408051918252519081900360200190f35b341561039957fe5b610136600435610ac1565b604080519115158252519081900360200190f35b34156103c057fe5b610136600435610b63565b604080519115158252519081900360200190f35b6001545b90565b60035481565b60005433600160a060020a0390811691161461040757610000565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600060018281548110151561047e57fe5b906000526020600020906005020160005b50600160a060020a0333166000908152600491909101602052604090205460ff1690505b919050565b6000805433600160a060020a039081169116148015906104d9575060045434105b156104e357610000565b600154839081106104f357610000565b8360018181548110151561050357fe5b906000526020600020906005020160005b505460ff1615156001141561052857610000565b8460018181548110151561053857fe5b906000526020600020906005020160005b50600160a060020a0333166000908152600491909101602052604090205460ff1615156001141561057957610000565b84600281111561058857610000565b60038054600190810190915560028054600160a060020a0333163101905580548190899081106105b457fe5b906000526020600020906005020160005b5033600160a060020a031660008181526004929092016020526040909120805460ff191692151592909217909155600180549131918990811061060457fe5b906000526020600020906005020160005b50600088815260029190910160205260409020805490910190556001805481908990811061063f57fe5b906000526020600020906005020160005b506000888152600391909101602090815260409182902080549093019092558051600160a060020a033316318152905188928a927f8b8ed2ef61b90da02f78bd8647287f46833d5b11467db4451e5c4b165485bf46929081900390910190a3600194505b5b505b505b505b505b92915050565b6000805433600160a060020a039081169116146106df57610000565b50600581905560015b5b919050565b60055481565b600054600160a060020a031681565b6000600061070f610b8e565b600060006000600060006000600060018b81548110151561072c57fe5b906000526020600020906005020160005b5090508060000160009054906101000a900460ff1699508060000160019054906101000a9004600160a060020a03169850806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108065780601f106107db57610100808354040283529160200191610806565b820191906000526020600020905b8154815290600101906020018083116107e957829003601f168201915b505050505097508060020160006000815260200190815260200160002054965080600201600060018152602001908152602001600020549550806002016000600281526020019081526020016000205494508060030160006000815260200190815260200160002054935080600301600060018152602001908152602001600020549250806003016000600281526020019081526020016000205491505b509193959799909294969850565b6000805433600160a060020a039081169116146108ce57610000565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f19350505050151561090257610000565b5060015b5b90565b60008054819033600160a060020a0390811691161480159061092d575060055434105b1561093757610000565b82600481511080610949575060a08151115b1561095357610000565b600180549250828101906109679082610ba0565b503360018381548110151561097857fe5b906000526020600020906005020160005b508054600160a060020a03929092166101000274ffffffffffffffffffffffffffffffffffffffff001990921691909117905560018054859190849081106109cd57fe5b906000526020600020906005020160005b5060010190805190602001906109f5929190610bd2565b508133600160a060020a03167f7793f929911ad07e07894a20378f1eccce0fb493486c569d74045731fb583b8e866040518080602001828103825283818151815260200191508051906020019080838360008314610a6e575b805182526020831115610a6e57601f199092019160209182019101610a4e565b505050905090810190601f168015610a9a5780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600192505b5b505b50919050565b60025481565b60045481565b60008133600160a060020a0316600182815481101515610add57fe5b906000526020600020906005020160005b50546101009004600160a060020a031614801590610b1b575060005433600160a060020a03908116911614155b15610b2557610000565b6001600184815481101515610b3657fe5b906000526020600020906005020160005b50805460ff1916911515919091179055600191505b5b50919050565b6000805433600160a060020a03908116911614610b7f57610000565b50600481905560015b5b919050565b60408051602081019091526000815290565b815481835581811511610bcc57600502816005028360005260206000209182019101610bcc9190610c51565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610c1357805160ff1916838001178555610c40565b82800160010185558215610c40579182015b82811115610c40578251825591602001919060010190610c25565b5b50610c4d929150610c9a565b5090565b6103e391905b80821115610c4d57805474ffffffffffffffffffffffffffffffffffffffffff191681556000610c8a6001830182610cbb565b50600501610c57565b5090565b90565b6103e391905b80821115610c4d5760008155600101610ca0565b5090565b90565b50805460018160011615610100020316600290046000825580601f10610ce15750610469565b601f0160209004906000526020600020908101906104699190610c9a565b5b505600a165627a7a72305820b084dcce4e3d78f8a86c925f6c3f2ed689e3674655482541076a1a22f6cdedad0029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/registry.json b/js-old/src/dapps/chaindeploy/contracts/code/registry.json deleted file mode 100644 index 809e7bcfb..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/registry.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/b1e0348144793e4ce6f7d6d2c4c7d0bb4ae9765e/SimpleRegistry.sol", - "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055670de0b6b3a7640000600355341561003357fe5b5b611b2f806100436000396000f300606060405236156101225763ffffffff60e060020a60003504166306b2ff47811461012457806313af40351461015457806319362a28146101725780633f3935d1146101df578063432ced04146102495780634f39ca59146102685780636795dbcd1461028f57806369fe0e2d1461030257806379ce9fac146103295780638da5cb5b1461035c57806390b97fc11461038857806392698814146103f15780639890220b14610418578063ac4e73f91461043c578063ac72c120146104b1578063c3a3582514610388578063ddca3f4314610541578063deb931a214610563578063df57b74214610592578063e30bd740146105c1578063eadf976014610172578063ef5454d6146106ca578063f25eb5c11461073f578063f6d339e414610751575bfe5b341561012c57fe5b610140600160a060020a03600435166107c7565b604080519115158252519081900360200190f35b341561015c57fe5b610170600160a060020a03600435166107fa565b005b341561017a57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526101409583359593946044949392909201918190840183828082843750949650509335935061086e92505050565b604080519115158252519081900360200190f35b34156101e757fe5b610140600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610a1495505050505050565b604080519115158252519081900360200190f35b610140600435610b6e565b604080519115158252519081900360200190f35b341561027057fe5b610140600435610c03565b604080519115158252519081900360200190f35b341561029757fe5b60408051602060046024803582810135601f81018590048502860185019096528585526102e69583359593946044949392909201918190840183828082843750949650610cc495505050505050565b60408051600160a060020a039092168252519081900360200190f35b341561030a57fe5b610140600435610d40565b604080519115158252519081900360200190f35b341561033157fe5b610140600435600160a060020a0360243516610d9e565b604080519115158252519081900360200190f35b341561036457fe5b6102e6610e2e565b60408051600160a060020a039092168252519081900360200190f35b341561039057fe5b60408051602060046024803582810135601f81018590048502860185019096528585526103df9583359593946044949392909201918190840183828082843750949650610cc495505050505050565b60408051918252519081900360200190f35b34156103f957fe5b610140600435610eb9565b604080519115158252519081900360200190f35b341561042057fe5b610140610ed9565b604080519115158252519081900360200190f35b341561044457fe5b610140600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965050509235600160a060020a03169250610f6e915050565b604080519115158252519081900360200190f35b34156104b957fe5b6101406004356112ac565b604080519115158252519081900360200190f35b341561039057fe5b60408051602060046024803582810135601f81018590048502860185019096528585526103df9583359593946044949392909201918190840183828082843750949650610cc495505050505050565b60408051918252519081900360200190f35b341561054957fe5b6103df61134c565b60408051918252519081900360200190f35b341561056b57fe5b6102e6600435611352565b60408051600160a060020a039092168252519081900360200190f35b341561059a57fe5b6102e6600435611370565b60408051600160a060020a039092168252519081900360200190f35b34156105c957fe5b6105dd600160a060020a0360043516611392565b604080516020808252835181830152835191928392908301918501908083838215610623575b80518252602083111561062357601f199092019160209182019101610603565b505050905090810190601f16801561064f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017a57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526101409583359593946044949392909201918190840183828082843750949650509335935061086e92505050565b604080519115158252519081900360200190f35b34156106d257fe5b610140600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965050509235600160a060020a031692506115e8915050565b604080519115158252519081900360200190f35b341561074757fe5b6101706116c6565b005b341561075957fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610140958335959394604494939290920191819084018382808284375094965050509235600160a060020a0316925061185a915050565b604080519115158252519081900360200190f35b600160a060020a03811660009081526002602081905260409091205460001961010060018316150201160415155b919050565b60005433600160a060020a039081169116146108155761086a565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a360008054600160a060020a031916600160a060020a0383161790555b5b50565b600083815260016020526040812054849033600160a060020a0390811691161461089757610a0b565b6000858152600160209081526040918290209151865186936002019288929182918401908083835b602083106108de5780518252601f1990920191602091820191016108bf565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420949094555050855186928291908401908083835b6020831061093c5780518252601f19909201916020918201910161091d565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208183528a51838301528a519096508b95507fb829c3e412537bbe794c048ccb9e4605bb4aaaa8e4d4c15c1a6e0c2adc1716ea948b94508392908301919085019080838382156109cd575b8051825260208311156109cd57601f1990920191602091820191016109ad565b505050905090810190601f1680156109f95780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b509392505050565b60008133600160a060020a031660016000836040518082805190602001908083835b60208310610a555780518252601f199092019160209182019101610a36565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002060010154600160a060020a0316939093149250610aab91505057610b67565b600160a060020a03331660009081526002602090815260409091208451610ad492860190611a09565b5033600160a060020a0316836040518082805190602001908083835b60208310610b0f5780518252601f199092019160209182019101610af0565b5181516020939093036101000a60001901801990911692169190911790526040519201829003822093507f098ae8581bb8bd9af1beaf7f2e9f51f31a8e5a8bfada4e303a645d71d9c9192092506000919050a3600191505b5b50919050565b6000818152600160205260408120548290600160a060020a031615610b9257610b67565b600354341015610ba157610b67565b6000838152600160205260408082208054600160a060020a03191633600160a060020a03169081179091559051909185917f4963513eca575aba66fdcd25f267aae85958fe6fb97e75fa25d783f1a091a2219190a3600191505b5b5b50919050565b600081815260016020526040812054829033600160a060020a03908116911614610c2c57610b67565b600083815260016020818152604080842090920154600160a060020a03168352600290528120610c5b91611a88565b60008381526001602081905260408083208054600160a060020a03199081168255920180549092169091555133600160a060020a03169185917fef1961b4d2909dc23643b309bfe5c3e5646842d98c3a58517037ef3871185af39190a3600191505b5b50919050565b600082815260016020908152604080832090518451600290920192859282918401908083835b60208310610d095780518252601f199092019160209182019101610cea565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b6000805433600160a060020a03908116911614610d5c576107f5565b60038290556040805183815290517f6bbc57480a46553fa4d156ce702beef5f3ad66303b0ed1a5d4cb44966c6584c39181900360200190a15060015b5b919050565b600082815260016020526040812054839033600160a060020a03908116911614610dc757610e26565b6000848152600160205260408082208054600160a060020a031916600160a060020a0387811691821790925591519192339091169187917f7b97c62130aa09acbbcbf7482630e756592496f1759eaf702f469cf64dfb779491a4600191505b5b5092915050565b600054600160a060020a031681565b600082815260016020908152604080832090518451600290920192859282918401908083835b60208310610d095780518252601f199092019160209182019101610cea565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b600081815260016020526040902054600160a060020a031615155b919050565b6000805433600160a060020a03908116911614610ef557610f6a565b60408051600160a060020a03301631815290517fdef931299fe61d176f949118058530c1f3f539dcb6950b4e372c9b835c33ca079181900360200190a1604051600160a060020a0333811691309091163180156108fc02916000818181858888f193505050501515610f6657610000565b5060015b5b90565b60006000836040518082805190602001908083835b60208310610fa25780518252601f199092019160209182019101610f83565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912060008181526001909252929020549193505033600160a060020a039081169116149050610ff6576112a3565b846040518082805190602001908083835b602083106110265780518252601f199092019160209182019101611007565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120600081815260019283905293909320015491955050600160a060020a03161580159250905061111257506000828152600160208181526040808420830154600160a060020a031684526002918290529283902092518354869493919283928592908116156101000260001901160480156110ff5780601f106110dd5761010080835404028352918201916110ff565b820191906000526020600020905b8154815290600101906020018083116110eb575b5050915050604051809103902060001916145b156111eb57600082815260016020818152604080842090920154600160a060020a0316835260029052812061114691611a88565b6000828152600160208181526040928390209091015491518751600160a060020a039093169288928291908401908083835b602083106111975780518252601f199092019160209182019101611178565b5181516020939093036101000a60001901801990911692169190911790526040519201829003822093507f12491ad95fd945e444d88a894ffad3c21959880a4dcd8af99d4ae4ffc71d4abd92506000919050a35b6000828152600160208181526040928390209091018054600160a060020a031916600160a060020a0388169081179091559151875188928291908401908083835b6020831061124b5780518252601f19909201916020918201910161122c565b5181516020939093036101000a60001901801990911692169190911790526040519201829003822093507f728435a0031f6a04538fcdd24922a7e06bc7bc945db03e83d22122d1bc5f28df92506000919050a3600192505b5b505092915050565b60008181526001602081905260409091200154600160a060020a031615155b919050565b600082815260016020908152604080832090518451600290920192859282918401908083835b60208310610d095780518252601f199092019160209182019101610cea565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b60035481565b600081815260016020526040902054600160a060020a03165b919050565b60008181526001602081905260409091200154600160a060020a03165b919050565b61139a611ad0565b600160a060020a038216600090815260026020818152604092839020805484516001821615610100026000190190911693909304601f81018390048302840183019094528383529192908301828280156114355780601f1061140a57610100808354040283529160200191611435565b820191906000526020600020905b81548152906001019060200180831161141857829003601f168201915b505050505090505b919050565b600083815260016020526040812054849033600160a060020a0390811691161461089757610a0b565b6000858152600160209081526040918290209151865186936002019288929182918401908083835b602083106108de5780518252601f1990920191602091820191016108bf565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420949094555050855186928291908401908083835b6020831061093c5780518252601f19909201916020918201910161091d565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208183528a51838301528a519096508b95507fb829c3e412537bbe794c048ccb9e4605bb4aaaa8e4d4c15c1a6e0c2adc1716ea948b94508392908301919085019080838382156109cd575b8051825260208311156109cd57601f1990920191602091820191016109ad565b505050905090810190601f1680156109f95780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b509392505050565b6000805433600160a060020a0390811691161461160457610d3a565b600160a060020a0382166000908152600260209081526040909120845161162d92860190611a09565b5081600160a060020a0316836040518082805190602001908083835b602083106116685780518252601f199092019160209182019101611649565b5181516020939093036101000a60001901801990911692169190911790526040519201829003822093507f098ae8581bb8bd9af1beaf7f2e9f51f31a8e5a8bfada4e303a645d71d9c9192092506000919050a35060015b5b92915050565b33600160a060020a03166002600033600160a060020a0316600160a060020a0316815260200190815260200160002060405180828054600181600116156101000203166002900480156117505780601f1061172e576101008083540402835291820191611750565b820191906000526020600020905b81548152906001019060200180831161173c575b505060405190819003812092507f12491ad95fd945e444d88a894ffad3c21959880a4dcd8af99d4ae4ffc71d4abd9150600090a3600160006002600033600160a060020a0316600160a060020a0316815260200190815260200160002060405180828054600181600116156101000203166002900480156118085780601f106117e6576101008083540402835291820191611808565b820191906000526020600020905b8154815290600101906020018083116117f4575b50506040805191829003909120845260208085019590955292830160009081206001018054600160a060020a031916905533600160a060020a0316815260029094525050812061185791611a88565b5b565b600083815260016020526040812054849033600160a060020a0390811691161461188357610a0b565b60008581526001602090815260409182902091518651600160a060020a038716936002019288929182918401908083835b602083106108de5780518252601f1990920191602091820191016108bf565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420949094555050855186928291908401908083835b6020831061093c5780518252601f19909201916020918201910161091d565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208183528a51838301528a519096508b95507fb829c3e412537bbe794c048ccb9e4605bb4aaaa8e4d4c15c1a6e0c2adc1716ea948b94508392908301919085019080838382156109cd575b8051825260208311156109cd57601f1990920191602091820191016109ad565b505050905090810190601f1680156109f95780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b509392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611a4a57805160ff1916838001178555611a77565b82800160010185558215611a77579182015b82811115611a77578251825591602001919060010190611a5c565b5b50611a84929150611ae2565b5090565b50805460018160011615610100020316600290046000825580601f10611aae575061086a565b601f01602090049060005260206000209081019061086a9190611ae2565b5b50565b60408051602081019091526000815290565b610f6a91905b80821115611a845760008155600101611ae8565b5090565b905600a165627a7a723058202a8f09bd2a20f43dfe4c6adb69bf4bfa211cda23787d972cd6e33eee989cafc50029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/signaturereg.json b/js-old/src/dapps/chaindeploy/contracts/code/signaturereg.json deleted file mode 100644 index 3dd4fe07d..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/signaturereg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/SignatureReg.sol", - "output": "0x606060405260008054600160a060020a03191633600160a060020a0316178155600255341561002a57fe5b5b60408051808201909152601081527f726567697374657228737472696e67290000000000000000000000000000000060208201526100759064010000000061036661007c82021704565b505b61031c565b60006100f7826040518082805190602001908083835b602083106100b15780518252601f199092019160209182019101610092565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020836100ff640100000000026103d6176401000000009004565b90505b919050565b7fffffffff000000000000000000000000000000000000000000000000000000008216600090815260016020819052604082205484916002908216156101000260001901909116041561015157610274565b7fffffffff000000000000000000000000000000000000000000000000000000008416600090815260016020908152604090912084516101939286019061027c565b5060028054600101905560408051602080825285518183015285517fffffffff00000000000000000000000000000000000000000000000000000000881693600160a060020a033316937f50e01e16719d6c699e516c57f4c514e77f6bc21a978d33f23980acdddbcbd0b293899391928392908301918501908083838215610236575b80518252602083111561023657601f199092019160209182019101610216565b505050905090810190601f1680156102625780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b5092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106102bd57805160ff19168380011785556102ea565b828001600101855582156102ea579182015b828111156102ea5782518255916020019190600101906102cf565b5b506102f79291506102fb565b5090565b61031991905b808211156102f75760008155600101610301565b5090565b90565b6105d78061032b6000396000f3006060604052361561005c5763ffffffff60e060020a60003504166313af4035811461005e5780633015a5211461007c5780638da5cb5b1461009e5780639890220b146100ca578063b46bcdaa146100dc578063f2c298be14610179575bfe5b341561006657fe5b61007a600160a060020a03600435166101e3565b005b341561008457fe5b61008c610264565b60408051918252519081900360200190f35b34156100a657fe5b6100ae61026a565b60408051600160a060020a039092168252519081900360200190f35b34156100d257fe5b61007a610279565b005b34156100e457fe5b6100f9600160e060020a0319600435166102cc565b60408051602080825283518183015283519192839290830191850190808383821561013f575b80518252602083111561013f57601f19909201916020918201910161011f565b505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018157fe5b6101cf600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061036695505050505050565b604080519115158252519081900360200190f35b60005433600160a060020a039081169116146101fe57610260565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b60025481565b600054600160a060020a031681565b60005433600160a060020a03908116911614610294576102c8565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156102c857610000565b5b5b565b60016020818152600092835260409283902080548451600294821615610100026000190190911693909304601f810183900483028401830190945283835291929083018282801561035e5780601f106103335761010080835404028352916020019161035e565b820191906000526020600020905b81548152906001019060200180831161034157829003601f168201915b505050505081565b60006103ce826040518082805190602001908083835b6020831061039b5780518252601f19909201916020918201910161037c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020836103d6565b90505b919050565b600160e060020a03198216600090815260016020819052604082205484916002908216156101000260001901909116041561041057610503565b600160e060020a031984166000908152600160209081526040909120845161043a9286019061050b565b506002805460010190556040805160208082528551818301528551600160e060020a0319881693600160a060020a033316937f50e01e16719d6c699e516c57f4c514e77f6bc21a978d33f23980acdddbcbd0b2938993919283929083019185019080838382156104c5575b8051825260208311156104c557601f1990920191602091820191016104a5565b505050905090810190601f1680156104f15780820380516001836020036101000a031916815260200191505b509250505060405180910390a3600191505b5b5092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061054c57805160ff1916838001178555610579565b82800160010185558215610579579182015b8281111561057957825182559160200191906001019061055e565b5b5061058692915061058a565b5090565b6105a891905b808211156105865760008155600101610590565b5090565b905600a165627a7a723058206830357dde798fafa19dd78a4460c047f76cc132713db13442c5da7485fc0ff40029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/tokendeploy.json b/js-old/src/dapps/chaindeploy/contracts/code/tokendeploy.json deleted file mode 100644 index 7dd0391b1..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/tokendeploy.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/0ca02d60066202432305c8e9b1cbf33267478ab3/BasicCoin.sol", - "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055341561002757fe5b5b610f43806100376000396000f3006060604052361561007d5763ffffffff60e060020a600035041663061ea8cc811461007f57806306661abd146100ad57806313af4035146100cf5780635001f3b5146100ed5780638da5cb5b1461010f5780639507d39a1461013b5780639890220b14610179578063acfdfd1c1461018b578063c00ca38314610236575bfe5b341561008757fe5b61009b600160a060020a0360043516610280565b60408051918252519081900360200190f35b34156100b557fe5b61009b61029f565b60408051918252519081900360200190f35b34156100d757fe5b6100eb600160a060020a03600435166102a6565b005b34156100f557fe5b61009b610327565b60408051918252519081900360200190f35b341561011757fe5b61011f61032e565b60408051600160a060020a039092168252519081900360200190f35b341561014357fe5b61014e60043561033d565b60408051600160a060020a039485168152928416602084015292168183015290519081900360600190f35b341561018157fe5b6100eb610392565b005b60408051602060046024803582810135601f8101859004850286018501909652858552610222958335959394604494939290920191819084018382808284375050604080516020601f89358b0180359182018390048302840183019094528083529799988101979196509182019450925082915084018382808284375094965050509235600160a060020a031692506103e5915050565b604080519115158252519081900360200190f35b341561023e57fe5b61014e600160a060020a036004351660243561079b565b60408051600160a060020a039485168152928416602084015292168183015290519081900360600190f35b600160a060020a0381166000908152600260205260409020545b919050565b6001545b90565b60005433600160a060020a039081169116146102c157610000565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b620f424081565b600054600160a060020a031681565b600060006000600060018581548110151561035457fe5b906000526020600020906003020160005b50805460018201546002830154600160a060020a039283169750908216955016925090505b509193909250565b60005433600160a060020a039081169116146103ad57610000565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156103e157610000565b5b5b565b60008181808088336103f56107eb565b918252600160a060020a03166020820152604080519182900301906000f080151561041c57fe5b925061042733610280565b915083600160a060020a031663ddca3f436000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b151561046f57fe5b60325a03f1151561047c57fe5b50506040805151600160a060020a03331660009081526002602052919091209092506001840191506104ae90826107fb565b50600154600160a060020a03331660009081526002602052604090208054849081106104d657fe5b906000526020600020900160005b5055600180548082016104f78382610825565b916000526020600020906003020160005b60606040519081016040528087600160a060020a0316815260200133600160a060020a0316815260200188600160a060020a0316815250909190915060008201518160000160006101000a815481600160a060020a030219169083600160a060020a0316021790555060208201518160010160006101000a815481600160a060020a030219169083600160a060020a0316021790555060408201518160020160006101000a815481600160a060020a030219169083600160a060020a0316021790555050505083600160a060020a0316637b1a547c82858b620f42408c336000604051602001526040518763ffffffff1660e060020a0281526004018086600160a060020a0316600160a060020a03168152602001806020018581526020018060200184600160a060020a0316600160a060020a03168152602001838103835287818151815260200191508051906020019080838360008314610686575b80518252602083111561068657601f199092019160209182019101610666565b505050905090810190601f1680156106b25780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838382156106f1575b8051825260208311156106f157601f1990920191602091820191016106d1565b505050905090810190601f16801561071d5780820380516001836020036101000a031916815260200191505b509750505050505050506020604051808303818588803b151561073c57fe5b61235a5a03f1151561074a57fe5b5050604051600160a060020a03808716935087811692503316907f454b0172f64812df0cd504c2bd7df7aab8ff328a54d946b4bd0fa7c527adf9cc90600090a4600194505b50505050949350505050565b600160a060020a03821660009081526002602052604081208054829182916107dd9190869081106107c857fe5b906000526020600020900160005b505461033d565b9250925092505b9250925092565b604051610650806108c883390190565b81548183558181151161081f5760008381526020902061081f918101908301610857565b5b505050565b81548183558181151161081f5760030281600302836000526020600020918201910161081f9190610878565b5b505050565b6102a391905b80821115610871576000815560010161085d565b5090565b90565b6102a391905b8082111561087157805473ffffffffffffffffffffffffffffffffffffffff19908116825560018201805482169055600282018054909116905560030161087e565b5090565b905600606060405260008054600160a060020a03191633600160a060020a0316179055341561002757fe5b6040516040806106508339810160405280516020909101515b600034111561004e57610000565b8180151561005b57610000565b600183905560008054600160a060020a031916600160a060020a038416908117825581526002602052604090208390555b5b505b50505b6105af806100a16000396000f3006060604052361561007d5763ffffffff60e060020a600035041663095ea7b3811461009257806313af4035146100c557806318160ddd146100e357806323b872dd146101055780635001f3b51461013e57806370a08231146101605780638da5cb5b1461018e578063a9059cbb146101ba578063dd62ed3e146101ed575b341561008557fe5b6100905b610000565b565b005b341561009a57fe5b6100b1600160a060020a0360043516602435610221565b604080519115158252519081900360200190f35b34156100cd57fe5b610090600160a060020a03600435166102b6565b005b34156100eb57fe5b6100f3610337565b60408051918252519081900360200190f35b341561010d57fe5b6100b1600160a060020a036004358116906024351660443561033d565b604080519115158252519081900360200190f35b341561014657fe5b6100f361045d565b60408051918252519081900360200190f35b341561016857fe5b6100f3600160a060020a0360043516610464565b60408051918252519081900360200190f35b341561019657fe5b61019e610483565b60408051600160a060020a039092168252519081900360200190f35b34156101c257fe5b6100b1600160a060020a0360043516602435610492565b604080519115158252519081900360200190f35b34156101f557fe5b6100f3600160a060020a0360043581169060243516610552565b60408051918252519081900360200190f35b6000600034111561023157610000565b82600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a350600160a060020a0333811660009081526002602090815260408083209386168352600193840190915290208054830190555b5b92915050565b60005433600160a060020a039081169116146102d157610000565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b60015481565b6000600034111561034d57610000565b600160a060020a038416600090815260026020526040902054849083908190101561037757610000565b600160a060020a0380871660009081526002602090815260408083203394851684526001019091529020548791908690819010156103b457610000565b87600160a060020a031689600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef896040518082815260200191505060405180910390a3600160a060020a03808a16600090815260026020818152604080842033861685526001808201845282862080548f900390559390925281548c9003909155928b16825291902080548901905595505b5b5050505b50505b9392505050565b620f424081565b600160a060020a0381166000908152600260205260409020545b919050565b600054600160a060020a031681565b600060003411156104a257610000565b33600160a060020a0381166000908152600260205260409020548390819010156104cb57610000565b84600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3600160a060020a0333811660009081526002602052604080822080548890039055918716815220805485019055600192505b5b50505b92915050565b600160a060020a03808316600090815260026020908152604080832093851683526001909301905220545b929150505600a165627a7a72305820b5bf89a0a85c15df1e9717e49be06fe1a4f9dcc1e0cebf5483dd1c0bcd14a0910029a165627a7a723058207f96b7ad40c02cfaeaf29e65c79456dd3fd9828c9d3fbaf801fb60010456c3880029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/tokenreg.json b/js-old/src/dapps/chaindeploy/contracts/code/tokenreg.json deleted file mode 100644 index bcba34127..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/tokenreg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/TokenReg.sol", - "output": "0x606060405260008054600160a060020a03191633600160a060020a0316179055670de0b6b3a7640000600455341561003357fe5b5b611473806100436000396000f300606060405236156100b45763ffffffff60e060020a600035041663044215c681146100b657806313af4035146101df57806366b42dcb146101fd57806369fe0e2d146102ab5780637958533a146102c05780637b1a547c146102e8578063891de9ed146103a15780638da5cb5b146104bc5780639890220b146104e85780639f181b5e146104fa578063a02b161e1461051c578063b72e717d14610531578063dd93890b1461066a578063ddca3f4314610685575bfe5b34156100be57fe5b6100c96004356106a7565b60408051600160a060020a038088168252918101859052908216608082015260a060208083018281528751928401929092528651606084019160c0850191908901908083838215610135575b80518252602083111561013557601f199092019160209182019101610115565b505050905090810190601f1680156101615780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838382156101a0575b8051825260208311156101a057601f199092019160209182019101610180565b505050905090810190601f1680156101cc5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b34156101e757fe5b6101fb600160a060020a036004351661083a565b005b60408051602060046024803582810135601f8101859004850286018501909652858552610297958335600160a060020a0316959394604494939290920191819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a8a359a9099940197509195509182019350915081908401838280828437509496506108ae95505050505050565b604080519115158252519081900360200190f35b34156102b357fe5b6101fb6004356108c8565b005b34156102c857fe5b6102d66004356024356108ed565b60408051918252519081900360200190f35b60408051602060046024803582810135601f8101859004850286018501909652858552610297958335600160a060020a0316959394604494939290920191819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989a8a359a90999401975091955091820193509150819084018382808284375094965050509235600160a060020a0316925061092c915050565b604080519115158252519081900360200190f35b34156103a957fe5b6103f7600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843750949650610c6695505050505050565b6040518086815260200185600160a060020a0316600160a060020a031681526020018481526020018060200183600160a060020a0316600160a060020a0316815260200182810382528481815181526020019150805190602001908083836000831461047e575b80518252602083111561047e57601f19909201916020918201910161045e565b505050905090810190601f1680156104aa5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b34156104c457fe5b6104cc610dca565b60408051600160a060020a039092168252519081900360200190f35b34156104f057fe5b6101fb610dd9565b005b341561050257fe5b6102d6610e2c565b60408051918252519081900360200190f35b341561052457fe5b6101fb600435610e33565b005b341561053957fe5b61054d600160a060020a0360043516611047565b60405180868152602001806020018581526020018060200184600160a060020a0316600160a060020a03168152602001838103835287818151815260200191508051906020019080838360008314610135575b80518252602083111561013557601f199092019160209182019101610115565b505050905090810190601f1680156101615780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838382156101a0575b8051825260208311156101a057601f199092019160209182019101610180565b505050905090810190601f1680156101cc5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b341561067257fe5b6101fb6004356024356044356111f3565b005b341561068d57fe5b6102d66112b0565b60408051918252519081900360200190f35b60006106b16112b6565b60006106bb6112b6565b600060006003878154811015156106ce57fe5b906000526020600020906006020160005b50805460018083018054604080516020601f600260001997861615610100029790970190941695909504928301859004850281018501909152818152600160a060020a039094169a5093945091929083018282801561077f5780601f106107545761010080835404028352916020019161077f565b820191906000526020600020905b81548152906001019060200180831161076257829003601f168201915b505050600280850154600386018054604080516020601f6000196101006001871615020190941696909604928301869004860281018601909152818152969b50919950935091508301828280156108175780601f106107ec57610100808354040283529160200191610817565b820191906000526020600020905b8154815290600101906020018083116107fa57829003601f168201915b50505050600483015491945050600160a060020a031691505b5091939590929450565b60005433600160a060020a03908116911614610855576108aa565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a360008054600160a060020a031916600160a060020a0383161790555b5b50565b60006108bd858585853361092c565b90505b949350505050565b60005433600160a060020a039081169116146108e3576108aa565b60048190555b5b50565b60006003838154811015156108fe57fe5b906000526020600020906006020160005b506000838152600591909101602052604090205490505b92915050565b600060045434101561093d57610c5d565b600160a060020a03861660009081526001602052604090205486901561096257610c5b565b8551869060031461097257610c59565b866002816040518082805190602001908083835b602083106109a55780518252601f199092019160209182019101610986565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220541591506109df905057610c56565b60038054600181016109f183826112c8565b916000526020600020906006020160005b506040805160a081018252600160a060020a03808e1680835260208084018f90529383018d9052606083018c9052908a1660808301528354600160a060020a0319161783558b51909291610a5d9160018401918e01906112fa565b506040820151600282015560608201518051610a839160038401916020909101906112fa565b506080919091015160049091018054600160a060020a031916600160a060020a03928316179055600354908b1660009081526001602090815260409182902083905590518b519293506002928c928291908401908083835b60208310610afa5780518252601f199092019160209182019101610adb565b51815160001960209485036101000a81019182169119929092161790915293909101958652604051958690038101862096909655506003548d519101948d9493508392508401908083835b60208310610b645780518252601f199092019160209182019101610b45565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f25074d730da65a10e171fe5589d2182313ef00da38d23a9ae3b78923568bdf2d8b896040518083600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360008314610c17575b805182526020831115610c1757601f199092019160209182019101610bf7565b505050905090810190601f168015610c435780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600193505b5b505b505b505b95945050505050565b600060006000610c746112b6565b6000600060016002886040518082805190602001908083835b60208310610cac5780518252601f199092019160209182019101610c8d565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054039550600386815481101515610cf257fe5b906000526020600020906006020160005b5080546002808301546003840180546040805160206101006001851615026000190190931695909504601f8101839004830286018301909152808552600160a060020a039095169a50919850939450909291908301828280156108175780601f106107ec57610100808354040283529160200191610817565b820191906000526020600020905b8154815290600101906020018083116107fa57829003601f168201915b50505050600483015491945050600160a060020a031691505b5091939590929450565b600054600160a060020a031681565b60005433600160a060020a03908116911614610df457610e28565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f193505050501515610e2857610000565b5b5b565b6003545b90565b60005433600160a060020a03908116911614610e4e576108aa565b80600382815481101515610e5e57fe5b906000526020600020906006020160005b506001016040518082805460018160011615610100020316600290048015610ece5780601f10610eac576101008083540402835291820191610ece565b820191906000526020600020905b815481529060010190602001808311610eba575b505060405190819003812092507f96e76fa77fea85d8abeb7533fdb8288c214bb1dcf1f867c8f36a95f1f509c1759150600090a360016000600383815481101515610f1557fe5b906000526020600020906006020160005b5054600160a060020a031681526020810191909152604001600090812055600380546002919083908110610f5657fe5b906000526020600020906006020160005b506001016040518082805460018160011615610100020316600290048015610fc65780601f10610fa4576101008083540402835291820191610fc6565b820191906000526020600020905b815481529060010190602001808311610fb2575b50509283525050604051908190036020019020600090556003805482908110610feb57fe5b906000526020600020906006020160005b8154600160a060020a0319168255611018600183016000611379565b60028201600090556003820160006110309190611379565b506004018054600160a060020a03191690555b5b50565b60006110516112b6565b600061105b6112b6565b600160a060020a03851660009081526001602052604081205460038054600019909201965082918790811061108c57fe5b906000526020600020906006020160005b509050806001018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561077f5780601f106107545761010080835404028352916020019161077f565b820191906000526020600020905b81548152906001019060200180831161076257829003601f168201915b505050600280850154600386018054604080516020601f6000196101006001871615020190941696909604928301869004860281018601909152818152969b50919950935091508301828280156108175780601f106107ec57610100808354040283529160200191610817565b820191906000526020600020905b8154815290600101906020018083116107fa57829003601f168201915b50505050600483015491945050600160a060020a031691505b5091939590929450565b8233600160a060020a031660038281548110151561120d57fe5b906000526020600020906006020160005b5060040154600160a060020a031614611236576112a9565b8160038581548110151561124657fe5b906000526020600020906006020160005b50600085815260059190910160209081526040918290209290925580518481529051859287927f7991c63a749706fd298fc2387764d640be6e714307b6357b1d3c2ce35cba3b52929081900390910190a35b5b50505050565b60045481565b60408051602081019091526000815290565b8154818355818115116112f4576006028160060283600052602060002091820191016112f491906113c1565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061133b57805160ff1916838001178555611368565b82800160010185558215611368579182015b8281111561136857825182559160200191906001019061134d565b5b50611375929150611426565b5090565b50805460018160011615610100020316600290046000825580601f1061139f57506108aa565b601f0160209004906000526020600020908101906108aa9190611426565b5b50565b610e3091905b80821115611375578054600160a060020a031916815560006113ec6001830182611379565b60028201600090556003820160006114049190611379565b50600481018054600160a060020a03191690556006016113c7565b5090565b90565b610e3091905b80821115611375576000815560010161142c565b5090565b905600a165627a7a72305820ab1d1a18270ba278cc2f74cd1b7b547cdcd6308a9df1dec1120fa9f6199b1f480029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/verifyEmail.json b/js-old/src/dapps/chaindeploy/contracts/code/verifyEmail.json deleted file mode 100644 index a87fb0a22..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/verifyEmail.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/e5afdacc716ca743ceddf80978d4e6b2b465dbe9/ProofOfEmail.sol", - "output": "0x606060405260008054600160a060020a03191633600160a060020a0316178155600355341561002a57fe5b5b6108a48061003a6000396000f300606060405236156100ca5763ffffffff60e060020a60003504166306b2ff4781146100cc57806313af4035146100fc5780632650b9881461011a5780634b59e8801461018c57806359c87d70146101b05780636795dbcd146101bd57806369fe0e2d1461023057806370c4d5f214610245578063797af627146103255780638da5cb5b1461034c5780639890220b14610378578063ac72c1201461038a578063cc1d4c02146103b1578063ddca3f43146103e1578063df57b74214610403578063e30bd74014610432575bfe5b34156100d457fe5b6100e8600160a060020a03600435166104ce565b604080519115158252519081900360200190f35b341561010457fe5b610118600160a060020a03600435166104d6565b005b341561012257fe5b60408051602060046024803582810135601f810185900485028601850190965285855261017a958335600160a060020a0316959394604494939290920191819084018382808284375094965061055795505050505050565b60408051918252519081900360200190f35b341561019457fe5b610118600160a060020a0360043516602435604435610577565b005b6101186004356105eb565b005b34156101c557fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610214958335959394604494939290920191819084018382808284375094965061063595505050505050565b60408051600160a060020a039092168252519081900360200190f35b341561023857fe5b610118600435610654565b005b341561024d57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526102a5958335600160a060020a0316959394604494939290920191819084018382808284375094965061067995505050505050565b6040805160208082528351818301528351919283929083019185019080838382156102eb575b8051825260208311156102eb57601f1990920191602091820191016102cb565b505050905090810190601f1680156103175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561032d57fe5b6100e8600435610688565b604080519115158252519081900360200190f35b341561035457fe5b610214610791565b60408051600160a060020a039092168252519081900360200190f35b341561038057fe5b6101186107a0565b005b341561039257fe5b6100e86004356107f3565b604080519115158252519081900360200190f35b34156103b957fe5b6100e8600160a060020a0360043516610813565b604080519115158252519081900360200190f35b34156103e957fe5b61017a610834565b60408051918252519081900360200190f35b341561040b57fe5b61021460043561083a565b60408051600160a060020a039092168252519081900360200190f35b341561043a57fe5b6102a5600160a060020a0360043516610858565b6040805160208082528351818301528351919283929083019185019080838382156102eb575b8051825260208311156102eb57601f1990920191602091820191016102cb565b505050905090810190601f1680156103175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60005b919050565b60005433600160a060020a039081169116146104f157610553565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a0382166000908152600260205260409020545b92915050565b60005433600160a060020a03908116911614610592576105e5565b600082815260046020908152604091829020839055815184815291518392600160a060020a038716927f76babef7e9f1065118be3f9d7094016a1cc06dd12811501c7712deb22144f37b92918290030190a35b5b505050565b6003543410156105fa57610553565b6040518190600160a060020a033316907f070669e6be82aa9b077a096b0f9617893a4dc5cb05897e27fd7a6112c8e6629e90600090a35b5b50565b600082815260016020526040902054600160a060020a03165b92915050565b60005433600160a060020a0390811691161461066f57610553565b60038190555b5b50565b610571610866565b5b92915050565b6040805182815281516020918190038201902060009081526004909152908120548015156106b55761078b565b6040805184815281516020918190038201902060009081526004825282812081905583815260019091522054600160a060020a031615158061070e5750600160a060020a03331660009081526002602052604090205415155b156107185761078b565b6000818152600160209081526040808320805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a031690811790915580845260029092528083208490555190917fd415b905d4dd806bfba99a7a0e6351bd0c9db3a9912add21c0e6bef4479f673f91a2600191505b50919050565b600054600160a060020a031681565b60005433600160a060020a039081169116146107bb576107ef565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f1935050505015156107ef57610000565b5b5b565b600081815260016020526040902054600160a060020a031615155b919050565b600160a060020a03811660009081526002602052604090205415155b919050565b60035481565b600081815260016020526040902054600160a060020a03165b919050565b6104d1610866565b5b919050565b604080516020810190915260008152905600a165627a7a7230582081d03388dd06c78ee4098c4f1e23cd3c25e38d249d5da59962c6b28ec6e20ea70029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/code/verifySms.json b/js-old/src/dapps/chaindeploy/contracts/code/verifySms.json deleted file mode 100644 index 0cfc43f9d..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/code/verifySms.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compiler": "v0.4.9+commit.364da425", - "source": "https://github.com/paritytech/contracts/blob/58842b92c00e3c45a84b6d0ac9b842f016dde50a/SMSVerification.sol", - "output": "0x606060405260008054600160a060020a033316600160a060020a03199182168117909255600280549091169091179055666a94d74f430000600455341561004257fe5b5b6109a0806100526000396000f300606060405236156100ca5763ffffffff60e060020a60003504166313af403581146100cc57806314253887146100ea578063338cdca1146101085780633da5c3ce146101125780635283f3391461013357806369fe0e2d146101af57806374a8f103146101c4578063797af627146101e25780638da5cb5b146102095780639890220b14610235578063c89e436114610247578063ca4cbf6714610273578063ca5eb5e1146102e5578063cc1d4c0214610303578063ddca3f4314610333578063fc2525ab14610273575bfe5b34156100d457fe5b6100e8600160a060020a03600435166103c7565b005b34156100f257fe5b6100e8600160a060020a0360043516610448565b005b6100e86104b4565b005b341561011a57fe5b6100e8600160a060020a0360043516602435610521565b005b341561013b57fe5b60408051602060046024803582810135601f8101859004850286018501909652858552610193958335600160a060020a0316959394604494939290920191819084018382808284375094965061059295505050505050565b60408051600160a060020a039092168252519081900360200190f35b34156101b757fe5b6100e8600435610623565b005b34156101cc57fe5b6100e8600160a060020a0360043516610648565b005b34156101ea57fe5b6101f56004356106d9565b604080519115158252519081900360200190f35b341561021157fe5b610193610771565b60408051600160a060020a039092168252519081900360200190f35b341561023d57fe5b6100e8610780565b005b341561024f57fe5b6101936107d3565b60408051600160a060020a039092168252519081900360200190f35b341561027b57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526102d3958335600160a060020a0316959394604494939290920191819084018382808284375094965061059295505050505050565b60408051918252519081900360200190f35b34156102ed57fe5b6100e8600160a060020a0360043516610873565b005b341561030b57fe5b6101f5600160a060020a03600435166108bb565b604080519115158252519081900360200190f35b341561033b57fe5b6102d36108dd565b60408051918252519081900360200190f35b341561027b57fe5b60408051602060046024803582810135601f81018590048502860185019096528585526102d3958335600160a060020a0316959394604494939290920191819084018382808284375094965061059295505050505050565b60408051918252519081900360200190f35b60005433600160a060020a039081169116146103e257610444565b60008054604051600160a060020a03808516939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b60025433600160a060020a0390811691161461046357610444565b600160a060020a0381166000818152600160208190526040808320805460ff1916909217909155517fd415b905d4dd806bfba99a7a0e6351bd0c9db3a9912add21c0e6bef4479f673f9190a25b5b50565b6004543410156104c35761051e565b600160a060020a03331660009081526001602052604090205460ff16156104e95761051e565b604051600160a060020a033316907f039f711c9c18dd815b225b1424855e6118e746c6b5d688907f10c4dd29ebe92a90600090a25b5b565b60025433600160a060020a0390811691161461053c5761058d565b600160a060020a038216600081815260036020908152604091829020849055815184815291517fa9a343b39eac85ffb326e93ecd46785b814e72dc9f2b33bb0b4a315ba2859f439281900390910190a25b5b5050565b60006001600084600160a060020a0316600160a060020a03168152602001908152602001600020600101826040518082805190602001908083835b602083106105ec5780518252601f1990920191602091820191016105cd565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b60005433600160a060020a0390811691161461063e57610444565b60048190555b5b50565b60025433600160a060020a0390811691161461066357610444565b600160a060020a038116600090815260016020526040902054819060ff16151561068c5761058d565b600160a060020a038216600081815260016020526040808220805460ff19169055517fb6fa8b8bd5eab60f292eca876e3ef90722275b785309d84b1de113ce0b8c4e749190a25b5b505b50565b6040805182815281516020918190038201902033600160a060020a031660009081526003909252918120549091146107105761076c565b600160a060020a0333166000818152600360209081526040808320839055600191829052808320805460ff1916909217909155517fd415b905d4dd806bfba99a7a0e6351bd0c9db3a9912add21c0e6bef4479f673f9190a25060015b919050565b600054600160a060020a031681565b60005433600160a060020a0390811691161461079b5761051e565b604051600160a060020a0333811691309091163180156108fc02916000818181858888f19350505050151561051e57610000565b5b5b565b600254600160a060020a031681565b60006001600084600160a060020a0316600160a060020a03168152602001908152602001600020600101826040518082805190602001908083835b602083106105ec5780518252601f1990920191602091820191016105cd565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b92915050565b60005433600160a060020a0390811691161461088e57610444565b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a03811660009081526001602052604090205460ff165b919050565b60045481565b60006001600084600160a060020a0316600160a060020a03168152602001908152602001600020600101826040518082805190602001908083835b602083106105ec5780518252601f1990920191602091820191016105cd565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054925050505b929150505600a165627a7a72305820f6beb9c0ae3b45609ad6fc26c1b74600cbaa5f0088ca07be3e9c392a12b2c6150029" -} diff --git a/js-old/src/dapps/chaindeploy/contracts/dappreg.js b/js-old/src/dapps/chaindeploy/contracts/dappreg.js deleted file mode 100644 index 71379bf8b..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/dappreg.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/dappreg'; -import { compiler, source as sourceUrl, output as byteCode } from './code/dappreg'; - -const id = 'dappreg'; // 7bbc4f1a27628781b96213e781a1b8eec6982c1db8fac739af6e4c5a55862c03 -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/gavcoin.js b/js-old/src/dapps/chaindeploy/contracts/gavcoin.js deleted file mode 100644 index f7518ef53..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/gavcoin.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/gavcoin'; -import { compiler, source as sourceUrl, output as byteCode } from './code/gavcoin'; - -const isExternal = true; -const id = 'gavcoin'; -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - isExternal, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/githubhint.js b/js-old/src/dapps/chaindeploy/contracts/githubhint.js deleted file mode 100644 index 5198e38b5..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/githubhint.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/githubhint'; -import { compiler, source as sourceUrl, output as byteCode } from './code/githubhint'; - -const id = 'githubhint'; -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/index.js b/js-old/src/dapps/chaindeploy/contracts/index.js deleted file mode 100644 index 5e066f758..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/index.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import * as badgereg from './badgereg'; -import * as dappreg from './dappreg'; -import * as gavcoin from './gavcoin'; -import * as githubhint from './githubhint'; -import * as jgvoting from './jg-voting'; -import * as registry from './registry'; -import * as signaturereg from './signaturereg'; -import * as tokendeployMgr from './tokendeployMgr'; -import * as tokendeployReg from './tokendeployReg'; -import * as tokenreg from './tokenreg'; -import * as verifyEmail from './verifyEmail'; -import * as verifySms from './verifySms'; -import * as wallet from './wallet'; - -const contracts = [ - // builtin - githubhint, - badgereg, - dappreg, - signaturereg, - tokenreg, - tokendeployReg, - tokendeployMgr, - verifyEmail, - verifySms, - wallet, - - // external - gavcoin, - jgvoting -]; - -export { - contracts, - registry -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/jg-voting.js b/js-old/src/dapps/chaindeploy/contracts/jg-voting.js deleted file mode 100644 index 8ffbed3c5..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/jg-voting.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from './abi/jg-voting'; -import { compiler, source as sourceUrl, output as byteCode } from './code/jg-voting'; - -const isExternal = true; -const id = 'jg-voting'; -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - isExternal, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/registry.js b/js-old/src/dapps/chaindeploy/contracts/registry.js deleted file mode 100644 index 1b44f4245..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/registry.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/registry2'; -import { compiler, source as sourceUrl, output as byteCode } from './code/registry'; - -const id = 'registry'; -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/signaturereg.js b/js-old/src/dapps/chaindeploy/contracts/signaturereg.js deleted file mode 100644 index 6d9f9bf60..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/signaturereg.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/signaturereg'; -import { compiler, source as sourceUrl, output as byteCode } from './code/signaturereg'; - -const id = 'signaturereg'; -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/tokendeployMgr.js b/js-old/src/dapps/chaindeploy/contracts/tokendeployMgr.js deleted file mode 100644 index d07435fdd..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/tokendeployMgr.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/basiccoinmanager'; -import { compiler, source as sourceUrl, output as byteCode } from './code/tokendeploy'; - -const id = 'basiccoinmgr'; -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/tokendeployReg.js b/js-old/src/dapps/chaindeploy/contracts/tokendeployReg.js deleted file mode 100644 index 1db07e91a..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/tokendeployReg.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { abi, sourceUrl, deployParams, compiler, byteCode } from './tokenreg'; - -const id = 'basiccoinreg'; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/tokenreg.js b/js-old/src/dapps/chaindeploy/contracts/tokenreg.js deleted file mode 100644 index 11ee29fa1..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/tokenreg.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/tokenreg'; -import { compiler, source as sourceUrl, output as byteCode } from './code/tokenreg'; - -const id = 'tokenreg'; -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/verifyEmail.js b/js-old/src/dapps/chaindeploy/contracts/verifyEmail.js deleted file mode 100644 index 0176d5949..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/verifyEmail.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/email-verification'; -import { compiler, source as sourceUrl, output as byteCode } from './code/verifyEmail'; - -const isBadge = true; -const id = 'emailverification'; -const deployParams = []; -const badgeSource = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/c4721a87cb95375da91f8699438d8d7907b3f5e9/certifications/email-verification.svg', - imageHash: '0x5617a14da2a0c210939da6eafb734e60906f64a504c3e107812668860a752dc6' -}; - -export { - abi, - badgeSource, - byteCode, - compiler, - deployParams, - id, - isBadge, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/verifySms.js b/js-old/src/dapps/chaindeploy/contracts/verifySms.js deleted file mode 100644 index d7ea50902..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/verifySms.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import abi from '~/contracts/abi/sms-verification'; -import { compiler, source as sourceUrl, output as byteCode } from './code/verifySms'; - -const isBadge = true; -const id = 'smsverification'; -const deployParams = []; -const badgeSource = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/1b1beb57ab1f4d3a93a12711b233b5cded791a2f/certifications/sms-verification.svg', - imageHash: '0x49fa653c35c0a9ce128579883babd673ad4cfc94bf9f1cfe96a2bbc30a7552c6' -}; - -export { - abi, - badgeSource, - byteCode, - compiler, - deployParams, - id, - isBadge, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/contracts/wallet.js b/js-old/src/dapps/chaindeploy/contracts/wallet.js deleted file mode 100644 index 6639cba80..000000000 --- a/js-old/src/dapps/chaindeploy/contracts/wallet.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { walletCompiler as compiler, walletLibrary as byteCode, walletLibraryABI as abiJson, walletLibraryRegKey as id, walletSource as sourceUrl } from '~/contracts/code/wallet'; - -const abi = JSON.parse(abiJson); -const deployParams = []; - -export { - abi, - byteCode, - compiler, - deployParams, - id, - sourceUrl -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/console.js b/js-old/src/dapps/chaindeploy/dapps/console.js deleted file mode 100644 index 4e599b2fa..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/console.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtins from '~/views/Dapps/builtin.json'; - -const id = 'console'; -const app = builtins.find((app) => app.url === id); -const hashId = app.id; -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/console/3ea0dbfefded359ccdbea37bc4cf350c0aa16948/console.jpeg', - imageHash: '0xc3962e2eab7afaeb9cd11522381723afbafdc41dc7ba31bee472e187c4459e81' -}; -const name = app.name; - -export { - hashId, - id, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/dappreg.js b/js-old/src/dapps/chaindeploy/dapps/dappreg.js deleted file mode 100644 index fec35ef76..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/dappreg.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtins from '~/views/Dapps/builtin.json'; - -const id = 'dappreg'; -const app = builtins.find((app) => app.url === id); -const hashId = app.id; -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/cdd6ac4f1e2f11619bed72a53ae71217dffe19ad/dapps/legos-64x64.png', - imageHash: '0xa8feea35c761cc6c2fe862fe336419f11ca5421f578757720a899b89fc1df154' -}; -const name = app.name; - -export { - hashId, - id, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/gavcoin.js b/js-old/src/dapps/chaindeploy/dapps/gavcoin.js deleted file mode 100644 index 148c6fb8e..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/gavcoin.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { api } from '../parity'; - -const isExternal = true; -const id = 'gavcoin'; -const hashId = api.util.sha3(id); -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/9e135f76fe9ba61e2d8ccbd72ed144c26c450780/tokens/gavcoin-64x64.png', - imageHash: '0xd40679a3a234d8421c678d64f4df3308859e8ad07ac95ce4a228aceb96955287', - manifestUrl: 'https://raw.githubusercontent.com/gavofyork/gavcoin/eb2f8dc4d3ad4dd5f4562690525b7cfedc9681ba/manifest.json', - manifestHash: '0xd582c572fbef8015837f2c1a8798f2c3149a1d9d655b4020edb1bbece725371d', - contentUrl: { - repo: 'gavofyork/gavcoin', - commit: '0xeb2f8dc4d3ad4dd5f4562690525b7cfedc9681ba' - }, - contentHash: '0x0b6c7b3fc8dad3edb39fd1465904ce9a11938ef18f08f8115f275047ba249530' -}; -const name = 'GavCoin'; - -export { - hashId, - id, - isExternal, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/githubhint.js b/js-old/src/dapps/chaindeploy/dapps/githubhint.js deleted file mode 100644 index 49fb4be9c..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/githubhint.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtins from '~/views/Dapps/builtin.json'; - -const id = 'githubhint'; -const app = builtins.find((app) => app.url === id); -const hashId = app.id; -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/link-64x64.jpg', - imageHash: '0x6568901e711886e2c61eef1bbc7e2d8d37a27b9eb3e9e270eda8548f2ec796e8' -}; -const name = app.name; - -export { - hashId, - id, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/index.js b/js-old/src/dapps/chaindeploy/dapps/index.js deleted file mode 100644 index e95bf5648..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/index.js +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import * as consolejs from './console'; -import * as dappreg from './dappreg'; -import * as gavcoin from './gavcoin'; -import * as githubhint from './githubhint'; -import * as jgvoting from './jg-voting'; -import * as jgwhenblock from './jg-whenblock'; -import * as localtx from './localtx'; -import * as registry from './registry'; -import * as signaturereg from './signaturereg'; -import * as tokendeploy from './tokendeploy'; -import * as tokenreg from './tokenreg'; -import * as web from './web'; - -const apps = [ - // builtin - consolejs, - dappreg, - githubhint, - localtx, - registry, - signaturereg, - tokendeploy, - tokenreg, - web, - - // external - gavcoin, - jgvoting, - jgwhenblock -]; - -export { - apps -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/jg-voting.js b/js-old/src/dapps/chaindeploy/dapps/jg-voting.js deleted file mode 100644 index 899e95894..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/jg-voting.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { api } from '../parity'; - -const isExternal = true; -const id = 'jg-voting'; -const hashId = api.util.sha3(id); -const source = { - imageUrl: 'https://raw.githubusercontent.com/jacogr/dapp-voting/038ff4074544f2babc7aed9c4ac3dc070b85b804/assets/images/vote.jpg', - imageHash: '0x3620828e1a745d2714e9f37dc2d47cdab5ef9982190a845b5e7665b7a7767661', - manifestUrl: 'https://raw.githubusercontent.com/jacogr/dapp-voting/682f0fe4b86508a1a2487de6c7c61f7b100ba5b2/manifest.json', - manifestHash: '0x9b83e01f87d225e7bfdd305c51319504ff9b4cf8d517ca4b64f606762e72f59e', - contentUrl: { - repo: 'jacogr/dapp-voting', - commit: '0x7d941597e862a600a60b9d6ecd3a6f606d96cd7b' - }, - contentHash: '0x9fcc0910f6a8c4e45715d41aea2d287da31bf1d7321003fc66df6a012ce2d753' -}; -const name = 'Yes, No, Maybe'; - -export { - hashId, - id, - isExternal, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/jg-whenblock.js b/js-old/src/dapps/chaindeploy/dapps/jg-whenblock.js deleted file mode 100644 index 0005ca454..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/jg-whenblock.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -const isExternal = true; -const id = 'whenarewethere'; -const hashId = '0xfef3bfded03695e38a9ff476a0999e1fa421e72d1fb3b55a87d6c2bdb6fc18ef'; -const source = { - imageUrl: 'https://raw.githubusercontent.com/jacogr/dapp-when-are-we-there/167aa4d904c5aa6246d0d6d6f41c4ed8a56889cd/assets/images/clock.jpg', - imageHash: '0x2534b44f685b6399bf63f86679128216c43e9a58be1dfb58533923f0bcffeba7', - manifestUrl: 'https://raw.githubusercontent.com/jacogr/dapp-when-are-we-there/bf72dc3033711a3ab41bec3c1249638f70bae768/manifest.json', - manifestHash: '0xfe26f6a19ea9393d69bc5d8c73c5072ccf126f51c10c135b42d6bf162d774fd9', - contentUrl: { - repo: 'jacogr/dapp-when-are-we-there', - commit: '0xbf72dc3033711a3ab41bec3c1249638f70bae768' - }, - contentHash: '0x3505cbbef5c2243eedba07d340d4abccfaa3cfb799f51827e33c9721a5254d13' -}; -const name = 'When are we there'; - -export { - hashId, - id, - isExternal, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/localtx.js b/js-old/src/dapps/chaindeploy/dapps/localtx.js deleted file mode 100644 index 6fc275a13..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/localtx.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtins from '~/views/Dapps/builtin.json'; - -const id = 'localtx'; -const app = builtins.find((app) => app.url === id); -const hashId = app.id; -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/cdd6ac4f1e2f11619bed72a53ae71217dffe19ad/dapps/stack-64x64.png', - imageHash: '0x22b924801e1971659a51956dcdfc5a2d592d8bdd03780dd72d5bc4c84b595b4c' -}; -const name = app.name; - -export { - hashId, - id, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/registry.js b/js-old/src/dapps/chaindeploy/dapps/registry.js deleted file mode 100644 index 49ff4757b..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/registry.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtins from '~/views/Dapps/builtin.json'; - -const id = 'registry'; -const app = builtins.find((app) => app.url === id); -const hashId = app.id; -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/register-64x64.jpg', - imageHash: '0xf7100024052cd78b5e043287c05392b5db0bfce5caedd6d39555d40283ef0a1c' -}; -const name = app.name; - -export { - hashId, - id, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/signaturereg.js b/js-old/src/dapps/chaindeploy/dapps/signaturereg.js deleted file mode 100644 index 12efcff36..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/signaturereg.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtins from '~/views/Dapps/builtin.json'; - -const id = 'signaturereg'; -const app = builtins.find((app) => app.url === id); -const hashId = app.id; -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/hex-64x64.jpg', - imageHash: '0x26f7f2415cd5cbbffa58e8119fdbdd7181cac79119dd7f6ba6ee99d7f4445640' -}; -const name = app.name; - -export { - hashId, - id, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/tokendeploy.js b/js-old/src/dapps/chaindeploy/dapps/tokendeploy.js deleted file mode 100644 index 43ea8f22b..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/tokendeploy.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtins from '~/views/Dapps/builtin.json'; - -const id = 'tokendeploy'; -const app = builtins.find((app) => app.url === id); -const hashId = app.id; -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/interlock-64x64.png', - imageHash: '0xde104baf02aec783e0bffc624514ee267dbcb455382375e3ffa715790c1c939f' -}; -const name = app.name; - -export { - hashId, - id, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/tokenreg.js b/js-old/src/dapps/chaindeploy/dapps/tokenreg.js deleted file mode 100644 index 784febba0..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/tokenreg.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtins from '~/views/Dapps/builtin.json'; - -const id = 'tokenreg'; -const app = builtins.find((app) => app.url === id); -const hashId = app.id; -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/b88e983abaa1a6a6345b8d9448c15b117ddb540e/dapps/coins-64x64.jpg', - imageHash: '0xe23d429d15de98c7878d92bc90b79c7afabe1b04c2ad5e3e2c89adc8f439edc9' -}; -const name = app.name; - -export { - hashId, - id, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/dapps/web.js b/js-old/src/dapps/chaindeploy/dapps/web.js deleted file mode 100644 index 0726e2bf7..000000000 --- a/js-old/src/dapps/chaindeploy/dapps/web.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import builtins from '~/views/Dapps/builtin.json'; - -const id = 'web'; -const app = builtins.find((app) => app.url === id); -const hashId = app.id; -const source = { - imageUrl: 'https://raw.githubusercontent.com/paritytech/dapp-assets/ec6138115d0e1f45258969cd90b3b274e0ff2258/dapps/earth-64x64.jpg', - imageHash: '0x0b9b62a9262f75461191d4e8bf686c56528cbc0fe885c1f5878052ca8b2f65bf' -}; -const name = app.name; - -export { - hashId, - id, - name, - source -}; diff --git a/js-old/src/dapps/chaindeploy/parity.js b/js-old/src/dapps/chaindeploy/parity.js deleted file mode 100644 index 1dea0d696..000000000 --- a/js-old/src/dapps/chaindeploy/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -const api = window.parity.api; - -export { - api -}; diff --git a/js-old/src/dapps/chaindeploy/store.js b/js-old/src/dapps/chaindeploy/store.js deleted file mode 100644 index 07b693135..000000000 --- a/js-old/src/dapps/chaindeploy/store.js +++ /dev/null @@ -1,714 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { action, computed, observable } from 'mobx'; - -import { contracts as contractsInfo, registry as registryInfo } from './contracts'; -import { apps } from './dapps'; -import { api } from './parity'; -import { executeContract, isValidNumber, validateCode } from './utils'; - -export default class ContractsStore { - @observable apps = null; - @observable badges = null; - @observable contracts = null; - @observable error = null; - @observable registry = null; - - constructor () { - this.apps = apps; - this.badges = contractsInfo.filter((contract) => contract.isBadge); - this.contracts = contractsInfo.filter((contract) => !contract.isBadge); - this.registry = registryInfo; - - api.subscribe('eth_blockNumber', this.onNewBlockNumber); - } - - @computed get contractBadgereg () { - return this.contracts.find((contract) => contract.id === 'badgereg'); - } - - @computed get contractDappreg () { - return this.contracts.find((contract) => contract.id === 'dappreg'); - } - - @computed get contractGithubhint () { - return this.contracts.find((contract) => contract.id === 'githubhint'); - } - - @computed get contractTokenreg () { - return this.contracts.find((contract) => contract.id === 'tokenreg'); - } - - @computed get isBadgeDeploying () { - return this.badges - .filter((contract) => contract.isDeploying) - .length !== 0; - } - - @computed get isContractDeploying () { - return this.contracts - .filter((contract) => contract.isDeploying) - .length !== 0; - } - - @computed get isDappDeploying () { - return this.apps - .filter((app) => app.isDeploying) - .length !== 0; - } - - @computed get haveAllBadges () { - return this.badges - .filter((contract) => !contract.instance || !contract.hasLatestCode || !contract.badgeImageHash || !contract.badgeImageMatch || !contract.isBadgeRegistered) - .length === 0; - } - - @computed get haveAllContracts () { - return this.contracts - .filter((contract) => !contract.instance || !contract.hasLatestCode) - .length === 0; - } - - @computed get haveAllDapps () { - return this.apps - .filter((app) => { - return !app.isOnChain || - !app.imageHash || !app.imageMatch || - (app.source.contentHash && !app.contentMatch) || - (app.source.manifestHash && !app.manifestMatch); - }) - .length === 0; - } - - @action refreshApps = () => { - this.apps = [].concat(this.apps.peek()); - } - - @action refreshContracts = () => { - this.badges = [].concat(this.badges.peek()); - this.contracts = [].concat(this.contracts.peek()); - } - - @action setError = (error) => { - console.error(error); - - this.error = error.message - ? error.message - : error; - } - - @action setRegistryAddress = (address, isOnChain = false) => { - if (this.registry.address !== address || !this.registry.instance) { - console.log(`registry found at ${address}`); - - this.registry = Object.assign({}, this.registry, { - address, - instance: api.newContract(this.registry.abi, address).instance, - isOnChain - }); - } - } - - @action setRegistryCode (byteCode) { - this.registry.hasLatestCode = validateCode(this.registry.byteCode, byteCode); - } - - @action setRegistryDeploying = (isDeploying = false) => { - this.registry = Object.assign({}, this.registry, { - isDeploying, - status: isDeploying - ? 'Deploying contract' - : null - }); - } - - @action setBadgeId = (badge, badgeId) => { - badge.badgeId = badgeId; - badge.isBadgeRegistered = true; - - this.refreshContracts(); - } - - @action setBadgeImageHash = (badge, imageHash) => { - badge.badgeImageHash = imageHash; - badge.badgeImageMatch = badge.badgeSource.imageHash === imageHash; - - this.refreshContracts(); - } - - @action setContractAddress = (contract, address, isOnChain = false) => { - if (contract.address !== address || !contract.instance || contract.isOnChain !== isOnChain) { - console.log(`${contract.id} found at ${address}`); - - contract.address = address; - contract.instance = api.newContract(contract.abi, address).instance; - contract.isOnChain = isOnChain; - - this.refreshContracts(); - } - } - - @action setContractCode (contract, byteCode) { - contract.hasLatestCode = validateCode(contract.byteCode, byteCode); - - this.refreshContracts(); - } - - @action setContractDeploying = (contract, isDeploying = false) => { - contract.isDeploying = isDeploying; - contract.status = isDeploying - ? 'Deploying contract' - : null; - - this.refreshContracts(); - } - - @action setContractStatus = (contract, status) => { - contract.status = status; - - this.refreshContracts(); - } - - @action setAppDeploying = (app, isDeploying = false) => { - app.isDeploying = isDeploying; - app.status = isDeploying - ? 'Registering app' - : null; - - this.refreshApps(); - } - - @action setAppFound = (app, isOnChain = false) => { - if (app.isOnChain !== isOnChain) { - console.log(`${app.name} found on dappreg`); - - app.isOnChain = isOnChain; - - this.refreshApps(); - } - } - - @action setAppContentHash = (app, contentHash) => { - if (app.contentHash !== contentHash) { - console.log(`${app.name} has contentHash ${contentHash}`); - - app.contentHash = contentHash; - app.contentMatch = contentHash === app.source.contentHash; - - this.refreshApps(); - } - } - - @action setAppImageHash = (app, imageHash) => { - if (app.imageHash !== imageHash) { - console.log(`${app.name} has imageHash ${imageHash}`); - - app.imageHash = imageHash; - app.imageMatch = imageHash === app.source.imageHash; - - this.refreshApps(); - } - } - - @action setAppManifestHash = (app, manifestHash) => { - if (app.manifestHash !== manifestHash) { - console.log(`${app.name} has manifestHash ${manifestHash}`); - - app.manifestHash = manifestHash; - app.manifestMatch = manifestHash === app.source.manifestHash; - - this.refreshApps(); - } - } - - @action setAppStatus = (app, status) => { - console.log(app.id, status); - - app.status = status; - - this.refreshApps(); - } - - deployApp = (app) => { - console.log(`Registering application ${app.id}`); - - this.setAppDeploying(app, true); - - const options = {}; - const values = [app.hashId]; - - return api.parity - .defaultAccount() - .then((defaultAccount) => { - options.from = defaultAccount; - - if (app.isOnChain) { - return true; - } - - return this.contractDappreg.instance - .fee.call({}, []) - .then((fee) => { - options.value = fee; - - return executeContract(app.id, this.contractDappreg, 'register', options, values); - }); - }) - .then(() => { - if (app.imageHash && app.imageMatch) { - return true; - } - - this.setAppStatus(app, 'Registering image url'); - - return this - .registerHash(app.source.imageHash, app.source.imageUrl, options.from) - .then(() => this.setAppMeta(app, 'IMG', app.source.imageHash, options.from)); - }) - .then(() => { - if (!app.source.manifestHash || app.manifestMatch) { - return true; - } - - this.setAppStatus(app, 'Registering manifest url'); - - return this - .registerHash(app.source.manifestHash, app.source.manifestUrl, options.from) - .then(() => this.setAppMeta(app, 'MANIFEST', app.source.manifestHash, options.from)); - }) - .then(() => { - if (!app.source.contentHash || app.contentMatch) { - return true; - } - - this.setAppStatus(app, 'Registering content url'); - - return this - .registerRepo(app.source.contentHash, app.source.contentUrl, options.from) - .then(() => this.setAppMeta(app, 'CONTENT', app.source.contentHash, options.from)); - }) - .catch(() => { - return null; - }) - .then(() => { - this.setAppDeploying(app, false); - }); - } - - deployApps = () => { - this.apps - .filter((app) => { - return !app.isDeploying && - ( - !app.isOnChain || - (!app.imageHash || !app.imageMatch) || - (app.source.contentHash && !app.contentMatch) || - (app.source.manifestHash && !app.manifestMatch) - ); - }) - .forEach(this.deployApp); - } - - _deployContract = (contract) => { - console.log(`Deploying contract ${contract.id}`); - - const options = { - data: contract.byteCode - }; - - return api.parity - .defaultAccount() - .then((defaultAccount) => { - options.from = defaultAccount; - - return api - .newContract(contract.abi) - .deploy(options, contract.deployParams, (error, data) => { - if (error) { - console.error(contract.id, error); - } else { - console.log(contract.id, data); - } - }) - .then((contractAddress) => { - return [contractAddress, defaultAccount]; - }); - }); - } - - deployContract = (contract) => { - if (contract.hasLatestCode) { - return Promise.resolve(false); - } - - let defaultAccount = '0x0'; - - this.setContractDeploying(contract, true); - - return this - ._deployContract(contract) - .then(([address, _defaultAccount]) => { - const isOnChain = contract.isOnChain; - - defaultAccount = _defaultAccount; - - this.setContractAddress(contract, address); - - return isOnChain - ? true - : this.reserveAddress(contract, defaultAccount); - }) - .then(() => { - return this.registerAddress(contract, defaultAccount); - }) - .catch(() => { - return null; - }) - .then(() => { - this.setContractDeploying(contract, false); - }); - } - - deployBadge = (badge) => { - let defaultAccount; - - return this - .deployContract(badge) - .then(() => { - this.setContractDeploying(badge, true); - - return api.parity.defaultAccount(); - }) - .then((_defaultAccount) => { - defaultAccount = _defaultAccount; - - if (badge.isBadgeRegistered) { - return true; - } - - this.setContractStatus(badge, 'Registering with badgereg'); - - return this.registerBadge(badge, defaultAccount); - }) - .then(() => { - if (badge.badgeImageMatch) { - return true; - } - - this.setContractStatus(badge, 'Registering image url'); - - return this - .registerHash(badge.badgeSource.imageHash, badge.badgeSource.imageUrl, defaultAccount) - .then(() => this.registerBadgeImage(badge, badge.badgeSource.imageHash, defaultAccount)); - }) - .then(() => { - this.setContractDeploying(badge, false); - }); - } - - deployContracts = () => { - this.contracts - .filter((contract) => !contract.isDeploying && (!contract.instance || !contract.hasLatestCode)) - .forEach(this.deployContract); - } - - deployBadges = () => { - this.badges - .filter((contract) => !contract.isDeploying && (!contract.instance || !contract.hasLatestCode || !contract.badgeImageHash || !contract.badgeImageMatch || !contract.isBadgeRegistered)) - .forEach(this.deployBadge); - } - - deployRegistry = () => { - this.setRegistryDeploying(true); - - return this - ._deployContract(this.registry) - .then(([address]) => { - this.setRegistryDeploying(false); - this.setRegistryAddress(address); - }); - } - - registerBadge = (badge, fromAddress) => { - const options = { - from: fromAddress - }; - const values = [badge.address, api.util.sha3.text(badge.id.toLowerCase())]; - - return this.contractBadgereg.instance - .fee.call({}, []) - .then((fee) => { - options.value = fee; - - return executeContract(badge.id, this.contractBadgereg, 'register', options, values); - }); - } - - registerBadgeImage = (badge, hash, fromAddress) => { - const options = { - from: fromAddress - }; - const values = [badge.badgeId, 'IMG', hash]; - - this.setContractStatus(badge, 'Setting meta IMG'); - - return executeContract(badge.id, this.contractBadgereg, 'setMeta', options, values); - } - - setAppMeta = (app, key, meta, fromAddress) => { - const options = { - from: fromAddress - }; - const values = [app.hashId, key, meta]; - - this.setAppStatus(app, `Setting meta ${key}`); - - return executeContract(app.id, this.contractDappreg, 'setMeta', options, values); - } - - reserveAddress = (contract, fromAddress) => { - const options = { from: fromAddress }; - const values = [api.util.sha3.text(contract.id.toLowerCase())]; - - this.setContractStatus(contract, 'Reserving name'); - - return this.registry.instance - .fee.call({}, []) - .then((value) => { - options.value = value; - - return executeContract(contract.id, this.registry, 'reserve', options, values); - }); - } - - registerAddress = (contract, fromAddress) => { - const options = { from: fromAddress }; - const values = [api.util.sha3.text(contract.id.toLowerCase()), 'A', contract.address]; - - this.setContractStatus(contract, 'Setting lookup address'); - - return executeContract(contract.id, this.registry, 'setAddress', options, values); - } - - registerRepo = (hash, content, fromAddress) => { - const options = { - from: fromAddress - }; - const values = [hash, content.repo || content, content.commit || 0]; - - return this.contractGithubhint.instance - .entries.call({}, [hash]) - .then(([imageUrl, commit, owner]) => { - if (isValidNumber(owner)) { - return true; - } - - return executeContract(hash, this.contractGithubhint, 'hint', options, values); - }) - .catch(() => false); - } - - registerHash = (hash, url, fromAddress) => { - const options = { - from: fromAddress - }; - const values = [hash, url]; - - return this.contractGithubhint.instance - .entries.call({}, [hash]) - .then(([imageUrl, commit, owner]) => { - if (isValidNumber(owner)) { - return true; - } - - return executeContract(hash, this.contractGithubhint, 'hintURL', options, values); - }) - .catch(() => false); - } - - findRegistry = () => { - if (this.registry.address && this.registry.hasLatestCode) { - return Promise.resolve(this.registry); - } - - return api.parity - .registryAddress() - .then((address) => { - if (isValidNumber(address)) { - this.setRegistryAddress(address, true); - } - - return api.eth.getCode(address); - }) - .then((byteCode) => { - this.setRegistryCode(byteCode); - }); - } - - findApps = () => { - if (!this.contractDappreg.instance) { - return Promise.resolve(false); - } - - return Promise - .all( - this.apps.map((app) => { - return app.isOnChain - ? Promise.resolve([[0]]) - : this.contractDappreg.instance.get.call({}, [app.hashId]); - }) - ) - .then((apps) => { - apps.forEach(([_id, owner], index) => { - const id = api.util.bytesToHex(_id); - - if (isValidNumber(id)) { - this.setAppFound(this.apps[index], true); - } - }); - - return Promise.all( - this.apps.map((app) => { - return !app.isOnChain || (app.imageHash && app.imageMatch) - ? Promise.resolve([[0], [0], [0]]) - : Promise.all([ - this.contractDappreg.instance.meta.call({}, [app.hashId, 'CONTENT']), - this.contractDappreg.instance.meta.call({}, [app.hashId, 'IMG']), - this.contractDappreg.instance.meta.call({}, [app.hashId, 'MANIFEST']) - ]); - }) - ); - }) - .then((hashes) => { - hashes.forEach(([content, image, manifest], index) => { - const contentHash = api.util.bytesToHex(content); - const imageHash = api.util.bytesToHex(image); - const manifestHash = api.util.bytesToHex(manifest); - - if (isValidNumber(contentHash)) { - this.setAppContentHash(this.apps[index], contentHash); - } - - if (isValidNumber(imageHash)) { - this.setAppImageHash(this.apps[index], imageHash); - } - - if (isValidNumber(manifestHash)) { - this.setAppManifestHash(this.apps[index], manifestHash); - } - }); - }); - } - - findBadges = () => { - if (!this.contractBadgereg.instance) { - return Promise.resolve(false); - } - - return this - .findContracts(this.badges) - .then(() => { - return Promise.all( - this.badges.map((badge) => { - return badge.isBadgeRegistered - ? Promise.resolve([0, 0, 0]) - : this.contractBadgereg.instance.fromAddress.call({}, [badge.address]); - }) - ); - }) - .then((badgeInfos) => { - badgeInfos.forEach(([id, name, owner], index) => { - if (isValidNumber(owner)) { - this.setBadgeId(this.badges[index], id); - } - }); - - return Promise - .all( - this.badges.map((badge) => { - return !badge.isBadgeRegistered - ? Promise.resolve([0]) - : this.contractBadgereg.instance.meta.call({}, [badge.badgeId, 'IMG']); - }) - ); - }) - .then((images) => { - images.forEach((imageBytes, index) => { - const imageHash = api.util.bytesToHex(imageBytes); - - if (isValidNumber(imageHash)) { - this.setBadgeImageHash(this.badges[index], imageHash); - } - }); - }); - } - - findContracts = (contracts = this.contracts) => { - if (!this.registry.instance) { - return Promise.resolve(false); - } - - return Promise - .all( - contracts.map((contract) => { - const hashId = api.util.sha3.text(contract.id.toLowerCase()); - - return contract.isOnChain - ? Promise.resolve([0, 0]) - : Promise.all([ - this.registry.instance.getAddress.call({}, [hashId, 'A']), - this.registry.instance.getOwner.call({}, [hashId]) - ]); - }) - ) - .then((addresses) => { - addresses.forEach(([address, owner], index) => { - if (isValidNumber(owner) && isValidNumber(address)) { - this.setContractAddress(contracts[index], address, true); - } - }); - - return Promise.all( - contracts.map((contract) => { - return !contract.address || contract.hasLatestCode - ? Promise.resolve(null) - : api.eth.getCode(contract.address); - }) - ); - }) - .then((codes) => { - codes.forEach((byteCode, index) => { - if (byteCode) { - this.setContractCode(contracts[index], byteCode); - } - }); - }); - } - - onNewBlockNumber = (error, blockNumber) => { - if (error) { - return; - } - - return this - .findRegistry() - .then(this.findContracts) - .then(this.findApps) - .then(this.findBadges) - .catch(this.setError); - } -} diff --git a/js-old/src/dapps/chaindeploy/utils.js b/js-old/src/dapps/chaindeploy/utils.js deleted file mode 100644 index 87e7279e3..000000000 --- a/js-old/src/dapps/chaindeploy/utils.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import BigNumber from 'bignumber.js'; - -import { api } from './parity'; - -export function validateCode (source, retrieved) { - const original = source.substr(12); - const bytecode = retrieved.substr(12); - - const knownHash = api.util.sha3(original.slice(-1 * bytecode.length)); - const codeHash = api.util.sha3(bytecode); - - return knownHash === codeHash; -} - -export function isValidNumber (number) { - return number && !(new BigNumber(number)).isZero(); -} - -export function executeContract (logId, contract, funcName, options, values) { - const func = contract.instance[funcName]; - - return func - .estimateGas(options, values) - .then((gasEst) => { - options.gas = gasEst.mul(1.2); - - return trackRequest( - func.postTransaction(options, values), - (error, data) => { - if (error) { - console.error(logId, error); - } else { - console.log(logId, data); - } - } - ); - }); -} - -export function trackRequest (promise, callback) { - return promise - .then((requestId) => { - callback(null, { state: 'checkRequest', requestId }); - - return api.pollMethod('parity_checkRequest', requestId); - }) - .then((txHash) => { - callback(null, { state: 'getTransactionReceipt', txHash }); - - return api.pollMethod('eth_getTransactionReceipt', txHash, (receipt) => { - if (!receipt || !receipt.blockNumber || receipt.blockNumber.eq(0)) { - return false; - } - - return true; - }); - }) - .then((receipt) => { - callback(null, { state: 'hasReceipt', receipt }); - }) - .catch((error) => { - callback(error); - - throw error; - }); -} diff --git a/js-old/src/dapps/console.js b/js-old/src/dapps/console.js deleted file mode 100644 index 44b6dcb9c..000000000 --- a/js-old/src/dapps/console.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import React from 'react'; -import ReactDOM from 'react-dom'; -import { AppContainer } from 'react-hot-loader'; - -import 'codemirror/addon/dialog/dialog'; -import 'codemirror/addon/dialog/dialog.css'; -import 'codemirror/addon/hint/javascript-hint'; -import 'codemirror/addon/hint/show-hint'; -import 'codemirror/addon/hint/show-hint.css'; -import 'codemirror/addon/search/match-highlighter'; -import 'codemirror/addon/search/search'; -import 'codemirror/addon/search/searchcursor'; -import 'codemirror/keymap/sublime'; -import 'codemirror/lib/codemirror.css'; -import 'codemirror/mode/javascript/javascript'; -// Custom codemirror style -import './console/codemirror.css'; - -import Application from './console/Application'; - -import '../../assets/fonts/Roboto/font.css'; -import '../../assets/fonts/RobotoMono/font.css'; -import './style.css'; - -ReactDOM.render( - - - , - document.querySelector('#container') -); - -if (module.hot) { - module.hot.accept('./console/Application/index.js', () => { - require('./console/Application/index.js'); - - ReactDOM.render( - - - , - document.querySelector('#container') - ); - }); -} diff --git a/js-old/src/dapps/console/Application/application.css b/js-old/src/dapps/console/Application/application.css deleted file mode 100644 index eea2c030d..000000000 --- a/js-old/src/dapps/console/Application/application.css +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (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 . -*/ - -.app { - display: flex; - flex-direction: column; - font-family: Arial, sans-serif; - font-size: 11px; - height: 100vh; - overflow: hidden; -} - -textarea, -input { - font-family: dejavu sans mono, monospace; - outline: none; -} - -code, -pre { - font-family: dejavu sans mono, monospace; - font-size: 11px; -} - -.header { - flex: 0 0 auto; -} - -.view { - display: flex; - flex: 1; - flex-direction: column; -} - -.eval { - flex: 0 1 auto; - font-family: dejavu sans mono, monospace; - overflow: auto; -} - -.input { - border-top: 1px solid #eee; - display: flex; - flex: 1 1 auto; - min-height: 50px; -} - -.status { - flex: 0 0 auto; - font-family: dejavu sans mono, monospace; -} diff --git a/js-old/src/dapps/console/Application/application.js b/js-old/src/dapps/console/Application/application.js deleted file mode 100644 index 5a591e710..000000000 --- a/js-old/src/dapps/console/Application/application.js +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { observer } from 'mobx-react'; -import React, { Component } from 'react'; - -import { api } from '../parity'; - -import Console from '../Console'; -import Header from '../Header'; -import Input from '../Input'; -import Settings from '../Settings'; -import Snippets from '../Snippets'; -import Watches from '../Watches'; - -import ApplicationStore from './application.store'; -import WatchesStore from '../Watches/watches.store'; - -import styles from './application.css'; - -@observer -export default class Application extends Component { - application = ApplicationStore.get(); - watches = WatchesStore.get(); - - componentWillMount () { - this.watches.add('time', () => new Date()); - this.watches.add('blockNumber', api.eth.blockNumber, api); - } - - render () { - return ( -
-
-
-
- - { this.renderView() } - -
- -
-
- ); - } - - renderView () { - const { view } = this.application; - - if (view === 'console') { - return ( -
-
- -
-
- -
-
- ); - } - - if (view === 'settings') { - return ( -
- -
- ); - } - - if (view === 'snippets') { - return ( -
- -
- ); - } - - return null; - } -} diff --git a/js-old/src/dapps/console/Application/application.store.js b/js-old/src/dapps/console/Application/application.store.js deleted file mode 100644 index c10be46c6..000000000 --- a/js-old/src/dapps/console/Application/application.store.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { action, observable } from 'mobx'; - -let instance; - -export default class ApplicationStore { - @observable view = this.views[0].id; - - views = [ - { label: 'Console', id: 'console' }, - { label: 'Snippets', id: 'snippets' }, - { label: 'Settings', id: 'settings' } - ]; - - static get () { - if (!instance) { - instance = new ApplicationStore(); - } - - return instance; - } - - @action - setView (view) { - this.view = view; - } -} diff --git a/js-old/src/dapps/console/Application/index.js b/js-old/src/dapps/console/Application/index.js deleted file mode 100644 index 3d8d1ca3b..000000000 --- a/js-old/src/dapps/console/Application/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './application'; diff --git a/js-old/src/dapps/console/Autocomplete/autocomplete.css b/js-old/src/dapps/console/Autocomplete/autocomplete.css deleted file mode 100644 index 8d4585e7a..000000000 --- a/js-old/src/dapps/console/Autocomplete/autocomplete.css +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (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 . -*/ - -.container { - background: #f8f8f8; - box-shadow: 0 0.125em 0.25em rgba(0, 0, 0, 0.5); - font-family: dejavu sans mono, monospace; - left: 20px; - position: absolute; - max-height: 300px; - overflow: auto; -} - -.item { - background-color: white; - padding: 0.25em 0.25em 0.25em 0.35em; - display: flex; - justify-content: space-between; - - &.selected { - background-color: rgb(64, 115, 244); - - &, - .proto { - color: white; - } - } - - &:hover { - cursor: default; - } - - &:hover:not(.selected) { - background-color: rgb(230, 236, 255); - } - - .proto { - color: gray; - margin-left: 1em; - } -} diff --git a/js-old/src/dapps/console/Autocomplete/autocomplete.js b/js-old/src/dapps/console/Autocomplete/autocomplete.js deleted file mode 100644 index e2938f23d..000000000 --- a/js-old/src/dapps/console/Autocomplete/autocomplete.js +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { observer } from 'mobx-react'; -import React, { Component } from 'react'; -import ReactDOM from 'react-dom'; - -import AutocompleteStore from './autocomplete.store'; - -import styles from './autocomplete.css'; - -@observer -export default class Autocomplete extends Component { - autocompleteStore = AutocompleteStore.get(); - - render () { - if (!this.autocompleteStore.show) { - return null; - } - - return ( -
- { this.renderAutocompletes() } -
- ); - } - - renderAutocompletes () { - const { selected, values } = this.autocompleteStore; - const displayedProto = {}; - - return values.map((autocomplete, index) => { - const { name, prototypeName } = autocomplete; - const onClick = () => this.handleClick(index); - const setRef = (node) => this.setRef(index, node); - - const proto = !displayedProto[prototypeName] - ? ( - - { prototypeName } - - ) - : null; - - if (!displayedProto[prototypeName]) { - displayedProto[prototypeName] = true; - } - - const classes = [ styles.item ]; - - if (index === selected) { - classes.push(styles.selected); - } - - return ( -
- - { name } - - { proto } -
- ); - }); - } - - handleClick = (index) => { - this.autocompleteStore.select(index); - }; - - setRef = (index, node) => { - const element = ReactDOM.findDOMNode(node); - - this.autocompleteStore.setElement(index, element); - }; -} diff --git a/js-old/src/dapps/console/Autocomplete/autocomplete.store.js b/js-old/src/dapps/console/Autocomplete/autocomplete.store.js deleted file mode 100644 index 82ff2f24d..000000000 --- a/js-old/src/dapps/console/Autocomplete/autocomplete.store.js +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { action, observable } from 'mobx'; - -import { evaluate } from '../utils'; - -let instance; - -export default class AutocompleteStore { - @observable values = []; - @observable position = {}; - @observable show = false; - @observable selected = null; - - elements = {}; - inputNode = null; - lastObject = null; - lastObjectPropertyNames = []; - - static get () { - if (!instance) { - instance = new AutocompleteStore(); - } - - return instance; - } - - get hasSelected () { - return this.selected !== null; - } - - clearCache () { - this.lastObject = null; - this.lastObjectPropertyNames = null; - } - - @action - focus (offset = 1) { - if (this.values.length === 0) { - this.selected = null; - return; - } - - this.selected = this.selected === null - ? ( - offset === 1 - ? 0 - : this.values.length - 1 - ) - : (this.values.length + this.selected + offset) % (this.values.length); - - if (this.isVisible(this.selected)) { - return; - } - - const element = this.elements[this.selected]; - - if (!element) { - return; - } - - element.scrollIntoView(offset === -1); - } - - focusOnInput () { - if (!this.inputNode) { - return; - } - - this.inputNode.focus(); - } - - @action - hide () { - this.show = false; - this.selected = null; - } - - isVisible (index) { - const element = this.elements[index]; - - if (!element) { - return false; - } - - const eBoundings = element.getBoundingClientRect(); - const pBoundings = element.parentElement.getBoundingClientRect(); - - if (eBoundings.top < pBoundings.top || eBoundings.bottom > pBoundings.bottom) { - return false; - } - - return true; - } - - select (inputStore, _index = this.selected) { - const index = _index === null - ? 0 - : _index; - - if (!this.values[index]) { - console.warn(`autocomplete::select has been called on AutocompleteStore with wrong value ${index}`); - return; - } - - const { name } = this.values[index]; - const { input } = inputStore; - const objects = input.split('.'); - - objects[objects.length - 1] = name; - const nextInput = objects.join('.'); - - this.hide(); - this.focusOnInput(); - return inputStore.updateInput(nextInput, false); - } - - setElement (index, element) { - this.elements[index] = element; - } - - setInputNode (node) { - this.inputNode = node; - } - - @action - setPosition () { - if (!this.inputNode) { - return; - } - - const inputBoundings = this.inputNode.getBoundingClientRect(); - const bodyBoundings = document.body.getBoundingClientRect(); - - // display on bottom of input - if (inputBoundings.top < bodyBoundings.height / 2) { - const nextPosition = { - top: 20 - }; - - this.position = nextPosition; - return; - } - - // display on top of input - const nextPosition = { - bottom: inputBoundings.height - }; - - this.position = nextPosition; - return; - } - - @action - setValues (values) { - this.values = values; - this.selected = null; - const show = values.length > 0; - - // Reveal autocomplete - if (!this.show && show) { - this.setPosition(); - } - - this.show = show; - } - - update (input) { - if (input.length === 0) { - return this.setValues([]); - } - - const objects = input.split('.'); - const suffix = objects.pop().toLowerCase(); - const prefix = objects.join('.'); - const object = prefix.length > 0 - ? prefix - : 'window'; - - if (object !== this.lastObject) { - const evalResult = evaluate(object); - - if (evalResult.error) { - this.lastObjectProperties = []; - } else { - this.lastObjectProperties = getAllProperties(evalResult.result); - } - - this.lastObject = object; - } - - const autocompletes = this.lastObjectProperties.filter((property) => { - return property.name.toLowerCase().includes(suffix); - }); - - return this.setValues(autocompletes); - } -} - -function getAllProperties (object) { - const propertyNames = {}; - - while (object) { - const prototypeName = object && object.constructor && object.constructor.name || ''; - - Object.getOwnPropertyNames(object) - .sort() - .forEach((name) => { - if (Object.prototype.hasOwnProperty.call(propertyNames, name)) { - return; - } - - propertyNames[name] = { name, prototypeName }; - }); - - object = Object.getPrototypeOf(object); - } - - return Object.values(propertyNames); -} diff --git a/js-old/src/dapps/console/Autocomplete/index.js b/js-old/src/dapps/console/Autocomplete/index.js deleted file mode 100644 index 5761be0e3..000000000 --- a/js-old/src/dapps/console/Autocomplete/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './autocomplete'; diff --git a/js-old/src/dapps/console/Console/console.css b/js-old/src/dapps/console/Console/console.css deleted file mode 100644 index a0b3db4ff..000000000 --- a/js-old/src/dapps/console/Console/console.css +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (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 . -*/ - -.result { - border-top: 1px solid #eee; - display: flex; - font-family: dejavu sans mono, monospace; - padding: 0.35em 0.25em; - - &.error { - background-color: hsl(0, 100%, 97%); - - .text { - color: red; - } - } - - &.warn { - background-color: hsl(50, 100%, 95%); - } -} - -.type { - font-weight: bold !important; - font-size: 8pt; - padding: 0 0.5em 0 0.25em; -} - -.time { - color: gray; - padding: 0 1em 0 0.5em; -} - -.token { - white-space: pre-wrap; -} - -.text { - display: flex; -} - -.text .token:not(:first-child) { - margin-left: 0.5em; -} diff --git a/js-old/src/dapps/console/Console/console.js b/js-old/src/dapps/console/Console/console.js deleted file mode 100644 index 75f9713a6..000000000 --- a/js-old/src/dapps/console/Console/console.js +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { observer } from 'mobx-react'; -import React, { Component } from 'react'; -import ReactDOM from 'react-dom'; -import { ObjectInspector } from 'react-inspector'; - -import ConsoleStore from './console.store'; -import SettingsStore from '../Settings/settings.store'; - -import styles from './console.css'; - -const ICONS = { - debug: ' ', - error: '✖', - info: 'ℹ', - input: '>', - log: ' ', - result: '<', - warn: '⚠' -}; - -@observer -export default class Console extends Component { - consoleStore = ConsoleStore.get(); - settingsStore = SettingsStore.get(); - - render () { - return ( -
- { this.renderResults() } -
- ); - } - - renderResults () { - const { logs } = this.consoleStore; - - return logs.map((data, index) => { - const { type, timestamp } = data; - const values = this.consoleStore.logValues[index]; - const classes = [ styles.result, styles[type] ]; - - return ( -
- - { this.renderTimestamp(timestamp) } - - { - values.map((value, valueIndex) => ( - - { this.toString(value) } - - )) - } - -
- ); - }); - } - - renderTimestamp (timestamp) { - const { displayTimestamps } = this.settingsStore; - - if (!displayTimestamps) { - return null; - } - - return ( - - { new Date(timestamp).toISOString().slice(11, 23) } - - ); - } - - setRef = (node) => { - const element = ReactDOM.findDOMNode(node); - - this.consoleStore.setNode(element); - }; - - toString (value) { - if (typeof value === 'string') { - return value; - } - - if (value instanceof Error) { - return value.toString(); - } - - return ( - - ); - } -} diff --git a/js-old/src/dapps/console/Console/console.store.js b/js-old/src/dapps/console/Console/console.store.js deleted file mode 100644 index dc2fc6db4..000000000 --- a/js-old/src/dapps/console/Console/console.store.js +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { action, observable } from 'mobx'; - -import AutocompleteStore from '../Autocomplete/autocomplete.store'; -import { evaluate } from '../utils'; - -let instance; - -export default class ConsoleStore { - @observable logs = []; - - autocompleteStore = AutocompleteStore.get(); - logValues = []; - node = null; - - constructor () { - this.attachConsole(); - } - - static get () { - if (!instance) { - instance = new ConsoleStore(); - } - - return instance; - } - - attachConsole () { - ['debug', 'error', 'info', 'log', 'warn'].forEach((level) => { - const old = window.console[level].bind(window.console); - - window.console[level] = (...args) => { - old(...args); - this.log({ type: level, values: args }); - }; - }); - } - - @action - clear () { - this.logs = []; - this.logValues = []; - } - - evaluate (input) { - this.log({ type: 'input', value: input }); - - setTimeout(() => { - const { result, error } = evaluate(input); - let value = error || result; - const type = error - ? 'error' - : 'result'; - - if (typeof value === 'string') { - value = `"${value}"`; - } - - if (value && typeof value === 'object' && typeof value.then === 'function') { - return value - .then((result) => { - this.log({ type: 'result', value: result }); - }) - .catch((error) => { - this.log({ type: 'error', value: error }); - }); - } - - this.log({ type, value }); - }); - } - - @action - log ({ type, value, values }) { - this.logs.push({ - type, - timestamp: Date.now() - }); - - if (values) { - this.logValues.push(values); - } else { - this.logValues.push([ value ]); - } - - this.autocompleteStore.setPosition(); - this.scroll(); - } - - setNode (node) { - this.node = node; - this.scroll(); - } - - scroll () { - if (!this.node) { - return; - } - - setTimeout(() => { - if (this.node.children.length === 0) { - return; - } - - // Scroll to the last child - this.node - .children[this.node.children.length - 1] - .scrollIntoView(false); - }, 50); - } -} diff --git a/js-old/src/dapps/console/Console/index.js b/js-old/src/dapps/console/Console/index.js deleted file mode 100644 index 2956b330f..000000000 --- a/js-old/src/dapps/console/Console/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './console'; diff --git a/js-old/src/dapps/console/Header/header.css b/js-old/src/dapps/console/Header/header.css deleted file mode 100644 index 116de6b8c..000000000 --- a/js-old/src/dapps/console/Header/header.css +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (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 . -*/ - -.container { - background-color: #f3f3f3; - border-bottom: 1px solid #ccc; - font-size: 12px; - padding: 0 0.5em; -} - -.tabs { - display: flex; -} - -.tab { - align-items: center; - box-sizing: border-box; - border: 1px solid transparent; - color: #333; - cursor: default; - display: flex; - height: 24px; - line-height: 15px; - margin-top: 2px; - padding: 2px 6px 2px 4px; - - &:hover, - &.active:hover { - background-color: #e5e5e5; - } - - &.active { - background-color: white; - border: 1px solid #ccc; - border-bottom: none; - } -} diff --git a/js-old/src/dapps/console/Header/header.js b/js-old/src/dapps/console/Header/header.js deleted file mode 100644 index c422b8256..000000000 --- a/js-old/src/dapps/console/Header/header.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import { observer } from 'mobx-react'; -import React, { Component } from 'react'; - -import ApplicationStore from '../Application/application.store'; - -import styles from './header.css'; - -@observer -export default class Header extends Component { - application = ApplicationStore.get(); - - render () { - return ( -
-
- { this.renderTabs() } -
-
- ); - } - - renderTabs () { - const { view } = this.application; - - return this.application.views.map((tab) => { - const { label, id } = tab; - const classes = [ styles.tab ]; - const onClick = () => this.handleClickTab(id); - - if (id === view) { - classes.push(styles.active); - } - - return ( -
- { label } -
- ); - }); - } - - handleClickTab = (id) => { - this.application.setView(id); - }; -} diff --git a/js-old/src/dapps/console/Header/index.js b/js-old/src/dapps/console/Header/index.js deleted file mode 100644 index aef90266f..000000000 --- a/js-old/src/dapps/console/Header/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './header'; diff --git a/js-old/src/dapps/console/Input/index.js b/js-old/src/dapps/console/Input/index.js deleted file mode 100644 index 29e00f72b..000000000 --- a/js-old/src/dapps/console/Input/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -export default from './input'; diff --git a/js-old/src/dapps/console/Input/input.css b/js-old/src/dapps/console/Input/input.css deleted file mode 100644 index 7b0c2306e..000000000 --- a/js-old/src/dapps/console/Input/input.css +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (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 . -*/ - -.type { - color: #59f; - font-weight: bold !important; - font-size: 11px; - padding: 0 0.5em 0 0.25em; -} - -.inputContainer { - flex: 1; -} - -.input { - border: 0; - margin: 0; - padding: 0; - color: black; - height: 100%; - font-size: 11px; - resize: none; - width: 100%; -} - -.container { - border-top: 1px solid lightgray; - display: flex; - flex: 1; - padding: 0.25em; - position: relative; -} diff --git a/js-old/src/dapps/console/Input/input.js b/js-old/src/dapps/console/Input/input.js deleted file mode 100644 index 3263aff38..000000000 --- a/js-old/src/dapps/console/Input/input.js +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (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 . - -import keycode from 'keycode'; -import { observer } from 'mobx-react'; -import React, { Component } from 'react'; -import ReactDOM from 'react-dom'; - -import Autocomplete from '../Autocomplete'; - -import AutocompleteStore from '../Autocomplete/autocomplete.store'; -import ConsoleStore from '../Console/console.store'; -import InputStore from './input.store'; -import SettingsStore from '../Settings/settings.store'; - -import styles from './input.css'; - -@observer -export default class Input extends Component { - autocompleteStore = AutocompleteStore.get(); - consoleStore = ConsoleStore.get(); - inputStore = InputStore.get(); - settingsStore = SettingsStore.get(); - - render () { - const { input } = this.inputStore; - - return ( -
- - > -
-