2019-10-03 17:16:09 +03:00
|
|
|
// Copyright 2019 The Grin Developers
|
2019-02-13 18:05:19 +03:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
//! Grin wallet command-line function implementations
|
|
|
|
|
|
|
|
use crate::api::TLSConfig;
|
2019-10-14 22:24:09 +03:00
|
|
|
use crate::config::{TorConfig, WalletConfig, WALLET_CONFIG_FILE_NAME};
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
use crate::core::{core, global};
|
|
|
|
use crate::error::{Error, ErrorKind};
|
|
|
|
use crate::impls::{create_sender, KeybaseAllChannels, SlateGetter as _, SlateReceiver as _};
|
|
|
|
use crate::impls::{PathToSlate, SlatePutter};
|
|
|
|
use crate::keychain;
|
|
|
|
use crate::libwallet::{InitTxArgs, IssueInvoiceTxArgs, NodeClient, WalletInst, WalletLCProvider};
|
2019-08-06 14:50:41 +03:00
|
|
|
use crate::util::secp::key::SecretKey;
|
2019-02-13 18:05:19 +03:00
|
|
|
use crate::util::{Mutex, ZeroingString};
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
use crate::{controller, display};
|
|
|
|
use serde_json as json;
|
2019-02-13 18:05:19 +03:00
|
|
|
use std::fs::File;
|
|
|
|
use std::io::Write;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use std::thread;
|
|
|
|
use std::time::Duration;
|
|
|
|
use uuid::Uuid;
|
|
|
|
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
fn show_recovery_phrase(phrase: ZeroingString) {
|
|
|
|
println!("Your recovery phrase is:");
|
|
|
|
println!();
|
|
|
|
println!("{}", &*phrase);
|
|
|
|
println!();
|
|
|
|
println!("Please back-up these words in a non-digital format.");
|
|
|
|
}
|
2019-02-13 18:05:19 +03:00
|
|
|
|
|
|
|
/// Arguments common to all wallet commands
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct GlobalArgs {
|
|
|
|
pub account: String,
|
2019-09-12 15:18:15 +03:00
|
|
|
pub api_secret: Option<String>,
|
2019-02-13 18:05:19 +03:00
|
|
|
pub node_api_secret: Option<String>,
|
|
|
|
pub show_spent: bool,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
pub chain_type: global::ChainTypes,
|
2019-02-13 18:05:19 +03:00
|
|
|
pub password: Option<ZeroingString>,
|
|
|
|
pub tls_conf: Option<TLSConfig>,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Arguments for init command
|
|
|
|
pub struct InitArgs {
|
|
|
|
/// BIP39 recovery phrase length
|
|
|
|
pub list_length: usize,
|
|
|
|
pub password: ZeroingString,
|
|
|
|
pub config: WalletConfig,
|
|
|
|
pub recovery_phrase: Option<ZeroingString>,
|
|
|
|
pub restore: bool,
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn init<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
g_args: &GlobalArgs,
|
|
|
|
args: InitArgs,
|
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
|
|
|
let mut w_lock = wallet.lock();
|
|
|
|
let p = w_lock.lc_provider()?;
|
2019-10-14 22:24:09 +03:00
|
|
|
p.create_config(
|
|
|
|
&g_args.chain_type,
|
|
|
|
WALLET_CONFIG_FILE_NAME,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
)?;
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
p.create_wallet(
|
|
|
|
None,
|
2019-02-13 18:05:19 +03:00
|
|
|
args.recovery_phrase,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
args.list_length,
|
|
|
|
args.password.clone(),
|
2019-09-02 18:03:35 +03:00
|
|
|
false,
|
2019-02-13 18:05:19 +03:00
|
|
|
)?;
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
|
|
|
|
let m = p.get_mnemonic(None, args.password)?;
|
|
|
|
show_recovery_phrase(m);
|
2019-02-13 18:05:19 +03:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Argument for recover
|
|
|
|
pub struct RecoverArgs {
|
|
|
|
pub recovery_phrase: Option<ZeroingString>,
|
|
|
|
pub passphrase: ZeroingString,
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn recover<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
args: RecoverArgs,
|
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
|
|
|
let mut w_lock = wallet.lock();
|
|
|
|
let p = w_lock.lc_provider()?;
|
|
|
|
match args.recovery_phrase {
|
|
|
|
None => {
|
|
|
|
let m = p.get_mnemonic(None, args.passphrase)?;
|
|
|
|
show_recovery_phrase(m);
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
Some(phrase) => p.recover_from_mnemonic(phrase, args.passphrase)?,
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Arguments for listen command
|
|
|
|
pub struct ListenArgs {
|
|
|
|
pub method: String,
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn listen<L, C, K>(
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-09-02 18:03:35 +03:00
|
|
|
keychain_mask: Arc<Mutex<Option<SecretKey>>>,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
config: &WalletConfig,
|
2019-10-14 22:24:09 +03:00
|
|
|
tor_config: &TorConfig,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
args: &ListenArgs,
|
|
|
|
g_args: &GlobalArgs,
|
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
|
|
|
{
|
2019-03-17 22:14:58 +03:00
|
|
|
let res = match args.method.as_str() {
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
"http" => controller::foreign_listener(
|
|
|
|
wallet.clone(),
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
&config.api_listen_addr(),
|
|
|
|
g_args.tls_conf.clone(),
|
2019-10-14 22:24:09 +03:00
|
|
|
tor_config.use_tor_listener,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
),
|
|
|
|
"keybase" => KeybaseAllChannels::new()?.listen(
|
|
|
|
config.clone(),
|
|
|
|
g_args.password.clone().unwrap(),
|
|
|
|
&g_args.account,
|
|
|
|
g_args.node_api_secret.clone(),
|
|
|
|
),
|
|
|
|
method => {
|
|
|
|
return Err(ErrorKind::ArgumentError(format!(
|
|
|
|
"No listener for method \"{}\".",
|
|
|
|
method
|
|
|
|
))
|
|
|
|
.into());
|
2019-03-17 22:14:58 +03:00
|
|
|
}
|
2019-02-13 18:05:19 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
if let Err(e) = res {
|
|
|
|
return Err(ErrorKind::LibWallet(e.kind(), e.cause_string()).into());
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
pub fn owner_api<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<SecretKey>,
|
2019-02-13 18:05:19 +03:00
|
|
|
config: &WalletConfig,
|
|
|
|
g_args: &GlobalArgs,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
|
|
|
L: WalletLCProvider<'static, C, K> + Send + Sync + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
|
|
|
{
|
2019-09-02 18:03:35 +03:00
|
|
|
// keychain mask needs to be a sinlge instance, in case the foreign API is
|
|
|
|
// also being run at the same time
|
|
|
|
let km = Arc::new(Mutex::new(keychain_mask));
|
2019-02-13 18:05:19 +03:00
|
|
|
let res = controller::owner_listener(
|
|
|
|
wallet,
|
2019-09-02 18:03:35 +03:00
|
|
|
km,
|
2019-02-13 18:05:19 +03:00
|
|
|
config.owner_api_listen_addr().as_str(),
|
2019-09-12 15:18:15 +03:00
|
|
|
g_args.api_secret.clone(),
|
2019-02-13 18:05:19 +03:00
|
|
|
g_args.tls_conf.clone(),
|
|
|
|
config.owner_api_include_foreign.clone(),
|
|
|
|
);
|
|
|
|
if let Err(e) = res {
|
|
|
|
return Err(ErrorKind::LibWallet(e.kind(), e.cause_string()).into());
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Arguments for account command
|
|
|
|
pub struct AccountArgs {
|
|
|
|
pub create: Option<String>,
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn account<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-02-13 18:05:19 +03:00
|
|
|
args: AccountArgs,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
2019-02-13 18:05:19 +03:00
|
|
|
if args.create.is_none() {
|
2019-08-06 14:50:41 +03:00
|
|
|
let res = controller::owner_single_use(wallet, keychain_mask, |api, m| {
|
|
|
|
let acct_mappings = api.accounts(m)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
// give logging thread a moment to catch up
|
|
|
|
thread::sleep(Duration::from_millis(200));
|
|
|
|
display::accounts(acct_mappings);
|
|
|
|
Ok(())
|
|
|
|
});
|
|
|
|
if let Err(e) = res {
|
|
|
|
error!("Error listing accounts: {}", e);
|
|
|
|
return Err(ErrorKind::LibWallet(e.kind(), e.cause_string()).into());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
let label = args.create.unwrap();
|
2019-08-06 14:50:41 +03:00
|
|
|
let res = controller::owner_single_use(wallet, keychain_mask, |api, m| {
|
|
|
|
api.create_account_path(m, &label)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
thread::sleep(Duration::from_millis(200));
|
|
|
|
info!("Account: '{}' Created!", label);
|
|
|
|
Ok(())
|
|
|
|
});
|
|
|
|
if let Err(e) = res {
|
|
|
|
thread::sleep(Duration::from_millis(200));
|
|
|
|
error!("Error creating account '{}': {}", label, e);
|
|
|
|
return Err(ErrorKind::LibWallet(e.kind(), e.cause_string()).into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Arguments for the send command
|
|
|
|
pub struct SendArgs {
|
|
|
|
pub amount: u64,
|
|
|
|
pub message: Option<String>,
|
|
|
|
pub minimum_confirmations: u64,
|
|
|
|
pub selection_strategy: String,
|
|
|
|
pub estimate_selection_strategies: bool,
|
|
|
|
pub method: String,
|
|
|
|
pub dest: String,
|
|
|
|
pub change_outputs: usize,
|
|
|
|
pub fluff: bool,
|
|
|
|
pub max_outputs: usize,
|
2019-03-12 19:48:14 +03:00
|
|
|
pub target_slate_version: Option<u16>,
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn send<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-10-14 22:24:09 +03:00
|
|
|
tor_config: Option<TorConfig>,
|
2019-02-13 18:05:19 +03:00
|
|
|
args: SendArgs,
|
|
|
|
dark_scheme: bool,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
2019-02-13 18:05:19 +03:00
|
|
|
if args.estimate_selection_strategies {
|
|
|
|
let strategies = vec!["smallest", "all"]
|
|
|
|
.into_iter()
|
|
|
|
.map(|strategy| {
|
2019-03-29 19:00:02 +03:00
|
|
|
let init_args = InitTxArgs {
|
|
|
|
src_acct_name: None,
|
|
|
|
amount: args.amount,
|
|
|
|
minimum_confirmations: args.minimum_confirmations,
|
|
|
|
max_outputs: args.max_outputs as u32,
|
|
|
|
num_change_outputs: args.change_outputs as u32,
|
|
|
|
selection_strategy_is_use_all: strategy == "all",
|
|
|
|
estimate_only: Some(true),
|
|
|
|
..Default::default()
|
|
|
|
};
|
2019-08-06 14:50:41 +03:00
|
|
|
let slate = api.init_send_tx(m, init_args).unwrap();
|
2019-03-29 19:00:02 +03:00
|
|
|
(strategy, slate.amount, slate.fee)
|
2019-02-13 18:05:19 +03:00
|
|
|
})
|
|
|
|
.collect();
|
|
|
|
display::estimate(args.amount, strategies, dark_scheme);
|
|
|
|
} else {
|
2019-03-29 19:00:02 +03:00
|
|
|
let init_args = InitTxArgs {
|
|
|
|
src_acct_name: None,
|
|
|
|
amount: args.amount,
|
|
|
|
minimum_confirmations: args.minimum_confirmations,
|
|
|
|
max_outputs: args.max_outputs as u32,
|
|
|
|
num_change_outputs: args.change_outputs as u32,
|
|
|
|
selection_strategy_is_use_all: args.selection_strategy == "all",
|
|
|
|
message: args.message.clone(),
|
|
|
|
target_slate_version: args.target_slate_version,
|
|
|
|
send_args: None,
|
|
|
|
..Default::default()
|
|
|
|
};
|
2019-08-06 14:50:41 +03:00
|
|
|
let result = api.init_send_tx(m, init_args);
|
2019-03-14 18:05:13 +03:00
|
|
|
let mut slate = match result {
|
2019-02-13 18:05:19 +03:00
|
|
|
Ok(s) => {
|
|
|
|
info!(
|
|
|
|
"Tx created: {} grin to {} (strategy '{}')",
|
|
|
|
core::amount_to_hr_string(args.amount, false),
|
|
|
|
args.dest,
|
|
|
|
args.selection_strategy,
|
|
|
|
);
|
|
|
|
s
|
|
|
|
}
|
|
|
|
Err(e) => {
|
|
|
|
info!("Tx not created: {}", e);
|
|
|
|
return Err(e);
|
|
|
|
}
|
|
|
|
};
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
|
|
|
|
match args.method.as_str() {
|
|
|
|
"file" => {
|
|
|
|
PathToSlate((&args.dest).into()).put_tx(&slate)?;
|
2019-08-06 14:50:41 +03:00
|
|
|
api.tx_lock_outputs(m, &slate, 0)?;
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
return Ok(());
|
|
|
|
}
|
|
|
|
"self" => {
|
2019-08-06 14:50:41 +03:00
|
|
|
api.tx_lock_outputs(m, &slate, 0)?;
|
|
|
|
let km = match keychain_mask.as_ref() {
|
|
|
|
None => None,
|
|
|
|
Some(&m) => Some(m.to_owned()),
|
|
|
|
};
|
|
|
|
controller::foreign_single_use(wallet, km, |api| {
|
2019-03-29 11:46:12 +03:00
|
|
|
slate = api.receive_tx(&slate, Some(&args.dest), None)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
}
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
method => {
|
2019-10-14 22:24:09 +03:00
|
|
|
let sender = create_sender(method, &args.dest, tor_config)?;
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
slate = sender.send_tx(&slate)?;
|
2019-08-06 14:50:41 +03:00
|
|
|
api.tx_lock_outputs(m, &slate, 0)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
|
|
|
}
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
|
2019-08-06 14:50:41 +03:00
|
|
|
api.verify_slate_messages(m, &slate).map_err(|e| {
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
error!("Error validating participant messages: {}", e);
|
|
|
|
e
|
|
|
|
})?;
|
2019-08-06 14:50:41 +03:00
|
|
|
slate = api.finalize_tx(m, &slate)?;
|
|
|
|
let result = api.post_tx(m, &slate.tx, args.fluff);
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
match result {
|
|
|
|
Ok(_) => {
|
|
|
|
info!("Tx sent ok",);
|
|
|
|
return Ok(());
|
|
|
|
}
|
|
|
|
Err(e) => {
|
|
|
|
error!("Tx sent fail: {}", e);
|
|
|
|
return Err(e);
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Receive command argument
|
|
|
|
pub struct ReceiveArgs {
|
|
|
|
pub input: String,
|
|
|
|
pub message: Option<String>,
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn receive<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-02-13 18:05:19 +03:00
|
|
|
g_args: &GlobalArgs,
|
|
|
|
args: ReceiveArgs,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K>,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
|
|
|
let mut slate = PathToSlate((&args.input).into()).get_tx()?;
|
2019-08-06 14:50:41 +03:00
|
|
|
let km = match keychain_mask.as_ref() {
|
|
|
|
None => None,
|
|
|
|
Some(&m) => Some(m.to_owned()),
|
|
|
|
};
|
|
|
|
controller::foreign_single_use(wallet, km, |api| {
|
2019-02-13 18:05:19 +03:00
|
|
|
if let Err(e) = api.verify_slate_messages(&slate) {
|
|
|
|
error!("Error validating participant messages: {}", e);
|
|
|
|
return Err(e);
|
|
|
|
}
|
2019-03-29 11:46:12 +03:00
|
|
|
slate = api.receive_tx(&slate, Some(&g_args.account), args.message.clone())?;
|
2019-02-13 18:05:19 +03:00
|
|
|
Ok(())
|
|
|
|
})?;
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
PathToSlate(format!("{}.response", args.input).into()).put_tx(&slate)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
info!(
|
2019-05-31 10:33:23 +03:00
|
|
|
"Response file {}.response generated, and can be sent back to the transaction originator.",
|
2019-02-13 18:05:19 +03:00
|
|
|
args.input
|
|
|
|
);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Finalize command args
|
|
|
|
pub struct FinalizeArgs {
|
|
|
|
pub input: String,
|
|
|
|
pub fluff: bool,
|
2019-11-18 13:19:00 +03:00
|
|
|
pub nopost: bool,
|
|
|
|
pub dest: Option<String>,
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn finalize<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-02-13 18:05:19 +03:00
|
|
|
args: FinalizeArgs,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
|
|
|
let mut slate = PathToSlate((&args.input).into()).get_tx()?;
|
|
|
|
|
2019-05-09 21:06:32 +03:00
|
|
|
// Rather than duplicating the entire command, we'll just
|
|
|
|
// try to determine what kind of finalization this is
|
|
|
|
// based on the slate contents
|
|
|
|
// for now, we can tell this is an invoice transaction
|
|
|
|
// if the receipient (participant 1) hasn't completed sigs
|
|
|
|
let part_data = slate.participant_with_id(1);
|
|
|
|
let is_invoice = {
|
|
|
|
match part_data {
|
|
|
|
None => {
|
|
|
|
error!("Expected slate participant data missing");
|
|
|
|
return Err(ErrorKind::ArgumentError(
|
|
|
|
"Expected Slate participant data missing".into(),
|
|
|
|
))?;
|
|
|
|
}
|
|
|
|
Some(p) => !p.is_complete(),
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
2019-05-09 21:06:32 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
if is_invoice {
|
2019-08-06 14:50:41 +03:00
|
|
|
let km = match keychain_mask.as_ref() {
|
|
|
|
None => None,
|
|
|
|
Some(&m) => Some(m.to_owned()),
|
|
|
|
};
|
|
|
|
controller::foreign_single_use(wallet.clone(), km, |api| {
|
2019-05-09 21:06:32 +03:00
|
|
|
if let Err(e) = api.verify_slate_messages(&slate) {
|
|
|
|
error!("Error validating participant messages: {}", e);
|
|
|
|
return Err(e);
|
|
|
|
}
|
|
|
|
slate = api.finalize_invoice_tx(&mut slate)?;
|
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
} else {
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
|
|
|
if let Err(e) = api.verify_slate_messages(m, &slate) {
|
2019-05-09 21:06:32 +03:00
|
|
|
error!("Error validating participant messages: {}", e);
|
|
|
|
return Err(e);
|
|
|
|
}
|
2019-08-06 14:50:41 +03:00
|
|
|
slate = api.finalize_tx(m, &mut slate)?;
|
2019-05-09 21:06:32 +03:00
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
}
|
2019-02-13 18:05:19 +03:00
|
|
|
|
2019-11-18 13:19:00 +03:00
|
|
|
if !args.nopost {
|
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
|
|
|
let result = api.post_tx(m, &slate.tx, args.fluff);
|
|
|
|
match result {
|
|
|
|
Ok(_) => {
|
|
|
|
info!(
|
|
|
|
"Transaction sent successfully, check the wallet again for confirmation."
|
|
|
|
);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
Err(e) => {
|
|
|
|
error!("Tx not sent: {}", e);
|
|
|
|
Err(e)
|
|
|
|
}
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
2019-11-18 13:19:00 +03:00
|
|
|
})?;
|
|
|
|
}
|
|
|
|
|
|
|
|
if args.dest.is_some() {
|
|
|
|
PathToSlate((&args.dest.unwrap()).into()).put_tx(&slate)?;
|
|
|
|
}
|
2019-05-09 21:06:32 +03:00
|
|
|
|
2019-02-13 18:05:19 +03:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2019-05-09 21:06:32 +03:00
|
|
|
/// Issue Invoice Args
|
|
|
|
pub struct IssueInvoiceArgs {
|
|
|
|
/// output file
|
|
|
|
pub dest: String,
|
|
|
|
/// issue invoice tx args
|
|
|
|
pub issue_args: IssueInvoiceTxArgs,
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn issue_invoice_tx<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-05-09 21:06:32 +03:00
|
|
|
args: IssueInvoiceArgs,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
|
|
|
let slate = api.issue_invoice_tx(m, args.issue_args)?;
|
2019-05-09 21:06:32 +03:00
|
|
|
let mut tx_file = File::create(args.dest.clone())?;
|
|
|
|
tx_file.write_all(json::to_string(&slate).unwrap().as_bytes())?;
|
|
|
|
tx_file.sync_all()?;
|
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Arguments for the process_invoice command
|
|
|
|
pub struct ProcessInvoiceArgs {
|
|
|
|
pub message: Option<String>,
|
|
|
|
pub minimum_confirmations: u64,
|
|
|
|
pub selection_strategy: String,
|
|
|
|
pub method: String,
|
|
|
|
pub dest: String,
|
|
|
|
pub max_outputs: usize,
|
|
|
|
pub input: String,
|
|
|
|
pub estimate_selection_strategies: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Process invoice
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn process_invoice<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-10-14 22:24:09 +03:00
|
|
|
tor_config: Option<TorConfig>,
|
2019-05-09 21:06:32 +03:00
|
|
|
args: ProcessInvoiceArgs,
|
|
|
|
dark_scheme: bool,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
|
|
|
let slate = PathToSlate((&args.input).into()).get_tx()?;
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
2019-05-09 21:06:32 +03:00
|
|
|
if args.estimate_selection_strategies {
|
|
|
|
let strategies = vec!["smallest", "all"]
|
|
|
|
.into_iter()
|
|
|
|
.map(|strategy| {
|
|
|
|
let init_args = InitTxArgs {
|
|
|
|
src_acct_name: None,
|
|
|
|
amount: slate.amount,
|
|
|
|
minimum_confirmations: args.minimum_confirmations,
|
|
|
|
max_outputs: args.max_outputs as u32,
|
|
|
|
num_change_outputs: 1u32,
|
|
|
|
selection_strategy_is_use_all: strategy == "all",
|
|
|
|
estimate_only: Some(true),
|
|
|
|
..Default::default()
|
|
|
|
};
|
2019-08-06 14:50:41 +03:00
|
|
|
let slate = api.init_send_tx(m, init_args).unwrap();
|
2019-05-09 21:06:32 +03:00
|
|
|
(strategy, slate.amount, slate.fee)
|
|
|
|
})
|
|
|
|
.collect();
|
|
|
|
display::estimate(slate.amount, strategies, dark_scheme);
|
|
|
|
} else {
|
|
|
|
let init_args = InitTxArgs {
|
|
|
|
src_acct_name: None,
|
|
|
|
amount: 0,
|
|
|
|
minimum_confirmations: args.minimum_confirmations,
|
|
|
|
max_outputs: args.max_outputs as u32,
|
|
|
|
num_change_outputs: 1u32,
|
|
|
|
selection_strategy_is_use_all: args.selection_strategy == "all",
|
|
|
|
message: args.message.clone(),
|
|
|
|
send_args: None,
|
|
|
|
..Default::default()
|
|
|
|
};
|
2019-08-06 14:50:41 +03:00
|
|
|
if let Err(e) = api.verify_slate_messages(m, &slate) {
|
2019-05-09 21:06:32 +03:00
|
|
|
error!("Error validating participant messages: {}", e);
|
|
|
|
return Err(e);
|
|
|
|
}
|
2019-08-06 14:50:41 +03:00
|
|
|
let result = api.process_invoice_tx(m, &slate, init_args);
|
2019-05-09 21:06:32 +03:00
|
|
|
let mut slate = match result {
|
|
|
|
Ok(s) => {
|
|
|
|
info!(
|
|
|
|
"Invoice processed: {} grin to {} (strategy '{}')",
|
|
|
|
core::amount_to_hr_string(slate.amount, false),
|
|
|
|
args.dest,
|
|
|
|
args.selection_strategy,
|
|
|
|
);
|
|
|
|
s
|
|
|
|
}
|
|
|
|
Err(e) => {
|
|
|
|
info!("Tx not created: {}", e);
|
|
|
|
return Err(e);
|
|
|
|
}
|
|
|
|
};
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
|
|
|
|
match args.method.as_str() {
|
|
|
|
"file" => {
|
|
|
|
let slate_putter = PathToSlate((&args.dest).into());
|
|
|
|
slate_putter.put_tx(&slate)?;
|
2019-08-06 14:50:41 +03:00
|
|
|
api.tx_lock_outputs(m, &slate, 0)?;
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
}
|
|
|
|
"self" => {
|
2019-08-06 14:50:41 +03:00
|
|
|
api.tx_lock_outputs(m, &slate, 0)?;
|
|
|
|
let km = match keychain_mask.as_ref() {
|
|
|
|
None => None,
|
|
|
|
Some(&m) => Some(m.to_owned()),
|
|
|
|
};
|
|
|
|
controller::foreign_single_use(wallet, km, |api| {
|
2019-05-09 21:06:32 +03:00
|
|
|
slate = api.finalize_invoice_tx(&slate)?;
|
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
}
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
method => {
|
2019-10-14 22:24:09 +03:00
|
|
|
let sender = create_sender(method, &args.dest, tor_config)?;
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
slate = sender.send_tx(&slate)?;
|
2019-08-06 14:50:41 +03:00
|
|
|
api.tx_lock_outputs(m, &slate, 0)?;
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
}
|
2019-05-09 21:06:32 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|
2019-02-13 18:05:19 +03:00
|
|
|
/// Info command args
|
|
|
|
pub struct InfoArgs {
|
|
|
|
pub minimum_confirmations: u64,
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn info<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-02-13 18:05:19 +03:00
|
|
|
g_args: &GlobalArgs,
|
|
|
|
args: InfoArgs,
|
|
|
|
dark_scheme: bool,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
2019-02-13 18:05:19 +03:00
|
|
|
let (validated, wallet_info) =
|
2019-08-06 14:50:41 +03:00
|
|
|
api.retrieve_summary_info(m, true, args.minimum_confirmations)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
display::info(&g_args.account, &wallet_info, validated, dark_scheme);
|
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn outputs<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-02-13 18:05:19 +03:00
|
|
|
g_args: &GlobalArgs,
|
|
|
|
dark_scheme: bool,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
|
|
|
let res = api.node_height(m)?;
|
|
|
|
let (validated, outputs) = api.retrieve_outputs(m, g_args.show_spent, true, None)?;
|
2019-03-29 19:00:02 +03:00
|
|
|
display::outputs(&g_args.account, res.height, validated, outputs, dark_scheme)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Txs command args
|
|
|
|
pub struct TxsArgs {
|
|
|
|
pub id: Option<u32>,
|
2019-07-08 11:43:56 +03:00
|
|
|
pub tx_slate_id: Option<Uuid>,
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn txs<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-02-13 18:05:19 +03:00
|
|
|
g_args: &GlobalArgs,
|
|
|
|
args: TxsArgs,
|
|
|
|
dark_scheme: bool,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
|
|
|
let res = api.node_height(m)?;
|
|
|
|
let (validated, txs) = api.retrieve_txs(m, true, args.id, args.tx_slate_id)?;
|
2019-07-08 11:43:56 +03:00
|
|
|
let include_status = !args.id.is_some() && !args.tx_slate_id.is_some();
|
2019-02-13 18:05:19 +03:00
|
|
|
display::txs(
|
|
|
|
&g_args.account,
|
2019-03-29 19:00:02 +03:00
|
|
|
res.height,
|
2019-02-13 18:05:19 +03:00
|
|
|
validated,
|
|
|
|
&txs,
|
|
|
|
include_status,
|
|
|
|
dark_scheme,
|
|
|
|
)?;
|
2019-07-08 11:43:56 +03:00
|
|
|
|
|
|
|
// if given a particular transaction id or uuid, also get and display associated
|
2019-02-13 18:05:19 +03:00
|
|
|
// inputs/outputs and messages
|
2019-07-08 11:43:56 +03:00
|
|
|
let id = if args.id.is_some() {
|
|
|
|
args.id
|
|
|
|
} else if args.tx_slate_id.is_some() {
|
|
|
|
if let Some(tx) = txs.iter().find(|t| t.tx_slate_id == args.tx_slate_id) {
|
|
|
|
Some(tx.id)
|
|
|
|
} else {
|
|
|
|
println!("Could not find a transaction matching given txid.\n");
|
|
|
|
None
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
None
|
|
|
|
};
|
|
|
|
|
|
|
|
if id.is_some() {
|
2019-08-06 14:50:41 +03:00
|
|
|
let (_, outputs) = api.retrieve_outputs(m, true, false, id)?;
|
2019-03-29 19:00:02 +03:00
|
|
|
display::outputs(&g_args.account, res.height, validated, outputs, dark_scheme)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
// should only be one here, but just in case
|
2019-04-25 09:59:45 +03:00
|
|
|
for tx in txs {
|
|
|
|
display::tx_messages(&tx, dark_scheme)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
}
|
2019-07-08 11:43:56 +03:00
|
|
|
}
|
|
|
|
|
2019-02-13 18:05:19 +03:00
|
|
|
Ok(())
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:19:00 +03:00
|
|
|
/// Post
|
|
|
|
pub struct PostArgs {
|
|
|
|
pub input: String,
|
|
|
|
pub fluff: bool,
|
|
|
|
}
|
|
|
|
|
2019-11-20 14:01:38 +03:00
|
|
|
pub fn post<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-11-18 13:19:00 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
|
|
|
args: PostArgs,
|
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-20 14:01:38 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
2019-11-18 13:19:00 +03:00
|
|
|
{
|
|
|
|
let slate = PathToSlate((&args.input).into()).get_tx()?;
|
|
|
|
|
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
|
|
|
api.post_tx(m, &slate.tx, args.fluff)?;
|
|
|
|
info!("Posted transaction");
|
|
|
|
return Ok(());
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2019-02-13 18:05:19 +03:00
|
|
|
/// Repost
|
|
|
|
pub struct RepostArgs {
|
|
|
|
pub id: u32,
|
|
|
|
pub dump_file: Option<String>,
|
|
|
|
pub fluff: bool,
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn repost<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-02-13 18:05:19 +03:00
|
|
|
args: RepostArgs,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
|
|
|
let (_, txs) = api.retrieve_txs(m, true, Some(args.id), None)?;
|
|
|
|
let stored_tx = api.get_stored_tx(m, &txs[0])?;
|
2019-02-13 18:05:19 +03:00
|
|
|
if stored_tx.is_none() {
|
|
|
|
error!(
|
|
|
|
"Transaction with id {} does not have transaction data. Not reposting.",
|
|
|
|
args.id
|
|
|
|
);
|
|
|
|
return Ok(());
|
|
|
|
}
|
|
|
|
match args.dump_file {
|
|
|
|
None => {
|
|
|
|
if txs[0].confirmed {
|
|
|
|
error!(
|
|
|
|
"Transaction with id {} is confirmed. Not reposting.",
|
|
|
|
args.id
|
|
|
|
);
|
|
|
|
return Ok(());
|
|
|
|
}
|
2019-08-06 14:50:41 +03:00
|
|
|
api.post_tx(m, &stored_tx.unwrap(), args.fluff)?;
|
2019-02-13 18:05:19 +03:00
|
|
|
info!("Reposted transaction at {}", args.id);
|
|
|
|
return Ok(());
|
|
|
|
}
|
|
|
|
Some(f) => {
|
|
|
|
let mut tx_file = File::create(f.clone())?;
|
|
|
|
tx_file.write_all(json::to_string(&stored_tx).unwrap().as_bytes())?;
|
|
|
|
tx_file.sync_all()?;
|
|
|
|
info!("Dumped transaction data for tx {} to {}", args.id, f);
|
|
|
|
return Ok(());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Cancel
|
|
|
|
pub struct CancelArgs {
|
|
|
|
pub tx_id: Option<u32>,
|
|
|
|
pub tx_slate_id: Option<Uuid>,
|
|
|
|
pub tx_id_string: String,
|
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn cancel<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-02-13 18:05:19 +03:00
|
|
|
args: CancelArgs,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
|
|
|
let result = api.cancel_tx(m, args.tx_id, args.tx_slate_id);
|
2019-02-13 18:05:19 +03:00
|
|
|
match result {
|
|
|
|
Ok(_) => {
|
|
|
|
info!("Transaction {} Cancelled", args.tx_id_string);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
Err(e) => {
|
|
|
|
error!("TX Cancellation failed: {}", e);
|
|
|
|
Err(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2019-03-07 19:19:47 +03:00
|
|
|
/// wallet check
|
|
|
|
pub struct CheckArgs {
|
|
|
|
pub delete_unconfirmed: bool,
|
2019-11-06 13:04:42 +03:00
|
|
|
pub start_height: Option<u64>,
|
2019-03-07 19:19:47 +03:00
|
|
|
}
|
|
|
|
|
2019-11-18 13:49:51 +03:00
|
|
|
pub fn scan<L, C, K>(
|
|
|
|
wallet: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
2019-08-06 14:50:41 +03:00
|
|
|
keychain_mask: Option<&SecretKey>,
|
2019-03-07 19:19:47 +03:00
|
|
|
args: CheckArgs,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
) -> Result<(), Error>
|
|
|
|
where
|
2019-11-18 13:49:51 +03:00
|
|
|
L: WalletLCProvider<'static, C, K> + 'static,
|
|
|
|
C: NodeClient + 'static,
|
|
|
|
K: keychain::Keychain + 'static,
|
Merge milestone/2.1.0 into master (#199)
* version bump for next potential release
* Merge master into milestone/2.1.0 (#182)
* Derive --version output dynamically from cargo package version (#174)
* add --txid to the `wallet txs` command (#176)
* add --txid to the `wallet txs` command
* add test for `wallet txs` command with `--txid` parameter
* Refactor - Split WalletCommAdapter into multiple traits (#180)
* Derive --version output dynamically from cargo package version (#174)
* add server auth argument to http client
* Revert "add server auth argument to http client"
This reverts commit f52a8d2c7cdfb8583af5716ad621eb560811d6ee.
* modify WalletCommAdapter, moving dest argument into fields on implementors,
visiting havok on automated tests, at least one of which is now out of date and failing
* Split WalletCommAdapter into four traits, one for each of its intended behaviors.
* Remove two vestigals
1. args, a stringly typed argument to put_tx
2. NullAdapter, which is no longer used
* Remove unused "params" argument from listen method.
* Re-add previously existing TODO comment
* Fix non-test build
* completely Fix non-test build
* Full Lifecycle API Support (#184)
* refactoring wallet lib traits
* rustfmt
* rustfmt
* add new files
* explicit lifetime specifiers on all wallet traits
* rustfmt
* modify apis to use new walletinst
* rustfmt
* converting controller crate
* rustfmt
* controller crate compiling
* rustfmt
* compilation
* rustfmt
* Remove config from wallet, implement open_wallet, close_wallet in lifecycle provider, remove password + open_with_credentials from WalletBackend + impl
* rustfmt
* full compilation, changing recovery + init to new model
* rustfmt
* wallet initialisation working, init command output and flow identical to v2.0.0 wallet
* rustfmt
* fix listener and owner api startup
* rustfmt
* rustfmt
* move encryption test
* rustfmt
* fix api doctests
* rustfmt
* fix for most tests in controller crate
* rustfmt
* fix for check tests in controller crate
* fix main wallet tests
* rustfmt
* add explicit functions to handle mnemonic recovery, fix CLI recovery workflow
* rustfmt
* update keybase adapter to use new wallet format
* rustfmt
* test fix
* remove debug output
2019-07-29 15:25:03 +03:00
|
|
|
{
|
2019-08-06 14:50:41 +03:00
|
|
|
controller::owner_single_use(wallet.clone(), keychain_mask, |api, m| {
|
2019-11-06 13:04:42 +03:00
|
|
|
warn!("Starting output scan ...",);
|
|
|
|
let result = api.scan(m, args.start_height, args.delete_unconfirmed);
|
2019-02-13 18:05:19 +03:00
|
|
|
match result {
|
|
|
|
Ok(_) => {
|
|
|
|
warn!("Wallet check complete",);
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
Err(e) => {
|
|
|
|
error!("Wallet check failed: {}", e);
|
|
|
|
error!("Backtrace: {}", e.backtrace().unwrap());
|
|
|
|
Err(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})?;
|
|
|
|
Ok(())
|
|
|
|
}
|