### Quickstart Bench Setup and Run Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/breez-bench/kotlin/README.md This snippet shows the essential commands to set up and run the Breez SDK bench. It includes starting the MySQL backend, setting up the SDK bindings, and initiating the benchmark sweep. ```bash make mysql-up # idempotent: starts container + creates DB make setup # one-time per branch (publishes KMP bindings) export FAUCET_USERNAME=... # request from Lightspark export FAUCET_PASSWORD=... make run # sweep + auto-fund + aggregate (~7 min default) # → out//RESULTS.md ``` -------------------------------- ### Install and Run SSR Example Source: https://github.com/breez/spark-sdk/blob/main/packages/wasm/examples/ssr/README.md Commands to install dependencies and run the development server for the SSR example. Open http://localhost:3000 to view the output. ```bash npm install npm run dev # Open http://localhost:3000 ``` -------------------------------- ### Install and Serve Breez SDK Docs Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/README.md Installs necessary tools and builds/serves the Breez SDK documentation locally. Ensure you have Rust and Cargo installed. ```bash cargo install mdbook@0.4.52 cargo install --path ./snippets-processor cargo install mdbook-variables cargo install mdbook-pagetoc cargo install mdbook-llms-txt-tools mdbook build mdbook serve --open ``` -------------------------------- ### Run the Node.js CLI Example Source: https://github.com/breez/spark-sdk/blob/main/packages/wasm/examples/node/README.md Execute the Breez SDK Spark Wasm Node.js example using the npm script. ```bash npm run cli ``` -------------------------------- ### Setup Breez SDK Spark CLI Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/csharp/README.md Restore NuGet packages for the Breez SDK Spark CLI. Ensure you have .NET 8 SDK or later installed. ```bash # Restore NuGet packages make setup ``` -------------------------------- ### Install Dependencies Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/wasm/README.md Install project dependencies using make or npm. ```bash # Install dependencies make setup # Or manually npm install ``` -------------------------------- ### Install Breez CLI with Python Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/python/README.md Instructions for setting up a Python virtual environment and installing the Breez CLI in editable mode for development. ```bash python3 -m venv .venv source .venv/bin/activate pip install -e . breez-cli --help ``` -------------------------------- ### Build and Run Breez SDK Examples Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/swift/README.md Follow these commands to clean, build, and run the Breez SDK example project using Swift Package Manager. ```bash cd BreezSDKExamples swift package clean swift build swift run ``` -------------------------------- ### Install Protobuf using Homebrew Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/DEVELOPMENT.md Install the Protobuf compiler using the Homebrew package manager. This is a prerequisite for building UniFFI bindings. ```bash brew install protobuf ``` -------------------------------- ### Install Breez SDK with npm Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/install_javascript.md Use this command to install the Breez SDK for Javascript/Typescript via npm. ```bash npm install @breeztech/breez-sdk-spark ``` -------------------------------- ### Install Breez SDK - Spark Source: https://github.com/breez/spark-sdk/blob/main/packages/wasm/README.md Install the Breez SDK - Spark package using npm or yarn. ```sh npm install @breeztech/breez-sdk-spark ``` ```sh yarn add @breeztech/breez-sdk-spark ``` -------------------------------- ### Logging Examples Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/SNIPPET_CONVENTIONS.md Examples of how to log messages with variables in various languages. ```rust info!("Message: {variable}"); ``` ```go log.Printf("Message: %v", variable) ``` ```python logging.debug(f"Message: {variable}") ``` ```kotlin // Log.v("Breez", "Message: $variable") (commented) ``` ```swift print("Message: \(variable)") ``` ```csharp Console.WriteLine($"Message: {variable}"); ``` ```dart print("Message: $variable"); ``` ```typescript console.log(`Message: ${variable}`) ``` ```typescript console.log(`Message: ${variable}`) ``` -------------------------------- ### Install Breez SDK with yarn Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/install_javascript.md Use this command to install the Breez SDK for Javascript/Typescript via yarn. ```bash yarn add @breeztech/breez-sdk-spark ``` -------------------------------- ### Setup Published SDK and CLI Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/python/README.md Use these commands to set up the published SDK from PyPI and then run the CLI. ```bash make setup-published ``` ```bash make run ``` -------------------------------- ### Install Rust with rustup Source: https://github.com/breez/spark-sdk/blob/main/crates/internal/README.md Installs Rust using rustup. Ensure you source the environment file after installation. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.cargo/env ``` -------------------------------- ### Install Protobuf Compiler Source: https://github.com/breez/spark-sdk/blob/main/CLAUDE.md Install the protobuf compiler on Debian/Ubuntu, macOS, or Arch Linux systems. ```bash # Debian/Ubuntu apt-get install -y protobuf-compiler # macOS brew install protobuf # Arch Linux pacman -S protobuf ``` -------------------------------- ### Install Breez Spark SDK Python Package Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/langs/python/README.md Install the breez-sdk-spark package using pip. This command fetches and installs the latest version from PyPi. ```bash pip install breez-sdk-spark ``` -------------------------------- ### MySQL Storage Example Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/wasm/README.md Configure the CLI to use MySQL for storage by providing a connection string. ```bash # Use MySQL storage node src/main.js --mysql-connection-string "mysql://user:pass@localhost:3306/spark" ``` -------------------------------- ### Setup and Run CLI with Published SDK Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/kotlin-multiplatform/README.md Follow these steps to set up the project using the published SDK from the Breez Maven repository and then build and run the CLI. ```bash # 1. Generate Gradle wrapper (one-time) gradle wrapper # 2. Download dependencies make setup-published # 3. Build and run make run ``` -------------------------------- ### Setup and Run Published SDK Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/flutter/README.md Commands to set up the project and run the CLI using the published Breez SDK. This is the recommended approach for most users. ```bash make setup-published # flutter pub get make run # dart run bin/breez_cli.dart (regtest) ``` -------------------------------- ### Setup Breez SDK Recovery Wallet Test Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/breez-itest/README.md Manually run the setup test to create a new wallet with various payment variants and generate credentials for recovery testing. This test is marked as ignored by default. ```bash cargo test -p breez-sdk-itest test_setup_recovery_wallet -- --ignored --nocapture ``` -------------------------------- ### Setup Published SDK Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/golang/README.md To use the published Go SDK, comment out the replace directive in go.mod and run this command to download dependencies. ```bash make setup-published ``` -------------------------------- ### Run Development Server Source: https://github.com/breez/spark-sdk/blob/main/packages/wasm/examples/web/README.md Start the development server for the Vite application. ```bash npm run dev ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/breez/spark-sdk/blob/main/packages/wasm/examples/node/README.md Install the necessary Node.js dependencies for the project using npm. ```bash npm install ``` -------------------------------- ### Install Rust with rustup Source: https://github.com/breez/spark-sdk/blob/main/DEVELOPMENT.md Ensure Rust is installed using rustup. This is the first step for setting up the development environment. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -------------------------------- ### Install Breez SDK Go Package Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/install_go.md Use this command to add the Breez SDK Go package to your project. ```bash go get github.com/breez/breez-sdk-spark-go ``` -------------------------------- ### PostgreSQL Storage Example Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/wasm/README.md Configure the CLI to use PostgreSQL for storage by providing a connection string. ```bash # Use PostgreSQL storage node src/main.js --postgres-connection-string "host=localhost user=postgres dbname=spark" ``` -------------------------------- ### Setup Postgres for Benchmarking Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/breez-bench/js/README.md Instructions for setting up a local PostgreSQL instance using Docker for the benchmark. This includes creating necessary databases for sender and receiver nodes. ```sh docker run -d --name spark-perf-pg -e POSTGRES_PASSWORD=postgres -p 5544:5432 postgres:16 docker exec spark-perf-pg psql -U postgres -c 'CREATE DATABASE bench_sender_node;' docker exec spark-perf-pg psql -U postgres -c 'CREATE DATABASE bench_receiver_node;' ``` -------------------------------- ### Setup and Run Local Bindings Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/flutter/README.md Commands to set up the project and run the CLI using local bindings. This is useful for development or when needing the latest changes not yet published. ```bash make setup # builds Flutter/FRB bindings + flutter pub get make run # dart run bin/breez_cli.dart (regtest) ``` -------------------------------- ### Install Breez SDK using npm Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/install_react_native.md Use this command to install the Breez SDK package for React Native projects managed with npm. ```bash npm install @breeztech/breez-sdk-spark-react-native ``` -------------------------------- ### Install Dependencies on Debian/Ubuntu Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/lnurl/README.md Installs necessary development libraries for compiling the LNURL server on Debian/Ubuntu systems. ```shell apt-get update apt-get install -y libprotobuf-dev libssl-dev pkg-config protobuf-compiler ``` -------------------------------- ### Example Mixed Run Configuration Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/breez-bench/kotlin/README.md Configure the 'MIX' environment variable to define the percentage distribution of different payment methods for a mixed run. This example sets specific percentages for info, send_spark, send_ln, receive_spark, and receive_ln operations. ```bash MIX='info=40,send_spark=20,send_ln=10,receive_spark=20,receive_ln=10' \ SWEEP_RPS=50,100,250 DURATION=2m make run ``` -------------------------------- ### Install Breez SDK using yarn Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/install_react_native.md Use this command to install the Breez SDK package for React Native projects managed with yarn. ```bash yarn add @breeztech/breez-sdk-spark-react-native ``` -------------------------------- ### Install Dependencies for Node.js Benchmark Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/breez-bench/js/README.md Navigate to the benchmark directory and install Node.js dependencies. Ensure you are using Node.js version 22 or higher. Rebuild the WASM package if SDK sources are changed. ```sh cd crates/breez-sdk/breez-bench/js nvm use 22 # or any node >=22 npm install ``` -------------------------------- ### Install Breez SDK for Expo Managed Workflow Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/install_react_native.md Use this command to install the Breez SDK package for Expo projects using the managed workflow. ```bash npx expo install @breeztech/breez-sdk-spark-react-native ``` -------------------------------- ### Run Spark CLI with Network and Data Directory Options Source: https://github.com/breez/spark-sdk/blob/main/crates/internal/README.md Example of running the Spark CLI with specific network and data directory configurations. ```bash cargo run -p spark-cli -- --network regtest -d ~/.spark-regtest ``` -------------------------------- ### Custom Data Directory Example Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/wasm/README.md Run the CLI using a custom data directory path. ```bash # Use a custom data directory node src/main.js --data-dir ~/.breez/my-wallet ``` -------------------------------- ### File Provider CLI Commands Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/cli/README.md Examples for using the file-based PRF provider with different options for passkey management and label storage. ```bash cargo run -- --passkey file ``` ```bash cargo run -- --passkey file --label personal ``` ```bash cargo run -- --passkey file --list-labels ``` ```bash cargo run -- --passkey file --label personal --store-label ``` -------------------------------- ### Go Function Signature Convention Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/SNIPPET_CONVENTIONS.md Example of a Go function signature using BreezSdk. ```go func FunctionName(sdk *breez_sdk_spark.BreezSdk) (*breez_sdk_spark.ResponseType, error) { ``` -------------------------------- ### Add Breez.Sdk.Spark using Package Manager Console Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/install_csharp.md Use this command to install the Breez.Sdk.Spark NuGet package from the Package Manager Console in Visual Studio. ```powershell Install-Package Breez.Sdk.Spark ``` -------------------------------- ### Import Breez Spark SDK in Python Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/langs/python/README.md Import the breez_sdk_spark library into your Python project. This is the first step after installation to start using the SDK's functionalities. ```python import breez_sdk_spark ``` -------------------------------- ### FIDO2 Provider CLI Commands Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/cli/README.md Examples for using the FIDO2/WebAuthn PRF provider, compatible with browser-based passkeys. Requires the 'fido2' feature flag. ```bash cargo run --features fido2 -- --passkey fido2 ``` ```bash cargo run --features fido2 -- --passkey fido2 --label personal ``` ```bash cargo run --features fido2 -- --passkey fido2 --rpid localhost --label personal ``` ```bash cargo run --features fido2 -- --passkey fido2 --list-labels ``` ```bash cargo run --features fido2 -- --passkey fido2 --label personal --store-label ``` -------------------------------- ### Verify Rust and Cargo Installation Source: https://github.com/breez/spark-sdk/blob/main/crates/internal/README.md Checks if Rust and Cargo have been installed correctly by displaying their versions. ```bash rustc --version cargo --version ``` -------------------------------- ### Initialize Breez SDK (Rust) Source: https://github.com/breez/spark-sdk/blob/main/CLAUDE.md Minimal example to connect to the Breez SDK using a mnemonic seed and API key in Rust. Replace placeholders with your actual API key and seed phrase. The storage directory is specified for SDK data. ```rust use breez_sdk_spark::*; let mut config = default_config(Network::Mainnet); config.api_key = Some("".to_string()); let sdk = connect(ConnectRequest { config, seed: Seed::Mnemonic { mnemonic: "".into(), passphrase: None }, storage_dir: "./.data".to_string(), }).await?; let info = sdk.get_info(GetInfoRequest { ensure_synced: Some(true) }).await?; // info.balance_sats, info.token_balances sdk.disconnect().await?; ``` -------------------------------- ### Initialize Breez SDK (TypeScript) Source: https://github.com/breez/spark-sdk/blob/main/CLAUDE.md Minimal example to connect to the Breez SDK using a mnemonic seed and API key. Ensure to replace placeholders with your actual API key and seed phrase. The storage directory is specified for SDK data. ```typescript import { connect, defaultConfig } from '@breeztech/breez-sdk-spark' const config = defaultConfig('mainnet') config.apiKey = '' const sdk = await connect({ config, seed: { type: 'mnemonic', mnemonic: '<12/24 words>', passphrase: undefined }, storageDir: './.data' }) const info = await sdk.getInfo({ ensureSynced: true }) // info.balanceSats, info.tokenBalances // To get addresses: // const lnAddress = await sdk.getLightningAddress() // const sparkAddr = await sdk.receivePayment({ paymentMethod: { type: 'sparkAddress' } }) await sdk.disconnect() ``` -------------------------------- ### Install Dependencies on macOS Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/lnurl/README.md Installs required packages using Homebrew for macOS users to compile the LNURL server. ```shell brew install protobuf openssl pkg-config ``` -------------------------------- ### Build Project Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/csharp/README.md Use this command to build the C# project. ```bash dotnet build ``` -------------------------------- ### Tron Bare Address Example Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/cross_chain.md An example of a bare Tron address. This base58check format with a 'T' prefix is recognized by the SDK. ```text TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t ``` -------------------------------- ### Build and Run Breez CLI Go Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/golang/README.md Build the Go CLI binary and execute it, or run it directly using 'go run'. Useful for development and testing. ```bash # Build and run directly go build -o breez-cli . ./breez-cli --help ``` ```bash # Run without building a binary go run . --network regtest ``` -------------------------------- ### Run CLI on Mainnet Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/golang/README.md Build and run the CLI on the mainnet. Ensure your BREEZ_API_KEY is set. ```bash make run-mainnet ``` -------------------------------- ### Build and Run Breez CLI with Swift Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/swift/README.md Build the project and run the Breez CLI. You can also specify a network like mainnet. ```bash swift build && swift run breez-cli ``` ```bash swift run breez-cli --network mainnet ``` -------------------------------- ### Solana Canonical URI Example Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/cross_chain.md An example of a Solana canonical URI. The 'spl-token=' parameter specifies the SPL mint for token transfers. ```text solana:?amount=&spl-token= ``` -------------------------------- ### Solana Bare Address Example Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/cross_chain.md An example of a bare Solana address. The SDK recognizes this base58 encoded format for public keys. ```text EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v ``` -------------------------------- ### Tron Canonical URI Example Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/cross_chain.md An example of a Tron canonical URI. The 'token=' parameter is used to specify the TRC-20 contract address for transfers. ```text tron:?amount=&token= ``` -------------------------------- ### EVM Bare Address Example Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/cross_chain.md An example of a bare EVM address. The SDK detects this format and parses it without contract address, chain ID, or amount. ```text 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 ``` -------------------------------- ### Display Spark CLI Help Source: https://github.com/breez/spark-sdk/blob/main/crates/internal/README.md Lists all available commands for the Spark CLI. ```bash spark-cli [mainnet]> help ``` -------------------------------- ### Run Breez SDK Benchmarks on Mainnet Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/breez-bench/README.md Execute the Breez SDK benchmarks on the mainnet. This requires persistent wallets, setting data directories, and exporting the BREEZ_API_KEY. The first run will create phrase files with new mnemonics. ```bash cargo run -p breez-sdk-bench -- \ --network mainnet \ --sender-data-dir ~/.breez-bench/sender \ --receiver-data-dir ~/.breez-bench/receiver ``` ```bash # Set API key for mainnet export BREEZ_API_KEY="your-api-key" ``` -------------------------------- ### LNURL Webhook Payload Example Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/lnurl_webhooks.md This is an example of the JSON payload structure for a `spark_payment_received` webhook notification, detailing the information sent when a user receives a payment to their Lightning Address. ```json { "template": "spark_payment_received", "data": { "payment_hash": "abc123...", "invoice": "lnbc50u1p...", "preimage": "def456...", "amount_sat": 50000, "user_pubkey": "02abc123...", "lightning_address": "alice@yourdomain.com", "sender_comment": "Thanks!", "timestamp": 1711929600000 } } ``` -------------------------------- ### Use Passkey with Default Label (File Provider) Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/flutter/README.md This command initiates passkey authentication using the file provider with the default label. Ensure the Breez SDK is initialized. ```bash dart run bin/breez_cli.dart --passkey file ``` -------------------------------- ### Initialize and Connect in Browser Source: https://github.com/breez/spark-sdk/blob/main/packages/wasm/README.md Initialize the WebAssembly module and connect to the Breez SDK for browser applications. Ensure `init()` is called before other SDK methods. ```js import init, { defaultConfig, connect, } from "@breeztech/breez-sdk-spark/web"; await init(); const config = defaultConfig("mainnet"); config.apiKey = ""; const sdk = await connect({ config, seed: { type: "mnemonic", mnemonic: "", passphrase: undefined }, storageDir: "./.data", }); ``` -------------------------------- ### EVM Canonical URI Examples Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/cross_chain.md Examples of EVM canonical URIs following EIP-681. These can represent native sends or ERC-20 transfers, optionally including chain ID and amount. ```text ethereum:[@]?value= ``` ```text ethereum:[@]/transfer?address=&uint256= ``` -------------------------------- ### Use Passkey with File Provider (Default Label) Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/swift/README.md This command demonstrates how to use the passkey feature with the file provider, utilizing the default label for wallet derivation. Ensure the Breez API key is set in the environment if using mainnet. ```bash make run ARGS="--passkey file" ``` -------------------------------- ### Run Standalone Binary Source: https://github.com/breez/spark-sdk/blob/main/crates/nip65-publisher/README.md Execute the standalone nip65-publisher binary. Provide the necessary arguments for private key, API key, and recommended relays. ```bash ./nip65-publisher \ --private-key \ --api-key \ --relay wss://relay.primal.net ``` -------------------------------- ### Get Spark CLI Wallet Information Source: https://github.com/breez/spark-sdk/blob/main/crates/internal/README.md Retrieves general information about the Spark wallet. ```bash spark-cli [mainnet]> info ``` -------------------------------- ### Run on Mainnet Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/flutter/README.md Instructions to run the CLI on the mainnet, which requires setting an API key. Ensure you have a valid API key before running. ```bash export BREEZ_API_KEY="" make run-mainnet ``` -------------------------------- ### Initialize SDK with MySQL Backend Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/customizing.md Configures the SDK to use MySQL 8.0+ for all storage needs, including storage, tree store, and token store. This is suitable for horizontally scaled server deployments. The `run_migration` option can be set to `false` if your service manages schema migrations externally. ```rust let mysql_config = MysqlStorage::new(MysqlStorage::default_config(... let builder = SdkBuilder::new().with_storage_backend(mysql_config); let _sdk_breez = builder.build().await.unwrap(); ``` -------------------------------- ### Configure macOS Framework Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/install_kotlin_multiplatform.md Apply the Breez SDK KMP Gradle plugin and configure macOS targets to use dynamic framework binaries. ```gradle plugins { id("technology.breez.spark.kmp") version "{VERSION}" } kotlin { listOf( macosArm64(), macosX64(), ).forEach { it.binaries.framework { baseName = "shared" isStatic = false } } } ``` -------------------------------- ### Python Enum/Type Discrimination Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/SNIPPET_CONVENTIONS.md Example of discriminating enums with associated data in Python using `isinstance`. ```python if isinstance(response.payment_method, PaymentMethod.BOLT11_INVOICE): logging.debug(f"Fee: {response.payment_method.fee_sats} sats") ``` -------------------------------- ### Display Help for LNURL CLI Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/lnurl/README.md Shows all available command-line options for the `lnurl` binary, useful for understanding configuration parameters. ```shell lnurl --help ``` -------------------------------- ### Flutter Function Signature Convention Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/SNIPPET_CONVENTIONS.md Example of an asynchronous Flutter function signature using BreezSdk. ```dart Future functionName(BreezSdk sdk) async { ``` -------------------------------- ### C# Function Signature Convention Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/SNIPPET_CONVENTIONS.md Example of an asynchronous C# function signature using BreezSdk. ```csharp async Task FunctionName(BreezSdk sdk) { ``` -------------------------------- ### Swift Function Signature Convention Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/SNIPPET_CONVENTIONS.md Example of an asynchronous Swift function signature using BreezSdk. ```swift func functionName(sdk: BreezSdk) async throws { ``` -------------------------------- ### Generate Gradle Wrapper and Run CLI Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/kotlin-multiplatform/README.md Use this command to generate the Gradle wrapper and then run the CLI. The default network is regtest, which does not require an API key. ```bash # 1. Generate Gradle wrapper (one-time) gradle wrapper # 2. Set API key (required for mainnet) export BREEZ_API_KEY="" # 3. Run (regtest by default, no API key needed) make run ``` -------------------------------- ### Breez CLI Passkey File Provider Usage Source: https://github.com/breez/spark-sdk/blob/main/crates/breez-sdk/bindings/examples/cli/langs/python/README.md Demonstrates how to use the Breez CLI with the file-based passkey provider. These commands show options for using the default label, a specific label, listing available labels, and storing a new label. ```bash breez-cli --passkey file ``` ```bash breez-cli --passkey file --label personal ``` ```bash breez-cli --passkey file --list-labels ``` ```bash breez-cli --passkey file --label personal --store-label ``` -------------------------------- ### Kotlin Function Signature Convention Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/SNIPPET_CONVENTIONS.md Example of a suspend Kotlin function signature using BreezSdk. ```kotlin suspend fun functionName(sdk: BreezSdk) { ``` -------------------------------- ### Python Function Signature Convention Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/SNIPPET_CONVENTIONS.md Example of an asynchronous Python function signature using BreezSdk. ```python async def function_name(sdk: BreezSdk): ``` -------------------------------- ### Configure iOS Framework Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/src/guide/install_kotlin_multiplatform.md Apply the Breez SDK KMP Gradle plugin and configure iOS targets to use dynamic framework binaries. ```gradle plugins { id("technology.breez.spark.kmp") version "{VERSION}" } kotlin { listOf( iosArm64(), iosSimulatorArm64(), iosX64(), ).forEach { it.binaries.framework { baseName = "shared" isStatic = false } } } ``` -------------------------------- ### Rust Function Signature Convention Source: https://github.com/breez/spark-sdk/blob/main/docs/breez-sdk/snippets/SNIPPET_CONVENTIONS.md Example of an asynchronous Rust function signature using BreezSdk. ```rust async fn function_name(sdk: &BreezSdk) -> Result<()> { ```