2022-01-17 12:59:09 +01:00
|
|
|
//! This is a test plugin used to verify that we can compile and run
|
|
|
|
//! plugins using the Rust API against c-lightning.
|
|
|
|
|
2022-02-07 11:00:08 +01:00
|
|
|
use cln_plugin::{options, Builder};
|
2022-01-17 12:59:09 +01:00
|
|
|
use tokio;
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<(), anyhow::Error> {
|
2022-02-07 11:00:08 +01:00
|
|
|
let (plugin, stdin) = Builder::new((), tokio::io::stdin(), tokio::io::stdout())
|
|
|
|
.option(options::ConfigOption::new(
|
|
|
|
"test-option",
|
|
|
|
options::Value::Integer(42),
|
|
|
|
"a test-option with default 42",
|
|
|
|
))
|
|
|
|
.build();
|
|
|
|
|
2022-01-24 13:19:45 +01:00
|
|
|
tokio::spawn(async {
|
|
|
|
tokio::time::sleep(tokio::time::Duration::from_millis(1000)).await;
|
|
|
|
log::info!("Hello world");
|
|
|
|
});
|
|
|
|
plugin.run(stdin).await
|
2022-01-17 12:59:09 +01:00
|
|
|
}
|