Skip to content

Commit

Permalink
Extend PendingContract type to support sign_and_execute
Browse files Browse the repository at this point in the history
  • Loading branch information
rockbmb committed Sep 12, 2019
1 parent b5b2f56 commit 4de83e3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/contract/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,11 @@ impl<T: Transport> Builder<T> {
from: Address,
password: &str,
web3: crate::Web3<T>,
) -> Result<PendingContract<T, Ft>, ethabi::Error>
) -> Result<PendingContract<T, Box<dyn Future<Item = TransactionReceipt, Error = crate::error::Error>>>, ethabi::Error>
where
P: Tokenize,
V: AsRef<str>,
T: Transport,
Ft: Future<Item = TransactionReceipt, Error = crate::error::Error>,
T: Transport + 'static,
{
let options = self.options;
let eth = self.eth;
Expand Down Expand Up @@ -162,19 +161,22 @@ impl<T: Transport> Builder<T> {
condition: options.condition,
};

let waiting = web3.personal().sign_transaction(tx, password).and_then(|signed_tx| {
let transport = eth.transport().clone();
let poll_interval = self.poll_interval.clone();
let confirmations = self.confirmations.clone();
let waiting = web3.personal().sign_transaction(tx, password).and_then(move |signed_tx| {
confirm::send_raw_transaction_with_confirmation(
eth.transport().clone(),
transport,
signed_tx.raw,
self.poll_interval,
self.confirmations,
poll_interval,
confirmations,
)
});

Ok(PendingContract {
eth: Some(eth),
abi: Some(abi),
waiting,
waiting: Box::new(waiting),
})
}
}
Expand Down

0 comments on commit 4de83e3

Please sign in to comment.