finalizing
This commit is contained in:
parent
1aaae7b553
commit
bb8a79f18c
@ -260,11 +260,15 @@ impl Eth for EthClient {
|
|||||||
let client = take_weak!(self.client);
|
let client = take_weak!(self.client);
|
||||||
let store = client.secret_store().read().unwrap();
|
let store = client.secret_store().read().unwrap();
|
||||||
match store.account_secret(&transaction_request.from) {
|
match store.account_secret(&transaction_request.from) {
|
||||||
Ok(_) => {
|
Ok(secret) => {
|
||||||
// todo: actually sign and push to queue transaction here
|
let sync = take_weak!(self.sync);
|
||||||
Ok(Value::Bool(true))
|
let (transaction, _) = transaction_request.to_eth();
|
||||||
|
let signed_transaction = transaction.sign(&secret);
|
||||||
|
let hash = signed_transaction.hash();
|
||||||
|
sync.insert_transaction(signed_transaction);
|
||||||
|
to_value(&hash)
|
||||||
},
|
},
|
||||||
Err(_) => { Ok(Value::Bool(false ))}
|
Err(_) => { to_value(&U256::zero()) }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ impl Bytes {
|
|||||||
pub fn new(bytes: Vec<u8>) -> Bytes {
|
pub fn new(bytes: Vec<u8>) -> Bytes {
|
||||||
Bytes(bytes)
|
Bytes(bytes)
|
||||||
}
|
}
|
||||||
|
pub fn to_vec(self) -> Vec<u8> { let Bytes(x) = self; x }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Bytes {
|
impl Default for Bytes {
|
||||||
|
@ -19,7 +19,6 @@ use ethcore::transaction::{LocalizedTransaction, Action};
|
|||||||
use v1::types::{Bytes, OptionalValue};
|
use v1::types::{Bytes, OptionalValue};
|
||||||
use serde::{Deserializer, Error};
|
use serde::{Deserializer, Error};
|
||||||
use ethcore;
|
use ethcore;
|
||||||
use util;
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize)]
|
#[derive(Debug, Default, Serialize)]
|
||||||
pub struct Transaction {
|
pub struct Transaction {
|
||||||
@ -53,7 +52,8 @@ pub struct TransactionRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TransactionRequest {
|
impl TransactionRequest {
|
||||||
fn to_eth(self) -> (ethcore::transaction::Transaction, Address) {
|
/// maps transaction request to the transaction that can be signed and inserted
|
||||||
|
pub fn to_eth(self) -> (ethcore::transaction::Transaction, Address) {
|
||||||
(ethcore::transaction::Transaction {
|
(ethcore::transaction::Transaction {
|
||||||
nonce: self.nonce.unwrap_or(U256::zero()),
|
nonce: self.nonce.unwrap_or(U256::zero()),
|
||||||
action: match self.to {
|
action: match self.to {
|
||||||
@ -63,7 +63,7 @@ impl TransactionRequest {
|
|||||||
gas: self.gas.unwrap_or(U256::zero()),
|
gas: self.gas.unwrap_or(U256::zero()),
|
||||||
gas_price: self.gas_price.unwrap_or(U256::zero()),
|
gas_price: self.gas_price.unwrap_or(U256::zero()),
|
||||||
value: self.value.unwrap_or(U256::zero()),
|
value: self.value.unwrap_or(U256::zero()),
|
||||||
data: { let (ref x) = self.data; x }
|
data: self.data.to_vec()
|
||||||
}, self.from)
|
}, self.from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user