diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6096506..0fec161 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,25 @@ jobs: with: node-version: 22 cache: pnpm + # package.json + pnpm-lock.yaml resolve @percolatorct/sdk as + # `file:../../percolator-sdk`, so a bare checkout has no SDK to install and + # `pnpm install --frozen-lockfile` dies with + # `ENOENT ... scandir '/work/percolator-sdk'`. + # Note the path is TWO levels up (not one, as in percolator-indexer#172): + # from `/work/percolator-api/percolator-api` that is `/work`. + # actions/checkout cannot write outside GITHUB_WORKSPACE, so check out into + # the workspace and then move it up. percolator-sdk is public, so the + # default token suffices. + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + with: + repository: dcccrypto/percolator-sdk + ref: main + path: _percolator-sdk + - name: Place @percolatorct/sdk as a sibling checkout (#232) + run: | + rm -rf ../../percolator-sdk + mv _percolator-sdk ../../percolator-sdk + test -f ../../percolator-sdk/dist/index.js || { echo "SDK dist/ missing — the SDK repo ships a committed dist; aborting"; exit 1; } - run: pnpm install --frozen-lockfile - run: pnpm build - run: pnpm test diff --git a/tests/sdk-smoke.test.ts b/tests/sdk-smoke.test.ts index 5c464ff..9fe7c6a 100644 --- a/tests/sdk-smoke.test.ts +++ b/tests/sdk-smoke.test.ts @@ -54,6 +54,7 @@ import { getMatcherProgramId, getCurrentNetwork, PROGRAM_IDS, + V17_PROGRAMS_DEPLOYED, // oracle/price-router.ts (used by oracle-router.ts route) resolvePrice, // v17 crank encoder @@ -262,13 +263,31 @@ describe("@percolatorct/sdk exports — PDA derivation", () => { // ── 7. Program IDs ──────────────────────────────────────────────────────────── describe("@percolatorct/sdk exports — program IDs", () => { - it("getProgramId returns a valid PublicKey for devnet", () => { + // The v17 SDK fails closed until the converged v17 programs are deployed + // (Phase 7 cutover gate): rather than hand back a legacy address that cannot + // decode v17 instruction payloads, getProgramId()/getMatcherProgramId() throw + // while V17_PROGRAMS_DEPLOYED === false. Assert whichever half of that + // contract is live so this smoke test stays honest across the cutover. + // Widened to boolean — the SDK types the constant as the literal `false`. + const v17Deployed: boolean = V17_PROGRAMS_DEPLOYED; + + it("getProgramId honours the v17 deployment gate for devnet", () => { + if (!v17Deployed) { + expect(() => getProgramId("devnet")).toThrow(/v17 program is not deployed/); + return; + } const id = getProgramId("devnet"); expect(id).toBeInstanceOf(PublicKey); expect(id.toBase58().length).toBeGreaterThan(0); }); - it("getMatcherProgramId returns a valid PublicKey for devnet", () => { + it("getMatcherProgramId honours the v17 deployment gate for devnet", () => { + if (!v17Deployed) { + expect(() => getMatcherProgramId("devnet")).toThrow( + /v17 matcher program is not deployed/, + ); + return; + } const id = getMatcherProgramId("devnet"); expect(id).toBeInstanceOf(PublicKey); });