Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<runner>/work/percolator-sdk'`.
# Note the path is TWO levels up (not one, as in percolator-indexer#172):
# from `<runner>/work/percolator-api/percolator-api` that is `<runner>/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
Expand Down
23 changes: 21 additions & 2 deletions tests/sdk-smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
});
Expand Down
Loading