merge master into sms-verification-modal
This commit is contained in:
commit
7a83fb8595
@ -326,7 +326,7 @@ windows:
|
|||||||
- set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;C:\vs2015\VC\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt
|
- set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;C:\vs2015\VC\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt
|
||||||
- set LIB=C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64
|
- set LIB=C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64
|
||||||
- set RUST_BACKTRACE=1
|
- set RUST_BACKTRACE=1
|
||||||
- set RUSTFLAGS=%RUSTFLAGS% -Zorbit=off
|
- set RUSTFLAGS=%RUSTFLAGS%
|
||||||
- rustup default stable-x86_64-pc-windows-msvc
|
- rustup default stable-x86_64-pc-windows-msvc
|
||||||
- cargo build --release %CARGOFLAGS%
|
- cargo build --release %CARGOFLAGS%
|
||||||
- curl -sL --url "https://github.com/ethcore/win-build/raw/master/SimpleFC.dll" -o nsis\SimpleFC.dll
|
- curl -sL --url "https://github.com/ethcore/win-build/raw/master/SimpleFC.dll" -o nsis\SimpleFC.dll
|
||||||
|
@ -17,7 +17,7 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- rust: stable
|
- rust: stable
|
||||||
env: RUN_TESTS="true" TEST_OPTIONS="--no-release"
|
env: RUN_TESTS="true" TEST_OPTIONS="--no-release"
|
||||||
- rust: beta
|
- rust: stable
|
||||||
env: RUN_COVERAGE="true"
|
env: RUN_COVERAGE="true"
|
||||||
- rust: stable
|
- rust: stable
|
||||||
env: RUN_DOCS="true"
|
env: RUN_DOCS="true"
|
||||||
|
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1249,7 +1249,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "parity-ui-precompiled"
|
name = "parity-ui-precompiled"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
source = "git+https://github.com/ethcore/js-precompiled.git#7bf550e482ef274480d1fd7e1ceb2efddd747dbd"
|
source = "git+https://github.com/ethcore/js-precompiled.git#b4df3bd592651729716ec38577410f7c1e767007"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -1926,7 +1926,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ws"
|
name = "ws"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
source = "git+https://github.com/ethcore/ws-rs.git?branch=mio-upstream-stable#0cd6c5e3e9d5e61a37d53eb8dcbad523dcc69314"
|
source = "git+https://github.com/ethcore/ws-rs.git?branch=mio-upstream-stable#f5c0b35d660244d1b7500693c8cc28277ce1d418"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 0.4.0-dev (git+https://github.com/carllerche/bytes)",
|
"bytes 0.4.0-dev (git+https://github.com/carllerche/bytes)",
|
||||||
"httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "TestInstantSeal",
|
"name": "DevelopmentChain",
|
||||||
"engine": {
|
"engine": {
|
||||||
"InstantSeal": null
|
"InstantSeal": null
|
||||||
},
|
},
|
||||||
@ -28,6 +28,6 @@
|
|||||||
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||||
"102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
|
"0x00a329c0648769a73afac7f9381e08fb43dbea72": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ impl Engine for InstantSeal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn schedule(&self, _env_info: &EnvInfo) -> Schedule {
|
fn schedule(&self, _env_info: &EnvInfo) -> Schedule {
|
||||||
Schedule::new_homestead()
|
Schedule::new_post_eip150(false, false, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_sealer(&self, _author: &Address) -> Option<bool> { Some(true) }
|
fn is_sealer(&self, _author: &Address) -> Option<bool> { Some(true) }
|
||||||
@ -79,7 +79,7 @@ mod tests {
|
|||||||
let tap = AccountProvider::transient_provider();
|
let tap = AccountProvider::transient_provider();
|
||||||
let addr = tap.insert_account("".sha3(), "").unwrap();
|
let addr = tap.insert_account("".sha3(), "").unwrap();
|
||||||
|
|
||||||
let spec = Spec::new_test_instant();
|
let spec = Spec::new_instant();
|
||||||
let engine = &*spec.engine;
|
let engine = &*spec.engine;
|
||||||
let genesis_header = spec.genesis_header();
|
let genesis_header = spec.genesis_header();
|
||||||
let mut db_result = get_temp_state_db();
|
let mut db_result = get_temp_state_db();
|
||||||
@ -95,7 +95,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn instant_cant_verify() {
|
fn instant_cant_verify() {
|
||||||
let engine = Spec::new_test_instant().engine;
|
let engine = Spec::new_instant().engine;
|
||||||
let mut header: Header = Header::default();
|
let mut header: Header = Header::default();
|
||||||
|
|
||||||
assert!(engine.verify_block_basic(&header, None).is_ok());
|
assert!(engine.verify_block_basic(&header, None).is_ok());
|
||||||
|
@ -1251,7 +1251,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn internal_seals_without_work() {
|
fn internal_seals_without_work() {
|
||||||
let miner = Miner::with_spec(&Spec::new_test_instant());
|
let miner = Miner::with_spec(&Spec::new_instant());
|
||||||
|
|
||||||
let c = generate_dummy_client(2);
|
let c = generate_dummy_client(2);
|
||||||
let client = c.reference().as_ref();
|
let client = c.reference().as_ref();
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
use account_db::{AccountDB, AccountDBMut};
|
use account_db::{AccountDB, AccountDBMut};
|
||||||
use snapshot::Error;
|
use snapshot::Error;
|
||||||
|
|
||||||
use util::{U256, FixedHash, H256, Bytes, HashDB, DBValue, SHA3_EMPTY, SHA3_NULL_RLP};
|
use util::{U256, FixedHash, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP};
|
||||||
use util::trie::{TrieDB, Trie};
|
use util::trie::{TrieDB, Trie};
|
||||||
use rlp::{Rlp, RlpStream, Stream, UntrustedRlp, View};
|
use rlp::{Rlp, RlpStream, Stream, UntrustedRlp, View};
|
||||||
|
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::HashSet;
|
||||||
|
|
||||||
// An empty account -- these are replaced with RLP null data for a space optimization.
|
// An empty account -- these are replaced with RLP null data for a space optimization.
|
||||||
const ACC_EMPTY: Account = Account {
|
const ACC_EMPTY: Account = Account {
|
||||||
@ -150,7 +150,6 @@ impl Account {
|
|||||||
pub fn from_fat_rlp(
|
pub fn from_fat_rlp(
|
||||||
acct_db: &mut AccountDBMut,
|
acct_db: &mut AccountDBMut,
|
||||||
rlp: UntrustedRlp,
|
rlp: UntrustedRlp,
|
||||||
code_map: &HashMap<H256, Bytes>,
|
|
||||||
) -> Result<(Self, Option<Bytes>), Error> {
|
) -> Result<(Self, Option<Bytes>), Error> {
|
||||||
use util::{TrieDBMut, TrieMut};
|
use util::{TrieDBMut, TrieMut};
|
||||||
|
|
||||||
@ -177,9 +176,6 @@ impl Account {
|
|||||||
}
|
}
|
||||||
CodeState::Hash => {
|
CodeState::Hash => {
|
||||||
let code_hash = try!(rlp.val_at(3));
|
let code_hash = try!(rlp.val_at(3));
|
||||||
if let Some(code) = code_map.get(&code_hash) {
|
|
||||||
acct_db.emplace(code_hash.clone(), DBValue::from_slice(code));
|
|
||||||
}
|
|
||||||
|
|
||||||
(code_hash, None)
|
(code_hash, None)
|
||||||
}
|
}
|
||||||
@ -229,7 +225,7 @@ mod tests {
|
|||||||
use util::{Address, FixedHash, H256, HashDB, DBValue};
|
use util::{Address, FixedHash, H256, HashDB, DBValue};
|
||||||
use rlp::{UntrustedRlp, View};
|
use rlp::{UntrustedRlp, View};
|
||||||
|
|
||||||
use std::collections::{HashSet, HashMap};
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use super::{ACC_EMPTY, Account};
|
use super::{ACC_EMPTY, Account};
|
||||||
|
|
||||||
@ -250,7 +246,7 @@ mod tests {
|
|||||||
|
|
||||||
let fat_rlp = account.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
let fat_rlp = account.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
||||||
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
||||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp, &Default::default()).unwrap().0, account);
|
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp).unwrap().0, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -275,7 +271,7 @@ mod tests {
|
|||||||
|
|
||||||
let fat_rlp = account.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
let fat_rlp = account.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
||||||
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
||||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp, &Default::default()).unwrap().0, account);
|
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp).unwrap().0, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -318,12 +314,11 @@ mod tests {
|
|||||||
let fat_rlp1 = UntrustedRlp::new(&fat_rlp1);
|
let fat_rlp1 = UntrustedRlp::new(&fat_rlp1);
|
||||||
let fat_rlp2 = UntrustedRlp::new(&fat_rlp2);
|
let fat_rlp2 = UntrustedRlp::new(&fat_rlp2);
|
||||||
|
|
||||||
let code_map = HashMap::new();
|
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr2), fat_rlp2).unwrap();
|
||||||
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr2), fat_rlp2, &code_map).unwrap();
|
|
||||||
assert!(maybe_code.is_none());
|
assert!(maybe_code.is_none());
|
||||||
assert_eq!(acc, account2);
|
assert_eq!(acc, account2);
|
||||||
|
|
||||||
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr1), fat_rlp1, &code_map).unwrap();
|
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr1), fat_rlp1).unwrap();
|
||||||
assert_eq!(maybe_code, Some(b"this is definitely code".to_vec()));
|
assert_eq!(maybe_code, Some(b"this is definitely code".to_vec()));
|
||||||
assert_eq!(acc, account1);
|
assert_eq!(acc, account1);
|
||||||
}
|
}
|
||||||
@ -332,9 +327,8 @@ mod tests {
|
|||||||
fn encoding_empty_acc() {
|
fn encoding_empty_acc() {
|
||||||
let mut db = get_temp_state_db();
|
let mut db = get_temp_state_db();
|
||||||
let mut used_code = HashSet::new();
|
let mut used_code = HashSet::new();
|
||||||
let code_map = HashMap::new();
|
|
||||||
|
|
||||||
assert_eq!(ACC_EMPTY.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &Address::default()), &mut used_code).unwrap(), ::rlp::NULL_RLP.to_vec());
|
assert_eq!(ACC_EMPTY.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &Address::default()), &mut used_code).unwrap(), ::rlp::NULL_RLP.to_vec());
|
||||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &Address::default()), UntrustedRlp::new(&::rlp::NULL_RLP), &code_map).unwrap(), (ACC_EMPTY, None));
|
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &Address::default()), UntrustedRlp::new(&::rlp::NULL_RLP)).unwrap(), (ACC_EMPTY, None));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ pub fn chunk_state<'a>(db: &HashDB, root: &H256, writer: &Mutex<SnapshotWriter +
|
|||||||
pub struct StateRebuilder {
|
pub struct StateRebuilder {
|
||||||
db: Box<JournalDB>,
|
db: Box<JournalDB>,
|
||||||
state_root: H256,
|
state_root: H256,
|
||||||
code_map: HashMap<H256, Bytes>, // maps code hashes to code itself.
|
known_code: HashMap<H256, H256>, // code hashes mapped to first account with this code.
|
||||||
missing_code: HashMap<H256, Vec<H256>>, // maps code hashes to lists of accounts missing that code.
|
missing_code: HashMap<H256, Vec<H256>>, // maps code hashes to lists of accounts missing that code.
|
||||||
bloom: Bloom,
|
bloom: Bloom,
|
||||||
}
|
}
|
||||||
@ -400,7 +400,7 @@ impl StateRebuilder {
|
|||||||
StateRebuilder {
|
StateRebuilder {
|
||||||
db: journaldb::new(db.clone(), pruning, ::db::COL_STATE),
|
db: journaldb::new(db.clone(), pruning, ::db::COL_STATE),
|
||||||
state_root: SHA3_NULL_RLP,
|
state_root: SHA3_NULL_RLP,
|
||||||
code_map: HashMap::new(),
|
known_code: HashMap::new(),
|
||||||
missing_code: HashMap::new(),
|
missing_code: HashMap::new(),
|
||||||
bloom: StateDB::load_bloom(&*db),
|
bloom: StateDB::load_bloom(&*db),
|
||||||
}
|
}
|
||||||
@ -419,7 +419,7 @@ impl StateRebuilder {
|
|||||||
self.db.as_hashdb_mut(),
|
self.db.as_hashdb_mut(),
|
||||||
rlp,
|
rlp,
|
||||||
&mut pairs,
|
&mut pairs,
|
||||||
&self.code_map,
|
&self.known_code,
|
||||||
flag
|
flag
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -428,13 +428,13 @@ impl StateRebuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// patch up all missing code. must be done after collecting all new missing code entries.
|
// patch up all missing code. must be done after collecting all new missing code entries.
|
||||||
for (code_hash, code) in status.new_code {
|
for (code_hash, code, first_with) in status.new_code {
|
||||||
for addr_hash in self.missing_code.remove(&code_hash).unwrap_or_else(Vec::new) {
|
for addr_hash in self.missing_code.remove(&code_hash).unwrap_or_else(Vec::new) {
|
||||||
let mut db = AccountDBMut::from_hash(self.db.as_hashdb_mut(), addr_hash);
|
let mut db = AccountDBMut::from_hash(self.db.as_hashdb_mut(), addr_hash);
|
||||||
db.emplace(code_hash, DBValue::from_slice(&code));
|
db.emplace(code_hash, DBValue::from_slice(&code));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.code_map.insert(code_hash, code);
|
self.known_code.insert(code_hash, first_with);
|
||||||
}
|
}
|
||||||
|
|
||||||
let backing = self.db.backing().clone();
|
let backing = self.db.backing().clone();
|
||||||
@ -482,7 +482,8 @@ impl StateRebuilder {
|
|||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct RebuiltStatus {
|
struct RebuiltStatus {
|
||||||
new_code: Vec<(H256, Bytes)>, // new code that's become available.
|
// new code that's become available. (code_hash, code, addr_hash)
|
||||||
|
new_code: Vec<(H256, Bytes, H256)>,
|
||||||
missing_code: Vec<(H256, H256)>, // accounts that are missing code.
|
missing_code: Vec<(H256, H256)>, // accounts that are missing code.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,10 +493,9 @@ fn rebuild_accounts(
|
|||||||
db: &mut HashDB,
|
db: &mut HashDB,
|
||||||
account_fat_rlps: UntrustedRlp,
|
account_fat_rlps: UntrustedRlp,
|
||||||
out_chunk: &mut [(H256, Bytes)],
|
out_chunk: &mut [(H256, Bytes)],
|
||||||
code_map: &HashMap<H256, Bytes>,
|
known_code: &HashMap<H256, H256>,
|
||||||
abort_flag: &AtomicBool
|
abort_flag: &AtomicBool,
|
||||||
) -> Result<RebuiltStatus, ::error::Error>
|
) -> Result<RebuiltStatus, ::error::Error> {
|
||||||
{
|
|
||||||
let mut status = RebuiltStatus::default();
|
let mut status = RebuiltStatus::default();
|
||||||
for (account_rlp, out) in account_fat_rlps.into_iter().zip(out_chunk) {
|
for (account_rlp, out) in account_fat_rlps.into_iter().zip(out_chunk) {
|
||||||
if !abort_flag.load(Ordering::SeqCst) { return Err(Error::RestorationAborted.into()) }
|
if !abort_flag.load(Ordering::SeqCst) { return Err(Error::RestorationAborted.into()) }
|
||||||
@ -504,17 +504,33 @@ fn rebuild_accounts(
|
|||||||
let fat_rlp = try!(account_rlp.at(1));
|
let fat_rlp = try!(account_rlp.at(1));
|
||||||
|
|
||||||
let thin_rlp = {
|
let thin_rlp = {
|
||||||
let mut acct_db = AccountDBMut::from_hash(db, hash);
|
|
||||||
|
|
||||||
// fill out the storage trie and code while decoding.
|
// fill out the storage trie and code while decoding.
|
||||||
let (acc, maybe_code) = try!(Account::from_fat_rlp(&mut acct_db, fat_rlp, code_map));
|
let (acc, maybe_code) = {
|
||||||
|
let mut acct_db = AccountDBMut::from_hash(db, hash);
|
||||||
|
try!(Account::from_fat_rlp(&mut acct_db, fat_rlp))
|
||||||
|
};
|
||||||
|
|
||||||
let code_hash = acc.code_hash().clone();
|
let code_hash = acc.code_hash().clone();
|
||||||
match maybe_code {
|
match maybe_code {
|
||||||
Some(code) => status.new_code.push((code_hash, code)),
|
// new inline code
|
||||||
|
Some(code) => status.new_code.push((code_hash, code, hash)),
|
||||||
None => {
|
None => {
|
||||||
if code_hash != ::util::SHA3_EMPTY && !code_map.contains_key(&code_hash) {
|
if code_hash != ::util::SHA3_EMPTY {
|
||||||
status.missing_code.push((hash, code_hash));
|
// see if this code has already been included inline
|
||||||
|
match known_code.get(&code_hash) {
|
||||||
|
Some(&first_with) => {
|
||||||
|
// if so, load it from the database.
|
||||||
|
let code = try!(AccountDB::from_hash(db, first_with)
|
||||||
|
.get(&code_hash)
|
||||||
|
.ok_or_else(|| Error::MissingCode(vec![first_with])));
|
||||||
|
|
||||||
|
// and write it again under a different mangled key
|
||||||
|
AccountDBMut::from_hash(db, hash).emplace(code_hash, code);
|
||||||
|
}
|
||||||
|
// if not, queue it up to be filled later
|
||||||
|
None => status.missing_code.push((hash, code_hash)),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
//! State snapshotting tests.
|
//! State snapshotting tests.
|
||||||
|
|
||||||
use snapshot::{chunk_state, Error as SnapshotError, Progress, StateRebuilder};
|
use snapshot::{chunk_state, Error as SnapshotError, Progress, StateRebuilder};
|
||||||
|
use snapshot::account::Account;
|
||||||
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
||||||
use super::helpers::{compare_dbs, StateProducer};
|
use super::helpers::{compare_dbs, StateProducer};
|
||||||
|
|
||||||
@ -30,6 +31,8 @@ use util::memorydb::MemoryDB;
|
|||||||
use util::Mutex;
|
use util::Mutex;
|
||||||
use devtools::RandomTempPath;
|
use devtools::RandomTempPath;
|
||||||
|
|
||||||
|
use util::sha3::SHA3_NULL_RLP;
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
|
|
||||||
@ -88,6 +91,58 @@ fn snap_and_restore() {
|
|||||||
compare_dbs(&old_db, new_db.as_hashdb());
|
compare_dbs(&old_db, new_db.as_hashdb());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn get_code_from_prev_chunk() {
|
||||||
|
use std::collections::HashSet;
|
||||||
|
use rlp::{RlpStream, Stream};
|
||||||
|
use util::{HashDB, H256, FixedHash, U256, Hashable};
|
||||||
|
|
||||||
|
use account_db::{AccountDBMut, AccountDB};
|
||||||
|
|
||||||
|
let code = b"this is definitely code";
|
||||||
|
let mut used_code = HashSet::new();
|
||||||
|
let mut acc_stream = RlpStream::new_list(4);
|
||||||
|
acc_stream.append(&U256::default())
|
||||||
|
.append(&U256::default())
|
||||||
|
.append(&SHA3_NULL_RLP)
|
||||||
|
.append(&code.sha3());
|
||||||
|
|
||||||
|
let (h1, h2) = (H256::random(), H256::random());
|
||||||
|
|
||||||
|
// two accounts with the same code, one per chunk.
|
||||||
|
// first one will have code inlined,
|
||||||
|
// second will just have its hash.
|
||||||
|
let thin_rlp = acc_stream.out();
|
||||||
|
let acc1 = Account::from_thin_rlp(&thin_rlp);
|
||||||
|
let acc2 = Account::from_thin_rlp(&thin_rlp);
|
||||||
|
|
||||||
|
let mut make_chunk = |acc: Account, hash| {
|
||||||
|
let mut db = MemoryDB::new();
|
||||||
|
AccountDBMut::from_hash(&mut db, hash).insert(&code[..]);
|
||||||
|
|
||||||
|
let fat_rlp = acc.to_fat_rlp(&AccountDB::from_hash(&db, hash), &mut used_code).unwrap();
|
||||||
|
|
||||||
|
let mut stream = RlpStream::new_list(1);
|
||||||
|
stream.begin_list(2).append(&hash).append_raw(&fat_rlp, 1);
|
||||||
|
stream.out()
|
||||||
|
};
|
||||||
|
|
||||||
|
let chunk1 = make_chunk(acc1, h1);
|
||||||
|
let chunk2 = make_chunk(acc2, h2);
|
||||||
|
|
||||||
|
let db_path = RandomTempPath::create_dir();
|
||||||
|
let db_cfg = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||||
|
let new_db = Arc::new(Database::open(&db_cfg, &db_path.to_string_lossy()).unwrap());
|
||||||
|
|
||||||
|
let mut rebuilder = StateRebuilder::new(new_db, Algorithm::Archive);
|
||||||
|
let flag = AtomicBool::new(true);
|
||||||
|
|
||||||
|
rebuilder.feed(&chunk1, &flag).unwrap();
|
||||||
|
rebuilder.feed(&chunk2, &flag).unwrap();
|
||||||
|
|
||||||
|
rebuilder.check_missing().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn checks_flag() {
|
fn checks_flag() {
|
||||||
let mut producer = StateProducer::new();
|
let mut producer = StateProducer::new();
|
||||||
|
@ -135,6 +135,12 @@ impl From<ethjson::spec::Spec> for Spec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! load_bundled {
|
||||||
|
($e:expr) => {
|
||||||
|
Spec::load(include_bytes!(concat!("../../res/", $e, ".json")) as &[u8]).expect(concat!("Chain spec ", $e, " is invalid."))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
impl Spec {
|
impl Spec {
|
||||||
/// Convert engine spec into a arc'd Engine of the right underlying type.
|
/// Convert engine spec into a arc'd Engine of the right underlying type.
|
||||||
/// TODO avoid this hard-coded nastiness - use dynamic-linked plugin framework instead.
|
/// TODO avoid this hard-coded nastiness - use dynamic-linked plugin framework instead.
|
||||||
@ -267,19 +273,13 @@ impl Spec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new Spec which conforms to the Frontier-era Morden chain except that it's a NullEngine consensus.
|
/// Create a new Spec which conforms to the Frontier-era Morden chain except that it's a NullEngine consensus.
|
||||||
pub fn new_test() -> Self {
|
pub fn new_test() -> Spec { load_bundled!("null_morden") }
|
||||||
Spec::load(include_bytes!("../../res/null_morden.json") as &[u8]).expect("null_morden.json is invalid")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a new Spec which is a NullEngine consensus with a premine of address whose secret is sha3('').
|
/// Create a new Spec which is a NullEngine consensus with a premine of address whose secret is sha3('').
|
||||||
pub fn new_null() -> Self {
|
pub fn new_null() -> Spec { load_bundled!("null") }
|
||||||
Spec::load(include_bytes!("../../res/null.json") as &[u8]).expect("null.json is invalid")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a new Spec with InstantSeal consensus which does internal sealing (not requiring work).
|
/// Create a new Spec with InstantSeal consensus which does internal sealing (not requiring work).
|
||||||
pub fn new_test_instant() -> Self {
|
pub fn new_instant() -> Spec { load_bundled!("instant_seal") }
|
||||||
Spec::load(include_bytes!("../../res/instant_seal.json") as &[u8]).expect("instant_seal.json is invalid")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "parity.js",
|
"name": "parity.js",
|
||||||
"version": "0.2.38",
|
"version": "0.2.46",
|
||||||
"main": "release/index.js",
|
"main": "release/index.js",
|
||||||
"jsnext:main": "src/index.js",
|
"jsnext:main": "src/index.js",
|
||||||
"author": "Parity Team <admin@parity.io>",
|
"author": "Parity Team <admin@parity.io>",
|
||||||
|
@ -46,7 +46,8 @@ function stringToBytes (input) {
|
|||||||
if (isArray(input)) {
|
if (isArray(input)) {
|
||||||
return input;
|
return input;
|
||||||
} else if (input.substr(0, 2) === '0x') {
|
} else if (input.substr(0, 2) === '0x') {
|
||||||
return input.substr(2).toLowerCase().match(/.{1,2}/g).map((value) => parseInt(value, 16));
|
const matches = input.substr(2).toLowerCase().match(/.{1,2}/g) || [];
|
||||||
|
return matches.map((value) => parseInt(value, 16));
|
||||||
} else {
|
} else {
|
||||||
return input.split('').map((char) => char.charCodeAt(0));
|
return input.split('').map((char) => char.charCodeAt(0));
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,12 @@ export default class Contract {
|
|||||||
|
|
||||||
this._events.forEach((evt) => {
|
this._events.forEach((evt) => {
|
||||||
this._instance[evt.name] = evt;
|
this._instance[evt.name] = evt;
|
||||||
|
this._instance[evt.signature] = evt;
|
||||||
});
|
});
|
||||||
|
|
||||||
this._functions.forEach((fn) => {
|
this._functions.forEach((fn) => {
|
||||||
this._instance[fn.name] = fn;
|
this._instance[fn.name] = fn;
|
||||||
|
this._instance[fn.signature] = fn;
|
||||||
});
|
});
|
||||||
|
|
||||||
this._sendSubscriptionChanges();
|
this._sendSubscriptionChanges();
|
||||||
|
@ -20,6 +20,7 @@ import sinon from 'sinon';
|
|||||||
import { TEST_HTTP_URL, mockHttp } from '../../../test/mockRpc';
|
import { TEST_HTTP_URL, mockHttp } from '../../../test/mockRpc';
|
||||||
|
|
||||||
import Abi from '../../abi';
|
import Abi from '../../abi';
|
||||||
|
import { sha3 } from '../util/sha3';
|
||||||
|
|
||||||
import Api from '../api';
|
import Api from '../api';
|
||||||
import Contract from './contract';
|
import Contract from './contract';
|
||||||
@ -113,7 +114,13 @@ describe('api/contract/Contract', () => {
|
|||||||
]);
|
]);
|
||||||
contract.at('6789');
|
contract.at('6789');
|
||||||
|
|
||||||
expect(Object.keys(contract.instance)).to.deep.equal(['Drained', 'balanceOf', 'address']);
|
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');
|
expect(contract.address).to.equal('6789');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -21,3 +21,7 @@
|
|||||||
.iconMenu option {
|
.iconMenu option {
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@ -21,7 +21,7 @@ import { Dialog, FlatButton } from 'material-ui';
|
|||||||
import AccountSelector from '../../Accounts/AccountSelector';
|
import AccountSelector from '../../Accounts/AccountSelector';
|
||||||
import InputText from '../../Inputs/Text';
|
import InputText from '../../Inputs/Text';
|
||||||
|
|
||||||
import { TOKEN_ADDRESS_TYPE, TLA_TYPE, UINT_TYPE, STRING_TYPE } from '../../Inputs/validation';
|
import { TOKEN_ADDRESS_TYPE, TLA_TYPE, DECIMAL_TYPE, STRING_TYPE } from '../../Inputs/validation';
|
||||||
|
|
||||||
import styles from '../actions.css';
|
import styles from '../actions.css';
|
||||||
|
|
||||||
@ -41,11 +41,11 @@ const initState = {
|
|||||||
floatingLabelText: 'Token TLA',
|
floatingLabelText: 'Token TLA',
|
||||||
hintText: 'The token short name (3 characters)'
|
hintText: 'The token short name (3 characters)'
|
||||||
},
|
},
|
||||||
base: {
|
decimals: {
|
||||||
...defaultField,
|
...defaultField,
|
||||||
type: UINT_TYPE,
|
type: DECIMAL_TYPE,
|
||||||
floatingLabelText: 'Token Base',
|
floatingLabelText: 'Token Decimals',
|
||||||
hintText: 'The token precision'
|
hintText: 'The number of decimals (0-18)'
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
...defaultField,
|
...defaultField,
|
||||||
|
@ -47,7 +47,8 @@ export const registerToken = (tokenData) => (dispatch, getState) => {
|
|||||||
const contractInstance = state.status.contract.instance;
|
const contractInstance = state.status.contract.instance;
|
||||||
const fee = state.status.contract.fee;
|
const fee = state.status.contract.fee;
|
||||||
|
|
||||||
const { address, base, name, tla } = tokenData;
|
const { address, decimals, name, tla } = tokenData;
|
||||||
|
const base = Math.pow(10, decimals);
|
||||||
|
|
||||||
dispatch(setRegisterSending(true));
|
dispatch(setRegisterSending(true));
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ export const SIMPLE_TOKEN_ADDRESS_TYPE = 'SIMPLE_TOKEN_ADDRESS_TYPE';
|
|||||||
export const TLA_TYPE = 'TLA_TYPE';
|
export const TLA_TYPE = 'TLA_TYPE';
|
||||||
export const SIMPLE_TLA_TYPE = 'SIMPLE_TLA_TYPE';
|
export const SIMPLE_TLA_TYPE = 'SIMPLE_TLA_TYPE';
|
||||||
export const UINT_TYPE = 'UINT_TYPE';
|
export const UINT_TYPE = 'UINT_TYPE';
|
||||||
|
export const DECIMAL_TYPE = 'DECIMAL_TYPE';
|
||||||
export const STRING_TYPE = 'STRING_TYPE';
|
export const STRING_TYPE = 'STRING_TYPE';
|
||||||
export const HEX_TYPE = 'HEX_TYPE';
|
export const HEX_TYPE = 'HEX_TYPE';
|
||||||
export const URL_TYPE = 'URL_TYPE';
|
export const URL_TYPE = 'URL_TYPE';
|
||||||
@ -39,6 +40,7 @@ export const URL_TYPE = 'URL_TYPE';
|
|||||||
export const ERRORS = {
|
export const ERRORS = {
|
||||||
invalidTLA: 'The TLA should be 3 characters long',
|
invalidTLA: 'The TLA should be 3 characters long',
|
||||||
invalidUint: 'Please enter a non-negative integer',
|
invalidUint: 'Please enter a non-negative integer',
|
||||||
|
invalidDecimal: 'Please enter a value between 0 and 18',
|
||||||
invalidString: 'Please enter at least a character',
|
invalidString: 'Please enter at least a character',
|
||||||
invalidAccount: 'Please select an account to transact with',
|
invalidAccount: 'Please select an account to transact with',
|
||||||
invalidRecipient: 'Please select an account to send to',
|
invalidRecipient: 'Please select an account to send to',
|
||||||
@ -152,6 +154,21 @@ const validateUint = (uint) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const validateDecimal = (decimal) => {
|
||||||
|
if (!/^\d+$/.test(decimal) || parseInt(decimal) < 0 || parseInt(decimal) > 18) {
|
||||||
|
return {
|
||||||
|
error: ERRORS.invalidDecimal,
|
||||||
|
valid: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
value: parseInt(decimal),
|
||||||
|
error: null,
|
||||||
|
valid: true
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const validateString = (string) => {
|
const validateString = (string) => {
|
||||||
if (string.toString().length === 0) {
|
if (string.toString().length === 0) {
|
||||||
return {
|
return {
|
||||||
@ -204,6 +221,7 @@ export const validate = (value, type, contract) => {
|
|||||||
if (type === TLA_TYPE) return validateTLA(value, contract);
|
if (type === TLA_TYPE) return validateTLA(value, contract);
|
||||||
if (type === SIMPLE_TLA_TYPE) return validateTLA(value, contract, true);
|
if (type === SIMPLE_TLA_TYPE) return validateTLA(value, contract, true);
|
||||||
if (type === UINT_TYPE) return validateUint(value);
|
if (type === UINT_TYPE) return validateUint(value);
|
||||||
|
if (type === DECIMAL_TYPE) return validateDecimal(value);
|
||||||
if (type === STRING_TYPE) return validateString(value);
|
if (type === STRING_TYPE) return validateString(value);
|
||||||
if (type === HEX_TYPE) return validateHex(value);
|
if (type === HEX_TYPE) return validateHex(value);
|
||||||
if (type === URL_TYPE) return validateURL(value);
|
if (type === URL_TYPE) return validateURL(value);
|
||||||
|
@ -25,7 +25,7 @@ const initialState = {
|
|||||||
isLoading: true,
|
isLoading: true,
|
||||||
subscriptionId: null,
|
subscriptionId: null,
|
||||||
contract: {
|
contract: {
|
||||||
addres: null,
|
address: null,
|
||||||
instance: null,
|
instance: null,
|
||||||
raw: null,
|
raw: null,
|
||||||
owner: null,
|
owner: null,
|
||||||
|
@ -152,8 +152,8 @@ export default class Token extends Component {
|
|||||||
if (!base || base < 0) return null;
|
if (!base || base < 0) return null;
|
||||||
return (
|
return (
|
||||||
<Chip
|
<Chip
|
||||||
value={ base.toString() }
|
value={ Math.log10(base).toString() }
|
||||||
label='Base' />
|
label='Decimals' />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,22 +239,22 @@ export const addGithubhintURL = (from, key, url) => (dispatch, getState) => {
|
|||||||
export const unregisterToken = (index) => (dispatch, getState) => {
|
export const unregisterToken = (index) => (dispatch, getState) => {
|
||||||
console.log('unregistering token', index);
|
console.log('unregistering token', index);
|
||||||
|
|
||||||
const state = getState();
|
const { contract } = getState().status;
|
||||||
const contractInstance = state.status.contract.instance;
|
const { instance, owner } = contract;
|
||||||
|
|
||||||
const values = [ index ];
|
const values = [ index ];
|
||||||
const options = {
|
const options = {
|
||||||
from: state.accounts.selected.address
|
from: owner
|
||||||
};
|
};
|
||||||
|
|
||||||
contractInstance
|
instance
|
||||||
.unregister
|
.unregister
|
||||||
.estimateGas(options, values)
|
.estimateGas(options, values)
|
||||||
.then((gasEstimate) => {
|
.then((gasEstimate) => {
|
||||||
options.gas = gasEstimate.mul(1.2).toFixed(0);
|
options.gas = gasEstimate.mul(1.2).toFixed(0);
|
||||||
console.log(`transfer: gas estimated as ${gasEstimate.toFixed(0)} setting to ${options.gas}`);
|
console.log(`transfer: gas estimated as ${gasEstimate.toFixed(0)} setting to ${options.gas}`);
|
||||||
|
|
||||||
return contractInstance.unregister.postTransaction(options, values);
|
return instance.unregister.postTransaction(options, values);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error(`unregisterToken #${index} error`, e);
|
console.error(`unregisterToken #${index} error`, e);
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { MenuItem } from 'material-ui';
|
|
||||||
|
|
||||||
import { AddressSelect, Form, Input, InputAddressSelect, Select } from '../../../ui';
|
import { AddressSelect, Form, Input, TypedInput } from '../../../ui';
|
||||||
import { validateAbi } from '../../../util/validation';
|
import { validateAbi } from '../../../util/validation';
|
||||||
|
import { parseAbiType } from '../../../util/abi';
|
||||||
|
|
||||||
import styles from '../deployContract.css';
|
import styles from '../deployContract.css';
|
||||||
|
|
||||||
@ -103,6 +103,7 @@ export default class DetailsStep extends Component {
|
|||||||
value={ code }
|
value={ code }
|
||||||
onSubmit={ this.onCodeChange }
|
onSubmit={ this.onCodeChange }
|
||||||
readOnly={ readOnly } />
|
readOnly={ readOnly } />
|
||||||
|
|
||||||
{ this.renderConstructorInputs() }
|
{ this.renderConstructorInputs() }
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
@ -117,59 +118,23 @@ export default class DetailsStep extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return inputs.map((input, index) => {
|
return inputs.map((input, index) => {
|
||||||
const onChange = (event, value) => this.onParamChange(index, value);
|
const onChange = (value) => this.onParamChange(index, value);
|
||||||
const onChangeBool = (event, _index, value) => this.onParamChange(index, value === 'true');
|
|
||||||
const onSubmit = (value) => this.onParamChange(index, value);
|
|
||||||
const label = `${input.name}: ${input.type}`;
|
|
||||||
let inputBox = null;
|
|
||||||
|
|
||||||
switch (input.type) {
|
const label = `${input.name ? `${input.name}: ` : ''}${input.type}`;
|
||||||
case 'address':
|
const value = params[index];
|
||||||
inputBox = (
|
const error = paramsError[index];
|
||||||
<InputAddressSelect
|
const param = parseAbiType(input.type);
|
||||||
accounts={ accounts }
|
|
||||||
editing
|
|
||||||
label={ label }
|
|
||||||
value={ params[index] }
|
|
||||||
error={ paramsError[index] }
|
|
||||||
onChange={ onChange } />
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'bool':
|
|
||||||
const boolitems = ['false', 'true'].map((bool) => {
|
|
||||||
return (
|
|
||||||
<MenuItem
|
|
||||||
key={ bool }
|
|
||||||
value={ bool }
|
|
||||||
label={ bool }>{ bool }</MenuItem>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
inputBox = (
|
|
||||||
<Select
|
|
||||||
label={ label }
|
|
||||||
value={ params[index] ? 'true' : 'false' }
|
|
||||||
error={ paramsError[index] }
|
|
||||||
onChange={ onChangeBool }>
|
|
||||||
{ boolitems }
|
|
||||||
</Select>
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
inputBox = (
|
|
||||||
<Input
|
|
||||||
label={ label }
|
|
||||||
value={ params[index] }
|
|
||||||
error={ paramsError[index] }
|
|
||||||
onSubmit={ onSubmit } />
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={ index } className={ styles.funcparams }>
|
<div key={ index } className={ styles.funcparams }>
|
||||||
{ inputBox }
|
<TypedInput
|
||||||
|
label={ label }
|
||||||
|
value={ value }
|
||||||
|
error={ error }
|
||||||
|
accounts={ accounts }
|
||||||
|
onChange={ onChange }
|
||||||
|
param={ param }
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -200,35 +165,14 @@ export default class DetailsStep extends Component {
|
|||||||
const { abiError, abiParsed } = validateAbi(abi, api);
|
const { abiError, abiParsed } = validateAbi(abi, api);
|
||||||
|
|
||||||
if (!abiError) {
|
if (!abiError) {
|
||||||
const { inputs } = abiParsed.find((method) => method.type === 'constructor') || { inputs: [] };
|
const { inputs } = abiParsed
|
||||||
|
.find((method) => method.type === 'constructor') || { inputs: [] };
|
||||||
|
|
||||||
const params = [];
|
const params = [];
|
||||||
|
|
||||||
inputs.forEach((input) => {
|
inputs.forEach((input) => {
|
||||||
switch (input.type) {
|
const param = parseAbiType(input.type);
|
||||||
case 'address':
|
params.push(param.default);
|
||||||
params.push('0x');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'bool':
|
|
||||||
params.push(false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'bytes':
|
|
||||||
params.push('0x');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'uint':
|
|
||||||
params.push('0');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'string':
|
|
||||||
params.push('');
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
params.push('0');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onParamsChange(params);
|
onParamsChange(params);
|
||||||
|
@ -101,7 +101,8 @@ export default class DeployContract extends Component {
|
|||||||
steps={ deployError ? null : steps }
|
steps={ deployError ? null : steps }
|
||||||
title={ deployError ? 'deployment failed' : null }
|
title={ deployError ? 'deployment failed' : null }
|
||||||
waiting={ [1] }
|
waiting={ [1] }
|
||||||
visible>
|
visible
|
||||||
|
scroll>
|
||||||
{ this.renderStep() }
|
{ this.renderStep() }
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
@ -118,8 +119,22 @@ export default class DeployContract extends Component {
|
|||||||
onClick={ this.onClose } />
|
onClick={ this.onClose } />
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const closeBtn = (
|
||||||
|
<Button
|
||||||
|
icon={ <ContentClear /> }
|
||||||
|
label='Close'
|
||||||
|
onClick={ this.onClose } />
|
||||||
|
);
|
||||||
|
|
||||||
|
const closeBtnOk = (
|
||||||
|
<Button
|
||||||
|
icon={ <ActionDoneAll /> }
|
||||||
|
label='Close'
|
||||||
|
onClick={ this.onClose } />
|
||||||
|
);
|
||||||
|
|
||||||
if (deployError) {
|
if (deployError) {
|
||||||
return cancelBtn;
|
return closeBtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (step) {
|
switch (step) {
|
||||||
@ -134,17 +149,10 @@ export default class DeployContract extends Component {
|
|||||||
];
|
];
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return [
|
return [ closeBtn ];
|
||||||
cancelBtn
|
|
||||||
];
|
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
return [
|
return [ closeBtnOk ];
|
||||||
<Button
|
|
||||||
icon={ <ActionDoneAll /> }
|
|
||||||
label='Close'
|
|
||||||
onClick={ this.onClose } />
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,8 +285,6 @@ export default class DeployContract extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('onDeploymentState', data);
|
|
||||||
|
|
||||||
switch (data.state) {
|
switch (data.state) {
|
||||||
case 'estimateGas':
|
case 'estimateGas':
|
||||||
case 'postTransaction':
|
case 'postTransaction':
|
||||||
|
@ -29,6 +29,8 @@ const initialState = {
|
|||||||
show: false,
|
show: false,
|
||||||
validate: false,
|
validate: false,
|
||||||
validationBody: null,
|
validationBody: null,
|
||||||
|
error: false,
|
||||||
|
errorText: '',
|
||||||
content: ''
|
content: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,7 +67,7 @@ export default class ActionbarImport extends Component {
|
|||||||
|
|
||||||
renderModal () {
|
renderModal () {
|
||||||
const { title, renderValidation } = this.props;
|
const { title, renderValidation } = this.props;
|
||||||
const { show, step } = this.state;
|
const { show, step, error } = this.state;
|
||||||
|
|
||||||
if (!show) {
|
if (!show) {
|
||||||
return null;
|
return null;
|
||||||
@ -73,7 +75,7 @@ export default class ActionbarImport extends Component {
|
|||||||
|
|
||||||
const hasSteps = typeof renderValidation === 'function';
|
const hasSteps = typeof renderValidation === 'function';
|
||||||
|
|
||||||
const steps = hasSteps ? [ 'select a file', 'validate' ] : null;
|
const steps = hasSteps ? [ 'select a file', error ? 'error' : 'validate' ] : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
@ -89,7 +91,7 @@ export default class ActionbarImport extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderActions () {
|
renderActions () {
|
||||||
const { validate } = this.state;
|
const { validate, error } = this.state;
|
||||||
|
|
||||||
const cancelBtn = (
|
const cancelBtn = (
|
||||||
<Button
|
<Button
|
||||||
@ -100,6 +102,10 @@ export default class ActionbarImport extends Component {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return [ cancelBtn ];
|
||||||
|
}
|
||||||
|
|
||||||
if (validate) {
|
if (validate) {
|
||||||
const confirmBtn = (
|
const confirmBtn = (
|
||||||
<Button
|
<Button
|
||||||
@ -117,7 +123,15 @@ export default class ActionbarImport extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderBody () {
|
renderBody () {
|
||||||
const { validate } = this.state;
|
const { validate, errorText, error } = this.state;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>An error occured: { errorText }</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (validate) {
|
if (validate) {
|
||||||
return this.renderValidation();
|
return this.renderValidation();
|
||||||
@ -169,10 +183,20 @@ export default class ActionbarImport extends Component {
|
|||||||
return this.onCloseModal();
|
return this.onCloseModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const validationBody = renderValidation(content);
|
||||||
|
|
||||||
|
if (validationBody && validationBody.error) {
|
||||||
|
return this.setState({
|
||||||
|
step: 1,
|
||||||
|
error: true,
|
||||||
|
errorText: validationBody.error
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
step: 1,
|
step: 1,
|
||||||
validate: true,
|
validate: true,
|
||||||
validationBody: renderValidation(content),
|
validationBody,
|
||||||
content
|
content
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
24
js/src/ui/CopyToClipboard/copyToClipboard.css
Normal file
24
js/src/ui/CopyToClipboard/copyToClipboard.css
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
/* This file is part of Parity.
|
||||||
|
/*
|
||||||
|
/* Parity is free software: you can redistribute it and/or modify
|
||||||
|
/* it under the terms of the GNU General Public License as published by
|
||||||
|
/* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
/* (at your option) any later version.
|
||||||
|
/*
|
||||||
|
/* Parity is distributed in the hope that it will be useful,
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
/* GNU General Public License for more details.
|
||||||
|
/*
|
||||||
|
/* You should have received a copy of the GNU General Public License
|
||||||
|
/* along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
@ -16,15 +16,18 @@
|
|||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { IconButton } from 'material-ui';
|
import { IconButton } from 'material-ui';
|
||||||
|
import Snackbar from 'material-ui/Snackbar';
|
||||||
import Clipboard from 'react-copy-to-clipboard';
|
import Clipboard from 'react-copy-to-clipboard';
|
||||||
import CopyIcon from 'material-ui/svg-icons/content/content-copy';
|
import CopyIcon from 'material-ui/svg-icons/content/content-copy';
|
||||||
import Theme from '../Theme';
|
import Theme from '../Theme';
|
||||||
|
import { darkBlack } from 'material-ui/styles/colors';
|
||||||
const { textColor, disabledTextColor } = Theme.flatButton;
|
const { textColor, disabledTextColor } = Theme.flatButton;
|
||||||
|
|
||||||
|
import styles from './copyToClipboard.css';
|
||||||
|
|
||||||
export default class CopyToClipboard extends Component {
|
export default class CopyToClipboard extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
data: PropTypes.string.isRequired,
|
data: PropTypes.string.isRequired,
|
||||||
label: PropTypes.string,
|
|
||||||
onCopy: PropTypes.func,
|
onCopy: PropTypes.func,
|
||||||
size: PropTypes.number, // in px
|
size: PropTypes.number, // in px
|
||||||
cooldown: PropTypes.number // in ms
|
cooldown: PropTypes.number // in ms
|
||||||
@ -32,32 +35,46 @@ export default class CopyToClipboard extends Component {
|
|||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
className: '',
|
className: '',
|
||||||
label: 'copy to clipboard',
|
|
||||||
onCopy: () => {},
|
onCopy: () => {},
|
||||||
size: 16,
|
size: 16,
|
||||||
cooldown: 1000
|
cooldown: 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
copied: false
|
copied: false,
|
||||||
|
timeout: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
const { timeoutId } = this.state;
|
||||||
|
if (timeoutId) {
|
||||||
|
window.clearTimeout(timeoutId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { data, label, size } = this.props;
|
const { data, size } = this.props;
|
||||||
const { copied } = this.state;
|
const { copied } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Clipboard onCopy={ this.onCopy } text={ data }>
|
<Clipboard onCopy={ this.onCopy } text={ data }>
|
||||||
|
<div className={ styles.wrapper }>
|
||||||
|
<Snackbar
|
||||||
|
open={ copied }
|
||||||
|
message={
|
||||||
|
<div>copied <code className={ styles.data }>{ data }</code> to clipboard</div>
|
||||||
|
}
|
||||||
|
autoHideDuration={ 2000 }
|
||||||
|
bodyStyle={ { backgroundColor: darkBlack } }
|
||||||
|
/>
|
||||||
<IconButton
|
<IconButton
|
||||||
tooltip={ copied ? 'done!' : label }
|
|
||||||
disableTouchRipple
|
disableTouchRipple
|
||||||
tooltipPosition={ 'top-right' }
|
|
||||||
tooltipStyles={ { marginTop: `-${size / 4}px` } }
|
|
||||||
style={ { width: size, height: size, padding: '0' } }
|
style={ { width: size, height: size, padding: '0' } }
|
||||||
iconStyle={ { width: size, height: size } }
|
iconStyle={ { width: size, height: size } }
|
||||||
>
|
>
|
||||||
<CopyIcon color={ copied ? disabledTextColor : textColor } />
|
<CopyIcon color={ copied ? disabledTextColor : textColor } />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
</div>
|
||||||
</Clipboard>
|
</Clipboard>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -65,11 +82,12 @@ export default class CopyToClipboard extends Component {
|
|||||||
onCopy = () => {
|
onCopy = () => {
|
||||||
const { cooldown, onCopy } = this.props;
|
const { cooldown, onCopy } = this.props;
|
||||||
|
|
||||||
this.setState({ copied: true });
|
this.setState({
|
||||||
setTimeout(() => {
|
copied: true,
|
||||||
this.setState({ copied: false });
|
timeout: setTimeout(() => {
|
||||||
}, cooldown);
|
this.setState({ copied: false, timeout: null });
|
||||||
|
}, cooldown)
|
||||||
|
});
|
||||||
onCopy();
|
onCopy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 35px;
|
top: 35px;
|
||||||
|
|
||||||
|
&.noLabel {
|
||||||
|
top: 11px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.paddedInput input {
|
.paddedInput input {
|
||||||
|
@ -106,15 +106,21 @@ export default class AddressSelect extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderIdentityIcon (inputValue) {
|
renderIdentityIcon (inputValue) {
|
||||||
const { error, value } = this.props;
|
const { error, value, label } = this.props;
|
||||||
|
|
||||||
if (error || !inputValue || value.length !== 42) {
|
if (error || !inputValue || value.length !== 42) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const classes = [ styles.icon ];
|
||||||
|
|
||||||
|
if (!label) {
|
||||||
|
classes.push(styles.noLabel);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IdentityIcon
|
<IdentityIcon
|
||||||
className={ styles.icon }
|
className={ classes.join(' ') }
|
||||||
inline center
|
inline center
|
||||||
address={ value } />
|
address={ value } />
|
||||||
);
|
);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
|
import keycode from 'keycode';
|
||||||
import { MenuItem, AutoComplete as MUIAutoComplete } from 'material-ui';
|
import { MenuItem, AutoComplete as MUIAutoComplete } from 'material-ui';
|
||||||
import { PopoverAnimationVertical } from 'material-ui/Popover';
|
import { PopoverAnimationVertical } from 'material-ui/Popover';
|
||||||
|
|
||||||
@ -40,7 +41,8 @@ export default class AutoComplete extends Component {
|
|||||||
state = {
|
state = {
|
||||||
lastChangedValue: undefined,
|
lastChangedValue: undefined,
|
||||||
entry: null,
|
entry: null,
|
||||||
open: false
|
open: false,
|
||||||
|
fakeBlur: false
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
@ -67,6 +69,9 @@ export default class AutoComplete extends Component {
|
|||||||
fullWidth
|
fullWidth
|
||||||
floatingLabelFixed
|
floatingLabelFixed
|
||||||
dataSource={ this.getDataSource() }
|
dataSource={ this.getDataSource() }
|
||||||
|
menuProps={ { maxHeight: 400 } }
|
||||||
|
ref='muiAutocomplete'
|
||||||
|
onKeyDown={ this.onKeyDown }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -91,6 +96,30 @@ export default class AutoComplete extends Component {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onKeyDown = (event) => {
|
||||||
|
const { muiAutocomplete } = this.refs;
|
||||||
|
|
||||||
|
switch (keycode(event)) {
|
||||||
|
case 'down':
|
||||||
|
const { menu } = muiAutocomplete.refs;
|
||||||
|
menu.handleKeyDown(event);
|
||||||
|
this.setState({ fakeBlur: true });
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'enter':
|
||||||
|
case 'tab':
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
event.which = 'useless';
|
||||||
|
|
||||||
|
const e = new CustomEvent('down');
|
||||||
|
e.which = 40;
|
||||||
|
|
||||||
|
muiAutocomplete.handleKeyDown(e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onChange = (item, idx) => {
|
onChange = (item, idx) => {
|
||||||
if (idx === -1) {
|
if (idx === -1) {
|
||||||
return;
|
return;
|
||||||
@ -108,17 +137,22 @@ export default class AutoComplete extends Component {
|
|||||||
this.setState({ entry, open: false });
|
this.setState({ entry, open: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
onBlur = () => {
|
onBlur = (event) => {
|
||||||
const { onUpdateInput } = this.props;
|
const { onUpdateInput } = this.props;
|
||||||
|
|
||||||
// TODO: Handle blur gracefully where we use onUpdateInput (currently replaces input
|
// TODO: Handle blur gracefully where we use onUpdateInput (currently replaces
|
||||||
// input where text is allowed with the last selected value from the dropdown)
|
// input where text is allowed with the last selected value from the dropdown)
|
||||||
if (!onUpdateInput) {
|
if (!onUpdateInput) {
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
const { entry } = this.state;
|
const { entry, fakeBlur } = this.state;
|
||||||
|
|
||||||
|
if (fakeBlur) {
|
||||||
|
this.setState({ fakeBlur: false });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.handleOnChange(entry);
|
this.handleOnChange(entry);
|
||||||
}, 100);
|
}, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,4 @@
|
|||||||
|
|
||||||
.copy {
|
.copy {
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
|
|
||||||
svg {
|
|
||||||
transition: all .5s ease-in-out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,9 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
|
import { TextField } from 'material-ui';
|
||||||
|
|
||||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
import CopyToClipboard from '../../CopyToClipboard';
|
||||||
import CopyIcon from 'material-ui/svg-icons/content/content-copy';
|
|
||||||
import { TextField, IconButton } from 'material-ui';
|
|
||||||
import { lightWhite, fullWhite } from 'material-ui/styles/colors';
|
|
||||||
|
|
||||||
import styles from './input.css';
|
import styles from './input.css';
|
||||||
|
|
||||||
@ -65,7 +63,9 @@ export default class Input extends Component {
|
|||||||
hideUnderline: PropTypes.bool,
|
hideUnderline: PropTypes.bool,
|
||||||
value: PropTypes.oneOfType([
|
value: PropTypes.oneOfType([
|
||||||
PropTypes.number, PropTypes.string
|
PropTypes.number, PropTypes.string
|
||||||
])
|
]),
|
||||||
|
min: PropTypes.any,
|
||||||
|
max: PropTypes.any
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
@ -77,9 +77,7 @@ export default class Input extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
value: this.props.value || '',
|
value: this.props.value || ''
|
||||||
timeoutId: null,
|
|
||||||
copied: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps (newProps) {
|
componentWillReceiveProps (newProps) {
|
||||||
@ -88,17 +86,9 @@ export default class Input extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
|
||||||
const { timeoutId } = this.state;
|
|
||||||
|
|
||||||
if (timeoutId) {
|
|
||||||
window.clearTimeout(timeoutId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { value } = this.state;
|
const { value } = this.state;
|
||||||
const { children, className, hideUnderline, disabled, error, label, hint, multiLine, rows, type } = this.props;
|
const { children, className, hideUnderline, disabled, error, label, hint, multiLine, rows, type, min, max } = this.props;
|
||||||
|
|
||||||
const readOnly = this.props.readOnly || disabled;
|
const readOnly = this.props.readOnly || disabled;
|
||||||
|
|
||||||
@ -142,6 +132,8 @@ export default class Input extends Component {
|
|||||||
onChange={ this.onChange }
|
onChange={ this.onChange }
|
||||||
onKeyDown={ this.onKeyDown }
|
onKeyDown={ this.onKeyDown }
|
||||||
inputStyle={ inputStyle }
|
inputStyle={ inputStyle }
|
||||||
|
min={ min }
|
||||||
|
max={ max }
|
||||||
>
|
>
|
||||||
{ children }
|
{ children }
|
||||||
</TextField>
|
</TextField>
|
||||||
@ -151,7 +143,7 @@ export default class Input extends Component {
|
|||||||
|
|
||||||
renderCopyButton () {
|
renderCopyButton () {
|
||||||
const { allowCopy, hideUnderline, label, hint, floatCopy } = this.props;
|
const { allowCopy, hideUnderline, label, hint, floatCopy } = this.props;
|
||||||
const { copied, value } = this.state;
|
const { value } = this.state;
|
||||||
|
|
||||||
if (!allowCopy) {
|
if (!allowCopy) {
|
||||||
return null;
|
return null;
|
||||||
@ -165,8 +157,6 @@ export default class Input extends Component {
|
|||||||
? allowCopy
|
? allowCopy
|
||||||
: value;
|
: value;
|
||||||
|
|
||||||
const scale = copied ? 'scale(1.15)' : 'scale(1)';
|
|
||||||
|
|
||||||
if (hideUnderline && !label) {
|
if (hideUnderline && !label) {
|
||||||
style.marginBottom = 2;
|
style.marginBottom = 2;
|
||||||
} else if (label && !hint) {
|
} else if (label && !hint) {
|
||||||
@ -184,49 +174,11 @@ export default class Input extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.copy } style={ style }>
|
<div className={ styles.copy } style={ style }>
|
||||||
<CopyToClipboard
|
<CopyToClipboard data={ text } />
|
||||||
onCopy={ this.handleCopy }
|
|
||||||
text={ text } >
|
|
||||||
<IconButton
|
|
||||||
tooltip={ `${copied ? 'Copied' : 'Copy'} to clipboard` }
|
|
||||||
tooltipPosition='bottom-right'
|
|
||||||
style={ {
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
padding: 0
|
|
||||||
} }
|
|
||||||
iconStyle={ {
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
transform: scale
|
|
||||||
} }
|
|
||||||
tooltipStyles={ {
|
|
||||||
top: 16
|
|
||||||
} }
|
|
||||||
>
|
|
||||||
<CopyIcon
|
|
||||||
color={ copied ? lightWhite : fullWhite }
|
|
||||||
/>
|
|
||||||
</IconButton>
|
|
||||||
</CopyToClipboard>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCopy = () => {
|
|
||||||
if (this.state.timeoutId) {
|
|
||||||
window.clearTimeout(this.state.timeoutId);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({ copied: true }, () => {
|
|
||||||
const timeoutId = window.setTimeout(() => {
|
|
||||||
this.setState({ copied: false });
|
|
||||||
}, 500);
|
|
||||||
|
|
||||||
this.setState({ timeoutId });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onChange = (event, value) => {
|
onChange = (event, value) => {
|
||||||
this.setValue(value);
|
this.setValue(value);
|
||||||
|
|
||||||
|
17
js/src/ui/Form/TypedInput/index.js
Normal file
17
js/src/ui/Form/TypedInput/index.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
export default from './typedInput';
|
31
js/src/ui/Form/TypedInput/typedInput.css
Normal file
31
js/src/ui/Form/TypedInput/typedInput.css
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/* Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
/* This file is part of Parity.
|
||||||
|
/*
|
||||||
|
/* Parity is free software: you can redistribute it and/or modify
|
||||||
|
/* it under the terms of the GNU General Public License as published by
|
||||||
|
/* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
/* (at your option) any later version.
|
||||||
|
/*
|
||||||
|
/* Parity is distributed in the hope that it will be useful,
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
/* GNU General Public License for more details.
|
||||||
|
/*
|
||||||
|
/* You should have received a copy of the GNU General Public License
|
||||||
|
/* along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.inputs {
|
||||||
|
padding-top: 2px;
|
||||||
|
overflow-x: hidden;
|
||||||
|
|
||||||
|
label {
|
||||||
|
line-height: 22px;
|
||||||
|
pointer-events: none;
|
||||||
|
color: rgba(255, 255, 255, 0.498039);
|
||||||
|
-webkit-user-select: none;
|
||||||
|
font-size: 12px;
|
||||||
|
top: 11px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
}
|
239
js/src/ui/Form/TypedInput/typedInput.js
Normal file
239
js/src/ui/Form/TypedInput/typedInput.js
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import React, { Component, PropTypes } from 'react';
|
||||||
|
import { MenuItem } from 'material-ui';
|
||||||
|
import { range } from 'lodash';
|
||||||
|
|
||||||
|
import IconButton from 'material-ui/IconButton';
|
||||||
|
import AddIcon from 'material-ui/svg-icons/content/add';
|
||||||
|
import RemoveIcon from 'material-ui/svg-icons/content/remove';
|
||||||
|
|
||||||
|
import { Input, InputAddressSelect, Select } from '../../../ui';
|
||||||
|
import { ABI_TYPES } from '../../../util/abi';
|
||||||
|
|
||||||
|
import styles from './typedInput.css';
|
||||||
|
|
||||||
|
export default class TypedInput extends Component {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
onChange: PropTypes.func.isRequired,
|
||||||
|
accounts: PropTypes.object.isRequired,
|
||||||
|
param: PropTypes.object.isRequired,
|
||||||
|
|
||||||
|
error: PropTypes.any,
|
||||||
|
value: PropTypes.any,
|
||||||
|
label: PropTypes.string
|
||||||
|
};
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { param } = this.props;
|
||||||
|
const { type } = param;
|
||||||
|
|
||||||
|
if (type === ABI_TYPES.ARRAY) {
|
||||||
|
const { accounts, label, value = param.default } = this.props;
|
||||||
|
const { subtype, length } = param;
|
||||||
|
|
||||||
|
const fixedLength = !!length;
|
||||||
|
|
||||||
|
const inputs = range(length || value.length).map((_, index) => {
|
||||||
|
const onChange = (inputValue) => {
|
||||||
|
const newValues = [].concat(this.props.value);
|
||||||
|
newValues[index] = inputValue;
|
||||||
|
this.props.onChange(newValues);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TypedInput
|
||||||
|
key={ `${subtype.type}_${index}` }
|
||||||
|
onChange={ onChange }
|
||||||
|
accounts={ accounts }
|
||||||
|
param={ subtype }
|
||||||
|
value={ value[index] }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={ styles.inputs }>
|
||||||
|
<label>{ label }</label>
|
||||||
|
{ fixedLength ? null : this.renderLength() }
|
||||||
|
{ inputs }
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.renderType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderLength () {
|
||||||
|
const iconStyle = {
|
||||||
|
width: 16,
|
||||||
|
height: 16
|
||||||
|
};
|
||||||
|
|
||||||
|
const style = {
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
padding: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<IconButton
|
||||||
|
iconStyle={ iconStyle }
|
||||||
|
style={ style }
|
||||||
|
onClick={ this.onAddField }
|
||||||
|
>
|
||||||
|
<AddIcon />
|
||||||
|
</IconButton>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
iconStyle={ iconStyle }
|
||||||
|
style={ style }
|
||||||
|
onClick={ this.onRemoveField }
|
||||||
|
>
|
||||||
|
<RemoveIcon />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderType (type) {
|
||||||
|
if (type === ABI_TYPES.ADDRESS) {
|
||||||
|
return this.renderAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === ABI_TYPES.BOOL) {
|
||||||
|
return this.renderBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === ABI_TYPES.STRING) {
|
||||||
|
return this.renderDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === ABI_TYPES.BYTES) {
|
||||||
|
return this.renderDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === ABI_TYPES.INT) {
|
||||||
|
return this.renderNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === ABI_TYPES.FIXED) {
|
||||||
|
return this.renderNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.renderDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
renderNumber () {
|
||||||
|
const { label, value, error, param } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Input
|
||||||
|
label={ label }
|
||||||
|
value={ value }
|
||||||
|
error={ error }
|
||||||
|
onSubmit={ this.onSubmit }
|
||||||
|
type='number'
|
||||||
|
min={ param.signed ? null : 0 }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDefault () {
|
||||||
|
const { label, value, error } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Input
|
||||||
|
label={ label }
|
||||||
|
value={ value }
|
||||||
|
error={ error }
|
||||||
|
onSubmit={ this.onSubmit }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderAddress () {
|
||||||
|
const { accounts, label, value, error } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<InputAddressSelect
|
||||||
|
accounts={ accounts }
|
||||||
|
label={ label }
|
||||||
|
value={ value }
|
||||||
|
error={ error }
|
||||||
|
onChange={ this.onChange }
|
||||||
|
editing
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderBoolean () {
|
||||||
|
const { label, value, error } = this.props;
|
||||||
|
|
||||||
|
const boolitems = ['false', 'true'].map((bool) => {
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
key={ bool }
|
||||||
|
value={ bool }
|
||||||
|
label={ bool }
|
||||||
|
>
|
||||||
|
{ bool }
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
label={ label }
|
||||||
|
value={ value ? 'true' : 'false' }
|
||||||
|
error={ error }
|
||||||
|
onChange={ this.onChangeBool }
|
||||||
|
>
|
||||||
|
{ boolitems }
|
||||||
|
</Select>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeBool = (event, _index, value) => {
|
||||||
|
this.props.onChange(value === 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
onChange = (event, value) => {
|
||||||
|
this.props.onChange(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmit = (value) => {
|
||||||
|
this.props.onChange(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
onAddField = () => {
|
||||||
|
const { value, onChange, param } = this.props;
|
||||||
|
const newValues = [].concat(value, param.subtype.default);
|
||||||
|
|
||||||
|
onChange(newValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
onRemoveField = () => {
|
||||||
|
const { value, onChange } = this.props;
|
||||||
|
const newValues = value.slice(0, -1);
|
||||||
|
|
||||||
|
onChange(newValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import AddressSelect from './AddressSelect';
|
import AddressSelect from './AddressSelect';
|
||||||
import FormWrap from './FormWrap';
|
import FormWrap from './FormWrap';
|
||||||
|
import TypedInput from './TypedInput';
|
||||||
import Input from './Input';
|
import Input from './Input';
|
||||||
import InputAddress from './InputAddress';
|
import InputAddress from './InputAddress';
|
||||||
import InputAddressSelect from './InputAddressSelect';
|
import InputAddressSelect from './InputAddressSelect';
|
||||||
@ -27,6 +28,7 @@ export default from './form';
|
|||||||
export {
|
export {
|
||||||
AddressSelect,
|
AddressSelect,
|
||||||
FormWrap,
|
FormWrap,
|
||||||
|
TypedInput,
|
||||||
Input,
|
Input,
|
||||||
InputAddress,
|
InputAddress,
|
||||||
InputAddressSelect,
|
InputAddressSelect,
|
||||||
|
@ -28,11 +28,12 @@ class IdentityName extends Component {
|
|||||||
tokens: PropTypes.object,
|
tokens: PropTypes.object,
|
||||||
empty: PropTypes.bool,
|
empty: PropTypes.bool,
|
||||||
shorten: PropTypes.bool,
|
shorten: PropTypes.bool,
|
||||||
unknown: PropTypes.bool
|
unknown: PropTypes.bool,
|
||||||
|
name: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { address, accountsInfo, tokens, empty, shorten, unknown, className } = this.props;
|
const { address, accountsInfo, tokens, empty, name, shorten, unknown, className } = this.props;
|
||||||
const account = accountsInfo[address] || tokens[address];
|
const account = accountsInfo[address] || tokens[address];
|
||||||
const hasAccount = account && (!account.meta || !account.meta.deleted);
|
const hasAccount = account && (!account.meta || !account.meta.deleted);
|
||||||
|
|
||||||
@ -43,13 +44,14 @@ class IdentityName extends Component {
|
|||||||
const addressFallback = shorten ? this.formatHash(address) : address;
|
const addressFallback = shorten ? this.formatHash(address) : address;
|
||||||
const fallback = unknown ? defaultName : addressFallback;
|
const fallback = unknown ? defaultName : addressFallback;
|
||||||
const isUuid = hasAccount && account.name === account.uuid;
|
const isUuid = hasAccount && account.name === account.uuid;
|
||||||
const name = hasAccount && !isUuid
|
const displayName = (name && name.toUpperCase().trim()) ||
|
||||||
|
(hasAccount && !isUuid
|
||||||
? account.name.toUpperCase().trim()
|
? account.name.toUpperCase().trim()
|
||||||
: fallback;
|
: fallback);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className={ className }>
|
<span className={ className }>
|
||||||
{ name && name.length ? name : fallback }
|
{ displayName && displayName.length ? displayName : fallback }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import ContextProvider from './ContextProvider';
|
|||||||
import CopyToClipboard from './CopyToClipboard';
|
import CopyToClipboard from './CopyToClipboard';
|
||||||
import Editor from './Editor';
|
import Editor from './Editor';
|
||||||
import Errors from './Errors';
|
import Errors from './Errors';
|
||||||
import Form, { AddressSelect, FormWrap, Input, InputAddress, InputAddressSelect, InputChip, InputInline, Select } from './Form';
|
import Form, { AddressSelect, FormWrap, TypedInput, Input, InputAddress, InputAddressSelect, InputChip, InputInline, Select } from './Form';
|
||||||
import IdentityIcon from './IdentityIcon';
|
import IdentityIcon from './IdentityIcon';
|
||||||
import IdentityName from './IdentityName';
|
import IdentityName from './IdentityName';
|
||||||
import MethodDecoding from './MethodDecoding';
|
import MethodDecoding from './MethodDecoding';
|
||||||
@ -62,6 +62,7 @@ export {
|
|||||||
Errors,
|
Errors,
|
||||||
Form,
|
Form,
|
||||||
FormWrap,
|
FormWrap,
|
||||||
|
TypedInput,
|
||||||
Input,
|
Input,
|
||||||
InputAddress,
|
InputAddress,
|
||||||
InputAddressSelect,
|
InputAddressSelect,
|
||||||
|
146
js/src/util/abi.js
Normal file
146
js/src/util/abi.js
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import { range } from 'lodash';
|
||||||
|
|
||||||
|
const ARRAY_TYPE = 'ARRAY_TYPE';
|
||||||
|
const ADDRESS_TYPE = 'ADDRESS_TYPE';
|
||||||
|
const STRING_TYPE = 'STRING_TYPE';
|
||||||
|
const BOOL_TYPE = 'BOOL_TYPE';
|
||||||
|
const BYTES_TYPE = 'BYTES_TYPE';
|
||||||
|
const INT_TYPE = 'INT_TYPE';
|
||||||
|
const FIXED_TYPE = 'FIXED_TYPE';
|
||||||
|
|
||||||
|
export const ABI_TYPES = {
|
||||||
|
ARRAY: ARRAY_TYPE, ADDRESS: ADDRESS_TYPE,
|
||||||
|
STRING: STRING_TYPE, BOOL: BOOL_TYPE,
|
||||||
|
BYTES: BYTES_TYPE, INT: INT_TYPE,
|
||||||
|
FIXED: FIXED_TYPE
|
||||||
|
};
|
||||||
|
|
||||||
|
export function parseAbiType (type) {
|
||||||
|
const arrayRegex = /^(.+)\[(\d*)]$/;
|
||||||
|
|
||||||
|
if (arrayRegex.test(type)) {
|
||||||
|
const matches = arrayRegex.exec(type);
|
||||||
|
|
||||||
|
const subtype = parseAbiType(matches[1]);
|
||||||
|
const M = parseInt(matches[2]) || null;
|
||||||
|
const defaultValue = !M
|
||||||
|
? []
|
||||||
|
: range(M).map(() => subtype.default);
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: ARRAY_TYPE,
|
||||||
|
subtype: subtype,
|
||||||
|
length: M,
|
||||||
|
default: defaultValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const lengthRegex = /^(u?int|bytes)(\d{1,3})$/;
|
||||||
|
|
||||||
|
if (lengthRegex.test(type)) {
|
||||||
|
const matches = lengthRegex.exec(type);
|
||||||
|
|
||||||
|
const subtype = parseAbiType(matches[1]);
|
||||||
|
const length = parseInt(matches[2]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...subtype,
|
||||||
|
length
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const fixedLengthRegex = /^(u?fixed)(\d{1,3})x(\d{1,3})$/;
|
||||||
|
|
||||||
|
if (fixedLengthRegex.test(type)) {
|
||||||
|
const matches = fixedLengthRegex.exec(type);
|
||||||
|
|
||||||
|
const subtype = parseAbiType(matches[1]);
|
||||||
|
const M = parseInt(matches[2]);
|
||||||
|
const N = parseInt(matches[3]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...subtype,
|
||||||
|
M, N
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'string') {
|
||||||
|
return {
|
||||||
|
type: STRING_TYPE,
|
||||||
|
default: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'bool') {
|
||||||
|
return {
|
||||||
|
type: BOOL_TYPE,
|
||||||
|
default: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'address') {
|
||||||
|
return {
|
||||||
|
type: ADDRESS_TYPE,
|
||||||
|
default: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'bytes') {
|
||||||
|
return {
|
||||||
|
type: BYTES_TYPE,
|
||||||
|
default: '0x'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'uint') {
|
||||||
|
return {
|
||||||
|
type: INT_TYPE,
|
||||||
|
default: 0,
|
||||||
|
length: 256,
|
||||||
|
signed: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'int') {
|
||||||
|
return {
|
||||||
|
type: INT_TYPE,
|
||||||
|
default: 0,
|
||||||
|
length: 256,
|
||||||
|
signed: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'ufixed') {
|
||||||
|
return {
|
||||||
|
type: FIXED_TYPE,
|
||||||
|
default: 0,
|
||||||
|
length: 256,
|
||||||
|
signed: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'fixed') {
|
||||||
|
return {
|
||||||
|
type: FIXED_TYPE,
|
||||||
|
default: 0,
|
||||||
|
length: 256,
|
||||||
|
signed: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -43,6 +43,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.address {
|
.address {
|
||||||
white-space: nowrap;
|
display: inline-block;
|
||||||
font-family: monospace;
|
margin-left: .5em;
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,9 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
|
||||||
import IconButton from 'material-ui/IconButton';
|
|
||||||
import Snackbar from 'material-ui/Snackbar';
|
|
||||||
import CopyIcon from 'material-ui/svg-icons/content/content-copy';
|
|
||||||
import { lightWhite, fullWhite, darkBlack } from 'material-ui/styles/colors';
|
|
||||||
|
|
||||||
import { Balance, Container, ContainerTitle, IdentityIcon, IdentityName, Tags } from '../../../ui';
|
import { Balance, Container, ContainerTitle, IdentityIcon, IdentityName, Tags } from '../../../ui';
|
||||||
|
import CopyToClipboard from '../../../ui/CopyToClipboard';
|
||||||
|
|
||||||
import styles from './header.css';
|
import styles from './header.css';
|
||||||
|
|
||||||
@ -37,8 +33,7 @@ export default class Header extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
name: null,
|
name: null
|
||||||
addressCopied: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
@ -51,7 +46,6 @@ export default class Header extends Component {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { account, balance } = this.props;
|
const { account, balance } = this.props;
|
||||||
const { addressCopied } = this.state;
|
|
||||||
const { address, meta, uuid } = account;
|
const { address, meta, uuid } = account;
|
||||||
|
|
||||||
if (!account) {
|
if (!account) {
|
||||||
@ -64,50 +58,14 @@ export default class Header extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<Snackbar
|
|
||||||
open={ addressCopied }
|
|
||||||
message={
|
|
||||||
<span>
|
|
||||||
Address
|
|
||||||
<span className={ styles.address }> { address } </span>
|
|
||||||
copied to clipboard
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
autoHideDuration={ 4000 }
|
|
||||||
onRequestClose={ this.handleCopyAddressClose }
|
|
||||||
bodyStyle={ {
|
|
||||||
backgroundColor: darkBlack
|
|
||||||
} }
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Container>
|
<Container>
|
||||||
<IdentityIcon
|
<IdentityIcon
|
||||||
address={ address } />
|
address={ address } />
|
||||||
<div className={ styles.floatleft }>
|
<div className={ styles.floatleft }>
|
||||||
<ContainerTitle title={ <IdentityName address={ address } unknown /> } />
|
<ContainerTitle title={ <IdentityName address={ address } unknown /> } />
|
||||||
<div className={ styles.addressline }>
|
<div className={ styles.addressline }>
|
||||||
<CopyToClipboard
|
<CopyToClipboard data={ address } />
|
||||||
onCopy={ this.handleCopyAddress }
|
<div className={ styles.address }>{ address }</div>
|
||||||
text={ address } >
|
|
||||||
<IconButton
|
|
||||||
tooltip='Copy address to clipboard'
|
|
||||||
tooltipPosition='top-center'
|
|
||||||
style={ {
|
|
||||||
width: 32,
|
|
||||||
height: 16,
|
|
||||||
padding: 0
|
|
||||||
} }
|
|
||||||
iconStyle={ {
|
|
||||||
width: 16,
|
|
||||||
height: 16
|
|
||||||
} }>
|
|
||||||
<CopyIcon
|
|
||||||
color={ addressCopied ? lightWhite : fullWhite }
|
|
||||||
/>
|
|
||||||
</IconButton>
|
|
||||||
</CopyToClipboard>
|
|
||||||
<span>{ address } </span>
|
|
||||||
</div>
|
</div>
|
||||||
{ uuidText }
|
{ uuidText }
|
||||||
<div className={ styles.infoline }>
|
<div className={ styles.infoline }>
|
||||||
@ -157,14 +115,6 @@ export default class Header extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCopyAddress = () => {
|
|
||||||
this.setState({ addressCopied: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
handleCopyAddressClose = () => {
|
|
||||||
this.setState({ addressCopied: false });
|
|
||||||
}
|
|
||||||
|
|
||||||
setName () {
|
setName () {
|
||||||
const { account } = this.props;
|
const { account } = this.props;
|
||||||
|
|
||||||
|
@ -22,22 +22,28 @@ import { Balance, Container, ContainerTitle, IdentityIcon, IdentityName, Tags, I
|
|||||||
export default class Summary extends Component {
|
export default class Summary extends Component {
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
api: React.PropTypes.object
|
api: React.PropTypes.object
|
||||||
}
|
};
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
account: PropTypes.object.isRequired,
|
account: PropTypes.object.isRequired,
|
||||||
balance: PropTypes.object.isRequired,
|
balance: PropTypes.object,
|
||||||
link: PropTypes.string,
|
link: PropTypes.string,
|
||||||
|
name: PropTypes.string,
|
||||||
|
noLink: PropTypes.bool,
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
handleAddSearchToken: PropTypes.func
|
handleAddSearchToken: PropTypes.func
|
||||||
}
|
};
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
noLink: false
|
||||||
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
name: 'Unnamed'
|
name: 'Unnamed'
|
||||||
}
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { account, balance, children, link, handleAddSearchToken } = this.props;
|
const { account, children, handleAddSearchToken } = this.props;
|
||||||
const { tags } = account.meta;
|
const { tags } = account.meta;
|
||||||
|
|
||||||
if (!account) {
|
if (!account) {
|
||||||
@ -45,7 +51,6 @@ export default class Summary extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { address } = account;
|
const { address } = account;
|
||||||
const viewLink = `/${link || 'account'}/${address}`;
|
|
||||||
|
|
||||||
const addressComponent = (
|
const addressComponent = (
|
||||||
<Input
|
<Input
|
||||||
@ -62,12 +67,45 @@ export default class Summary extends Component {
|
|||||||
<IdentityIcon
|
<IdentityIcon
|
||||||
address={ address } />
|
address={ address } />
|
||||||
<ContainerTitle
|
<ContainerTitle
|
||||||
title={ <Link to={ viewLink }>{ <IdentityName address={ address } unknown /> }</Link> }
|
title={ this.renderLink() }
|
||||||
byline={ addressComponent } />
|
byline={ addressComponent } />
|
||||||
<Balance
|
|
||||||
balance={ balance } />
|
{ this.renderBalance() }
|
||||||
{ children }
|
{ children }
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderLink () {
|
||||||
|
const { link, noLink, account, name } = this.props;
|
||||||
|
|
||||||
|
const { address } = account;
|
||||||
|
const viewLink = `/${link || 'account'}/${address}`;
|
||||||
|
|
||||||
|
const content = (
|
||||||
|
<IdentityName address={ address } name={ name } unknown />
|
||||||
|
);
|
||||||
|
|
||||||
|
if (noLink) {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link to={ viewLink }>
|
||||||
|
{ content }
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderBalance () {
|
||||||
|
const { balance } = this.props;
|
||||||
|
|
||||||
|
if (!balance) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Balance balance={ balance } />
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,9 @@ import ContentAdd from 'material-ui/svg-icons/content/add';
|
|||||||
import { uniq } from 'lodash';
|
import { uniq } from 'lodash';
|
||||||
|
|
||||||
import List from '../Accounts/List';
|
import List from '../Accounts/List';
|
||||||
|
import Summary from '../Accounts/Summary';
|
||||||
import { AddAddress } from '../../modals';
|
import { AddAddress } from '../../modals';
|
||||||
import { Actionbar, ActionbarExport, ActionbarSearch, ActionbarSort, Button, Page } from '../../ui';
|
import { Actionbar, ActionbarExport, ActionbarImport, ActionbarSearch, ActionbarSort, Button, Page } from '../../ui';
|
||||||
|
|
||||||
import styles from './addresses.css';
|
import styles from './addresses.css';
|
||||||
|
|
||||||
@ -107,6 +108,12 @@ class Addresses extends Component {
|
|||||||
content={ contacts }
|
content={ contacts }
|
||||||
filename='addressbook.json' />,
|
filename='addressbook.json' />,
|
||||||
|
|
||||||
|
<ActionbarImport
|
||||||
|
key='importAddressbook'
|
||||||
|
onConfirm={ this.onImport }
|
||||||
|
renderValidation={ this.renderValidation }
|
||||||
|
/>,
|
||||||
|
|
||||||
this.renderSearchButton(),
|
this.renderSearchButton(),
|
||||||
this.renderSortButton()
|
this.renderSortButton()
|
||||||
];
|
];
|
||||||
@ -134,6 +141,66 @@ class Addresses extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderValidation = (content) => {
|
||||||
|
const error = {
|
||||||
|
error: 'The provided file is invalid...'
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const addresses = JSON.parse(content);
|
||||||
|
|
||||||
|
if (!addresses || Object.keys(addresses).length === 0) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
const body = Object
|
||||||
|
.values(addresses)
|
||||||
|
.filter((account) => account && account.address)
|
||||||
|
.map((account, index) => (
|
||||||
|
<Summary
|
||||||
|
key={ index }
|
||||||
|
account={ account }
|
||||||
|
name={ account.name }
|
||||||
|
noLink
|
||||||
|
/>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{ body }
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} catch (e) { return error; }
|
||||||
|
}
|
||||||
|
|
||||||
|
onImport = (content) => {
|
||||||
|
try {
|
||||||
|
const addresses = JSON.parse(content);
|
||||||
|
|
||||||
|
Object.values(addresses).forEach((account) => {
|
||||||
|
this.onAddAccount(account);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error('onImport', content, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onAddAccount = (account) => {
|
||||||
|
const { api } = this.context;
|
||||||
|
const { address, name, meta } = account;
|
||||||
|
|
||||||
|
Promise.all([
|
||||||
|
api.parity.setAccountName(address, name),
|
||||||
|
api.parity.setAccountMeta(address, {
|
||||||
|
...meta,
|
||||||
|
timestamp: Date.now(),
|
||||||
|
deleted: false
|
||||||
|
})
|
||||||
|
]).catch((error) => {
|
||||||
|
console.error('onAddAccount', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onAddSearchToken = (token) => {
|
onAddSearchToken = (token) => {
|
||||||
const { searchTokens } = this.state;
|
const { searchTokens } = this.state;
|
||||||
const newSearchTokens = uniq([].concat(searchTokens, token));
|
const newSearchTokens = uniq([].concat(searchTokens, token));
|
||||||
|
@ -33,6 +33,7 @@ export default class InputQuery extends Component {
|
|||||||
inputs: PropTypes.array.isRequired,
|
inputs: PropTypes.array.isRequired,
|
||||||
outputs: PropTypes.array.isRequired,
|
outputs: PropTypes.array.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
|
signature: PropTypes.string.isRequired,
|
||||||
className: PropTypes.string
|
className: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +178,7 @@ export default class InputQuery extends Component {
|
|||||||
|
|
||||||
onClick = () => {
|
onClick = () => {
|
||||||
const { values } = this.state;
|
const { values } = this.state;
|
||||||
const { inputs, contract, name, outputs } = this.props;
|
const { inputs, contract, name, outputs, signature } = this.props;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
@ -187,7 +188,7 @@ export default class InputQuery extends Component {
|
|||||||
const inputValues = inputs.map(input => values[input.name]);
|
const inputValues = inputs.map(input => values[input.name]);
|
||||||
|
|
||||||
contract
|
contract
|
||||||
.instance[name]
|
.instance[signature]
|
||||||
.call({}, inputValues)
|
.call({}, inputValues)
|
||||||
.then(results => {
|
.then(results => {
|
||||||
if (outputs.length === 1) {
|
if (outputs.length === 1) {
|
||||||
|
@ -70,7 +70,7 @@ export default class Queries extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderInputQuery (fn) {
|
renderInputQuery (fn) {
|
||||||
const { abi, name } = fn;
|
const { abi, name, signature } = fn;
|
||||||
const { contract } = this.props;
|
const { contract } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -80,6 +80,7 @@ export default class Queries extends Component {
|
|||||||
inputs={ abi.inputs }
|
inputs={ abi.inputs }
|
||||||
outputs={ abi.outputs }
|
outputs={ abi.outputs }
|
||||||
name={ name }
|
name={ name }
|
||||||
|
signature={ signature }
|
||||||
contract={ contract }
|
contract={ contract }
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
const HappyPack = require('happypack');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
|
||||||
const ENV = process.env.NODE_ENV || 'development';
|
const ENV = process.env.NODE_ENV || 'development';
|
||||||
@ -22,10 +23,26 @@ const DEST = process.env.BUILD_DEST || '.build';
|
|||||||
|
|
||||||
let modules = [
|
let modules = [
|
||||||
'babel-polyfill',
|
'babel-polyfill',
|
||||||
'browserify-aes', 'ethereumjs-tx', 'scryptsy',
|
'bignumber.js',
|
||||||
'react', 'react-dom', 'react-redux', 'react-router',
|
'blockies',
|
||||||
'redux', 'redux-thunk', 'react-router-redux',
|
'brace',
|
||||||
'lodash', 'material-ui', 'moment', 'blockies'
|
'browserify-aes',
|
||||||
|
'chart.js',
|
||||||
|
'ethereumjs-tx',
|
||||||
|
'lodash',
|
||||||
|
'material-ui',
|
||||||
|
'mobx',
|
||||||
|
'mobx-react',
|
||||||
|
'moment',
|
||||||
|
'react',
|
||||||
|
'react-dom',
|
||||||
|
'react-redux',
|
||||||
|
'react-router',
|
||||||
|
'react-router-redux',
|
||||||
|
'recharts',
|
||||||
|
'redux',
|
||||||
|
'redux-thunk',
|
||||||
|
'scryptsy'
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!isProd) {
|
if (!isProd) {
|
||||||
@ -44,6 +61,11 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
test: /\.json$/,
|
test: /\.json$/,
|
||||||
loaders: ['json']
|
loaders: ['json']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
include: /(ethereumjs-tx)/,
|
||||||
|
loaders: [ 'happypack/loader?id=js' ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -63,6 +85,12 @@ module.exports = {
|
|||||||
'process.env': {
|
'process.env': {
|
||||||
NODE_ENV: JSON.stringify(ENV)
|
NODE_ENV: JSON.stringify(ENV)
|
||||||
}
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
new HappyPack({
|
||||||
|
id: 'js',
|
||||||
|
threads: 4,
|
||||||
|
loaders: ['babel']
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ fn execute_import(cmd: ImportBlockchain) -> Result<String, String> {
|
|||||||
let panic_handler = PanicHandler::new_in_arc();
|
let panic_handler = PanicHandler::new_in_arc();
|
||||||
|
|
||||||
// create dirs used by parity
|
// create dirs used by parity
|
||||||
try!(cmd.dirs.create_dirs());
|
try!(cmd.dirs.create_dirs(false, false));
|
||||||
|
|
||||||
// load spec file
|
// load spec file
|
||||||
let spec = try!(cmd.spec.spec());
|
let spec = try!(cmd.spec.spec());
|
||||||
@ -263,7 +263,7 @@ fn execute_export(cmd: ExportBlockchain) -> Result<String, String> {
|
|||||||
let panic_handler = PanicHandler::new_in_arc();
|
let panic_handler = PanicHandler::new_in_arc();
|
||||||
|
|
||||||
// create dirs used by parity
|
// create dirs used by parity
|
||||||
try!(cmd.dirs.create_dirs());
|
try!(cmd.dirs.create_dirs(false, false));
|
||||||
|
|
||||||
let format = cmd.format.unwrap_or_default();
|
let format = cmd.format.unwrap_or_default();
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ Operating Options:
|
|||||||
(default: {flag_mode_alarm}).
|
(default: {flag_mode_alarm}).
|
||||||
--chain CHAIN Specify the blockchain type. CHAIN may be either a
|
--chain CHAIN Specify the blockchain type. CHAIN may be either a
|
||||||
JSON chain specification file or olympic, frontier,
|
JSON chain specification file or olympic, frontier,
|
||||||
homestead, mainnet, morden, classic, expanse or
|
homestead, mainnet, morden, classic, expanse,
|
||||||
testnet (default: {flag_chain}).
|
testnet or dev (default: {flag_chain}).
|
||||||
-d --db-path PATH Specify the database & configuration directory path
|
-d --db-path PATH Specify the database & configuration directory path
|
||||||
(default: {flag_db_path}).
|
(default: {flag_db_path}).
|
||||||
--keys-path PATH Specify the path for JSON key files to be found
|
--keys-path PATH Specify the path for JSON key files to be found
|
||||||
|
@ -44,11 +44,15 @@ impl Default for Directories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Directories {
|
impl Directories {
|
||||||
pub fn create_dirs(&self) -> Result<(), String> {
|
pub fn create_dirs(&self, dapps_enabled: bool, signer_enabled: bool) -> Result<(), String> {
|
||||||
try!(fs::create_dir_all(&self.db).map_err(|e| e.to_string()));
|
try!(fs::create_dir_all(&self.db).map_err(|e| e.to_string()));
|
||||||
try!(fs::create_dir_all(&self.keys).map_err(|e| e.to_string()));
|
try!(fs::create_dir_all(&self.keys).map_err(|e| e.to_string()));
|
||||||
|
if signer_enabled {
|
||||||
try!(fs::create_dir_all(&self.signer).map_err(|e| e.to_string()));
|
try!(fs::create_dir_all(&self.signer).map_err(|e| e.to_string()));
|
||||||
|
}
|
||||||
|
if dapps_enabled {
|
||||||
try!(fs::create_dir_all(&self.dapps).map_err(|e| e.to_string()));
|
try!(fs::create_dir_all(&self.dapps).map_err(|e| e.to_string()));
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ pub enum SpecType {
|
|||||||
Olympic,
|
Olympic,
|
||||||
Classic,
|
Classic,
|
||||||
Expanse,
|
Expanse,
|
||||||
|
Dev,
|
||||||
Custom(String),
|
Custom(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ impl str::FromStr for SpecType {
|
|||||||
"morden" | "testnet" => SpecType::Testnet,
|
"morden" | "testnet" => SpecType::Testnet,
|
||||||
"olympic" => SpecType::Olympic,
|
"olympic" => SpecType::Olympic,
|
||||||
"expanse" => SpecType::Expanse,
|
"expanse" => SpecType::Expanse,
|
||||||
|
"dev" => SpecType::Dev,
|
||||||
other => SpecType::Custom(other.into()),
|
other => SpecType::Custom(other.into()),
|
||||||
};
|
};
|
||||||
Ok(spec)
|
Ok(spec)
|
||||||
@ -64,6 +66,7 @@ impl SpecType {
|
|||||||
SpecType::Olympic => Ok(ethereum::new_olympic()),
|
SpecType::Olympic => Ok(ethereum::new_olympic()),
|
||||||
SpecType::Classic => Ok(ethereum::new_classic()),
|
SpecType::Classic => Ok(ethereum::new_classic()),
|
||||||
SpecType::Expanse => Ok(ethereum::new_expanse()),
|
SpecType::Expanse => Ok(ethereum::new_expanse()),
|
||||||
|
SpecType::Dev => Ok(Spec::new_instant()),
|
||||||
SpecType::Custom(ref filename) => {
|
SpecType::Custom(ref filename) => {
|
||||||
let file = try!(fs::File::open(filename).map_err(|_| "Could not load specification file."));
|
let file = try!(fs::File::open(filename).map_err(|_| "Could not load specification file."));
|
||||||
Spec::load(file)
|
Spec::load(file)
|
||||||
|
@ -110,7 +110,7 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<(), String> {
|
|||||||
raise_fd_limit();
|
raise_fd_limit();
|
||||||
|
|
||||||
// create dirs used by parity
|
// create dirs used by parity
|
||||||
try!(cmd.dirs.create_dirs());
|
try!(cmd.dirs.create_dirs(cmd.dapps_conf.enabled, cmd.signer_conf.enabled));
|
||||||
|
|
||||||
// load spec
|
// load spec
|
||||||
let spec = try!(cmd.spec.spec());
|
let spec = try!(cmd.spec.spec());
|
||||||
|
Loading…
Reference in New Issue
Block a user