# Cross-chain Bridge Service

Deterministic orchestration layer that coordinates multi-chain bridging flows
across Ethereum-compatible networks and Solana. The service consumes
deterministic dependencies (route planner, EVM/Solana bridge operators, audit
trail) and produces a canonical execution log for lock-and-mint,
burn-and-release, and message-passing routes.

## Features

- Selects the proper bridge route for EVM↔EVM, EVM↔Solana, and Solana↔EVM flows
  via an injected `BridgeRoutePlanner`.
- Executes per-step actions (`lock`, `mint`, `burn`, `release`, `message`,
  `execute`) against specialized EVM and Solana operators.
- Emits a normalized execution report containing the ordered transaction hashes
  for downstream analytics and auditing.

## Usage

```ts
import {
  createCrossChainBridgeService,
  type BridgeRequest
} from "./service";
import { createDefaultBridgeRoutePlanner } from "./planner";

const bridge = createCrossChainBridgeService({
  planner: createDefaultBridgeRoutePlanner(),
  evmOperator: /* implementation that talks to EVM bridge contracts */,
  solanaOperator: /* implementation invoking Solana CPI/cross-program instructions */,
  auditTrail: {
    async recordExecution(result) {
      console.log("Bridge execution", result);
    }
  },
  idGenerator: () => `route-${Date.now()}`
});

const request: BridgeRequest = {
  sourceChain: "ethereum",
  targetChain: "polygon",
  adapter: "layerzero",
  operation: "lock-and-mint",
  assetAddress: "0xAsset",
  tokenId: "1",
  recipient: "0xRecipient"
};

await bridge.bridgeAsset(request);
```

## Testing

```bash
timeout -k 5 60s npx jest --config apps/lilith/svc-cross-chain-bridge/jest.config.cjs --runInBand
```
