Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,19 @@
"@typescript-eslint/no-explicit-any": "warn",
"no-console": ["warn", { "allow": ["warn", "error"] }]
},
"ignorePatterns": ["node_modules/", "dist/", "android/", "ios/", ".expo/", "src/contracts/types/"]
"ignorePatterns": [
"node_modules/",
"dist/",
"android/",
"ios/",
".expo/",
"src/contracts/types/"
],
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
NODE_VERSION: '20'
RUST_VERSION: '1.77'
RUST_VERSION: '1.85'

jobs:
commitlint:
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ contracts/target/
# Backup/fixed package snapshots
package-fixed.json
package.json.backup
# GitHub API response dumps (UTF-16 encoded)
issue*.json
issues_summary.json
72 changes: 36 additions & 36 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ Thank you for taking the time to contribute SubTracker. This document covers eve

### Prerequisites

| Tool | Version | Purpose |
|------|---------|---------|
| Node.js | 20+ | Mobile app development |
| npm | bundled with Node | Package management |
| Rust | 1.77+ | Smart contract development |
| Expo CLI | latest | Running and building the app |
| Soroban CLI | latest | Deploying/interacting with contracts |
| Tool | Version | Purpose |
| ----------- | ----------------- | ------------------------------------ |
| Node.js | 20+ | Mobile app development |
| npm | bundled with Node | Package management |
| Rust | 1.77+ | Smart contract development |
| Expo CLI | latest | Running and building the app |
| Soroban CLI | latest | Deploying/interacting with contracts |

### Mobile App Setup

Expand Down Expand Up @@ -60,11 +60,11 @@ npm run contracts:test

Create a `.env` file at the project root if needed:

| Variable | Description |
|----------|-------------|
| `STELLAR_NETWORK` | `testnet` or `public` |
| `CONTRACT_ID` | Deployed Soroban subscription contract ID |
| `WEB3AUTH_CLIENT_ID` | Web3Auth client ID for social login |
| Variable | Description |
| -------------------- | ----------------------------------------- |
| `STELLAR_NETWORK` | `testnet` or `public` |
| `CONTRACT_ID` | Deployed Soroban subscription contract ID |
| `WEB3AUTH_CLIENT_ID` | Web3Auth client ID for social login |

### Generating Contract TypeScript Types

Expand Down Expand Up @@ -149,17 +149,17 @@ This project uses **Conventional Commits**. Every commit message must follow thi

### Types

| Type | When to use |
|------|-------------|
| `feat` | New feature |
| `fix` | Bug fix |
| `chore` | Maintenance, dependency updates, tooling |
| `docs` | Documentation only |
| Type | When to use |
| ---------- | ----------------------------------------------- |
| `feat` | New feature |
| `fix` | Bug fix |
| `chore` | Maintenance, dependency updates, tooling |
| `docs` | Documentation only |
| `refactor` | Code change that is neither a fix nor a feature |
| `test` | Adding or updating tests |
| `style` | Formatting, whitespace — no logic change |
| `ci` | CI/CD configuration changes |
| `perf` | Performance improvement |
| `test` | Adding or updating tests |
| `style` | Formatting, whitespace — no logic change |
| `ci` | CI/CD configuration changes |
| `perf` | Performance improvement |

### Scope (optional but encouraged)

Expand Down Expand Up @@ -210,10 +210,10 @@ refactor/wallet-service-error-handling

### Protected Branches

| Branch | Purpose |
|--------|---------|
| `main` | Production-ready code — all CI must pass, PR required |
| `dev` / `develop` | Integration branch — CI required |
| Branch | Purpose |
| ----------------- | ----------------------------------------------------- |
| `main` | Production-ready code — all CI must pass, PR required |
| `dev` / `develop` | Integration branch — CI required |

Never commit directly to `main`. All changes must go through a pull request.

Expand All @@ -232,16 +232,16 @@ Never commit directly to `main`. All changes must go through a pull request.

All of the following CI jobs must pass before a PR can be merged:

| Check | Command |
|-------|---------|
| Prettier format | `npm run format:check` |
| ESLint | `npm run lint` |
| TypeScript type check | `npm run typecheck` |
| Jest tests | `npm test` |
| Expo build | `npm run build` |
| Rust formatting | `npm run contracts:fmt` |
| Rust Clippy | `npm run contracts:clippy` |
| Rust tests | `npm run contracts:test` |
| Check | Command |
| --------------------- | -------------------------- |
| Prettier format | `npm run format:check` |
| ESLint | `npm run lint` |
| TypeScript type check | `npm run typecheck` |
| Jest tests | `npm test` |
| Expo build | `npm run build` |
| Rust formatting | `npm run contracts:fmt` |
| Rust Clippy | `npm run contracts:clippy` |
| Rust tests | `npm run contracts:test` |

### PR Checklist

Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ SubTrackr/
### 1. Clone the Repository

First, clone the repository to your local machine:

```bash
git clone https://github.com/Smartdevs17/SubTrackr.git
cd SubTrackr
Expand All @@ -76,30 +77,36 @@ cd SubTrackr
### 2. Install Prerequisites

#### Required for all development:

- **Node.js 20+**: We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage Node.js versions:

```bash
# Install nvm (if not already installed)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

