Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "rain.orderbook dev",
"name": "raindex dev",
"image": "ghcr.io/zombiezen/codespaces-nix",
"remoteUser": "vscode",
"features": {
Expand Down
14 changes: 7 additions & 7 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
> NOTE: Before using this guide, read the repository root `AGENTS.md` for authoritative agent instructions.

# Rain Orderbook – Agent Guide (Concise)
# Raindex – Agent Guide (Concise)

Always run commands via Nix: `nix develop -c <command>`. Never cancel long-running tasks (45–90 min builds, 30+ min tests).

## 1. Dependency readiness (quick check)
```bash
nix develop -c cargo build
nix develop -c cargo build --target wasm32-unknown-unknown --lib -r --workspace \
--exclude rain_orderbook_cli --exclude rain_orderbook_integration_tests
--exclude raindex_cli --exclude raindex_integration_tests
nix develop -c npm install
nix develop -c npm run build:orderbook
nix develop -c npm run build:raindex
nix develop -c npm run build:ui
```

Expand All @@ -19,7 +19,7 @@ If any step fails due to earlier lint/test issues, use the fallback below.
## 2. Development loop
- Edit code
- Rebuild dependencies you touched:
- Rust used by `@rainlanguage/orderbook` → `nix develop -c npm run build:orderbook`
- Rust used by `@rainlanguage/raindex` → `nix develop -c npm run build:raindex`
- `@rainlanguage/ui-components` → `nix develop -c npm run build -w @rainlanguage/ui-components`
- Run targeted tests and lints for changed areas

Expand All @@ -28,7 +28,7 @@ If any step fails due to earlier lint/test issues, use the fallback below.
| Area | Build (if needed) | Lint/Check | Tests |
|------|--------------------|------------|-------|
| Rust crates (`crates/*`) | `nix develop -c cargo build` | `nix develop -c cargo clippy --workspace --all-targets --all-features -D warnings` | `nix develop -c cargo test --workspace` or `--package <crate>` |
| Orderbook TS (`packages/orderbook`) | `nix develop -c npm run build:orderbook` | `nix develop -c npm run check -w @rainlanguage/orderbook` | `nix develop -c npm run test -w @rainlanguage/orderbook` |
| Orderbook TS (`packages/orderbook`) | `nix develop -c npm run build:raindex` | `nix develop -c npm run check -w @rainlanguage/raindex` | `nix develop -c npm run test -w @rainlanguage/raindex` |
| UI components (`packages/ui-components`) | `nix develop -c npm run build -w @rainlanguage/ui-components` | `nix develop -c npm run svelte-lint-format-check -w @rainlanguage/ui-components` | `nix develop -c npm run test -w @rainlanguage/ui-components` |
| Webapp (`packages/webapp`) | `nix develop -c npm run build -w @rainlanguage/webapp` | `nix develop -c npm run svelte-lint-format-check -w @rainlanguage/webapp` | `nix develop -c npm run test -w @rainlanguage/webapp` |
| Solidity contracts | `nix develop -c forge build` | — | `nix develop -c forge test` |
Expand All @@ -48,7 +48,7 @@ Partial commits are OK during the session. Before your final commit of the sessi
```bash
./prep-all.sh
nix develop -c npm run lint-format-check:all
nix develop -c npm run build:orderbook # if Rust/orderbook changed
nix develop -c npm run build:raindex # if Rust/orderbook changed
nix develop -c npm run build:ui
nix develop -c cargo test --workspace
nix develop -c npm run test
Expand All @@ -72,7 +72,7 @@ nix develop -c bash -c '(cd lib/rain.interpreter/lib/rain.interpreter.interface/
nix develop -c bash -c '(cd lib/rain.interpreter/lib/rain.metadata && rainix-sol-prelude && rainix-rs-prelude)'
nix develop -c rainix-sol-prelude && nix develop -c rainix-rs-prelude && nix develop -c raindex-prelude
nix develop -c ob-ui-components-prelude
nix develop -c npm run build -w @rainlanguage/orderbook
nix develop -c npm run build -w @rainlanguage/raindex
nix develop -c npm run build -w @rainlanguage/ui-components
nix develop -c npm run build -w @rainlanguage/webapp
```
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-cli-binary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
BUILD_TIMESTAMP=$(date -u +"%Y%m%dT%H%M%SZ")
echo "TAG_NAME=cli-${SHORT_SHA}-${BUILD_TIMESTAMP}" >> "$GITHUB_ENV"
echo "RELEASE_NAME=CLI Binary ${SHORT_SHA} (${BUILD_TIMESTAMP})" >> "$GITHUB_ENV"
echo "ASSET_PATH=crates/cli/bin/rain-orderbook-cli.tar.gz" >> "$GITHUB_ENV"
echo "ASSET_PATH=crates/cli/bin/raindex-cli.tar.gz" >> "$GITHUB_ENV"

- name: Publish GitHub release
uses: softprops/action-gh-release@v2
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/npm-package-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ jobs:
run: |
echo "Checking repository consistency..."
GIT_REPO=$(git remote get-url origin | sed 's/.*github.com[/:]//; s/.git$//')
OB_PKG_REPO=$(node -e "console.log(require('./packages/orderbook/package.json').repository?.url || '')" | sed 's|https://github.com/||; s|git+||; s|.git$||')
DEX_PKG_REPO=$(node -e "console.log(require('./packages/raindex/package.json').repository?.url || '')" | sed 's|https://github.com/||; s|git+||; s|.git$||')
UC_PKG_REPO=$(node -e "console.log(require('./packages/ui-components/package.json').repository?.url || '')" | sed 's|https://github.com/||; s|git+||; s|.git$||')
echo "Git remote: $GIT_REPO"
echo "orderbook package.json: $OB_PKG_REPO"
echo "raindex package.json: $DEX_PKG_REPO"
echo "ui-components package.json: $UC_PKG_REPO"
if [ "$GIT_REPO" != "$OB_PKG_REPO" ]; then
echo "Repository mismatch for orderbook!"
if [ "$GIT_REPO" != "$DEX_PKG_REPO" ]; then
echo "Repository mismatch for raindex!"
echo "This will cause 422 error during publish"
exit 1
fi
Expand Down Expand Up @@ -134,12 +134,12 @@ jobs:
- name: Test UI Components
run: nix develop -c npm run test -w @rainlanguage/ui-components

# check for npm package blacklists pkgs across all orderbook related packages
# check for npm package blacklists pkgs across all raindex related packages
- uses: rainlanguage/github-chore/.github/actions/npm-blacklist@main

- uses: rainlanguage/github-chore/.github/actions/npm-blacklist@main
with:
working-directory: packages/orderbook
working-directory: packages/raindex

- uses: rainlanguage/github-chore/.github/actions/npm-blacklist@main
with:
Expand All @@ -154,18 +154,18 @@ jobs:
# get hash of latest published pkgs from npm and concat them
- name: Get Old Hash
run: |
OB_PKG_OLD_HASH=$(npm view @rainlanguage/orderbook@latest dist.shasum 2>/dev/null || echo "none")
DEX_PKG_OLD_HASH=$(npm view @rainlanguage/raindex@latest dist.shasum 2>/dev/null || echo "none")
UC_PKG_OLD_HASH=$(npm view @rainlanguage/ui-components@latest dist.shasum 2>/dev/null || echo "none")
OLD_HASH=$OB_PKG_OLD_HASH-$UC_PKG_OLD_HASH
OLD_HASH=$DEX_PKG_OLD_HASH-$UC_PKG_OLD_HASH
echo "OLD_HASH=$OLD_HASH" >> $GITHUB_ENV
echo "old hash: $OLD_HASH"

# calc hash of current workspace pkgs by packing them and concat them
- name: Get New Hash
run: |
OB_PKG_NEW_HASH=$(npm pack --silent -w @rainlanguage/orderbook | xargs shasum | cut -c1-40)
DEX_PKG_NEW_HASH=$(npm pack --silent -w @rainlanguage/raindex | xargs shasum | cut -c1-40)
UC_PKG_NEW_HASH=$(npm pack --silent -w @rainlanguage/ui-components | xargs shasum | cut -c1-40)
NEW_HASH=$OB_PKG_NEW_HASH-$UC_PKG_NEW_HASH
NEW_HASH=$DEX_PKG_NEW_HASH-$UC_PKG_NEW_HASH
echo "NEW_HASH=$NEW_HASH" >> $GITHUB_ENV
echo "new hash: $NEW_HASH"
rm -f *.tgz
Expand All @@ -176,27 +176,27 @@ jobs:
- name: Set Version
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
npm version prerelease --preid alpha --no-git-tag-version -w @rainlanguage/orderbook
NEW_VERSION=$(jq -r '.version' ./packages/orderbook/package.json)
npm version prerelease --preid alpha --no-git-tag-version -w @rainlanguage/raindex
NEW_VERSION=$(jq -r '.version' ./packages/raindex/package.json)
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
jq --arg v "$NEW_VERSION" '.dependencies."@rainlanguage/orderbook" = $v' ./packages/ui-components/package.json > tmp.json && mv tmp.json ./packages/ui-components/package.json
jq --arg v "$NEW_VERSION" '.dependencies."@rainlanguage/raindex" = $v' ./packages/ui-components/package.json > tmp.json && mv tmp.json ./packages/ui-components/package.json
npx prettier --write ./packages/ui-components/package.json
npm version prerelease --preid alpha --no-git-tag-version -w @rainlanguage/ui-components

# Create orderbook npm package tarball
- name: Create orderbook NPM Package Tarball
# Create raindex npm package tarball
- name: Create raindex NPM Package Tarball
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: echo "OB_NPM_PACKAGE=$(npm pack --silent -w @rainlanguage/orderbook)" >> $GITHUB_ENV
run: echo "OB_NPM_PACKAGE=$(npm pack --silent -w @rainlanguage/raindex)" >> $GITHUB_ENV

- name: Rename orderbook NPM Package Tarball
- name: Rename raindex NPM Package Tarball
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: mv ${{ env.OB_NPM_PACKAGE }} orderbook_npm_package_${{ env.NEW_VERSION }}.tgz
run: mv ${{ env.OB_NPM_PACKAGE }} raindex_npm_package_${{ env.NEW_VERSION }}.tgz

# publish orderbook pkg to npm
- name: Publish orderbook pkg To NPM
- name: Publish raindex pkg To NPM
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
npm publish orderbook_npm_package_${{ env.NEW_VERSION }}.tgz \
npm publish raindex_npm_package_${{ env.NEW_VERSION }}.tgz \
--access public \
--tag latest \
--verbose
Expand All @@ -223,7 +223,7 @@ jobs:
- name: Commit And Tag
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
git add "packages/orderbook/package.json"
git add "packages/raindex/package.json"
git add "packages/ui-components/package.json"
git add "package-lock.json"
git commit -m "NPM Package Release v${{ env.NEW_VERSION }}"
Expand All @@ -247,7 +247,7 @@ jobs:
tag_name: npm-v${{ env.NEW_VERSION }}
name: NPM Package Release v${{ env.NEW_VERSION }}
files: |
orderbook_npm_package_${{ env.NEW_VERSION }}.tgz
raindex_npm_package_${{ env.NEW_VERSION }}.tgz
ui_components_npm_package_${{ env.NEW_VERSION }}.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-ui-components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:

- uses: rainlanguage/github-chore/.github/actions/npm-blacklist@main
with:
working-directory: packages/orderbook
working-directory: packages/raindex

- uses: rainlanguage/github-chore/.github/actions/npm-blacklist@main
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-webapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:

- uses: rainlanguage/github-chore/.github/actions/npm-blacklist@main
with:
working-directory: packages/orderbook
working-directory: packages/raindex

- uses: rainlanguage/github-chore/.github/actions/npm-blacklist@main
with:
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ subgraph/tests/.latest.json
node_modules
temp
dist
packages/orderbook/cjs.js
packages/orderbook/cjs.d.ts
packages/orderbook/esm.js
packages/orderbook/esm.d.ts
packages/raindex/cjs.js
packages/raindex/cjs.d.ts
packages/raindex/esm.js
packages/raindex/esm.d.ts
.direnv/

# Audit proposed fixes
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
## Project Structure & Module Organization
- Solidity contracts: `src/`, tests in `test/` with fixtures in `test-resources/`.
- Rust workspace: `crates/*` (e.g., `cli`, `common`, `bindings`, `js_api`, `quote`, `subgraph`, `settings`, `math`, `integration_tests`).
- JavaScript/Svelte: `packages/*` — `webapp`, `ui-components`, `orderbook` (wasm wrapper published to npm).
- JavaScript/Svelte: `packages/*` — `webapp`, `ui-components`, `raindex` (wasm wrapper published to npm).
- Subgraph and tooling: `subgraph/`, `script/`, helper scripts like `prep-all.sh`.

## Build, Test, and Development Commands
- Bootstrap: `./prep-all.sh` (installs deps and builds workspaces).
- Rust: `cargo build --workspace`; tests: `cargo test`.
- Solidity (Foundry): `forge build`; tests: `forge test`.
- Webapp: `cd packages/webapp && npm run dev`.
- JS workspaces (top-level): `npm run test`, `npm run build:ui`, `npm run build:orderbook`.
- JS workspaces (top-level): `npm run test`, `npm run build:ui`, `npm run build:raindex`.
- WASM bundle: `rainix-wasm-artifacts`.

## Coding Style & Naming Conventions
Expand Down
Loading
Loading