[runtime, indexer, simplex]: add phantom order support for passive price and liquidity indexing #564
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "@hyperbridge/sdk" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "sdk/packages/sdk/**" | |
| - "sdk/packages/indexer/**" | |
| - "sdk/packages/simplex/**" | |
| - ".github/workflows/test-sdk.yml" | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| paths: | |
| - "sdk/packages/sdk/**" | |
| - "sdk/packages/indexer/**" | |
| - "sdk/packages/simplex/**" | |
| - ".github/workflows/test-sdk.yml" | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: sdk | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 11 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Set up environment variables | |
| run: | | |
| cat > .env.local << EOF | |
| BSC_CHAPEL=${{ secrets.BSC_CHAPEL }} | |
| GNOSIS_CHIADO=${{ secrets.GNOSIS_CHIADO }} | |
| HYPERBRIDGE_GARGANTUA=${{ secrets.HYPERBRIDGE_GARGANTUA }} | |
| PASEO_RPC_URL=${{ secrets.PASEO_RPC_URL }} | |
| BIFROST_PASEO=${{ secrets.BIFROST_PASEO }} | |
| INDEXER_URL=${{ secrets.INDEXER_URL }} | |
| PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} | |
| SECRET_PHRASE=${{ secrets.SECRET_PHRASE }} | |
| ETH_MAINNET=${{ secrets.ETH_MAINNET }} | |
| BSC_MAINNET=${{ secrets.BSC_MAINNET }} | |
| BASE_MAINNET=${{ secrets.BASE_MAINNET }} | |
| POLYGON_MAINNET=${{ secrets.POLYGON_MAINNET }} | |
| ARBITRUM_MAINNET=${{ secrets.ARBITRUM_MAINNET }} | |
| BASE_SEPOLIA=${{ secrets.BASE_SEPOLIA }} | |
| POLYGON_AMOY=${{ secrets.POLYGON_AMOY }} | |
| SEPOLIA=${{ secrets.SEPOLIA }} | |
| BUNDLER_URL=${{ secrets.BUNDLER_URL }} | |
| COIN_GECKGO_API_KEY=${{secrets.COINGECKO}} | |
| TOKEN_GATEWAY_ADDRESS: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6" | |
| TURNKEY_ORG_ID=${{ secrets.TURNKEY_ORG_ID }} | |
| TURNKEY_API_PUBLIC_KEY=${{ secrets.TURNKEY_API_PUBLIC_KEY }} | |
| TURNKEY_API_PRIVATE_KEY=${{ secrets.TURNKEY_API_PRIVATE_KEY }} | |
| TURNKEY_SIGN_WITH=${{ secrets.TURNKEY_SIGN_WITH }} | |
| EOF | |
| - name: Build packages | |
| run: pnpm build | |
| env: | |
| ENV: local | |
| - name: Install Docker Compose | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y docker-compose | |
| docker compose version | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| - name: Start local indexer (in background) | |
| env: | |
| DB_USER: "postgres" | |
| DB_PASS: "postgres" | |
| DB_DATABASE: "postgres" | |
| DB_HOST: "postgres" | |
| DB_PORT: 5432 | |
| DB_PATH: "./.indexer" | |
| LOG_LEVEL: ${{ secrets.ACTIONS_RUNNER_DEBUG == 'true' && 'debug' || 'info' }} | |
| run: | | |
| cd packages/indexer | |
| nohup pnpm start:local > indexer_output.log 2>&1 & | |
| echo "Started indexer process in background" | |
| - name: Wait for GraphQL server to be available | |
| run: | | |
| echo "Waiting for GraphQL server to be available on port 3100..." | |
| timeout=300 | |
| elapsed=0 | |
| interval=5 | |
| while ! nc -z localhost 3100; do | |
| if [ "$elapsed" -ge "$timeout" ]; then | |
| echo "Timed out waiting for GraphQL server on port 3100" | |
| cat packages/indexer/indexer_output.log | |
| exit 1 | |
| fi | |
| echo "Waiting for GraphQL server (elapsed: ${elapsed}s)..." | |
| sleep $interval | |
| elapsed=$((elapsed + interval)) | |
| done | |
| echo "GraphQL server is available!" | |
| sleep 10 | |
| - name: Run SDK test - hyper-fungible-token | |
| run: pnpm --filter="@hyperbridge/sdk" test:hyper-fungible-token | |
| - name: Run SDK test - intents-coprocessor | |
| run: pnpm --filter="@hyperbridge/sdk" test:intents-coprocessor | |
| - name: Run simplex test | |
| run: pnpm --filter="@hyperbridge/simplex" test:filler | |
| - name: Run SDK test - concurrent (non-sequential tests) | |
| run: pnpm --filter="@hyperbridge/sdk" test:concurrent | |
| - name: Run SDK test - intent-gateway | |
| run: pnpm --filter="@hyperbridge/sdk" test:intent-gateway | |
| - name: Clean up | |
| if: always() | |
| run: | | |
| docker compose -f packages/indexer/docker/docker-compose.local.yml down || true | |
| if [ -f packages/indexer/indexer_output.log ]; then | |
| echo "Indexer logs:" | |
| cat packages/indexer/indexer_output.log | |
| fi | |
| # Full phantom-order flow: a locally-built simnode emits the order, real simplex IntentFillers | |
| # watch + submit USDC->cNGN bids, and the SDK aggregation reduces them to a snapshot — simulated | |
| # against an anvil fork of Base mainnet (needs eth_simulateV1 + the real gateway/tokens). | |
| phantom-filler-e2e: | |
| name: Phantom filler E2E (simnode + anvil) | |
| runs-on: arc-runner-set | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| submodules: recursive | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang netcat wget curl libssl-dev llvm libclang-dev libudev-dev make libprotobuf-dev protobuf-compiler pkg-config | |
| echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| toolchain: stable | |
| - name: Add wasm toolchain | |
| run: rustup target add wasm32-unknown-unknown --toolchain nightly | |
| - uses: webfactory/ssh-agent@v0.7.0 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_KEY }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install Foundry (anvil) | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 11 | |
| # Required by the sp1-recursion-gnark-ffi build script, which compiles a Go library. | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.24" | |
| - name: Build hyperbridge simnode | |
| run: cargo build -p hyperbridge | |
| - name: Install + build SDK | |
| working-directory: sdk | |
| run: | | |
| pnpm install | |
| pnpm --filter "@hyperbridge/sdk" build:node | |
| - name: Run phantom-filler E2E (anvil fork of Base + simnode) | |
| env: | |
| SIMNODE_URL: ws://127.0.0.1:9991 | |
| ANVIL_URL: http://127.0.0.1:8545 | |
| run: | | |
| anvil --fork-url "${{ secrets.BASE_MAINNET }}" --port 8545 --silent & | |
| ./target/debug/hyperbridge simnode --chain gargantua-1000 --rpc-port 9991 --port 40341 --tmp --rpc-methods=unsafe --rpc-cors=all --pool-type=single-state & | |
| ./scripts/wait_for_tcp_port_opening.sh localhost 8545 | |
| ./scripts/wait_for_tcp_port_opening.sh localhost 9991 | |
| cd sdk && pnpm --filter "@hyperbridge/simplex" test:phantom-filler-e2e | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| pkill -f "hyperbridge simnode" || true | |
| pkill -f "anvil --fork-url" || true |