# Install and use Node.js 20
nvm install 20
nvm use 20
```

- **Expo CLI**: Install the Expo command line tools globally:
```bash
npm install -g expo-cli
```
- **Freighter Wallet**: Install the [Freighter Wallet](https://freighter.app/) browser extension for Stellar transaction signing.

#### Required only for smart contract development:

- **Rust**: Install Rust and the WASM target:

```bash
# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Add WASM target
rustup target add wasm32-unknown-unknown
```

- **Soroban CLI**: Install the Soroban command line tools:
```bash
cargo install --locked soroban-cli
Expand All @@ -108,21 +115,23 @@ cd SubTrackr
### 3. Configure Environment Variables

Create a `.env` file in the root directory of the project:

```bash
cp .env.example .env
```

> **Note**: If `.env.example` doesn't exist, create a new `.env` file with the following variables:

| Variable | Description | Example Value |
| -------------------- | ----------------------------------------- | ------------------------------------------ |
| `STELLAR_NETWORK` | `testnet` or `public` Stellar network | `testnet` |
| `CONTRACT_ID` | Deployed Soroban subscription contract ID | `CB64...` (your deployed contract address) |
| Variable | Description | Example Value |
| -------------------- | ----------------------------------------- | ----------------------------------------------------------------- |
| `STELLAR_NETWORK` | `testnet` or `public` Stellar network | `testnet` |
| `CONTRACT_ID` | Deployed Soroban subscription contract ID | `CB64...` (your deployed contract address) |
| `WEB3AUTH_CLIENT_ID` | Web3Auth client ID for social login | Get one from [Web3Auth Dashboard](https://dashboard.web3auth.io/) |

### 4. Run the Mobile App

Install dependencies and start the Expo development server:

```bash
# Install dependencies
npm install
Expand All @@ -132,13 +141,15 @@ npx expo start
```

You can then run the app on:

- **iOS Simulator**: Press `i` in the Expo terminal
- **Android Emulator**: Press `a` in the Expo terminal
- **Physical Device**: Scan the QR code with the Expo Go app (iOS/Android)

### 5. (Optional) Deploy Smart Contracts

If you want to work on the smart contracts:

```bash
# Navigate to contracts directory
cd contracts
Expand All @@ -153,6 +164,7 @@ soroban contract deploy --wasm target/wasm32-unknown-unknown/release/subtrackr.w
### 6. Run Tests

Run the test suite to ensure everything is working correctly:

```bash
# Run unit tests
npm test
Expand Down Expand Up @@ -220,4 +232,4 @@ npm run release:dry-run

## License

MIT
MIT
72 changes: 72 additions & 0 deletions contracts/DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# SubTrackr Contract Deployment Guide

This guide describes how to deploy SubTrackr smart contracts to various Stellar networks using the provided automation scripts.

## Prerequisites

- [Soroban CLI](https://developers.stellar.org/docs/smart-contracts/getting-started/setup#install-the-soroban-cli) installed.
- [Rust](https://rustup.rs/) and `wasm32-unknown-unknown` target installed.
- A Stellar account with enough XLM for the target network.

## Deployment Scripts

All scripts are located in the `scripts/` directory at the project root.

### 1. Local Deployment

For development and testing on a local Soroban network.

```bash
./scripts/deploy-local.sh
```

**Note**: Assumes a local network is running and an identity `alice` exists.

### 2. Testnet Deployment

For deploying to the Stellar Testnet.

```bash
export SOROBAN_ACCOUNT="your-testnet-account-name"
export ADMIN_ADDRESS="GB..."
./scripts/deploy-testnet.sh
```

### 3. Mainnet Deployment

For deploying to the Stellar Public network (Mainnet).

```bash
export SOROBAN_ACCOUNT="your-mainnet-account-name"
export ADMIN_ADDRESS="GD..."
./scripts/deploy-mainnet.sh
```

**⚠️ WARNING**: Mainnet deployment costs real XLM. Ensure you have sufficient funds and have reviewed the contract code.

## Environment Variables

| Variable | Description | Required For |
|---|---|---|
| `SOROBAN_ACCOUNT` | The identity name (configured in Soroban CLI) or secret key to use for deployment. | Testnet, Mainnet |
| `ADMIN_ADDRESS` | The Stellar address that will be set as the contract admin during initialization. | Testnet, Mainnet |

## Verification

After deployment, you can verify that the contract is active by running:

```bash
./scripts/verify.sh <CONTRACT_ID> <NETWORK>
```

Replace `<CONTRACT_ID>` with the ID returned by the deployment script and `<NETWORK>` with `local`, `testnet`, or `public`.

## Rollback Procedure

Since smart contracts on Soroban are immutable (unless explicitly designed otherwise), a "rollback" typically involves:

1. Fixing the issue in the contract source code.
2. Deploying a new version of the contract.
3. Updating the application (frontend/backend) to use the new `CONTRACT_ID`.

Ensure you keep track of the `CONTRACT_ID` for each deployment (these are automatically saved to `contracts/.env.<network>`).
Loading
Loading