diff --git a/docs/sandbox-deployment.md b/docs/sandbox-deployment.md index d84cf1c..f5c44b8 100644 --- a/docs/sandbox-deployment.md +++ b/docs/sandbox-deployment.md @@ -1,66 +1,70 @@ -# Sandbox Deployment Recipes +# Soroban Sandbox Local Deployment Quickstart -Quick developer setup for FluxaPay using Docker Compose templates (Issue #231). +This guide walks through deploying and testing the full FluxaPay contract stack locally using the Stellar Soroban Sandbox network. -## Prerequisites +## 📋 Prerequisites -- Docker Desktop or Docker Engine + Compose v2 -- Stellar CLI (`stellar`) on the host for `scripts/sandbox-init.sh` -- Copy environment template: `cp .env.docker.example .env.docker` +- Docker Desktop / Docker Engine +- `stellar-cli` (v21.0.0+ installed via Cargo: `cargo install --locked stellar-cli`) +- Node.js 18+ -## Local Standalone Sandbox +## 🚀 Step-by-Step Walkthrough -Runs a local Stellar/Soroban node via `stellar/quickstart`. +### 1. Launch Local Soroban Sandbox +Start local Stellar standalone network via Docker: ```bash -docker compose up -d -./scripts/sandbox-init.sh +docker run --rm -it \ + -p 8000:8000 \ + --name soroban-preview \ + stellar/quickstart:testing \ + --standalone \ + --enable-soroban-rpc ``` -Default endpoints: - -| Service | URL | -|---------|-----| -| Soroban RPC | `http://localhost:8000/soroban/rpc` | -| Horizon | `http://localhost:8000` | -| Friendbot | `http://localhost:8000/friendbot?addr=` | - -Build WASM inside Docker (optional profile): +### 2. Initialize Network & Secret Keys +Run sandbox initialization script: ```bash -docker compose --profile build up contract-builder +bash scripts/sandbox-init.sh ``` -## Testnet Devbox - -Containerized Node.js workspace prewired for testnet RPC/HORIZON URLs. +### 3. Deploy Contract Stack +Deploy all 5 core Soroban smart contracts: ```bash -docker compose -f docker-compose.testnet.yml up -d -docker compose -f docker-compose.testnet.yml exec devbox bash -cd sdk && npm install && npm run build -``` +# 1. PaymentProcessor +stellar contract deploy --wasm target/wasm32-unknown-unknown/release/payment_processor.wasm --source alice --network standalone -Run SDK build check profile: +# 2. RefundManager +stellar contract deploy --wasm target/wasm32-unknown-unknown/release/refund_manager.wasm --source alice --network standalone -```bash -docker compose -f docker-compose.testnet.yml --profile ci up sdk-check -``` +# 3. FXOracle +stellar contract deploy --wasm target/wasm32-unknown-unknown/release/fx_oracle.wasm --source alice --network standalone -## Environment Variables +# 4. MerchantRegistry +stellar contract deploy --wasm target/wasm32-unknown-unknown/release/merchant_registry.wasm --source alice --network standalone -See `.env.docker.example` for all supported variables. After deploying contracts, populate: - -- `PAYMENT_PROCESSOR_ID` -- `MERCHANT_REGISTRY_ID` -- `FX_ORACLE_ID` -- `REFUND_MANAGER_ID` - -Then follow invoke recipes in [`local-invoke.md`](./local-invoke.md). +# 5. PaymentLinkManager +stellar contract deploy --wasm target/wasm32-unknown-unknown/release/payment_link_manager.wasm --source alice --network standalone +``` -## Tear Down +### 4. Account Funding & Initializing Entrypoints ```bash -docker compose down -v -docker compose -f docker-compose.testnet.yml down -v +# Fund test accounts +node scripts/fund-accounts.js + +# Invoke initialize on PaymentProcessor +stellar contract invoke \ + --id \ + --source alice \ + --network standalone \ + -- \ + initialize --admin alice --fee_bps 100 ``` + +## 🛠️ Troubleshooting + +- **`InsufficientFunds`**: Fund the invoking account using Friendbot: `curl "http://localhost:8000/friendbot?addr="`. +- **`ContractNotFound`**: Ensure the contract ID matches the deployment output saved in `.env`.