mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-18 14:24:19 +01:00
Mark rust code blocks as no_run
This commit is contained in:
@@ -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 = <your seed>;
|
||||
let credentials = BreezServices::register_node(Network::Bitcoin, seed).await?;
|
||||
```
|
||||
|
||||
## Recovering an existing node
|
||||
```rust
|
||||
```rust,no_run
|
||||
let seed = <your 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;
|
||||
|
||||
@@ -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?;
|
||||
```
|
||||
|
||||
@@ -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 = <efund tx fee rate>
|
||||
sdk.refund(refundable.bitcoin_address, destination_address, sat_per_byte).await?
|
||||
|
||||
Reference in New Issue
Block a user