mirror of
https://github.com/alsk1992/CloddsBot.git
synced 2026-10-02 02:54:40 +08:00
placeOrder/cancelOrder/cancelAllOrders/getBalance/getPositions/getOpenOrders
all called a plain X-API-Key REST API that doesn't match how Lighter (a
zk-rollup) actually works: every order/cancel is an L2 transaction, signed
by a native binary the official SDK loads via ctypes (compiled from
github.com/elliottech/lighter-go) — there's no published algorithm spec to
reimplement in TypeScript, and Lighter's own official AI-agent integration
(elliottech/lighter-agent-kit) works the same way: Python calling the real
SDK, not a from-scratch reimplementation in the host language.
New scripts/lighter-bridge/bridge.py wraps the official lighter-sdk (pinned
to a specific commit, matching elliottech/lighter-agent-kit's own lockfile),
invoked as a subprocess from src/exchanges/lighter/index.ts — one JSON
request in on stdin, one JSON result out on stdout, mirroring the existing
Rust fast-broadcast subprocess pattern (src/evm/fast-broadcast.ts) so both
"shell out to a real, verified implementation" paths in this codebase look
and behave the same way. Lazily pip-installs into a local .vendor/ dir on
first use, so nothing needs a pre-existing venv.
Verified live against mainnet: the bridge reaches Lighter's real API,
correctly loads the native signer, and gets back a genuine server response
("invalid account index" for a made-up test account) — proving the full
chain (bootstrap -> native signer load -> key validation -> live network
call) works end to end.
Also rewrote LighterOrder/LighterPosition/LighterBalance to match the real
API response shapes (verified against elliottech/lighter-agent-kit's
schemas-read.md) instead of the old guessed shape, and fixed several stale
"Lighter orderbook DEX on Arbitrum" doc/description strings — Lighter is its
own standalone zk-rollup, unrelated to Arbitrum.
Clodds Scripts
Build, deployment, and utility scripts.
Scripts
Installation
install.sh- One-liner installation scriptsetup.sh- Post-install setup wizard
Building
build.sh- Build all packagesbuild-desktop.sh- Build desktop appbuild-mobile.sh- Build mobile apps
Development
dev.sh- Start development environmenttest.sh- Run all testslint.sh- Run linters
Deployment
deploy.sh- Deploy to productiondocker-build.sh- Build Docker imagerelease.sh- Create new release
Utilities
db-migrate.sh- Run database migrationsdb-backup.sh- Backup databaselogs.sh- View logs
Usage
# Install
curl -fsSL https://clodds.com/install.sh | bash
# Development
./scripts/dev.sh
# Build
./scripts/build.sh
# Test
./scripts/test.sh