### Install iOS Dependencies and Run App Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-expo-react-native-app/README.md Navigate to the 'ios' directory and install native dependencies using CocoaPods, then start the iOS application. ```bash cd ios pod install yarn ios ``` -------------------------------- ### Starting spark-frost-signer Server Source: https://github.com/buildonspark/spark/blob/main/signer/README.md Examples of how to start the spark-frost-signer server, either using a Unix socket (default for Lightspark) or a TCP port. ```bash # Unix socket (default for Lightspark) spark-frost-signer --unix /tmp/frost-signer.sock # TCP port spark-frost-signer --port 8080 ``` -------------------------------- ### Project Setup Commands Source: https://github.com/buildonspark/spark/blob/main/AGENTS.md Commands to set up the project environment, including trusting and installing tools with `mise` and optionally installing git hooks with `lefthook`. ```bash mise trust && mise install lefthook install # git hooks (optional) ``` -------------------------------- ### Start Server (NPM) Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Starts the Express server using NPM. ```bash npm run start ``` -------------------------------- ### Spark CLI Examples Source: https://github.com/buildonspark/spark/blob/main/sdks/js/apps/spark-cli/README.md Examples demonstrating how to use the Spark CLI with different network and configuration options. ```bash spark-cli --network mainnet ``` ```bash spark-cli --network regtest ``` ```bash spark-cli --config ./my-config.json ``` -------------------------------- ### Install Project Toolchains with Mise Source: https://github.com/buildonspark/spark/blob/main/README.md Use `mise` to install the project's protobuf, rust, and go toolchains. Ensure you trust the project with `mise trust` before installing. ```bash mise trust mise install ``` -------------------------------- ### Quick Start with Vite Template Source: https://github.com/buildonspark/spark/blob/main/sdks/js/apps/create-spark-app/README.md Use this command to quickly scaffold a new Spark application using the Vite template. After creation, navigate into the project directory, install dependencies, and start the development server. ```bash npx @buildonspark/create-spark-app my-app --template vite cd my-app npm install npm run dev ``` -------------------------------- ### Install Spark SDK for Bare Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/bare/README.md Install the necessary packages for using the Spark SDK with the Bare runtime. ```bash npm install @buildonspark/bare bare ``` -------------------------------- ### Install Toolchain and Dependencies Source: https://github.com/buildonspark/spark/blob/main/GEMINI.md Installs the necessary toolchain and project dependencies using 'mise'. ```bash # Install toolchain and dependencies mise trust mise install ``` -------------------------------- ### Install Spark SDK Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/spark-sdk/README.md Install the Spark SDK using npm, yarn, or pnpm. ```bash npm install @buildonspark/spark-sdk # or yarn add @buildonspark/spark-sdk # or pnpm add @buildonspark/spark-sdk ``` -------------------------------- ### Install Bare and Bare-Make Globally Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/spark-frost-bare-addon/README.md Instructions for globally installing the bare and bare-make tools via npm. ```sh npm i -g bare bare-make ``` -------------------------------- ### Run Example Script Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/nodejs-scripts/README.md Execute the example script using yarn. Ensure workspace dependencies are resolved first by running `yarn`. ```bash yarn run example ``` -------------------------------- ### Example Spark CLI Flow Source: https://github.com/buildonspark/spark/blob/main/sdks/js/apps/spark-cli/README.md A step-by-step example flow for initializing a wallet, depositing funds, and transferring assets using the Spark CLI. ```bash initwallet getdepositaddress claimdeposit getbalance getleaves getsparkaddress sendtransfer ``` -------------------------------- ### Install Bitcoin Core with Homebrew Source: https://github.com/buildonspark/spark/blob/main/README.md Install Bitcoin Core with ZMQ support using Homebrew. Ensure your bitcoind installation is compiled with ZMQ. ```bash brew install bitcoin ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-expo-react-native-app/README.md Run this command in the project root to install all necessary Node.js dependencies. ```bash yarn ``` -------------------------------- ### Install ZeroMQ with Homebrew Source: https://github.com/buildonspark/spark/blob/main/README.md Install the ZeroMQ library using Homebrew, required for ZMQ communication with bitcoind. ```bash brew install zeromq ``` -------------------------------- ### Install Dependencies (NPM) Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Installs project dependencies using NPM. ```bash npm install ``` -------------------------------- ### Install Lefthook with Homebrew Source: https://github.com/buildonspark/spark/blob/main/README.md Install `lefthook` for managing git hooks via Homebrew. This is an optional installation method if not using `mise`. ```bash brew install lefthook ``` -------------------------------- ### Install Pkg-config with Homebrew Source: https://github.com/buildonspark/spark/blob/main/README.md Install the `pkg-config` utility using Homebrew, which is used in the build process. ```bash brew install pkgconf ``` -------------------------------- ### Install, Build, and Test JS SDKs Source: https://github.com/buildonspark/spark/blob/main/README.md Perform the necessary steps to run integration tests for the JS SDKs. This includes installing dependencies, building the project, and running the tests. ```bash yarn install yarn build yarn test:integration ``` -------------------------------- ### Install and Run Spark CLI Source: https://github.com/buildonspark/spark/blob/main/sdks/js/apps/spark-cli/README.md Install the Spark CLI globally using npm and run it. Alternatively, use npx for immediate execution. ```bash npx @buildonspark/cli ``` ```bash npm install -g @buildonspark/cli spark-cli ``` -------------------------------- ### Install CocoaPods Dependencies Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-react-native-app/README.md Run these commands to install CocoaPods dependencies for iOS development. 'bundle install' is for the first time or updating bundler, and 'bundle exec pod install' is for updating native dependencies. ```sh bundle install ``` ```sh bundle exec pod install ``` -------------------------------- ### Use or Install Node.js Version with NVM Source: https://github.com/buildonspark/spark/blob/main/sdks/js/README.md Navigates to the JS SDK directory and uses the appropriate Node.js version with NVM, or installs it if not present. ```bash cd spark/sdks/js nvm use || nvm install ``` -------------------------------- ### Install Spark Issuer SDK Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/issuer-sdk/README.md Install the Spark Issuer SDK and Spark SDK using npm, yarn, or pnpm. ```bash npm install @buildonspark/issuer-sdk @buildonspark/spark-sdk # or yarn add @buildonspark/issuer-sdk @buildonspark/spark-sdk # or pnpm add @buildonspark/issuer-sdk @buildonspark/spark-sdk ``` -------------------------------- ### Run Development Server Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-nextjs-app/README.md Commands to start the Next.js development server using different package managers. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Install Rust and LLVM Source: https://github.com/buildonspark/spark/blob/main/signer/spark-frost-uniffi/README.md Installs Rust, LLVM, and the wasm-pack tool. Also adds the LLVM bin directory to your PATH. ```sh # Install Rust and LLVM brew install rustup llvm # Add path to your shell, e.g. for zsh: echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc # Install Rust tools cargo install wasm-pack rustup target add wasm32-unknown-unknown ``` -------------------------------- ### Install Local Development Dependencies Source: https://github.com/buildonspark/spark/blob/main/README.md Install necessary tools for local development using Homebrew. Includes tmux, sqlx-cli for the LRC20 Node, and cargo for the LRC20 Node. ```bash brew install tmux brew install sqlx-cli # required for LRC20 Node brew install cargo # required for LRC20 Node ``` -------------------------------- ### Run Hermetic Testing with Tilt Source: https://github.com/buildonspark/spark/blob/main/GEMINI.md Starts hermetic testing in minikube using Tilt. This is the recommended approach for development. ```bash # Hermetic testing in minikube via Tilt (recommended) cd tilt && tilt up ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/nestjs-app/README.md Installs all necessary dependencies for the NestJS project using Yarn. ```bash $ yarn install ``` -------------------------------- ### Install Git Hooks Source: https://github.com/buildonspark/spark/blob/main/GEMINI.md Installs git hooks using 'lefthook' for enhanced version control workflows. This is optional but recommended. ```bash # Install git hooks (optional but recommended) lefthook install ``` -------------------------------- ### Start Spark Vite App Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-vite-app/README.md Run this command to start the Spark Vite App in development mode. The app surfaces additional targets based on local configurations. ```bash yarn start ``` -------------------------------- ### Build Bare Addon for Current Platform Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/spark-frost-bare-addon/README.md Commands to generate, build, and install the bare addon for the current platform using bare-make. ```sh yarn cd spark-frost-bare-addon # By default bare-make will target and build for your current platform yarn bare-make generate && yarn bare-make build && yarn bare-make install # Test the addon yarn bare index.js # To build for spark-bare-expo-react-native-app yarn bare-make generate --platform ios --arch arm64 --simulator && yarn bare-make build && yarn bare-make install # This seems to be necessary to build/install an additional target, otherwise it reuses the previous target: rm -rf build yarn bare-make generate --platform ios --arch arm64 && yarn bare-make build && yarn bare-make install rm -rf build yarn bare-make generate --platform ios --arch x64 && yarn bare-make build && yarn bare-make install rm -rf build ``` -------------------------------- ### Initialize Wallet and Get Balance (Bare) Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-bare-app/README.md Initialize a SparkWallet using BareSparkSigner and retrieve the balance. Requires the bare target to be attached via chrome://inspect. ```javascript const { SparkWallet, BareSparkSigner } = require("@buildonspark/bare"); const { wallet: w1 } = await SparkWallet.initialize({ signer: new BareSparkSigner() }) await w1.getBalance() ``` -------------------------------- ### Development Environment Setup Source: https://github.com/buildonspark/spark/blob/main/spark/CLAUDE.md Commands to set up the local development environment for the Spark backend, including running all services or using Tilt for hermetic testing. ```bash ./run-everything.sh # Local dev with tmux cd tilt && tilt up # Hermetic testing in minikube via Tilt ``` -------------------------------- ### Start Metro Bundler Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-react-native-app/README.md Run this command from the root of your React Native project to start the Metro JavaScript bundler. ```sh npm start ``` ```sh yarn start ``` -------------------------------- ### Install Clang and LLD on Linux Source: https://github.com/buildonspark/spark/blob/main/sdks/js/README.md Installs the Clang C/C++ compiler and LLD linker on Ubuntu/Debian systems, required for the postinstall build process. ```bash sudo apt install clang lld ``` -------------------------------- ### Install Mau CLI for Deployment Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/nestjs-app/README.md Installs the Mau command-line interface globally, which is used for deploying NestJS applications to AWS. ```bash $ yarn install -g mau ``` -------------------------------- ### Install JS SDK Dependencies Source: https://github.com/buildonspark/spark/blob/main/sdks/js/README.md Installs all project dependencies for the Spark JS SDK workspaces after navigating to the correct directory. ```bash cd spark/sdks/js yarn ``` -------------------------------- ### Start Local Spark Environment Source: https://github.com/buildonspark/spark/blob/main/README.md Initiate the local Spark development environment using the provided script. This is the first step before running tests. ```bash # Local environment ./run-everything.sh ``` -------------------------------- ### Go Code Comments: Good Clear Naming Example Source: https://github.com/buildonspark/spark/blob/main/AGENTS.md Presents a 'good' Go code example where a comment is unnecessary due to clear function naming, aligning with the guideline to prefer self-explanatory code. ```go // Good - no comment needed, function name is clear verifyOperatorSignatures(sigs) ``` -------------------------------- ### Initialize Spark Wallet and Get Balance Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/bare/README.md Initializes a Spark wallet, retrieves the balance, and displays the Spark address. Ensure to handle potential errors during execution. ```javascript import { SparkWallet } from "@buildonspark/bare"; import process from "bare-process"; async function main() { const { wallet, mnemonic } = await SparkWallet.initialize({ mnemonicOrSeed: undefined, // Or provide existing mnemonic options: { network: "MAINNET", // or "REGTEST" for testing }, }); const balance = await wallet.getBalance(); const sparkAddress = await wallet.getSparkAddress(); console.log("Mnemonic:", mnemonic); console.log("Balance:", balance); console.log("Spark Address:", sparkAddress); await wallet.cleanup(); } main().catch((error) => { console.error(error); process.exit(1); }); ``` -------------------------------- ### Run Local Development Environment with Tmux Source: https://github.com/buildonspark/spark/blob/main/GEMINI.md Launches the local development environment using tmux. This requires prior setup. ```bash # Local development with tmux (requires setup) ./run-everything.sh ``` -------------------------------- ### Registering the Ent Example Extension Source: https://github.com/buildonspark/spark/blob/main/spark/so/entexample/README.md This snippet shows how to register the entexample extension in your Ent code generation configuration. ```go ext := &entexample.Extension{} er.Generate("./schema", &gen.Config{ // ... features }, entc.Extensions(ext)) ``` -------------------------------- ### Build All Distributions Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-browser-extension/README.md Run this command to create distributions for both Chrome and Firefox extensions. ```bash yarn build ``` -------------------------------- ### Get Coop Exit Request Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Get a coop exit request by ID. ```APIDOC ## GET /spark-wallet/on-chain/coop-exit-request ### Description Get a coop exit request by ID. ### Method GET ### Endpoint /spark-wallet/on-chain/coop-exit-request ### Parameters #### Query Parameters - **id** (string) - Required - The ID of the coop exit request ## GET /issuer-wallet/on-chain/coop-exit-request ### Description Get a coop exit request by ID. ### Method GET ### Endpoint /issuer-wallet/on-chain/coop-exit-request ### Parameters #### Query Parameters - **id** (string) - Required - The ID of the coop exit request ``` -------------------------------- ### Basic CMake Configuration Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/spark-frost-bare-addon/CMakeLists.txt Sets the minimum CMake version and finds required packages like cmake-bare and cmake-cargo. This is the standard starting point for CMake projects. ```cmake cmake_minimum_required(VERSION 4.0) find_package(cmake-bare REQUIRED PATHS node_modules/cmake-bare) find_package(cmake-cargo REQUIRED PATHS node_modules/cmake-cargo) project(bare_addon C) add_crate() add_bare_module(bare_addon) ``` -------------------------------- ### Get Coop Exit Fee Estimate Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Get a fee estimate for coop exiting. ```APIDOC ## GET /spark-wallet/on-chain/get-coop-exit-fee-estimate ### Description Get a fee estimate for coop exiting. ### Method GET ### Endpoint /spark-wallet/on-chain/get-coop-exit-fee-estimate ### Parameters #### Query Parameters - **amountSats** (number) - Required - The amount to get the fee estimate for in satoshis - **withdrawalAddress** (string) - Required - The Bitcoin address where the funds should be sent ## GET /issuer-wallet/on-chain/get-coop-exit-fee-estimate ### Description Get a fee estimate for coop exiting. ### Method GET ### Endpoint /issuer-wallet/on-chain/get-coop-exit-fee-estimate ### Parameters #### Query Parameters - **amountSats** (number) - Required - The amount to get the fee estimate for in satoshis - **withdrawalAddress** (string) - Required - The Bitcoin address where the funds should be sent ``` -------------------------------- ### Install Clang on macOS Source: https://github.com/buildonspark/spark/blob/main/sdks/js/README.md Installs the Clang C/C++ compiler on macOS, a system dependency for the postinstall build process. ```bash xcode-select --install ``` -------------------------------- ### Build and Test Bare Addon Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/spark-frost-bare-addon/README.md Commands to build the addon and test it using the bare runtime. ```sh yarn build # Test the addon yarn bare index.js ``` -------------------------------- ### Quick Start with npm create Shorthand Source: https://github.com/buildonspark/spark/blob/main/sdks/js/apps/create-spark-app/README.md An alternative shorthand command using npm create to scaffold a new Spark application. This command initiates the project creation process. ```bash npm create @buildonspark/spark-app my-app ``` -------------------------------- ### Basic Test Fixture Creation with Defaults Source: https://github.com/buildonspark/spark/blob/main/spark/so/entexample/README.md Demonstrates creating a test fixture for a DepositAddress with all default values automatically applied. This is useful for simple test cases where custom values are not needed. ```go import ( "context" "testing" "github.com/lightsparkdev/spark/so/db" "github.com/lightsparkdev/spark/so/ent/entexample" ) func TestMyFeature(t *testing.T) { ctx := db.NewTestSQLiteContext(t) client := ent.FromContext(ctx) // Create a deposit address with all defaults addr := entexample.NewDepositAddressExample(t, client). MustExec(ctx) ``` -------------------------------- ### create-spark-app CLI Options Source: https://github.com/buildonspark/spark/blob/main/sdks/js/apps/create-spark-app/README.md This displays the available command-line options for the create-spark-app tool, including how to specify a template, a Git branch, and how to access help. ```bash Usage: npx @buildonspark/create-spark-app [project-name] [options] Options: --template, -t Template to use --branch, -b Git branch to fetch templates from (default: main) --help, -h Show help ``` -------------------------------- ### Local Development run-everything.sh Configuration Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/spark-mcp/README.md Configure the SDK for local development when using the `run-everything.sh` script. The SDK automatically handles routing to localhost. ```json { "mcpServers": { "spark-local": { "command": "node", "args": ["/path/to/spark/sdks/js/packages/spark-mcp/dist/index.js"], "env": { "BITCOIN_NETWORK": "LOCAL" } } } } ``` -------------------------------- ### Get Issuer Token Activity Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves a paginated list of all transactions specifically for the issuer's tokens. Similar to Get Token Activity but focused on issuer-specific transactions. ```http GET /issuer-wallet/tokens/issuer-token-activity ``` -------------------------------- ### Local SSP Development Environment Setup Source: https://github.com/buildonspark/spark/blob/main/README.md Set environment variables and run the Spark server locally for development. Ensure to unset AWS credentials if previously used for production. ```bash export QUART_APP=sparkcore.server export QUART_ENV=development export GRPC_DNS_RESOLVER=native export QUART_CONFIG=core-dev.py # run this line if accessed AWS PROD earlier, since PROD credentials supersede dev credentials. unset AWS_SESSION_TOKEN AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_TOKEN_EXPIRATION aws sso login QUART_CONFIG=core-dev.py uv run quart -A sparkcore.server -E development run ``` -------------------------------- ### Go Code Comments: Redundant Comment Example Source: https://github.com/buildonspark/spark/blob/main/AGENTS.md Illustrates a 'bad' example of a Go comment that merely repeats the code it precedes, emphasizing the preference for clear naming. ```go // Bad - comment just repeats the code // Verify operator signatures verifyOperatorSignatures(sigs) ``` -------------------------------- ### Build Command for Spark Frost Signer (Native) Source: https://github.com/buildonspark/spark/blob/main/signer/README.md Use this command to build the native binary for the spark-frost-signer crate. ```bash cargo build --release ``` -------------------------------- ### Initialize Spark Wallet with Existing Mnemonic Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/spark-sdk/README.md Initialize a Spark wallet using an existing twelve-word mnemonic phrase. Specify the network for the wallet. ```typescript // Or initialize with an existing mnemonic const { wallet } = await SparkWallet.initialize({ mnemonicOrSeed: "your twelve word mnemonic phrase here ...", options: { network: "MAINNET", }, }); ``` -------------------------------- ### Get Token Activity Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Returns a list of all token transactions. ```APIDOC ## GET /issuer-wallet/tokens/token-activity ### Description Returns a list of all token transactions. ### Method GET ### Endpoint /issuer-wallet/tokens/token-activity ### Parameters #### Query Parameters - `pageSize` (optional Number): Number of transactions to return (default: 20) - `lastTransactionHash` (optional String): The hash of the last transaction as a hex string - `layer` (optional String): The layer of the last transaction "L1" or "SPARK" ``` -------------------------------- ### Initialize Wallet Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Initializes a new wallet or recovers an existing one using a mnemonic or seed. ```APIDOC ## POST /spark-wallet/wallet/init ### Description Initialize a new wallet or recovers an existing one. ### Method POST ### Endpoint /spark-wallet/wallet/init ### Request Body - **mnemonicOrSeed** (string) - Optional - The mnemonic or seed for wallet recovery. ### Request Example ```json { "mnemonicOrSeed": "your mnemonic or seed here" } ``` ## POST /issuer-wallet/wallet/init ### Description Initialize a new wallet or recovers an existing one. ### Method POST ### Endpoint /issuer-wallet/wallet/init ### Request Body - **mnemonicOrSeed** (string) - Optional - The mnemonic or seed for wallet recovery. ### Request Example ```json { "mnemonicOrSeed": "your mnemonic or seed here" } ``` ``` -------------------------------- ### Get Pending Transfers Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves a list of pending transfers. ```APIDOC ## GET /spark-wallet/wallet/pending-transfers ### Description Returns a list of pending transfers. ### Method GET ### Endpoint /spark-wallet/wallet/pending-transfers ## GET /issuer-wallet/wallet/pending-transfers ### Description Returns a list of pending transfers. ### Method GET ### Endpoint /issuer-wallet/wallet/pending-transfers ``` -------------------------------- ### Spark CLI Options Source: https://github.com/buildonspark/spark/blob/main/sdks/js/apps/spark-cli/README.md Overview of available options for the Spark CLI, including network selection, configuration file path, version, and help. ```bash spark-cli [options] --network Network to connect to (mainnet, regtest, local) [default: regtest] --config Path to a JSON config file -v, --version Print version -h, --help Show this help message ``` -------------------------------- ### Building and Running spark-frost-signer Source: https://github.com/buildonspark/spark/blob/main/signer/README.md Commands to build the spark-frost-signer in release mode and run it with a specified Unix socket path. ```bash cargo build --release ./target/release/spark-frost-signer --unix /var/run/frost.sock ``` -------------------------------- ### Get Token Balance Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Returns the issuer's token balance. ```APIDOC ## GET /issuer-wallet/tokens/token-balance ### Description Returns the issuer's token balance. ### Method GET ### Endpoint /issuer-wallet/tokens/token-balance ``` -------------------------------- ### Get Spark Address Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves the wallet's Spark address. ```APIDOC ## GET /spark-wallet/wallet/spark-address ### Description Returns the wallet's Spark address. ### Method GET ### Endpoint /spark-wallet/wallet/spark-address ## GET /issuer-wallet/wallet/spark-address ### Description Returns the wallet's Spark address. ### Method GET ### Endpoint /issuer-wallet/wallet/spark-address ``` -------------------------------- ### Build Spark Backend Source: https://github.com/buildonspark/spark/blob/main/spark/CLAUDE.md Commands to build the Spark backend project, including generating proto files and Ent entities. ```bash make # Generate proto files mise gen-ent # Generate Ent entities after schema changes ``` -------------------------------- ### Get Issuer Token Activity Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Returns a list of all issuer token transactions. ```APIDOC ## GET /issuer-wallet/tokens/issuer-token-activity ### Description Returns a list of all issuer token transactions. ### Method GET ### Endpoint /issuer-wallet/tokens/issuer-token-activity ### Parameters #### Query Parameters - `pageSize` (optional Number): Number of transactions to return (default: 20) - `lastTransactionHash` (optional String): The hash of the last transaction as a hex string - `layer` (optional String): The layer of the last transaction "L1" or "SPARK" ``` -------------------------------- ### Generate Proto Files Source: https://github.com/buildonspark/spark/blob/main/README.md Run the `make` command to generate Go files after modifying proto files. ```bash make ``` -------------------------------- ### Get Lightning Send Request Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves a Lightning send request by its ID. ```APIDOC ## GET /spark-wallet/lightning/send-request ### Description Get a Lightning send request by ID. ### Method GET ### Endpoint /spark-wallet/lightning/send-request ### Query Parameters - **id** (string) - Required - The ID of the Lightning send request. ## GET /issuer-wallet/lightning/send-request ### Description Get a Lightning send request by ID. ### Method GET ### Endpoint /issuer-wallet/lightning/send-request ### Query Parameters - **id** (string) - Required - The ID of the Lightning send request. ``` -------------------------------- ### Build Command for Spark Frost (Native Library) Source: https://github.com/buildonspark/spark/blob/main/signer/README.md Use this command to build the native Rust library for the spark-frost crate. ```bash cargo build ``` -------------------------------- ### Get Lightning Receive Request Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves a Lightning receive request by its ID. ```APIDOC ## GET /spark-wallet/lightning/receive-request ### Description Get a Lightning receive request by ID. ### Method GET ### Endpoint /spark-wallet/lightning/receive-request ### Query Parameters - **id** (string) - Required - The ID of the Lightning receive request. ## GET /issuer-wallet/lightning/receive-request ### Description Get a Lightning receive request by ID. ### Method GET ### Endpoint /issuer-wallet/lightning/receive-request ### Query Parameters - **id** (string) - Required - The ID of the Lightning receive request. ``` -------------------------------- ### Get Transfer History Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves a list of past transfers with optional pagination. ```APIDOC ## GET /spark-wallet/wallet/transfers ### Description Returns a list of transfers. ### Method GET ### Endpoint /spark-wallet/wallet/transfers ### Query Parameters - **limit** (Number) - Optional - Number of transfers to return (default: 20) - **offset** (Number) - Optional - Offset for pagination (default: 0) ## GET /issuer-wallet/wallet/transfers ### Description Returns a list of transfers. ### Method GET ### Endpoint /issuer-wallet/wallet/transfers ### Query Parameters - **limit** (Number) - Optional - Number of transfers to return (default: 20) - **offset** (Number) - Optional - Offset for pagination (default: 0) ``` -------------------------------- ### Get Token Info Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves token information for all tokens held in the wallet. ```APIDOC ## GET /spark-wallet/tokens/info ### Description Returns the token information for all tokens held in this wallet. ### Method GET ### Endpoint /spark-wallet/tokens/info ## GET /issuer-wallet/tokens/info ### Description Returns the token information for all tokens held in this wallet. ### Method GET ### Endpoint /issuer-wallet/tokens/info ``` -------------------------------- ### Build Command for Spark Frost (WASM Library) Source: https://github.com/buildonspark/spark/blob/main/signer/README.md Use this command to build the WebAssembly library for the spark-frost crate. ```bash cargo build --target wasm32-unknown-unknown ``` -------------------------------- ### Get Wallet Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Returns the raw wallet instance for both Spark and Issuer wallets. ```APIDOC ## GET /spark-wallet/wallet ### Description Returns the raw wallet instance. ### Method GET ### Endpoint /spark-wallet/wallet ## GET /issuer-wallet/wallet ### Description Returns the raw wallet instance. ### Method GET ### Endpoint /issuer-wallet/wallet ``` -------------------------------- ### Configure PostgreSQL for TCP/IP Connections Source: https://github.com/buildonspark/spark/blob/main/README.md Sample configurations for postgresql.conf and pg_hba.conf to enable TCP/IP connections and local trust authentication. ```ini hba_file = './pg_hba.conf' ident_file = './pg_ident.conf' listen_addresses = '*' log_destination = 'stderr' log_line_prefix = '[%p] ' port = 5432 ``` ```ini #type database user address method local all all trust host all all 127.0.0.1/32 trust host all all ::1/128 trust ``` -------------------------------- ### Get Coop Exit Request Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieve a cooperative exit request by its unique ID. ```http GET /spark-wallet/on-chain/coop-exit-request?id=string GET /issuer-wallet/on-chain/coop-exit-request?id=string ``` -------------------------------- ### Get Wallet Balance Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves the current wallet balance, including token balances. ```APIDOC ## GET /spark-wallet/wallet/balance ### Description Returns the current wallet balance, including token balances. ### Method GET ### Endpoint /spark-wallet/wallet/balance ## GET /issuer-wallet/wallet/balance ### Description Returns the current wallet balance, including token balances. ### Method GET ### Endpoint /issuer-wallet/wallet/balance ``` -------------------------------- ### Generate Python Bindings and Build Project Source: https://github.com/buildonspark/spark/blob/main/signer/spark-token-primitives-uniffi/README.md Navigate to the UniFFI bindings directory, generate Python bindings using uniffi-bindgen, and then build the Rust project. ```sh cd signer/spark-token-primitives-uniffi cargo run --bin uniffi-bindgen generate src/spark_token_primitives.udl --language python --out-dir spark-token-primitives-python/src/spark_token_primitives/ --no-format cargo build --profile release-smaller ``` -------------------------------- ### Get Identity Public Key Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves the wallet's identity public key. ```APIDOC ## GET /spark-wallet/wallet/identity-public-key ### Description Returns the wallet's identity public key. ### Method GET ### Endpoint /spark-wallet/wallet/identity-public-key ## GET /issuer-wallet/wallet/identity-public-key ### Description Returns the wallet's identity public key. ### Method GET ### Endpoint /issuer-wallet/wallet/identity-public-key ``` -------------------------------- ### Get Token Public Key Info Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Returns information about the token's public key. ```APIDOC ## GET /issuer-wallet/tokens/token-public-key-info ### Description Returns information about the token's public key. ### Method GET ### Endpoint /issuer-wallet/tokens/token-public-key-info ``` -------------------------------- ### Run Android App Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-expo-react-native-app/README.md Execute this command in the project root to build and run the Android application. ```bash yarn android ``` -------------------------------- ### Initialize Issuer Wallet Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Initializes an Issuer wallet by making an empty POST request to the specified endpoint. ```bash https://localhost:{PORT}/issuer-wallet/init ``` -------------------------------- ### Get Wallet Instance Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves the raw wallet instance. Use this for both Spark and Issuer wallets. ```http GET /spark-wallet/wallet GET /issuer-wallet/wallet ``` -------------------------------- ### Initialize Spark Wallet Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Initializes a Spark wallet by making an empty POST request to the specified endpoint. ```bash https://localhost:{PORT}/spark-wallet/init ``` -------------------------------- ### Dynamic Runtime Logging Source: https://github.com/buildonspark/spark/blob/main/spark/CLAUDE.md Use `logger.Sugar().Infof` for logging dynamic runtime values. This is the preferred method for general information logging. ```go // Preferred for dynamic runtime values logger.Sugar().Infof("just finished %d things for task %s", numberOfThings, taskID) ``` -------------------------------- ### Get Lightning Send Fee Estimate Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Estimates the fee for sending Lightning payments for a given invoice. ```APIDOC ## GET /spark-wallet/lightning/send-fee-estimate ### Description Get a fee estimate for sending Lightning payments. ### Method GET ### Endpoint /spark-wallet/lightning/send-fee-estimate ### Query Parameters - **invoice** (string) - Required - The encoded invoice to get the fee estimate for. ## GET /issuer-wallet/lightning/send-fee-estimate ### Description Get a fee estimate for sending Lightning payments. ### Method GET ### Endpoint /issuer-wallet/lightning/send-fee-estimate ### Query Parameters - **invoice** (string) - Required - The encoded invoice to get the fee estimate for. ``` -------------------------------- ### Get Pending Transfers Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Fetches a list of pending transfers for the wallet. Use this for both Spark and Issuer wallets. ```http GET /spark-wallet/wallet/pending-transfers GET /issuer-wallet/wallet/pending-transfers ``` -------------------------------- ### Inspect Bare App Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-bare-app/README.md Run the bare app with inspection enabled to attach a debugger. ```bash yarn bare --inspect ``` -------------------------------- ### Build Commands for Spark SDK Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/spark-sdk/CLAUDE.md Common commands for building, testing, and generating artifacts for the Spark SDK. ```bash yarn build # Full production build yarn build:watch # Watch mode yarn test # Run tests yarn generate:proto # Regenerate proto types yarn patch-wasm # Re-run WASM post-processing (after build-bindings.sh) ``` -------------------------------- ### Run NestJS Application in Production Mode Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/nestjs-app/README.md Compiles and starts the NestJS application in production mode, optimized for performance. ```bash $ yarn run start:prod ``` -------------------------------- ### Initialize Wallet Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Initializes a new wallet or recovers an existing one. If no mnemonic is provided, a new one is generated and saved. ```http POST /spark-wallet/wallet/init POST /issuer-wallet/wallet/init ``` ```json { "mnemonicOrSeed": "string | undefined" } ``` -------------------------------- ### Run NestJS Application in Development Mode Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/nestjs-app/README.md Starts the NestJS application in development mode, typically with hot-reloading enabled. ```bash $ yarn run start ``` -------------------------------- ### Go Logging: Good Sugar Logger Usage for Dynamic Values Source: https://github.com/buildonspark/spark/blob/main/AGENTS.md Shows how to use Zap's `SugaredLogger` for printf-style logging with dynamic runtime values. ```go // Good - Sugar for printf-style with dynamic values logger.Sugar().Infof("transfer completed for %s", transferID) ``` ```go // Good - Sugar for multiple dynamic values logger.Sugar().Infof("rate limiter: enabled %t, window %s, max %d", enabled, window, max) ``` -------------------------------- ### Get Lightning Receive Request Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves a Lightning receive request by its ID. Use this for both Spark and Issuer wallets. ```http GET /spark-wallet/lightning/receive-request?id=string GET /issuer-wallet/lightning/receive-request?id=string ``` -------------------------------- ### Get Transfer History Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves a list of past transfers. Supports pagination with optional limit and offset parameters. ```http GET /spark-wallet/wallet/transfers?limit=20&offset=0 GET /issuer-wallet/wallet/transfers?limit=20&offset=0 ``` -------------------------------- ### Get Spark Address Source: https://github.com/buildonspark/spark/blob/main/sdks/js/examples/spark-node-express/README.md Retrieves the wallet's Spark address. Use this endpoint for both Spark and Issuer wallets. ```http GET /spark-wallet/wallet/spark-address GET /issuer-wallet/wallet/spark-address ``` -------------------------------- ### Local Development Minikube Configuration Source: https://github.com/buildonspark/spark/blob/main/sdks/js/packages/spark-mcp/README.md Set up the SDK for local development using Minikube. This requires specifying the local ingress host for routing. ```json { "mcpServers": { "spark-local": { "command": "node", "args": ["/path/to/spark/sdks/js/packages/spark-mcp/dist/index.js"], "env": { "BITCOIN_NETWORK": "LOCAL", "SPARK_LOCAL_INGRESS_HOST": "192.168.49.2" } } } } ```