diff --git a/src/guide/getting_started.md b/src/guide/getting_started.md index ae2b408..efb7211 100644 --- a/src/guide/getting_started.md +++ b/src/guide/getting_started.md @@ -12,13 +12,13 @@ The Breez SDK provides the following services: Connecting to a node requires a seed (your master key) and credentials. The seed is a bip39 mnemonic and the credentials are retrieved by registering a new node or recovering an existing one. ## Registering a new node -```rust +```rust,no_run let seed = ; let credentials = BreezServices::register_node(Network::Bitcoin, seed).await?; ``` ## Recovering an existing node -```rust +```rust,no_run let seed = ; let credentials = BreezServices::register_node(Network::Bitcoin, seed).await?; ``` @@ -27,7 +27,7 @@ Once the credentials are retrieved they should be saved in a secured storage. The next step is to initialize the SDK and start the node: ## Initializing the SDK -```rust +```rust,no_run // Create the default config let config = BreezServices::default_config(EnvironmentType::Production) @@ -48,7 +48,7 @@ BreezServices::start(rt(), &sdk).await?; At any point we can fetch our balance from the Greenlight node: -```rust +```rust,no_run if let Some(node_state) = sdk.node_info()? { let balance_ln = node_state.channels_balance_msat; let balance_onchain = node_state.onchain_balance_msat; diff --git a/src/guide/payments.md b/src/guide/payments.md index 1a678ed..96faf60 100644 --- a/src/guide/payments.md +++ b/src/guide/payments.md @@ -4,18 +4,18 @@ Breez SDK doesn't require you to open a channel and set up your inbound liquidity. Breez SDK automatically connects your node to the LSP peer and you can now receive payments: -```rust +```rust,no_run let invoice = sdk.receive_payment(3000, "Invoice for 3000 sats".into()).await?; ``` ## Sending Lightning Payments -```rust +```rust,no_run let bolt11 = "..."; sdk.send_payment(bolt11.into(), Some(3000)).await?; ``` -## Sending Spontaneus Lightning Payments -```rust +## Sending Spontaneous Lightning Payments +```rust,no_run let node_id = "..."; sdk.send_payment(node_id.into(), Some(3000)).await?; ``` diff --git a/src/guide/recieve_onchain.md b/src/guide/recieve_onchain.md index 5bc7c46..7c9fb04 100644 --- a/src/guide/recieve_onchain.md +++ b/src/guide/recieve_onchain.md @@ -1,7 +1,7 @@ # Receiving an on-chain transaction (swap-in) There are cases when you have funds in some bitcoin address and you would like to send those to your lightning node. -```rust +```rust,no_run let swap_info = sdk.receive_onchain().await?; // Send your funds to the bellow bitcoin address @@ -10,7 +10,7 @@ let address = swap_info.bitcoin_address; Once you've sent the funds to the above address, the SDK will monitor this address for unspent confirmed outputs and use a trustless submarine swap to receive these into your Lightning node. You can always monitor the status of the current in-progress swap using the following code: -```rust +```rust,no_run let swap_info = sdk.in_progress_swap().await? ``` @@ -21,13 +21,13 @@ The process of receiving funds via an on-chain address is trustless and uses a s In order to execute a refund, you need to supply an on-chain address to where the refunded amount will be sent. The following code will retrieve the refundable swaps: -```rust +```rust,no_run let refundables = sdk.list_refundables().await? ``` Once you have a refundable swap in hand, use the follwing code to execute a refund: -```rust +```rust,no_run let destination_address = "...".into() let sat_per_byte = sdk.refund(refundable.bitcoin_address, destination_address, sat_per_byte).await?