authors = ["Riccardo Casatta <riccardo@casatta.it>", "Alekos Filini <alekos.filini@gmail.com>"]
[dependencies]
+magical-macros = { path = "./macros" }
log = "^0.4"
bitcoin = { version = "0.23", features = ["use-serde"] }
miniscript = { version = "1.0" }
sled = { version = "0.31.0", optional = true }
electrum-client = { version = "0.2.0-beta.1", optional = true }
reqwest = { version = "0.10", optional = true, features = ["json"] }
-tokio = { version = "0.2", optional = true, features = ["rt-core"] }
futures = { version = "0.3", optional = true }
clap = { version = "2.33", optional = true }
base64 = { version = "^0.11", optional = true }
+# Platform-specific dependencies
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+tokio = { version = "0.2", features = ["rt-core"] }
+
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+async-trait = "0.1"
+
[features]
minimal = []
compiler = ["miniscript/compiler"]
default = ["key-value-db", "electrum"]
electrum = ["electrum-client"]
-esplora = ["reqwest", "futures", "tokio"]
+esplora = ["reqwest", "futures"]
key-value-db = ["sled"]
cli-utils = ["clap", "base64"]
.subcommand(SubCommand::with_name("repl").about("Opens an interactive shell"))
}
+#[maybe_async]
pub fn handle_matches<C, D>(
wallet: &Wallet<C, D>,
matches: ArgMatches<'_>,
if let Some(_sub_matches) = matches.subcommand_matches("get_new_address") {
Ok(Some(format!("{}", wallet.get_new_address()?)))
} else if let Some(_sub_matches) = matches.subcommand_matches("sync") {
- wallet.sync(None, None)?;
+ maybe_await!(wallet.sync(None, None))?;
Ok(None)
} else if let Some(_sub_matches) = matches.subcommand_matches("list_unspent") {
let mut res = String::new();
panic!("Missing `psbt` and `tx` option");
};
- let txid = wallet.broadcast(tx)?;
+ let txid = maybe_await!(wallet.broadcast(tx))?;
Ok(Some(format!("TXID: {}", txid)))
} else if let Some(sub_matches) = matches.subcommand_matches("extract_psbt") {