Files
bridge/app/server
zeekayandHanzo Dev a702429811 Bridge and threshold RPC on /v1; @luxfi/bridge 1.0.7
luxd serves exactly one prefix, /v1 (node/server/http/server.go:33), and
has never served /ext. createBridgeRPCClient's two defaults are the SDK's
whole contract for a caller who passes only nodeUrl — both pointed at a
404, and a caller had no way to see it from the outside.

Two Zoo endpoints were also aimed at the wrong network entirely:
api.lux.network/ext/bc/zoo/rpc and api.zoo.network/ext/bc/Z/rpc. Zoo is
sovereign on api.zoo.network (200200) and api.zoo-test.network (200201),
both confirmed serving /v1/bc/C/rpc; /v1/bc/Z/rpc and /v1/bc/zoo/rpc are
404. Env is the hostname, never a path segment.

Patch-bumps @luxfi/bridge 1.0.6 -> 1.0.7 so the fixed defaults ship. Note
1.0.6 was never actually on the registry — `npm view @luxfi/bridge` is a
hard 404 with no versions, while @luxfi/ui resolves fine from the same
scope, so this is a first publish rather than a re-publish.

Tests pin both defaults and assert the overrides still win. They fail on
/ext and pass on /v1. Full suite: 11 files, 94 tests.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 19:24:56 -07:00
..
2024-11-27 16:41:55 +08:00
2024-11-24 23:08:28 -06:00
2024-11-27 16:41:55 +08:00

bridge/server

The Lux Bridge Server is an API server that facilitates communication with Multi-Party Computation (MPC) nodes and manages asset swaps.

Prerequisites

•	Node.js: Version 20 or higher.
•	pnpm: Version 9.10.0 or higher.
•	Docker: Ensure Docker is installed and running.
•	Kubernetes: Access to a Kubernetes cluster for deployment.

Installation

1.	Clone the Repository:

git clone https://github.com/luxfi/bridge.git

2.	Install Dependencies:

pnpm install (from root or any project subdir)

Development

  • go into server dir

    cd server

  • generate prisma artifacts

    pnpx prisma generate

  • set up prisma to use sqlite

    in prisma/schema.prisma

datasource db {
  //provider  = "postgresql"
  provider  = "sqlite"
  url       = env("POSTGRES_URL")
  directUrl = env("POSTGRES_URL")
}
  • set env variable to point to sqlite

    in .env

    POSTGRESQL_URL=file:./dev.sqlite

  • create the local sqlite instance

    pnpx prisma db push

  • Start the dev server

    pnpm dev

This command uses nodemon to watch for file changes and restarts the server automatically.

[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/*
[nodemon] watching extensions: ts,js
[nodemon] starting `node -r tsconfig-paths/register -r ts-node/register ./src/server.ts`
>> Server is Running At: Port 5000

Building the Project

•	Build the Project:

pnpm build

This command compiles TypeScript files, resolves module aliases, and generates the Prisma client.

Docker Operations

•	Build Docker Image:

pnpm docker:build

This command builds the Docker image using Buildx for the linux/amd64 platform.

•	Log in to GitHub Container Registry:

pnpm docker:login

Ensure that the environment variables GH_USER and GH_TOKEN are set with your GitHub username and personal access token, respectively.

•	Push Docker Image:

pnpm docker:push

This command pushes the Docker image to the GitHub Container Registry.

Kubernetes Deployment

•	Apply Kubernetes Configuration:

pnpm k8s:apply

This command applies the Kubernetes deployment and service configurations located in the k8s directory.

•	Scale Deployment:

pnpm k8s:scale

Set the REPLICAS environment variable to the desired number of replicas before running this command.

•	Create Kubernetes Secret:

pnpm k8s:create-secret

Ensure the POSTGRESQL_URL environment variable is set with your PostgreSQL connection string.

•	Restart Deployment:

pnpm k8s:restart

•	Check Deployment Status:

pnpm k8s:status

This command retrieves the status of deployments, services, and pods labeled app=bridge-server.

Linting and Formatting

•	Lint Code:

pnpm lint

•	Format Code:

pnpm format

Environment Variables

The server utilizes environment variables for configuration. Create a .env file in the server directory with the following variables:

POSTGRESQL_URL=your_postgres_connection_string GH_USER=your_github_username GH_TOKEN=your_github_token REPLICAS=number_of_replicas LUX_SIGNER=

Ensure that sensitive information is kept secure and not committed to version control.